• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

libkonq

  • sources
  • kde-4.12
  • applications
  • kde-baseapps
  • lib
  • konq
konq_operations.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright 2000-2007 David Faure <faure@kde.org>
3  Copyright 2003 Waldo Bastian <bastian@kde.org>
4  Copyright 2001-2002 Alexander Neundorf <neundorf@kde.org>
5  Copyright 2002 Michael Brade <brade@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) version 3.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef __konq_operations_h__
24 #define __konq_operations_h__
25 
26 #include <kurl.h>
27 #include <libkonq_export.h>
28 
29 #include <QtCore/QObject>
30 #include <QDropEvent>
31 
32 class KJob;
33 namespace KIO { class Job; class SimpleJob; struct CopyInfo; }
34 class QWidget;
35 class KFileItem;
36 class KFileItemListProperties;
37 
42 class LIBKONQ_EXPORT KonqOperations : public QObject
43 {
44  Q_OBJECT
45 protected:
46  KonqOperations( QWidget * parent );
47  virtual ~KonqOperations();
48 
49 public:
54  static void editMimeType( const QString & mimeType, QWidget* parent );
55 
56  enum Operation { TRASH, DEL, COPY, MOVE, LINK, EMPTYTRASH, STAT, MKDIR, RESTORE, UNKNOWN, PUT, RENAME };
64  static void del( QWidget * parent, Operation method, const KUrl::List & selectedUrls );
65 
76  static void copy( QWidget * parent, Operation method, const KUrl::List & selectedUrls, const KUrl& destUrl );
86  static void doDrop( const KFileItem & destItem, const KUrl & destUrl, QDropEvent * ev, QWidget * parent );
87 
113  static KonqOperations *doDrop( const KFileItem & destItem, const KUrl & destUrl, QDropEvent * ev, QWidget * parent,
114  const QList<QAction*> &userActions );
115 
119  static void doPaste( QWidget * parent, const KUrl & destUrl, const QPoint &pos = QPoint() );
120 
129  static KonqOperations *doPasteV2(QWidget * parent, const KUrl & destUrl, const QPoint &pos = QPoint());
130 
137  static QPair<bool, QString> pasteInfo(const KUrl& targetUrl);
138 
142  static void emptyTrash( QWidget* parent );
146  static void restoreTrashedItems( const KUrl::List& urls, QWidget* parent );
147 
151  static KIO::SimpleJob* mkdir( QWidget *parent, const KUrl & url );
152 
161  static KIO::SimpleJob* newDir( QWidget * parent, const KUrl & baseUrl );
162  enum NewDirFlag { ViewShowsHiddenFile = 1 };
163  Q_DECLARE_FLAGS(NewDirFlags, NewDirFlag)
173  static KIO::SimpleJob* newDir( QWidget * parent, const KUrl & baseUrl, NewDirFlags flags );
174 
181  static void statUrl( const KUrl & url, const QObject *receiver, const char *member, QWidget* parent );
182 
189  static void rename( QWidget * parent, const KUrl & oldurl, const QString & name );
190 
202  static KonqOperations *renameV2( QWidget * parent, const KUrl & oldurl, const QString & name );
203 
212  static void rename( QWidget * parent, const KUrl & oldurl, const KUrl & newurl );
213 
227  static KonqOperations *renameV2( QWidget * parent, const KUrl & oldurl, const KUrl & newurl );
228 
229  enum ConfirmationType { DEFAULT_CONFIRMATION, SKIP_CONFIRMATION, FORCE_CONFIRMATION };
238  static bool askDeleteConfirmation( const KUrl::List & selectedUrls, int method, ConfirmationType confirmation, QWidget* widget );
239 
248  KUrl::List droppedUrls() const;
249 
254  QPoint dropPosition() const;
255 
256 Q_SIGNALS:
257  void statFinished( const KFileItem & item );
258  void aboutToCreate(const QPoint &pos, const QList<KIO::CopyInfo> &files);
259  void aboutToCreate(const KUrl::List &urls);
260  void renamingFailed(const KUrl &oldUrl, const KUrl &newUrl);
261 
262 private:
263  QWidget* parentWidget() const;
264  void _del( Operation method, const KUrl::List & selectedUrls, ConfirmationType confirmation );
265  void _restoreTrashedItems( const KUrl::List& urls );
266  void _statUrl( const KUrl & url, const QObject *receiver, const char *member );
267  void _addPluginActions(QList<QAction*>& pluginActions, const KUrl& destination, const KFileItemListProperties& info);
268 
269  // internal, for COPY/MOVE/LINK/MKDIR
270  void setOperation( KIO::Job * job, Operation method, const KUrl & dest );
271 
272  struct DropInfo
273  {
274  DropInfo( Qt::KeyboardModifiers k, const KUrl::List & u, const QMap<QString,QString> &m,
275  const QPoint& pos, Qt::DropAction a, const QList<QAction *> &actions) :
276  keyboardModifiers(k), urls(u), metaData(m), mousePos(pos), action(a), userActions(actions)
277  {}
278  Qt::KeyboardModifiers keyboardModifiers;
279  KUrl::List urls;
280  QMap<QString,QString> metaData;
281  QPoint mousePos;
282  Qt::DropAction action;
283  QList<QAction*> userActions;
284  };
285  // internal, for doDrop
286  void setDropInfo( DropInfo * info ) { m_info = info; }
287 
288  struct KIOPasteInfo // KDE4: remove and use DropInfo instead or a QPoint member
289  {
290  // Used to position the files at the position where RMB/Paste was used [mostly on the desktop]
291  QPoint mousePos;
292  };
293  void setPasteInfo( KIOPasteInfo * info ) { m_pasteInfo = info; }
294 
295 protected Q_SLOTS:
296 
297  void slotAboutToCreate(KIO::Job *job, const QList<KIO::CopyInfo> &files);
298  void slotResult( KJob * job );
299  void slotStatResult( KJob * job );
300  void asyncDrop( const KFileItem & item );
301  void doDropFileCopy();
302  void slotCopyingDone(KIO::Job *job, const KUrl &from, const KUrl &to);
303  void slotCopyingLinkDone(KIO::Job *job, const KUrl &from, const QString &target, const KUrl &to);
304 
305 private:
306  Operation m_method;
307  //KUrl::List m_srcUrls;
308  KUrl::List m_createdUrls;
309  KUrl m_destUrl;
310  // for doDrop
311  DropInfo * m_info;
312  KIOPasteInfo * m_pasteInfo;
313 };
314 
315 #include <kio/job.h>
316 
318 class KonqMultiRestoreJob : public KIO::Job
319 {
320  Q_OBJECT
321 
322 public:
323  KonqMultiRestoreJob( const KUrl::List& urls );
324 
325 protected Q_SLOTS:
326  virtual void slotStart();
327  virtual void slotResult( KJob *job );
328 
329 private:
330  const KUrl::List m_urls;
331  KUrl::List::const_iterator m_urlsIterator;
332  int m_progress;
333 };
334 
335 #endif
KonqMultiRestoreJob::slotResult
virtual void slotResult(KJob *job)
Definition: konq_operations.cpp:1007
KonqMultiRestoreJob
Restore multiple trashed files.
Definition: konq_operations.h:318
KonqOperations
Implements file operations (move,del,trash,paste,copy,move,link...) for file managers.
Definition: konq_operations.h:42
QWidget
KonqOperations::Operation
Operation
Definition: konq_operations.h:56
QObject
KonqOperations::NewDirFlag
NewDirFlag
Definition: konq_operations.h:162
KonqMultiRestoreJob::KonqMultiRestoreJob
KonqMultiRestoreJob(const KUrl::List &urls)
Definition: konq_operations.cpp:964
libkonq_export.h
LIBKONQ_EXPORT
#define LIBKONQ_EXPORT
Definition: libkonq_export.h:36
KonqOperations::UNKNOWN
Definition: konq_operations.h:56
KonqOperations::SKIP_CONFIRMATION
Definition: konq_operations.h:229
KonqOperations::ConfirmationType
ConfirmationType
Definition: konq_operations.h:229
KonqMultiRestoreJob::slotStart
virtual void slotStart()
Definition: konq_operations.cpp:973
QList
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkonq

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

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Applications
  •   Libraries
  •     libkonq
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal