• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkonq

konq_operations.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright 2000-2007  David Faure <faure@kde.org>
00003     Copyright 2003       Waldo Bastian <bastian@kde.org>
00004     Copyright 2001-2002  Alexander Neundorf <neundorf@kde.org>
00005     Copyright 2002       Michael Brade <brade@kde.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) version 3.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020 */
00021 
00022 #ifndef __konq_operations_h__
00023 #define __konq_operations_h__
00024 
00025 #include <kurl.h>
00026 #include <libkonq_export.h>
00027 
00028 #include <QtCore/QObject>
00029 #include <QtGui/QDropEvent>
00030 
00031 class KJob;
00032 namespace KIO { class Job; class SimpleJob; struct CopyInfo; }
00033 class QWidget;
00034 class KFileItem;
00035 
00040 class LIBKONQ_EXPORT KonqOperations : public QObject
00041 {
00042     Q_OBJECT
00043 protected:
00044     KonqOperations( QWidget * parent );
00045     virtual ~KonqOperations();
00046 
00047 public:
00052     static void editMimeType( const QString & mimeType, QWidget* parent );
00053 
00054     enum Operation { TRASH, DEL, COPY, MOVE, LINK, EMPTYTRASH, STAT, MKDIR, RESTORE, UNKNOWN };
00062     static void del( QWidget * parent, Operation method, const KUrl::List & selectedUrls );
00063 
00074     static void copy( QWidget * parent, Operation method, const KUrl::List & selectedUrls, const KUrl& destUrl );
00084     static void doDrop( const KFileItem & destItem, const KUrl & destUrl, QDropEvent * ev, QWidget * parent );
00085 
00089     static void doPaste( QWidget * parent, const KUrl & destUrl, const QPoint &pos = QPoint() );
00090 
00094     static void emptyTrash( QWidget* parent );
00098     static void restoreTrashedItems( const KUrl::List& urls, QWidget* parent );
00099 
00103     static KIO::SimpleJob* mkdir( QWidget *parent, const KUrl & url );
00104 
00113     static KIO::SimpleJob* newDir( QWidget * parent, const KUrl & baseUrl );
00114 
00121     static void statUrl( const KUrl & url, const QObject *receiver, const char *member, QWidget* parent );
00122 
00129     static void rename( QWidget * parent, const KUrl & oldurl, const QString & name );
00130 
00139     static void rename( QWidget * parent, const KUrl & oldurl, const KUrl & newurl );
00140 
00141     enum ConfirmationType { DEFAULT_CONFIRMATION, SKIP_CONFIRMATION, FORCE_CONFIRMATION };
00150     static bool askDeleteConfirmation( const KUrl::List & selectedUrls, int method, ConfirmationType confirmation, QWidget* widget );
00151 
00152 Q_SIGNALS:
00153     void statFinished( const KFileItem & item );
00154     void aboutToCreate(const QPoint &pos, const QList<KIO::CopyInfo> &files);
00155 
00156 private:
00157     QWidget* parentWidget() const;
00158     void _del( Operation method, const KUrl::List & selectedUrls, ConfirmationType confirmation );
00159     void _restoreTrashedItems( const KUrl::List& urls );
00160     void _statUrl( const KUrl & url, const QObject *receiver, const char *member );
00161 
00162     // internal, for COPY/MOVE/LINK/MKDIR
00163     void setOperation( KIO::Job * job, Operation method, const KUrl & dest );
00164 
00165     struct DropInfo
00166     {
00167         DropInfo( Qt::KeyboardModifiers k, const KUrl::List & u, const QMap<QString,QString> &m,
00168                   const QPoint& pos, Qt::DropAction a ) :
00169             keyboardModifiers(k), urls(u), metaData(m), mousePos(pos), action(a)
00170         {}
00171         Qt::KeyboardModifiers keyboardModifiers;
00172         KUrl::List urls;
00173         QMap<QString,QString> metaData;
00174         QPoint mousePos;
00175         Qt::DropAction action;
00176     };
00177     // internal, for doDrop
00178     void setDropInfo( DropInfo * info ) { m_info = info; }
00179 
00180     struct KIOPasteInfo // KDE4: remove and use DropInfo instead or a QPoint member
00181     {
00182         // Used to position the files at the position where RMB/Paste was used [mostly on the desktop]
00183         QPoint mousePos;
00184     };
00185     void setPasteInfo( KIOPasteInfo * info ) { m_pasteInfo = info; }
00186 
00187 protected Q_SLOTS:
00188 
00189     void slotAboutToCreate(KIO::Job *job, const QList<KIO::CopyInfo> &files);
00190     void slotResult( KJob * job );
00191     void slotStatResult( KJob * job );
00192     void asyncDrop( const KFileItem & item );
00193     void doDropFileCopy();
00194 
00195 private:
00196     Operation m_method;
00197     //KUrl::List m_srcUrls;
00198     KUrl m_destUrl;
00199     // for doDrop
00200     DropInfo * m_info;
00201     KIOPasteInfo * m_pasteInfo;
00202 };
00203 
00204 #include <kio/job.h>
00205 
00207 class KonqMultiRestoreJob : public KIO::Job
00208 {
00209     Q_OBJECT
00210 
00211 public:
00212     KonqMultiRestoreJob( const KUrl::List& urls );
00213 
00214 protected Q_SLOTS:
00215     virtual void slotStart();
00216     virtual void slotResult( KJob *job );
00217 
00218 private:
00219     const KUrl::List m_urls;
00220     KUrl::List::const_iterator m_urlsIterator;
00221     int m_progress;
00222 };
00223 
00224 #endif

libkonq

Skip menu "libkonq"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal