summaryrefslogtreecommitdiffstats
path: root/filesystemwidget.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-11-21 11:04:42 +0100
committerArno <am@disconnect.de>2010-11-21 11:04:42 +0100
commitf4a99fc9a5bac76c6bfd10212a80d5ece3b41aac (patch)
tree02a201926099d106ccbb3a27463df69c27f3f8d0 /filesystemwidget.h
parent6a9b5c654aaf326cb078a701eb38b2d10786bf7c (diff)
downloadSheMov-f4a99fc9a5bac76c6bfd10212a80d5ece3b41aac.tar.gz
SheMov-f4a99fc9a5bac76c6bfd10212a80d5ece3b41aac.tar.bz2
SheMov-f4a99fc9a5bac76c6bfd10212a80d5ece3b41aac.zip
Implemented mark as seen
Added new action to mark files as seen. Marked files have the foreground color red. For this the database connection is needed quite early, so I had to call SmGlobals::instance() in the constructor of SheMov without using it.
Diffstat (limited to 'filesystemwidget.h')
-rw-r--r--filesystemwidget.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/filesystemwidget.h b/filesystemwidget.h
index b04feca..0cc3abc 100644
--- a/filesystemwidget.h
+++ b/filesystemwidget.h
@@ -10,8 +10,11 @@
#include <QWidget>
#include <QPair>
+#include <QFileSystemModel>
+#include <QHash>
+#include <QSqlDatabase>
+#include <QDateTime>
-class QFileSystemModel;
class QTreeView;
class FilesystemDirProxy;
class FileView;
@@ -24,6 +27,8 @@ class QVariant;
class MessageDialog;
class PictureViewer;
class QStringList;
+class FileSystemModel;
+class QSqlQuery;
class FilesystemWidget : public QWidget {
Q_OBJECT
@@ -32,7 +37,7 @@ class FilesystemWidget : public QWidget {
~FilesystemWidget() {};
FileView *fileView() { return mFileView; };
FilesystemFileProxy *fileProxy() { return mFileProxy; };
- QFileSystemModel *dirModel() { return mModel; };
+ FileSystemModel *dirModel() { return mModel; };
const QString windowTitle() const { return mWindowTitle; };
PictureViewer *pictureViewer() { return mPicViewer; };
bool isMounted();
@@ -59,6 +64,7 @@ class FilesystemWidget : public QWidget {
void readSettings();
void writeSettings();
void dvdMount();
+ void markSeen();
private slots:
void doRenameFile();
@@ -72,7 +78,7 @@ class FilesystemWidget : public QWidget {
QPair<QString, QStringList> programData(const QString &prefix, const QString &preferred);
QStringList selectedFiles();
QStringList mExpandedDirs;
- QFileSystemModel *mModel;
+ FileSystemModel *mModel;
QTreeView *mDirView;
FileView *mFileView;
FilesystemDirProxy *mDirProxy;
@@ -86,5 +92,23 @@ class FilesystemWidget : public QWidget {
QString mLastDir;
};
-#endif
+class FileSystemModel : public QFileSystemModel {
+ Q_OBJECT
+ public:
+ FileSystemModel(QObject *parent = 0);
+ ~FileSystemModel();
+ virtual QVariant data(const QModelIndex &index, int role) const;
+ bool isSeen(const QString &path) const;
+
+ public slots:
+ void markAsSeen(const QString &path, bool seen);
+ private:
+ void cleanup();
+ QHash<QString, QDateTime> mSeen;
+ QSqlDatabase mDb;
+ QSqlQuery *mDeleteFromSeenQuery;
+ QSqlQuery *mMarkAsSeenQuery;
+};
+
+#endif