libkonq Library API Documentation

konq_operations.h

00001 /*  This file is part of the KDE project
00002     Copyright (C) 2000  David Faure <faure@kde.org>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 <qobject.h>
00026 #include <qevent.h>
00027 
00028 namespace KIO { class Job; class CopyInfo; }
00029 class QWidget;
00030 class KFileItem;
00031 class KonqMainWindow;
00032 
00037 class LIBKONQ_EXPORT KonqOperations : public QObject
00038 {
00039     Q_OBJECT
00040 protected:
00041     KonqOperations( QWidget * parent );
00042     virtual ~KonqOperations();
00043 
00044 public:
00048     static void editMimeType( const QString & mimeType );
00049 
00050     enum { TRASH, DEL, SHRED, COPY, MOVE, LINK, EMPTYTRASH, STAT, MKDIR, RESTORE, UNKNOWN };
00054     static void del( QWidget * parent, int method, const KURL::List & selectedURLs );
00055 
00059     static void copy( QWidget * parent, int method, const KURL::List & selectedURLs, const KURL& destUrl );
00069     static void doDrop( const KFileItem * destItem, const KURL & destURL, QDropEvent * ev, QWidget * parent );
00070 
00074     static void doPaste( QWidget * parent, const KURL & destURL, const QPoint &pos );
00075     static void doPaste( QWidget * parent, const KURL & destURL );
00076 
00077     static void emptyTrash();
00078     static void restoreTrashedItems( const KURL::List& urls );
00079 
00083     static void mkdir( QWidget *parent, const KURL & url );
00084 
00091     static void statURL( const KURL & url, const QObject *receiver, const char *member );
00092 
00099     static void rename( QWidget * parent, const KURL & oldurl, const QString & name );
00100 
00109     static void rename( QWidget * parent, const KURL & oldurl, const KURL & newurl );
00110 
00116     static void newDir( QWidget * parent, const KURL & baseURL );
00117 
00118 signals:
00119     void statFinished( const KFileItem * item );
00120     void aboutToCreate(const QPoint &pos, const QValueList<KIO::CopyInfo> &files);
00121 
00122 protected:
00123     enum { DEFAULT_CONFIRMATION, SKIP_CONFIRMATION, FORCE_CONFIRMATION };
00124     bool askDeleteConfirmation( const KURL::List & selectedURLs, int confirmation );
00125     void _del( int method, const KURL::List & selectedURLs, int confirmation );
00126     void _restoreTrashedItems( const KURL::List& urls );
00127     void _statURL( const KURL & url, const QObject *receiver, const char *member );
00128 
00129     // internal, for COPY/MOVE/LINK/MKDIR
00130     void setOperation( KIO::Job * job, int method, const KURL::List & src, const KURL & dest );
00131 
00132     struct DropInfo
00133     {
00134         DropInfo( uint k, KURL::List & l, const QMap<QString,QString> &m,
00135                   int x, int y, QDropEvent::Action a ) :
00136             keybstate(k), lst(l), metaData(m), mousePos(x,y), action(a) {}
00137         uint keybstate;
00138         KURL::List lst;
00139         QMap<QString,QString> metaData;
00140         QPoint mousePos;
00141         QDropEvent::Action action;
00142     };
00143     // internal, for doDrop
00144     void setDropInfo( DropInfo * info ) { m_info = info; }
00145 
00146     struct KIOPasteInfo
00147     {
00148         QByteArray data;
00149         KURL destURL;
00150         QPoint mousePos;
00151         QString dialogText;
00152     };
00153     void setPasteInfo( KIOPasteInfo * info ) { m_pasteInfo = info; }
00154 
00155 protected slots:
00156 
00157     void slotAboutToCreate(KIO::Job *job, const QValueList<KIO::CopyInfo> &files);
00158     void slotResult( KIO::Job * job );
00159     void slotStatResult( KIO::Job * job );
00160     void asyncDrop( const KFileItem * item );
00161     void slotKIOPaste();
00162     void doFileCopy();
00163 
00164 private:
00165     int m_method;
00166     //KURL::List m_srcURLs;
00167     KURL m_destURL;
00168     // for doDrop
00169     DropInfo * m_info;
00170     KIOPasteInfo * m_pasteInfo;
00171 };
00172 
00173 #include <kio/job.h>
00174 
00176 class KonqMultiRestoreJob : public KIO::Job
00177 {
00178     Q_OBJECT
00179 
00180 public:
00181     KonqMultiRestoreJob( const KURL::List& urls, bool showProgressInfo );
00182 
00183 protected slots:
00184     virtual void slotStart();
00185     virtual void slotResult( KIO::Job *job );
00186 
00187 private:
00188     const KURL::List m_urls;
00189     KURL::List::const_iterator m_urlsIterator;
00190     int m_progress;
00191 };
00192 
00193 #endif
KDE Logo
This file is part of the documentation for libkonq Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 01:53:45 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003