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
00138 void recordJob(CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job);
00139
00143 void recordCopyJob(KIO::CopyJob* copyJob);
00144
00148 bool undoAvailable() const;
00152 QString undoText() const;
00153
00160 quint64 newCommandSerialNumber();
00161 quint64 currentCommandSerialNumber() const;
00162
00163 public Q_SLOTS:
00169 void undo();
00170
00171 Q_SIGNALS:
00173 void undoAvailable(bool avail);
00174
00176 void undoTextChanged(const QString &text);
00177
00179 void undoJobFinished();
00180
00181 private:
00182 FileUndoManager();
00183 virtual ~FileUndoManager();
00184 friend class FileUndoManagerSingleton;
00185
00186 friend class UndoJob;
00187 friend class CommandRecorder;
00188
00189 friend class FileUndoManagerPrivate;
00190 FileUndoManagerPrivate *d;
00191 };
00192
00193 }
00194
00195 #endif