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 <qobject.h>
00024
#include <qevent.h>
00025
00026
namespace KIO {
class Job;
class CopyInfo; }
00027
class QWidget;
00028
class KFileItem;
00029
class KonqMainWindow;
00030
00035 class KonqOperations :
public QObject
00036 {
00037 Q_OBJECT
00038
protected:
00039
KonqOperations( QWidget * parent );
00040
virtual ~
KonqOperations();
00041
00042
public:
00046
static void editMimeType(
const QString & mimeType );
00047
00048
enum { TRASH, DEL, SHRED, COPY, MOVE, LINK, EMPTYTRASH, STAT, MKDIR };
00052
static void del( QWidget * parent,
int method,
const KURL::List & selectedURLs );
00053
00057
static void copy( QWidget * parent,
int method,
const KURL::List & selectedURLs,
const KURL& destUrl );
00067
static void doDrop(
const KFileItem * destItem,
const KURL & destURL, QDropEvent * ev, QWidget * parent );
00068
00072
static void doPaste( QWidget * parent,
const KURL & destURL,
const QPoint &pos );
00073
static void doPaste( QWidget * parent,
const KURL & destURL );
00074
00075
static void emptyTrash();
00076
00080
static void mkdir( QWidget *parent,
const KURL & url );
00081
00088
static void statURL(
const KURL & url,
const QObject *receiver,
const char *member );
00089
00096
static void rename( QWidget * parent,
const KURL & oldurl,
const QString & name );
00097
00106
static void rename( QWidget * parent,
const KURL & oldurl,
const KURL & newurl );
00107
00113
static void newDir( QWidget * parent,
const KURL & baseURL );
00114
00115 signals:
00116
void statFinished(
const KFileItem * item );
00117
void aboutToCreate(
const QPoint &pos,
const QValueList<KIO::CopyInfo> &files);
00118
00119
protected:
00120
enum { DEFAULT_CONFIRMATION, SKIP_CONFIRMATION, FORCE_CONFIRMATION };
00121
bool askDeleteConfirmation(
const KURL::List & selectedURLs,
int confirmation );
00122
void _del(
int method,
const KURL::List & selectedURLs,
int confirmation );
00123
void _statURL(
const KURL & url,
const QObject *receiver,
const char *member );
00124
00125
00126
void setOperation( KIO::Job * job,
int method,
const KURL::List & src,
const KURL & dest );
00127
00128
struct DropInfo
00129 {
00130 DropInfo( uint k, KURL::List & l,
const QMap<QString,QString> &m,
00131
int x,
int y, QDropEvent::Action a ) :
00132 keybstate(k), lst(l), metaData(m), mousePos(x,y), action(a) {}
00133 uint keybstate;
00134 KURL::List lst;
00135 QMap<QString,QString> metaData;
00136 QPoint mousePos;
00137 QDropEvent::Action action;
00138 };
00139
00140
void setDropInfo( DropInfo * info ) { m_info = info; }
00141
00142
struct KIOPasteInfo
00143 {
00144 QByteArray data;
00145 KURL destURL;
00146 QPoint mousePos;
00147 QString dialogText;
00148 };
00149
void setPasteInfo( KIOPasteInfo * info ) { m_pasteInfo = info; }
00150
00151
protected slots:
00152
00153
void slotAboutToCreate(KIO::Job *job,
const QValueList<KIO::CopyInfo> &files);
00154
void slotResult( KIO::Job * job );
00155
void slotStatResult( KIO::Job * job );
00156
void asyncDrop(
const KFileItem * item );
00157
void slotKIOPaste();
00158
void doFileCopy();
00159
00160
private:
00161
int m_method;
00162
00163 KURL m_destURL;
00164
00165 DropInfo * m_info;
00166 KIOPasteInfo * m_pasteInfo;
00167 };
00168
00169
#endif