From f3d62ad86a1def4d11d132af7366874f43a438b9 Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 21 Dec 2010 19:12:40 +0100 Subject: Fix copy, cut and paste files Make this options in the context and edit menu of FilesystemWidget behave a lot more as expected. Copy and cut just copies the file names to the clipboard, and paste paste moves them if they were cut and copies them when the action was copy. Still need to fix the colors when something is marked somehow. Should be configurable :) --- filesystemwidget.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'filesystemwidget.h') diff --git a/filesystemwidget.h b/filesystemwidget.h index ee0b9b3..b54fdad 100644 --- a/filesystemwidget.h +++ b/filesystemwidget.h @@ -32,6 +32,7 @@ class QSqlQuery; class FilesystemWidget : public QWidget { Q_OBJECT public: + enum ClipboardMode { Copy, Cut, None }; FilesystemWidget(QWidget *parent = 0); ~FilesystemWidget() {} FileView *fileView() { return mFileView; } @@ -54,8 +55,8 @@ class FilesystemWidget : public QWidget { void parentDir(); void goBack(); void deleteFiles(); - void copyFiles(); - void moveFiles(); + void toClipboard(int clipmode); + void fromClipboard(); void renameFile(); void renameCover(const QString &infix); void setTemplate(); @@ -73,7 +74,10 @@ class FilesystemWidget : public QWidget { private: void setWindowTitle(const QString &dir); void deleteRecursive(const QFileInfo &start); + void copyFiles(const QStringList &files, const QString &dest); + void moveFiles(const QStringList &files, const QString &dest); void copyRecursive(const QFileInfo &start, const QString &destdir); + const QString selectedDir(); QPair programData(const QString &prefix, const QString &preferred); QStringList selectedFiles(); QStringList mExpandedDirs; @@ -88,6 +92,7 @@ class FilesystemWidget : public QWidget { qint64 mSize; PictureViewer *mPicViewer; QString mLastDir; + int mClipboardMode; }; class FileSystemModel : public QFileSystemModel { @@ -100,6 +105,8 @@ class FileSystemModel : public QFileSystemModel { public slots: void markAsSeen(const QString &path, bool seen); + void markForClipboard(const QPersistentModelIndex &idx); + void clearClipboardList(); private: void cleanup(); @@ -107,6 +114,7 @@ class FileSystemModel : public QFileSystemModel { QSqlDatabase mDb; QSqlQuery *mDeleteFromSeenQuery; QSqlQuery *mMarkAsSeenQuery; + QList mClipEntries; }; #endif -- cgit v1.2.3-70-g09d2