KIO
fileundomanager.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2000 Simon Hausmann <hausmann@kde.org> 00003 Copyright (C) 2006, 2008 David Faure <faure@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 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 } // namespace 00212 00213 #endif
KDE 4.6 API Reference