19 #ifndef __konq_undo_h__
20 #define __konq_undo_h__
24 #include <tqvaluestack.h>
26 #include <dcopobject.h>
29 #include <libkonq_export.h>
38 struct KonqBasicOperation
40 typedef TQValueStack<KonqBasicOperation> Stack;
56 typedef TQValueStack<KonqCommand> Stack;
58 enum Type { COPY, MOVE, LINK, MKDIR, TRASH };
66 KonqBasicOperation::Stack m_opStack;
71 class KonqCommandRecorder :
public TQObject
75 KonqCommandRecorder( KonqCommand::Type op,
const KURL::List &src,
const KURL &dst, TDEIO::Job *job );
76 virtual ~KonqCommandRecorder();
79 void slotResult( TDEIO::Job *job );
81 void slotCopyingDone( TDEIO::Job *,
const KURL &from,
const KURL &to,
bool directory,
bool renamed );
82 void slotCopyingLinkDone( TDEIO::Job *,
const KURL &from,
const TQString &target,
const KURL &to );
85 class KonqCommandRecorderPrivate;
86 KonqCommandRecorderPrivate *d;
89 class LIBKONQ_EXPORT KonqUndoManager :
public TQObject,
public DCOPObject
93 friend class KonqUndoJob;
95 enum UndoState { MAKINGDIRS, MOVINGFILES, REMOVINGDIRS, REMOVINGFILES };
98 virtual ~KonqUndoManager();
100 static void incRef();
101 static void decRef();
102 static KonqUndoManager *
self();
104 void addCommand(
const KonqCommand &cmd );
106 bool undoAvailable()
const;
107 TQString undoText()
const;
113 void undoAvailable(
bool avail );
114 void undoTextChanged(
const TQString &text );
120 void stopUndo(
bool step );
124 virtual ASYNC push(
const KonqCommand &cmd );
126 virtual ASYNC lock();
127 virtual ASYNC unlock();
129 virtual KonqCommand::Stack get()
const;
132 void slotResult( TDEIO::Job *job );
137 void undoMakingDirectories();
138 void undoMovingFiles();
139 void undoRemovingFiles();
140 void undoRemovingDirectories();
142 void broadcastPush(
const KonqCommand &cmd );
144 void broadcastLock();
145 void broadcastUnlock();
147 void addDirToUpdate(
const KURL& url );
148 bool initializeFromKDesky();
150 class KonqUndoManagerPrivate;
151 KonqUndoManagerPrivate *d;
152 static KonqUndoManager *s_self;
153 static unsigned long s_refCnt;
156 TQDataStream &operator<<( TQDataStream &stream,
const KonqBasicOperation &op );
157 TQDataStream &operator>>( TQDataStream &stream, KonqBasicOperation &op );
159 TQDataStream &operator<<( TQDataStream &stream,
const KonqCommand &cmd );
160 TQDataStream &operator>>( TQDataStream &stream, KonqCommand &cmd );