00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __konq_operations_h__
00020 #define __konq_operations_h__
00021
00022 #include <kurl.h>
00023 #include <libkonq_export.h>
00024
00025 #include <tqobject.h>
00026 #include <tqevent.h>
00027
00028 namespace TDEIO { class Job; class CopyInfo; }
00029 class TQWidget;
00030 class KFileItem;
00031 class KonqMainWindow;
00032
00037 class LIBKONQ_EXPORT KonqOperations : public TQObject
00038 {
00039 Q_OBJECT
00040 protected:
00041 KonqOperations( TQWidget * parent );
00042 virtual ~KonqOperations();
00043
00044 public:
00048 static void editMimeType( const TQString & mimeType );
00049
00050 enum { TRASH, DEL, SHRED, COPY, MOVE, LINK, EMPTYTRASH, STAT, MKDIR, RESTORE, UNKNOWN };
00058 static void del( TQWidget * parent, int method, const KURL::List & selectedURLs );
00059
00070 static void copy( TQWidget * parent, int method, const KURL::List & selectedURLs, const KURL& destURL );
00080 static void doDrop( const KFileItem * destItem, const KURL & destURL, TQDropEvent * ev, TQWidget * parent );
00081
00085 static void doPaste( TQWidget * parent, const KURL & destURL, const TQPoint &pos );
00086 static void doPaste( TQWidget * parent, const KURL & destURL );
00087
00088 static void emptyTrash();
00089 static void restoreTrashedItems( const KURL::List& urls );
00090
00094 static void mkdir( TQWidget *parent, const KURL & url );
00095
00102 static void statURL( const KURL & url, const TQObject *receiver, const char *member );
00103
00110 static void rename( TQWidget * parent, const KURL & oldurl, const TQString & name );
00111
00120 static void rename( TQWidget * parent, const KURL & oldurl, const KURL & newurl );
00121
00127 static void newDir( TQWidget * parent, const KURL & baseURL );
00128
00129 enum ConfirmationType { DEFAULT_CONFIRMATION, SKIP_CONFIRMATION, FORCE_CONFIRMATION };
00138 static bool askDeleteConfirmation( const KURL::List & selectedURLs, int method, ConfirmationType confirmation, TQWidget* widget );
00139
00140 signals:
00141 void statFinished( const KFileItem * item );
00142 void aboutToCreate(const TQPoint &pos, const TQValueList<TDEIO::CopyInfo> &files);
00143
00144 protected:
00145 void _del( int method, const KURL::List & selectedURLs, ConfirmationType confirmation );
00146 void _restoreTrashedItems( const KURL::List& urls );
00147 void _statURL( const KURL & url, const TQObject *receiver, const char *member );
00148
00149
00150 void setOperation( TDEIO::Job * job, int method, const KURL::List & src, const KURL & dest );
00151
00152 struct DropInfo
00153 {
00154 DropInfo( uint k, KURL::List & l, const TQMap<TQString,TQString> &m,
00155 int x, int y, TQDropEvent::Action a ) :
00156 keybstate(k), lst(l), metaData(m), mousePos(x,y), action(a) {}
00157 uint keybstate;
00158 KURL::List lst;
00159 TQMap<TQString,TQString> metaData;
00160 TQPoint mousePos;
00161 TQDropEvent::Action action;
00162 };
00163
00164 void setDropInfo( DropInfo * info ) { m_info = info; }
00165
00166 struct KIOPasteInfo
00167 {
00168 TQByteArray data;
00169 KURL destURL;
00170 TQPoint mousePos;
00171 TQString dialogText;
00172 };
00173 void setPasteInfo( KIOPasteInfo * info ) { m_pasteInfo = info; }
00174
00175 private:
00176 TQWidget* parentWidget() const;
00177
00178 protected slots:
00179
00180 void slotAboutToCreate(TDEIO::Job *job, const TQValueList<TDEIO::CopyInfo> &files);
00181 void slotResult( TDEIO::Job * job );
00182 void slotStatResult( TDEIO::Job * job );
00183 void asyncDrop( const KFileItem * item );
00184 void doFileCopy();
00185
00186 private:
00187 int m_method;
00188
00189 KURL m_destURL;
00190
00191 DropInfo * m_info;
00192 KIOPasteInfo * m_pasteInfo;
00193 };
00194
00195 #include <tdeio/job.h>
00196
00198 class KonqMultiRestoreJob : public TDEIO::Job
00199 {
00200 Q_OBJECT
00201
00202 public:
00203 KonqMultiRestoreJob( const KURL::List& urls, bool showProgressInfo );
00204
00205 protected slots:
00206 virtual void slotStart();
00207 virtual void slotResult( TDEIO::Job *job );
00208
00209 private:
00210 const KURL::List m_urls;
00211 KURL::List::const_iterator m_urlsIterator;
00212 int m_progress;
00213 };
00214
00215 #endif