Brings the Qt uploader to parity with the web /manage page and the Android
app. Adds a stacked Manage page (reached from the post page) that lists
posts via GET /api/photos with thumbnails from GET /api/thumb/<slug>, edits
caption/date/tags in a QDialog via POST /api/edit, and deletes to trash via
POST /api/delete with a QMessageBox confirm. As a non-browser client it sends
no Origin and so passes the server's same-origin CSRF check.
Tag autocomplete now backs every tags field (post cards and the edit dialog)
via a per-token TagCompleter (QCompleter subclass, MatchContains) fed from
the unguarded GET /api/tags.json.
New files: managepostwidget.{h,cpp}, tagcompleter.{h,cpp}; network methods
and a RemotePhoto struct added to uploadclient. Built and linked clean; not
yet runtime-tested on a real display.
27 lines
797 B
C++
27 lines
797 B
C++
#pragma once
|
|
|
|
#include <QCompleter>
|
|
#include <QStringList>
|
|
|
|
class QStringListModel;
|
|
|
|
// A QCompleter for a comma-separated tags line edit. It completes only the
|
|
// token currently being typed (the text after the last comma) and, on
|
|
// selection, splices the chosen tag back in place of that token — the same
|
|
// per-token behaviour as the web and Android tag fields. Attach with
|
|
// QLineEdit::setCompleter; call setSuggestions() to (re)fill the tag list.
|
|
class TagCompleter : public QCompleter
|
|
{
|
|
public:
|
|
explicit TagCompleter(QObject *parent = nullptr);
|
|
|
|
void setSuggestions(const QStringList &tags);
|
|
|
|
protected:
|
|
QStringList splitPath(const QString &path) const override;
|
|
QString pathFromIndex(const QModelIndex &index) const override;
|
|
|
|
private:
|
|
QStringListModel *m_model;
|
|
};
|