KIO
fileundomanager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KIO_FILEUNDOMANAGER_H
00021 #define KIO_FILEUNDOMANAGER_H
00022
00023 #include <QtCore/QObject>
00024 #include <kurl.h>
00025
00026 #include <kio/kio_export.h>
00027
00028 class KDateTime;
00029
00030 namespace KIO
00031 {
00032 class Job;
00033 class CopyJob;
00034 class FileUndoManagerPrivate;
00035 class FileUndoManagerSingleton;
00036 class CommandRecorder;
00037 class UndoCommand;
00038 class UndoJob;
00039
00044 class KIO_EXPORT FileUndoManager : public QObject
00045 {
00046 Q_OBJECT
00047 public:
00051 static FileUndoManager *self();
00052
00063 class KIO_EXPORT UiInterface
00064 {
00065 public:
00066 UiInterface();
00067 virtual ~UiInterface();
00068
00072 void setShowProgressInfo(bool b);
00076 bool showProgressInfo() const;
00077
00081 void setParentWidget(QWidget* parentWidget);
00082
00086 QWidget* parentWidget() const;
00087
00091 virtual void jobError(KIO::Job* job);
00092
00097 virtual bool confirmDeletion(const KUrl::List& files);
00098
00104 virtual bool copiedFileWasModified(const KUrl& src, const KUrl& dest, const KDateTime& srcTime, const KDateTime& destTime);
00105
00109 virtual void virtual_hook(int id, void* data);
00110
00111 private:
00112 class UiInterfacePrivate;
00113 UiInterfacePrivate *d;
00114 };
00115
00121 void setUiInterface(UiInterface* ui);
00122
00127 UiInterface* uiInterface() const;
00128
00129 enum CommandType { Copy, Move, Rename, Link, Mkdir, Trash };
00130
00139 void recordJob(CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job);
00140
00145 void recordCopyJob(KIO::CopyJob* copyJob);
00146
00150 bool undoAvailable() const;
00154 QString undoText() const;
00155
00162 quint64 newCommandSerialNumber();
00163 quint64 currentCommandSerialNumber() const;
00164
00165 public Q_SLOTS:
00171 void undo();
00172
00173 Q_SIGNALS:
00175 void undoAvailable(bool avail);
00176
00178 void undoTextChanged(const QString &text);
00179
00181 void undoJobFinished();
00182
00189 void jobRecordingStarted(CommandType op);
00190
00197 void jobRecordingFinished(CommandType op);
00198
00199 private:
00200 FileUndoManager();
00201 virtual ~FileUndoManager();
00202 friend class FileUndoManagerSingleton;
00203
00204 friend class UndoJob;
00205 friend class CommandRecorder;
00206
00207 friend class FileUndoManagerPrivate;
00208 FileUndoManagerPrivate *d;
00209 };
00210
00211 }
00212
00213 #endif