• 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 
00162     static KUrl::List simplifiedUrlList( const KUrl::List & urls );
00163 
00164 Q_SIGNALS:
00165     void statFinished( const KFileItem & item );
00166     void aboutToCreate(const QPoint &pos, const QList<KIO::CopyInfo> &files);
00167 
00168 private:
00169     QWidget* parentWidget() const;
00170     void _del( Operation method, const KUrl::List & selectedUrls, ConfirmationType confirmation );
00171     void _restoreTrashedItems( const KUrl::List& urls );
00172     void _statUrl( const KUrl & url, const QObject *receiver, const char *member );
00173 
00174     // internal, for COPY/MOVE/LINK/MKDIR
00175     void setOperation( KIO::Job * job, Operation method, const KUrl & dest );
00176 
00177     struct DropInfo
00178     {
00179         DropInfo( Qt::KeyboardModifiers k, const KUrl::List & u, const QMap<QString,QString> &m,
00180                   const QPoint& pos, Qt::DropAction a ) :
00181             keyboardModifiers(k), urls(u), metaData(m), mousePos(pos), action(a)
00182         {}
00183         Qt::KeyboardModifiers keyboardModifiers;
00184         KUrl::List urls;
00185         QMap<QString,QString> metaData;
00186         QPoint mousePos;
00187         Qt::DropAction action;
00188     };
00189     // internal, for doDrop
00190     void setDropInfo( DropInfo * info ) { m_info = info; }
00191 
00192     struct KIOPasteInfo // KDE4: remove and use DropInfo instead or a QPoint member
00193     {
00194         // Used to position the files at the position where RMB/Paste was used [mostly on the desktop]
00195         QPoint mousePos;
00196     };
00197     void setPasteInfo( KIOPasteInfo * info ) { m_pasteInfo = info; }
00198 
00199 protected Q_SLOTS:
00200 
00201     void slotAboutToCreate(KIO::Job *job, const QList<KIO::CopyInfo> &files);
00202     void slotResult( KJob * job );
00203     void slotStatResult( KJob * job );
00204     void asyncDrop( const KFileItem & item );
00205     void doDropFileCopy();
00206 
00207 private:
00208     Operation m_method;
00209     //KUrl::List m_srcUrls;
00210     KUrl m_destUrl;
00211     // for doDrop
00212     DropInfo * m_info;
00213     KIOPasteInfo * m_pasteInfo;
00214 };
00215 
00216 #include <kio/job.h>
00217 
00219 class KonqMultiRestoreJob : public KIO::Job
00220 {
00221     Q_OBJECT
00222 
00223 public:
00224     KonqMultiRestoreJob( const KUrl::List& urls );
00225 
00226 protected Q_SLOTS:
00227     virtual void slotStart();
00228     virtual void slotResult( KJob *job );
00229 
00230 private:
00231     const KUrl::List m_urls;
00232     KUrl::List::const_iterator m_urlsIterator;
00233     int m_progress;
00234 };
00235 
00236 #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.4
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