Add a FileTagModel
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 10 Apr 2023 11:27:31 +0000 (19:27 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 16 May 2023 10:23:33 +0000 (18:23 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/CMakeLists.txt
src/gui/filetagmodel.cpp [new file with mode: 0644]
src/gui/filetagmodel.h [new file with mode: 0644]

index 1a0c9006abd342e17ecf94290847aeb60c168d90..8e67738292d262778ccaacfcffed0c3725b6073f 100644 (file)
@@ -88,6 +88,8 @@ set(client_SRCS
     editlocallyjob.cpp
     editlocallymanager.h
     editlocallymanager.cpp
+    filetagmodel.h
+    filetagmodel.cpp
     folder.h
     folder.cpp
     foldercreationdialog.h
diff --git a/src/gui/filetagmodel.cpp b/src/gui/filetagmodel.cpp
new file mode 100644 (file)
index 0000000..cfd1788
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2023 by Claudio Cambra <claudio.cambra@nextcloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "filetagmodel.h"
+
+FileTagModel::FileTagModel(QObject *parent)
+    : QAbstractListModel(parent)
+{
+}
+
+int FileTagModel::rowCount(const QModelIndex &parent) const
+{
+    // For list models only the root node (an invalid parent) should return the list's size. For all
+    // other (valid) parents, rowCount() should return 0 so that it does not become a tree model.
+    if (parent.isValid())
+        return 0;
+
+    // FIXME: Implement me!
+}
+
+QVariant FileTagModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid())
+        return QVariant();
+
+    // FIXME: Implement me!
+    return QVariant();
+}
diff --git a/src/gui/filetagmodel.h b/src/gui/filetagmodel.h
new file mode 100644 (file)
index 0000000..075b64e
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2023 by Claudio Cambra <claudio.cambra@nextcloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#pragma once
+
+#include <QAbstractListModel>
+
+class FileTagModel : public QAbstractListModel
+{
+    Q_OBJECT
+
+public:
+    explicit FileTagModel(QObject *parent = nullptr);
+
+    // Basic functionality:
+    [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+
+    [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+
+private:
+};