• 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.cpp
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 2002 Michael Brade <brade@kde.org>
5  Copyright 2001-2002 Alexander Neundorf <neundorf@kde.org>
6  Copyright 2000-2001 Simon Hausmann <hausmann@kde.org>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) version 3.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #include "konq_operations.h"
25 #include "konq_dndpopupmenuplugin.h"
26 #include "konqmimedata.h"
27 
28 #include <ktoolinvocation.h>
29 #include <kautomount.h>
30 #include <kmountpoint.h>
31 #include <kinputdialog.h>
32 #include <klocale.h>
33 #include <kmessagebox.h>
34 #include <knotification.h>
35 #include <krun.h>
36 #include <kshell.h>
37 #include <kprocess.h>
38 #include <kshortcut.h>
39 #include <kprotocolmanager.h>
40 #include <kio/deletejob.h>
41 #include <kio/fileundomanager.h>
42 #include <kio/job.h>
43 #include <kio/jobuidelegate.h>
44 #include <kio/jobclasses.h>
45 #include <kio/copyjob.h>
46 #include <kio/paste.h>
47 #include <kio/renamedialog.h>
48 #include <kdirnotify.h>
49 #include <kuiserverjobtracker.h>
50 #include <kstandarddirs.h>
51 // For doDrop
52 #include <kicon.h>
53 #include <kauthorized.h>
54 #include <kglobal.h>
55 #include <kglobalsettings.h>
56 #include <kdebug.h>
57 #include <kfileitem.h>
58 #include <kdesktopfile.h>
59 
60 //for _addPluginActions
61 #include <kfileitemlistproperties.h>
62 #include <kservice.h>
63 #include <kmimetypetrader.h>
64 
65 //#include <konq_iconviewwidget.h>
66 #include <QMenu>
67 #include <QApplication>
68 #include <QClipboard>
69 #include <QDropEvent>
70 #include <QList>
71 #include <QDir>
72 
73 #include <assert.h>
74 #include <unistd.h>
75 #include <kconfiggroup.h>
76 
77 static const KCatalogLoader loader("libkonq");
78 
79 KonqOperations::KonqOperations( QWidget *parent )
80  : QObject( parent ),
81  m_method( UNKNOWN ), m_info(0), m_pasteInfo(0)
82 {
83  setObjectName( QLatin1String( "KonqOperations" ) );
84 }
85 
86 KonqOperations::~KonqOperations()
87 {
88  delete m_info;
89  delete m_pasteInfo;
90 }
91 
92 void KonqOperations::editMimeType( const QString & mimeType, QWidget* parent )
93 {
94  QString keditfiletype = QLatin1String("keditfiletype");
95  KRun::runCommand( keditfiletype
96  + " --parent " + QString::number( (qptrdiff)parent->winId())
97  + ' ' + KShell::quoteArg(mimeType),
98  keditfiletype, keditfiletype /*unused*/, parent );
99 }
100 
101 void KonqOperations::del( QWidget * parent, Operation method, const KUrl::List & selectedUrls )
102 {
103  kDebug(1203) << parent->metaObject()->className();
104  if ( selectedUrls.isEmpty() )
105  {
106  kWarning(1203) << "Empty URL list !" ;
107  return;
108  }
109 
110  KonqOperations * op = new KonqOperations( parent );
111  ConfirmationType confirmation = DEFAULT_CONFIRMATION;
112  op->_del( method, selectedUrls, confirmation );
113 }
114 
115 void KonqOperations::emptyTrash( QWidget* parent )
116 {
117  KonqOperations *op = new KonqOperations( parent );
118  op->_del( EMPTYTRASH, KUrl("trash:/"), DEFAULT_CONFIRMATION );
119 }
120 
121 void KonqOperations::restoreTrashedItems( const KUrl::List& urls, QWidget* parent )
122 {
123  KonqOperations *op = new KonqOperations( parent );
124  op->_restoreTrashedItems( urls );
125 }
126 
127 KIO::SimpleJob* KonqOperations::mkdir( QWidget *parent, const KUrl & url )
128 {
129  KIO::SimpleJob * job = KIO::mkdir(url);
130  job->ui()->setWindow(parent);
131  job->ui()->setAutoErrorHandlingEnabled(true);
132  KIO::FileUndoManager::self()->recordJob( KIO::FileUndoManager::Mkdir, KUrl(), url, job );
133  return job;
134 }
135 
136 void KonqOperations::doPaste( QWidget * parent, const KUrl & destUrl, const QPoint &pos )
137 {
138  (void) KonqOperations::doPasteV2( parent, destUrl, pos );
139 }
140 
141 KonqOperations *KonqOperations::doPasteV2(QWidget *parent, const KUrl &destUrl, const QPoint &pos)
142 {
143  QClipboard *clipboard = QApplication::clipboard();
144  const QMimeData *data = clipboard->mimeData();
145  const bool move = KonqMimeData::decodeIsCutSelection(data);
146 
147  KIO::Job *job = KIO::pasteClipboard(destUrl, parent, move);
148  if (job) {
149  KonqOperations *op = new KonqOperations(parent);
150  KIOPasteInfo *pi = new KIOPasteInfo;
151  pi->mousePos = pos;
152  op->setPasteInfo(pi);
153  KIO::CopyJob *copyJob = qobject_cast<KIO::CopyJob*>(job);
154  if (copyJob) {
155  op->setOperation(job, move ? MOVE : COPY, copyJob->destUrl());
156  KIO::FileUndoManager::self()->recordJob(move ? KIO::FileUndoManager::Move : KIO::FileUndoManager::Copy, KUrl::List(), destUrl, job);
157  connect(copyJob, SIGNAL(copyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool)),
158  op, SLOT(slotCopyingDone(KIO::Job*,KUrl,KUrl)));
159  connect(copyJob, SIGNAL(copyingLinkDone(KIO::Job*,KUrl,QString,KUrl)),
160  op, SLOT(slotCopyingLinkDone(KIO::Job*,KUrl,QString,KUrl)));
161  } else if (KIO::SimpleJob *simpleJob = qobject_cast<KIO::SimpleJob*>(job)) {
162  op->setOperation(job, PUT, simpleJob->url());
163  KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Put, KUrl::List(), simpleJob->url(), job);
164  }
165  return op;
166  }
167 
168  return 0;
169 }
170 
171 void KonqOperations::copy( QWidget * parent, Operation method, const KUrl::List & selectedUrls, const KUrl& destUrl )
172 {
173  kDebug(1203) << parent->metaObject()->className() << selectedUrls << destUrl;
174  if ((method!=COPY) && (method!=MOVE) && (method!=LINK))
175  {
176  kWarning(1203) << "Illegal copy method !" ;
177  return;
178  }
179  if ( selectedUrls.isEmpty() )
180  {
181  kWarning(1203) << "Empty URL list !" ;
182  return;
183  }
184 
185  KonqOperations * op = new KonqOperations( parent );
186  KIO::CopyJob* job;
187  if (method == LINK)
188  job = KIO::link( selectedUrls, destUrl );
189  else if (method == MOVE)
190  job = KIO::move( selectedUrls, destUrl );
191  else
192  job = KIO::copy( selectedUrls, destUrl );
193 
194  connect(job, SIGNAL(copyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool)),
195  op, SLOT(slotCopyingDone(KIO::Job*,KUrl,KUrl)));
196  connect(job, SIGNAL(copyingLinkDone(KIO::Job*,KUrl,QString,KUrl)),
197  op, SLOT(slotCopyingLinkDone(KIO::Job*,KUrl,QString,KUrl)));
198 
199  op->setOperation( job, method, destUrl );
200 
201  KIO::FileUndoManager::self()->recordCopyJob(job);
202 }
203 
204 void KonqOperations::_del( Operation method, const KUrl::List & _selectedUrls, ConfirmationType confirmation )
205 {
206  KUrl::List selectedUrls;
207  for (KUrl::List::ConstIterator it = _selectedUrls.begin(); it != _selectedUrls.end(); ++it)
208  if (KProtocolManager::supportsDeleting(*it))
209  selectedUrls.append(*it);
210  if (selectedUrls.isEmpty()) {
211  delete this; // this one is ok, _del is always called directly
212  return;
213  }
214 
215  if ( confirmation == SKIP_CONFIRMATION || askDeleteConfirmation( selectedUrls, method, confirmation, parentWidget() ) )
216  {
217  //m_srcUrls = selectedUrls;
218  KIO::Job *job;
219  m_method = method;
220  switch( method )
221  {
222  case TRASH:
223  {
224  job = KIO::trash( selectedUrls );
225  KIO::FileUndoManager::self()->recordJob( KIO::FileUndoManager::Trash, selectedUrls, KUrl("trash:/"), job );
226  break;
227  }
228  case EMPTYTRASH:
229  {
230  // Same as in ktrash --empty
231  QByteArray packedArgs;
232  QDataStream stream( &packedArgs, QIODevice::WriteOnly );
233  stream << (int)1;
234  job = KIO::special( KUrl("trash:/"), packedArgs );
235  KNotification::event("Trash: emptied", QString() , QPixmap() , 0l, KNotification::DefaultEvent );
236  break;
237  }
238  case DEL:
239  job = KIO::del( selectedUrls );
240  break;
241  default:
242  kWarning() << "Unknown operation: " << method ;
243  delete this; // this one is ok, _del is always called directly
244  return;
245  }
246  job->ui()->setWindow(parentWidget());
247  connect( job, SIGNAL(result(KJob*)),
248  SLOT(slotResult(KJob*)) );
249  } else {
250  delete this; // this one is ok, _del is always called directly
251  }
252 }
253 
254 void KonqOperations::_restoreTrashedItems( const KUrl::List& urls )
255 {
256  m_method = RESTORE;
257  KonqMultiRestoreJob* job = new KonqMultiRestoreJob( urls );
258  job->ui()->setWindow(parentWidget());
259  KIO::getJobTracker()->registerJob(job);
260  connect( job, SIGNAL(result(KJob*)),
261  SLOT(slotResult(KJob*)) );
262 }
263 
264 bool KonqOperations::askDeleteConfirmation( const KUrl::List & selectedUrls, int method, ConfirmationType confirmation, QWidget* widget )
265 {
266  KIO::JobUiDelegate::DeletionType deletionType;
267  switch (method) {
268  case EMPTYTRASH:
269  deletionType = KIO::JobUiDelegate::EmptyTrash;
270  break;
271  case DEL:
272  deletionType = KIO::JobUiDelegate::Delete;
273  break;
274  default:
275  deletionType = KIO::JobUiDelegate::Trash;
276  break;
277  }
278 
279  KIO::JobUiDelegate::ConfirmationType confirmationType = confirmation == FORCE_CONFIRMATION ? KIO::JobUiDelegate::ForceConfirmation : KIO::JobUiDelegate::DefaultConfirmation;
280  KIO::JobUiDelegate uiDelegate;
281  uiDelegate.setWindow(widget);
282  return uiDelegate.askDeleteConfirmation(selectedUrls, deletionType, confirmationType);
283 }
284 
285 void KonqOperations::doDrop( const KFileItem & destItem, const KUrl & dest, QDropEvent * ev, QWidget * parent )
286 {
287  (void) KonqOperations::doDrop( destItem, dest, ev, parent, QList<QAction*>() );
288 }
289 
290 KonqOperations *KonqOperations::doDrop( const KFileItem & destItem, const KUrl & dest, QDropEvent * ev, QWidget * parent,
291  const QList<QAction*> & userActions )
292 {
293  kDebug(1203) << "dest:" << dest;
294  QMap<QString, QString> metaData;
295  // Prefer local urls if possible, to avoid problems with desktop:/ urls from other users (#184403)
296  const KUrl::List lst = KUrl::List::fromMimeData(ev->mimeData(), KUrl::List::PreferLocalUrls, &metaData);
297  if (!lst.isEmpty()) { // Are they urls ?
298  //kDebug(1203) << "metaData:" << metaData.count() << "entries.";
299  //QMap<QString,QString>::ConstIterator mit;
300  //for( mit = metaData.begin(); mit != metaData.end(); ++mit ) {
301  // kDebug(1203) << "metaData: key=" << mit.key() << "value=" << mit.value();
302  //}
303  // Check if we dropped something on itself
304  KUrl::List::ConstIterator it = lst.begin();
305  for (; it != lst.end() ; it++) {
306  kDebug(1203) << "URL:" << (*it);
307  if (dest.equals(*it, KUrl::CompareWithoutTrailingSlash)) {
308  // The event source may be the view or an item (icon)
309  // Note: ev->source() can be 0L! (in case of kdesktop) (Simon)
310  if ( !ev->source() || ( ev->source() != parent && ev->source()->parent() != parent ) )
311  KMessageBox::sorry( parent, i18n("You cannot drop a folder on to itself") );
312  kDebug(1203) << "Dropped on itself";
313  ev->setAccepted( false );
314  return 0; // do nothing instead of displaying kfm's annoying error box
315  }
316  }
317 
318  // Check the state of the modifiers key at the time of the drop
319  Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
320 
321  Qt::DropAction action = ev->dropAction();
322  // Check for the drop of a bookmark -> we want a Link action
323  if ( ev->provides("application/x-xbel") )
324  {
325  modifiers |= Qt::ControlModifier | Qt::ShiftModifier;
326  action = Qt::LinkAction;
327  kDebug(1203) << "Bookmark -> emulating Link";
328  }
329 
330  KonqOperations * op = new KonqOperations(parent);
331  op->setDropInfo( new DropInfo( modifiers, lst, metaData, QCursor::pos(), action, userActions ) );
332 
333  // Ok, now we need destItem.
334  if ( !destItem.isNull() )
335  {
336  // We have it already, we could just call asyncDrop.
337  // But popping up a menu in the middle of a DND operation confuses and crashes Qt (#157630)
338  // So let's delay it.
339  qRegisterMetaType<KFileItem>("KFileItem");
340  QMetaObject::invokeMethod(op, "asyncDrop", Qt::QueuedConnection, Q_ARG(KFileItem, destItem));
341  }
342  else
343  {
344  // we need to stat to get it.
345  op->_statUrl( dest, op, SLOT(asyncDrop(KFileItem)) );
346  }
347  // In both cases asyncDrop will delete op when done
348 
349  ev->acceptProposedAction();
350  return op;
351  }
352  else
353  {
354  //kDebug(1203) << "Pasting to " << dest.url();
355  KonqOperations * op = new KonqOperations(parent);
356  KIO::Job* job = KIO::pasteMimeData(ev->mimeData(), dest,
357  i18n( "File name for dropped contents:" ),
358  parent);
359  if (KIO::SimpleJob* simpleJob = qobject_cast<KIO::SimpleJob *>(job)) {
360  op->setOperation(job, PUT, simpleJob->url());
361  KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Put, KUrl::List(), simpleJob->url(), simpleJob);
362  }
363  ev->acceptProposedAction();
364  return op;
365  }
366 }
367 
368 void KonqOperations::asyncDrop( const KFileItem & destItem )
369 {
370  assert(m_info); // setDropInfo should have been called before asyncDrop
371  bool m_destIsLocal = false;
372  m_destUrl = destItem.mostLocalUrl(m_destIsLocal); // #168154
373 
374  //kDebug(1203) << "destItem->mode=" << destItem->mode() << " url=" << m_destUrl;
375  // Check what the destination is
376  if ( destItem.isDir() )
377  {
378  doDropFileCopy();
379  return;
380  }
381  if ( !m_destIsLocal )
382  {
383  // We dropped onto a remote URL that is not a directory!
384  // (e.g. an HTTP link in the sidebar).
385  // Can't do that, but we can't prevent it before stating the dest....
386  kWarning(1203) << "Cannot drop onto " << m_destUrl ;
387  deleteLater();
388  return;
389  }
390  if ( destItem.isDesktopFile() )
391  {
392  // Local .desktop file. What type ?
393  KDesktopFile desktopFile( m_destUrl.path() );
394  KConfigGroup desktopGroup = desktopFile.desktopGroup();
395  if ( desktopFile.hasApplicationType() )
396  {
397  QString error;
398  const QStringList urlStrList = m_info->urls.toStringList();
399  if ( KToolInvocation::startServiceByDesktopPath( m_destUrl.path(), urlStrList, &error ) > 0 )
400  KMessageBox::error( parentWidget(), error );
401  }
402  else
403  {
404  // Device or Link -> adjust dest
405  if ( desktopFile.hasDeviceType() && desktopGroup.hasKey("MountPoint") ) {
406  QString point = desktopGroup.readEntry( "MountPoint" );
407  m_destUrl.setPath( point );
408  QString dev = desktopFile.readDevice();
409  KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByDevice( dev );
410  // Is the device already mounted ?
411  if ( mp ) {
412  doDropFileCopy();
413  }
414 #ifndef Q_WS_WIN
415  else
416  {
417  const bool ro = desktopGroup.readEntry( "ReadOnly", false );
418  const QByteArray fstype = desktopGroup.readEntry( "FSType" ).toLatin1();
419  KAutoMount* am = new KAutoMount( ro, fstype, dev, point, m_destUrl.path(), false );
420  connect( am, SIGNAL(finished()), this, SLOT(doDropFileCopy()) );
421  }
422 #endif
423  return;
424  }
425  else if ( desktopFile.hasLinkType() && desktopGroup.hasKey("URL") ) {
426  m_destUrl = desktopGroup.readPathEntry("URL", QString());
427  doDropFileCopy();
428  return;
429  }
430  // else, well: mimetype, service, servicetype or .directory. Can't really drop anything on those.
431  }
432  }
433  else
434  {
435  // Should be a local executable
436  // (If this fails, there is a bug in KFileItem::acceptsDrops / KDirModel::flags)
437  kDebug(1203) << m_destUrl.path() << "should be an executable";
438  Q_ASSERT ( access( QFile::encodeName(m_destUrl.path()), X_OK ) == 0 );
439  // Launch executable for each of the files
440  QStringList args;
441  const KUrl::List lst = m_info->urls;
442  KUrl::List::ConstIterator it = lst.begin();
443  for ( ; it != lst.end() ; it++ )
444  args << (*it).path(); // assume local files
445  kDebug(1203) << "starting " << m_destUrl.path() << " with " << lst.count() << " arguments";
446  KProcess::startDetached( m_destUrl.path(), args );
447  }
448  deleteLater();
449 }
450 
451 KUrl::List KonqOperations::droppedUrls() const
452 {
453  return m_info->urls;
454 }
455 
456 QPoint KonqOperations::dropPosition() const
457 {
458  return m_info->mousePos;
459 }
460 
461 void KonqOperations::doDropFileCopy()
462 {
463  assert(m_info); // setDropInfo - and asyncDrop - should have been called before asyncDrop
464  const KUrl::List lst = m_info->urls;
465  Qt::DropAction action = m_info->action;
466  bool isDesktopFile = false;
467  bool itemIsOnDesktop = false;
468  bool allItemsAreFromTrash = true;
469  KUrl::List mlst; // list of items that can be moved
470  for (KUrl::List::ConstIterator it = lst.begin(); it != lst.end(); ++it)
471  {
472  bool local = (*it).isLocalFile();
473  if ( KProtocolManager::supportsDeleting( *it ) && (!local || QFileInfo((*it).directory()).isWritable() ))
474  mlst.append(*it);
475  if ( local && KDesktopFile::isDesktopFile((*it).toLocalFile()))
476  isDesktopFile = true;
477  if ( local && (*it).path().startsWith(KGlobalSettings::desktopPath()))
478  itemIsOnDesktop = true;
479  if ( local || (*it).protocol() != "trash" )
480  allItemsAreFromTrash = false;
481  }
482 
483  bool linkOnly = false; // if true, we'll show a popup menu, but with only "link" in it (for confirmation)
484  if (isDesktopFile && !KAuthorized::authorizeKAction("run_desktop_files") &&
485  (m_destUrl.path(KUrl::AddTrailingSlash) == KGlobalSettings::desktopPath()) ) {
486  linkOnly = true;
487  } else if ( allItemsAreFromTrash && lst.first().path() == "/" ) {
488  // Dropping a link to the trash: don't move the full contents, just make a link (#319660)
489  linkOnly = true;
490  }
491 
492  if ( !mlst.isEmpty() && m_destUrl.protocol() == "trash" )
493  {
494  if ( itemIsOnDesktop && !KAuthorized::authorizeKAction("editable_desktop_icons") )
495  {
496  deleteLater();
497  return;
498  }
499 
500  m_method = TRASH;
501  if ( askDeleteConfirmation( mlst, TRASH, DEFAULT_CONFIRMATION, parentWidget() ) )
502  action = Qt::MoveAction;
503  else
504  {
505  deleteLater();
506  return;
507  }
508  } else if (!linkOnly && (allItemsAreFromTrash || m_destUrl.protocol() == "trash")) {
509  // No point in asking copy/move/link when using dnd from or to the trash.
510  action = Qt::MoveAction;
511  }
512  else if ( (
513  ((m_info->keyboardModifiers & Qt::ControlModifier) == 0) &&
514  ((m_info->keyboardModifiers & Qt::ShiftModifier) == 0) &&
515  ((m_info->keyboardModifiers & Qt::AltModifier) == 0) ) || linkOnly )
516  {
517  // Neither control, shift or alt are pressed => show popup menu
518 
519  // TODO move this code out somehow. Allow user of KonqOperations to add his own actions...
520 #if 0
521  KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
522  bool bSetWallpaper = false;
523  if ( iconView && iconView->maySetWallpaper() && lst.count() == 1 )
524  {
525  KUrl url = lst.first();
526  KMimeType::Ptr mime = KMimeType::findByUrl( url );
527  if ( mime && ( ( KImageIO::isSupported(mime->name(), KImageIO::Reading) ) ||
528  mime->is( "image/svg+xml" ) ) )
529  {
530  bSetWallpaper = true;
531  }
532  }
533 #endif
534 
535  // Check what the source can do
536  // we'll assume it's the same for all URLs (hack)
537  // TODO: if we had a KFileItemList instead of a KUrl::List,
538  // we could use KFileItemsCapabilities
539  const KUrl url = lst.first();
540  bool sReading = KProtocolManager::supportsReading( url );
541  bool sDeleting = KProtocolManager::supportsDeleting( url );
542  bool sMoving = KProtocolManager::supportsMoving( url );
543  // Check what the destination can do
544  bool dWriting = KProtocolManager::supportsWriting( m_destUrl );
545  if ( !dWriting )
546  {
547  deleteLater();
548  return;
549  }
550 
551  bool enableLinking = true; // for now, but see below
552 
553  // We don't want to offer "move" for temp files. They might come from
554  // kmail using a tempfile for attachments, or ark using a tempdir for
555  // extracting an archive -- in all cases, we can't implement a real move,
556  // it's just a copy of the tempfile [and the source app will delete it later].
557  // https://www.intevation.de/roundup/kolab/issue2026
558  //
559  // Similarly, linking to a temp file is pointless.
560  if (url.isLocalFile() && url.toLocalFile().startsWith(KStandardDirs::locateLocal("tmp", QString()))) {
561  sMoving = false;
562  sDeleting = false;
563  enableLinking = false;
564  }
565 
566  QMenu popup;
567  QString seq = QKeySequence( Qt::ShiftModifier ).toString();
568  seq.chop(1); // chop superfluous '+'
569  QAction* popupMoveAction = new QAction(i18n( "&Move Here" ) + '\t' + seq, this);
570  popupMoveAction->setIcon(KIcon("go-jump"));
571  seq = QKeySequence( Qt::ControlModifier ).toString();
572  seq.chop(1);
573  QAction* popupCopyAction = new QAction(i18n( "&Copy Here" ) + '\t' + seq, this);
574  popupCopyAction->setIcon(KIcon("edit-copy"));
575  seq = QKeySequence( Qt::ControlModifier + Qt::ShiftModifier ).toString();
576  seq.chop(1);
577  QAction* popupLinkAction = new QAction(i18n( "&Link Here" ) + '\t' + seq, this);
578  popupLinkAction->setIcon(KIcon("edit-link"));
579  QAction* popupWallAction = new QAction( i18n( "Set as &Wallpaper" ), this );
580  popupWallAction->setIcon(KIcon("preferences-desktop-wallpaper"));
581  QAction* popupCancelAction = new QAction(i18n( "C&ancel" ) + '\t' + QKeySequence( Qt::Key_Escape ).toString(), this);
582  popupCancelAction->setIcon(KIcon("process-stop"));
583 
584  if (!mlst.isEmpty() && (sMoving || (sReading && sDeleting)) && !linkOnly )
585  {
586  bool equalDestination = true;
587  foreach ( const KUrl & src, lst )
588  {
589  const bool equalProtocol = ( m_destUrl.protocol() == src.protocol() );
590  if ( !equalProtocol || m_destUrl.path(KUrl::RemoveTrailingSlash) != src.directory() )
591  {
592  equalDestination = false;
593  break;
594  }
595  }
596 
597  if ( !equalDestination )
598  popup.addAction(popupMoveAction);
599  }
600 
601  if ( sReading && !linkOnly)
602  popup.addAction(popupCopyAction);
603 
604  if ( enableLinking )
605  popup.addAction(popupLinkAction);
606 
607 #if 0
608  if (bSetWallpaper)
609  popup.addAction(popupWallAction);
610 #endif
611 
612  //now initialize the drop plugins
613  KFileItemList fileItems;
614  foreach(const KUrl& url, lst) {
615  fileItems.append(KFileItem(
616  KFileItem::Unknown,
617  KFileItem::Unknown,
618  url));
619 
620  }
621 
622  QList<QAction*> pluginActions;
623  KFileItemListProperties info(fileItems);
624  _addPluginActions(pluginActions, m_destUrl, info);
625 
626  if (!m_info->userActions.isEmpty() || !pluginActions.isEmpty()) {
627  popup.addSeparator();
628  popup.addActions(m_info->userActions);
629  popup.addActions(pluginActions);
630  }
631 
632  popup.addSeparator();
633  popup.addAction(popupCancelAction);
634 
635  QAction* result = popup.exec( m_info->mousePos );
636 
637  if(result == popupCopyAction)
638  action = Qt::CopyAction;
639  else if(result == popupMoveAction)
640  action = Qt::MoveAction;
641  else if(result == popupLinkAction)
642  action = Qt::LinkAction;
643  else {
644  deleteLater();
645  return;
646  }
647  }
648 
649  KIO::CopyJob * job = 0;
650  switch ( action ) {
651  case Qt::MoveAction :
652  job = KIO::move( lst, m_destUrl );
653  job->setMetaData( m_info->metaData );
654  setOperation( job, m_method == TRASH ? TRASH : MOVE, m_destUrl );
655  KIO::FileUndoManager::self()->recordJob(
656  m_method == TRASH ? KIO::FileUndoManager::Trash : KIO::FileUndoManager::Move,
657  lst, m_destUrl, job );
658  break;
659  case Qt::CopyAction :
660  job = KIO::copy( lst, m_destUrl );
661  job->setMetaData( m_info->metaData );
662  setOperation( job, COPY, m_destUrl );
663  KIO::FileUndoManager::self()->recordCopyJob(job);
664  break;
665  case Qt::LinkAction :
666  kDebug(1203) << "lst.count=" << lst.count();
667  job = KIO::link( lst, m_destUrl );
668  job->setMetaData( m_info->metaData );
669  setOperation( job, LINK, m_destUrl );
670  KIO::FileUndoManager::self()->recordCopyJob(job);
671  break;
672  default : kError(1203) << "Unknown action " << (int)action << endl;
673  }
674  if (job) {
675  connect(job, SIGNAL(copyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool)),
676  this, SLOT(slotCopyingDone(KIO::Job*,KUrl,KUrl)));
677  connect(job, SIGNAL(copyingLinkDone(KIO::Job*,KUrl,QString,KUrl)),
678  this, SLOT(slotCopyingLinkDone(KIO::Job*,KUrl,QString,KUrl)));
679  return; // we still have stuff to do -> don't delete ourselves
680  }
681  deleteLater();
682 }
683 
684 void KonqOperations::slotCopyingDone( KIO::Job*, const KUrl&, const KUrl &to)
685 {
686  m_createdUrls << to;
687 }
688 
689 void KonqOperations::slotCopyingLinkDone(KIO::Job*, const KUrl&, const QString&, const KUrl &to)
690 {
691  m_createdUrls << to;
692 }
693 
694 void KonqOperations::_addPluginActions(QList<QAction*>& pluginActions,const KUrl& destination, const KFileItemListProperties& info)
695 {
696  kDebug(1203);
697  const QString commonMimeType = info.mimeType();
698  kDebug() << commonMimeType;
699  const KService::List plugin_offers = KMimeTypeTrader::self()->query(commonMimeType.isEmpty() ? QLatin1String("application/octet-stream") : commonMimeType, "KonqDndPopupMenu/Plugin", "exist Library");
700 
701  KService::List::ConstIterator iterator = plugin_offers.begin();
702  const KService::List::ConstIterator end = plugin_offers.end();
703  for(; iterator != end; ++iterator) {
704  //kDebug() << (*iterator)->name() << (*iterator)->library();
705  KonqDndPopupMenuPlugin *plugin = (*iterator)->createInstance<KonqDndPopupMenuPlugin>(this);
706  if (!plugin)
707  continue;
708  plugin->setup(info, destination, pluginActions);
709  }
710 }
711 
712 // these two are from /apps/konqueror/settings/konq/globalpaths.cpp
713 static bool cleanHomeDirPath( QString &path, const QString &homeDir )
714 {
715 #ifdef Q_WS_WIN //safer
716  if (!QDir::convertSeparators(path).startsWith(QDir::convertSeparators(homeDir)))
717  return false;
718 #else
719  if (!path.startsWith(homeDir))
720  return false;
721 #endif
722 
723  int len = homeDir.length();
724  // replace by "$HOME" if possible
725  if (len && (path.length() == len || path[len] == '/')) {
726  path.replace(0, len, QString::fromLatin1("$HOME"));
727  return true;
728  } else
729  return false;
730 }
731 static QString translatePath( QString path ) // krazy:exclude=passbyvalue
732 {
733  // keep only one single '/' at the beginning - needed for cleanHomeDirPath()
734  while (path[0] == '/' && path[1] == '/')
735  path.remove(0,1);
736 
737  // we probably should escape any $ ` and \ characters that may occur in the path, but the Qt code that reads back
738  // the file doesn't unescape them so not much point in doing so
739 
740  // All of the 3 following functions to return the user's home directory
741  // can return different paths. We have to test all them.
742  const QString homeDir0 = QFile::decodeName(qgetenv("HOME"));
743  const QString homeDir1 = QDir::homePath();
744  const QString homeDir2 = QDir(homeDir1).canonicalPath();
745  if (cleanHomeDirPath(path, homeDir0) ||
746  cleanHomeDirPath(path, homeDir1) ||
747  cleanHomeDirPath(path, homeDir2) ) {
748  // kDebug() << "Path was replaced\n";
749  }
750 
751  return path;
752 }
753 
754 void KonqOperations::rename( QWidget * parent, const KUrl & oldurl, const KUrl& newurl )
755 {
756  renameV2(parent, oldurl, newurl);
757 }
758 
759 KonqOperations *KonqOperations::renameV2( QWidget * parent, const KUrl & oldurl, const KUrl& newurl )
760 {
761  kDebug(1203) << "oldurl=" << oldurl << " newurl=" << newurl;
762  if ( oldurl == newurl )
763  return 0;
764 
765  KUrl::List lst;
766  lst.append(oldurl);
767  KIO::Job * job = KIO::moveAs( oldurl, newurl, oldurl.isLocalFile() ? KIO::HideProgressInfo : KIO::DefaultFlags );
768  KonqOperations * op = new KonqOperations( parent );
769  op->setOperation( job, RENAME, newurl );
770  KIO::FileUndoManager::self()->recordJob( KIO::FileUndoManager::Rename, lst, newurl, job );
771  // if moving the desktop then update config file and emit
772  if ( oldurl.isLocalFile() && oldurl.toLocalFile( KUrl::AddTrailingSlash ) == KGlobalSettings::desktopPath() )
773  {
774  kDebug(1203) << "That rename was the Desktop path, updating config files";
775  //save in XDG path
776  const QString userDirsFile(KGlobal::dirs()->localxdgconfdir() + QLatin1String("user-dirs.dirs"));
777  KConfig xdgUserConf( userDirsFile, KConfig::SimpleConfig );
778  KConfigGroup g( &xdgUserConf, "" );
779  g.writeEntry( "XDG_DESKTOP_DIR", QString("\"" + translatePath( newurl.path() ) + "\"") );
780  KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_PATHS);
781  }
782 
783  return op;
784 }
785 
786 void KonqOperations::setOperation( KIO::Job * job, Operation method, const KUrl & dest )
787 {
788  m_method = method;
789  m_destUrl = dest;
790  if ( job )
791  {
792  job->ui()->setWindow(parentWidget());
793  connect( job, SIGNAL(result(KJob*)),
794  SLOT(slotResult(KJob*)) );
795 #if 0
796  KIO::CopyJob *copyJob = dynamic_cast<KIO::CopyJob*>(job);
797  KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
798  if (copyJob && iconView)
799  {
800  connect(copyJob, SIGNAL(aboutToCreate(KIO::Job*,QList<KIO::CopyInfo>)),
801  this, SLOT(slotAboutToCreate(KIO::Job*,QList<KIO::CopyInfo>)));
802  // TODO move this connect into the iconview!
803  connect(this, SIGNAL(aboutToCreate(QPoint,QList<KIO::CopyInfo>)),
804  iconView, SLOT(slotAboutToCreate(QPoint,QList<KIO::CopyInfo>)));
805  }
806 #endif
807  }
808  else // for link
809  slotResult( 0L );
810 }
811 
812 void KonqOperations::slotAboutToCreate(KIO::Job *, const QList<KIO::CopyInfo> &files)
813 {
814  emit aboutToCreate( m_info ? m_info->mousePos : m_pasteInfo ? m_pasteInfo->mousePos : QPoint(), files);
815 }
816 
817 void KonqOperations::statUrl( const KUrl & url, const QObject *receiver, const char *member, QWidget* parent )
818 {
819  KonqOperations * op = new KonqOperations( parent );
820  op->m_method = STAT;
821  op->_statUrl( url, receiver, member );
822 }
823 
824 void KonqOperations::_statUrl( const KUrl & url, const QObject *receiver, const char *member )
825 {
826  connect( this, SIGNAL(statFinished(KFileItem)), receiver, member );
827  KIO::StatJob * job = KIO::stat( url /*, KIO::HideProgressInfo?*/ );
828  job->ui()->setWindow(parentWidget());
829  connect( job, SIGNAL(result(KJob*)),
830  SLOT(slotStatResult(KJob*)) );
831 }
832 
833 void KonqOperations::slotStatResult( KJob * job )
834 {
835  if ( job->error())
836  {
837  static_cast<KIO::Job*>( job )->ui()->showErrorMessage();
838  }
839  else
840  {
841  KIO::StatJob * statJob = static_cast<KIO::StatJob*>(job);
842  KFileItem item( statJob->statResult(), statJob->url() );
843  emit statFinished( item );
844  }
845  // If we're only here for a stat, we're done. But not if we used _statUrl internally
846  if ( m_method == STAT )
847  deleteLater();
848 }
849 
850 void KonqOperations::slotResult(KJob *job)
851 {
852  bool jobFailed = false;
853  if (job && job->error()) {
854  static_cast<KIO::Job*>(job)->ui()->showErrorMessage();
855  jobFailed = true;
856  }
857 
858  switch (m_method) {
859  case PUT: {
860  KIO::SimpleJob *simpleJob = qobject_cast<KIO::SimpleJob*>(job);
861  if (simpleJob && !jobFailed) {
862  m_createdUrls << simpleJob->url();
863  }
864  }
865  break;
866  case EMPTYTRASH:
867  case RESTORE:
868  // Update konq windows opened on trash:/
869  org::kde::KDirNotify::emitFilesAdded("trash:/"); // yeah, files were removed, but we don't know which ones...
870  break;
871  case RENAME: {
872  KIO::CopyJob *renameJob = qobject_cast<KIO::CopyJob*>(job);
873  if (renameJob && jobFailed) {
874  const KUrl oldUrl = renameJob->srcUrls().first();
875  const KUrl newUrl = renameJob->destUrl();
876  emit renamingFailed(oldUrl, newUrl);
877  }
878  }
879  break;
880  default:
881  break;
882  }
883 
884  if (!m_createdUrls.isEmpty()) {
885  // Inform the application about all created urls
886  emit aboutToCreate(m_createdUrls);
887  m_createdUrls.clear();
888  }
889 
890  deleteLater();
891 }
892 
893 void KonqOperations::rename( QWidget * parent, const KUrl & oldurl, const QString & name )
894 {
895  renameV2(parent, oldurl, name);
896 }
897 
898 KonqOperations *KonqOperations::renameV2( QWidget * parent, const KUrl & oldurl, const QString & name )
899 {
900  KUrl newurl( oldurl );
901  newurl.setPath( oldurl.directory( KUrl::AppendTrailingSlash ) + name );
902  kDebug(1203) << "KonqOperations::rename("<<name<<") called. newurl=" << newurl;
903  return renameV2( parent, oldurl, newurl );
904 }
905 
906 // Duplicated in libkfile's KDirOperator
907 static bool confirmCreatingHiddenDir(const QString& name, QWidget* parent)
908 {
909  KGuiItem continueGuiItem(KStandardGuiItem::cont());
910  continueGuiItem.setText(i18nc("@action:button", "Create directory"));
911  KGuiItem cancelGuiItem(KStandardGuiItem::cancel());
912  cancelGuiItem.setText(i18nc("@action:button", "Enter a different name"));
913  return KMessageBox::warningContinueCancel(
914  parent,
915  i18n("The name \"%1\" starts with a dot, so the directory will be hidden by default.", name),
916  i18nc("@title:window", "Create hidden directory?"),
917  continueGuiItem,
918  cancelGuiItem,
919  "confirm_create_hidden_dir") == KMessageBox::Continue;
920 }
921 
922 KIO::SimpleJob* KonqOperations::newDir(QWidget * parent, const KUrl & baseUrl)
923 {
924  return newDir(parent, baseUrl, NewDirFlags());
925 }
926 
927 KIO::SimpleJob* KonqOperations::newDir(QWidget * parent, const KUrl & baseUrl, NewDirFlags flags)
928 {
929  // Notice that kfile's KDirOperator::mkdir() is somewhat similar
930  bool ok;
931  QString name = i18nc( "@label Default name when creating a folder", "New Folder" );
932  if ( baseUrl.isLocalFile() && QFileInfo( baseUrl.toLocalFile( KUrl::AddTrailingSlash ) + name ).exists() )
933  name = KIO::RenameDialog::suggestName(baseUrl, name);
934 
935  bool askAgain;
936  do {
937  askAgain = false;
938  name = KInputDialog::getText ( i18nc( "@title:window", "New Folder" ),
939  i18nc( "@label:textbox", "Enter folder name:" ), name, &ok, parent );
940  if ( ok && !name.isEmpty() ) {
941  KUrl url;
942  if ((name[0] == '/') || (name[0] == '~')) {
943  url.setPath(KShell::tildeExpand(name));
944  } else {
945  const bool viewShowsHiddenFiles = (flags & ViewShowsHiddenFile);
946  if (!viewShowsHiddenFiles && name.startsWith('.')) {
947  if (!confirmCreatingHiddenDir(name, parent)) {
948  askAgain = true;
949  continue;
950  }
951  }
952  name = KIO::encodeFileName( name );
953  url = baseUrl;
954  url.addPath( name );
955  }
956  return KonqOperations::mkdir( parent, url );
957  }
958  } while (askAgain);
959  return 0;
960 }
961 
963 
964 KonqMultiRestoreJob::KonqMultiRestoreJob( const KUrl::List& urls )
965  : KIO::Job(),
966  m_urls( urls ), m_urlsIterator( m_urls.begin() ),
967  m_progress( 0 )
968 {
969  QTimer::singleShot(0, this, SLOT(slotStart()));
970  setUiDelegate(new KIO::JobUiDelegate);
971 }
972 
973 void KonqMultiRestoreJob::slotStart()
974 {
975  if ( m_urlsIterator == m_urls.begin() ) // first time: emit total
976  setTotalAmount( KJob::Files, m_urls.count() );
977 
978  if ( m_urlsIterator != m_urls.end() )
979  {
980  const KUrl& url = *m_urlsIterator;
981 
982  KUrl new_url = url;
983  if ( new_url.protocol()=="system"
984  && new_url.path().startsWith("/trash") )
985  {
986  QString path = new_url.path();
987  path.remove(0, 6);
988  new_url.setProtocol("trash");
989  new_url.setPath(path);
990  }
991 
992  Q_ASSERT( new_url.protocol() == "trash" );
993  QByteArray packedArgs;
994  QDataStream stream( &packedArgs, QIODevice::WriteOnly );
995  stream << (int)3 << new_url;
996  KIO::Job* job = KIO::special( new_url, packedArgs, KIO::HideProgressInfo );
997  addSubjob( job );
998  setProcessedAmount(KJob::Files, processedAmount(KJob::Files) + 1);
999  }
1000  else // done!
1001  {
1002  org::kde::KDirNotify::emitFilesRemoved(m_urls.toStringList() );
1003  emitResult();
1004  }
1005 }
1006 
1007 void KonqMultiRestoreJob::slotResult( KJob *job )
1008 {
1009  if ( job->error() )
1010  {
1011  KIO::Job::slotResult( job ); // will set the error and emit result(this)
1012  return;
1013  }
1014  removeSubjob(job);
1015  // Move on to next one
1016  ++m_urlsIterator;
1017  ++m_progress;
1018  //emit processedSize( this, m_progress );
1019  emitPercent( m_progress, m_urls.count() );
1020  slotStart();
1021 }
1022 
1023 QWidget* KonqOperations::parentWidget() const
1024 {
1025  return static_cast<QWidget *>( parent() );
1026 }
1027 
1028 QPair<bool, QString> KonqOperations::pasteInfo(const KUrl& targetUrl)
1029 {
1030  QPair<bool, QString> ret;
1031  QClipboard* clipboard = QApplication::clipboard();
1032  const QMimeData* mimeData = clipboard->mimeData();
1033 
1034  const bool canPasteData = KIO::canPasteMimeSource(mimeData);
1035  KUrl::List urls = KUrl::List::fromMimeData(mimeData);
1036  if (!urls.isEmpty() || canPasteData) {
1037  // disable the paste action if no writing is supported
1038  KFileItem item(KFileItem::Unknown, KFileItem::Unknown, targetUrl);
1039  ret.first = KFileItemListProperties(KFileItemList() << item).supportsWriting();
1040 
1041  if (urls.count() == 1) {
1042  const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, urls.first(), true);
1043  ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") :
1044  i18nc("@action:inmenu", "Paste One File");
1045 
1046  } else if (!urls.isEmpty()) {
1047  ret.second = i18ncp("@action:inmenu", "Paste One Item", "Paste %1 Items", urls.count());
1048  } else {
1049  ret.second = i18nc("@action:inmenu", "Paste Clipboard Contents...");
1050  }
1051  } else {
1052  ret.first = false;
1053  ret.second = i18nc("@action:inmenu", "Paste");
1054  }
1055 
1056  return ret;
1057 }
1058 
1059 #include "konq_operations.moc"
konq_dndpopupmenuplugin.h
KonqOperations::newDir
static KIO::SimpleJob * newDir(QWidget *parent, const KUrl &baseUrl)
Ask for the name of a new directory and create it.
Definition: konq_operations.cpp:922
translatePath
static QString translatePath(QString path)
Definition: konq_operations.cpp:731
cleanHomeDirPath
static bool cleanHomeDirPath(QString &path, const QString &homeDir)
Definition: konq_operations.cpp:713
KonqMultiRestoreJob::slotResult
virtual void slotResult(KJob *job)
Definition: konq_operations.cpp:1007
KonqMultiRestoreJob
Restore multiple trashed files.
Definition: konq_operations.h:318
KonqOperations::MOVE
Definition: konq_operations.h:56
KonqOperations::KonqOperations
KonqOperations(QWidget *parent)
Definition: konq_operations.cpp:79
konqmimedata.h
loader
static const KCatalogLoader loader("libkonq")
KonqOperations::asyncDrop
void asyncDrop(const KFileItem &item)
Definition: konq_operations.cpp:368
KonqOperations::del
static void del(QWidget *parent, Operation method, const KUrl::List &selectedUrls)
Delete the selectedUrls if possible.
Definition: konq_operations.cpp:101
KonqOperations::RESTORE
Definition: konq_operations.h:56
confirmCreatingHiddenDir
static bool confirmCreatingHiddenDir(const QString &name, QWidget *parent)
Definition: konq_operations.cpp:907
KonqOperations::copy
static void copy(QWidget *parent, Operation method, const KUrl::List &selectedUrls, const KUrl &destUrl)
Copy the selectedUrls to the destination destUrl.
Definition: konq_operations.cpp:171
KonqMimeData::decodeIsCutSelection
static bool decodeIsCutSelection(const QMimeData *mimeData)
Definition: konqmimedata.cpp:49
KonqOperations
Implements file operations (move,del,trash,paste,copy,move,link...) for file managers.
Definition: konq_operations.h:42
QWidget
KonqOperations::statFinished
void statFinished(const KFileItem &item)
KonqOperations::Operation
Operation
Definition: konq_operations.h:56
KonqOperations::slotResult
void slotResult(KJob *job)
Definition: konq_operations.cpp:850
QObject
KonqOperations::statUrl
static void statUrl(const KUrl &url, const QObject *receiver, const char *member, QWidget *parent)
Get info about a given URL, and when that's done (it's asynchronous!), call a given slot with a const...
Definition: konq_operations.cpp:817
KonqOperations::FORCE_CONFIRMATION
Definition: konq_operations.h:229
KonqOperations::~KonqOperations
virtual ~KonqOperations()
Definition: konq_operations.cpp:86
KonqOperations::renamingFailed
void renamingFailed(const KUrl &oldUrl, const KUrl &newUrl)
KonqOperations::emptyTrash
static void emptyTrash(QWidget *parent)
Empty the trash.
Definition: konq_operations.cpp:115
KonqOperations::slotStatResult
void slotStatResult(KJob *job)
Definition: konq_operations.cpp:833
KonqOperations::renameV2
static KonqOperations * renameV2(QWidget *parent, const KUrl &oldurl, const QString &name)
Do a renaming.
Definition: konq_operations.cpp:898
konq_operations.h
Copy
Definition: konq_copytomenu_p.h:38
KonqOperations::LINK
Definition: konq_operations.h:56
KonqOperations::DEFAULT_CONFIRMATION
Definition: konq_operations.h:229
KonqOperations::DEL
Definition: konq_operations.h:56
KonqDndPopupMenuPlugin::setup
virtual void setup(const KFileItemListProperties &popupMenuInfo, KUrl destination, QList< QAction * > &pluginActions)=0
Implement the setup method in the plugin in order to create actions in the given actionCollection and...
KonqMultiRestoreJob::KonqMultiRestoreJob
KonqMultiRestoreJob(const KUrl::List &urls)
Definition: konq_operations.cpp:964
KonqOperations::STAT
Definition: konq_operations.h:56
KonqOperations::TRASH
Definition: konq_operations.h:56
KonqOperations::PUT
Definition: konq_operations.h:56
KonqOperations::RENAME
Definition: konq_operations.h:56
KonqOperations::doPaste
static void doPaste(QWidget *parent, const KUrl &destUrl, const QPoint &pos=QPoint())
Paste the clipboard contents.
Definition: konq_operations.cpp:136
QMenu
KonqOperations::slotCopyingDone
void slotCopyingDone(KIO::Job *job, const KUrl &from, const KUrl &to)
Definition: konq_operations.cpp:684
KonqOperations::slotCopyingLinkDone
void slotCopyingLinkDone(KIO::Job *job, const KUrl &from, const QString &target, const KUrl &to)
Definition: konq_operations.cpp:689
KonqOperations::EMPTYTRASH
Definition: konq_operations.h:56
KonqOperations::SKIP_CONFIRMATION
Definition: konq_operations.h:229
KonqOperations::doDrop
static void doDrop(const KFileItem &destItem, const KUrl &destUrl, QDropEvent *ev, QWidget *parent)
Drop.
Definition: konq_operations.cpp:285
KonqDndPopupMenuPlugin
Base class for drag and drop popup menus.
Definition: konq_dndpopupmenuplugin.h:40
KonqOperations::doPasteV2
static KonqOperations * doPasteV2(QWidget *parent, const KUrl &destUrl, const QPoint &pos=QPoint())
Paste the clipboard contents.
Definition: konq_operations.cpp:141
KonqOperations::ConfirmationType
ConfirmationType
Definition: konq_operations.h:229
KonqOperations::slotAboutToCreate
void slotAboutToCreate(KIO::Job *job, const QList< KIO::CopyInfo > &files)
Definition: konq_operations.cpp:812
Move
Definition: konq_copytomenu_p.h:38
KonqOperations::aboutToCreate
void aboutToCreate(const QPoint &pos, const QList< KIO::CopyInfo > &files)
KonqOperations::doDropFileCopy
void doDropFileCopy()
Definition: konq_operations.cpp:461
KonqOperations::askDeleteConfirmation
static bool askDeleteConfirmation(const KUrl::List &selectedUrls, int method, ConfirmationType confirmation, QWidget *widget)
Ask for confirmation before deleting/trashing selectedUrls.
Definition: konq_operations.cpp:264
KonqOperations::editMimeType
static void editMimeType(const QString &mimeType, QWidget *parent)
Pop up properties dialog for mimetype mimeType.
Definition: konq_operations.cpp:92
KonqMultiRestoreJob::slotStart
virtual void slotStart()
Definition: konq_operations.cpp:973
KonqOperations::COPY
Definition: konq_operations.h:56
KonqOperations::rename
static void rename(QWidget *parent, const KUrl &oldurl, const QString &name)
Do a renaming.
Definition: konq_operations.cpp:893
KonqOperations::restoreTrashedItems
static void restoreTrashedItems(const KUrl::List &urls, QWidget *parent)
Restore trashed items.
Definition: konq_operations.cpp:121
KonqOperations::pasteInfo
static QPair< bool, QString > pasteInfo(const KUrl &targetUrl)
Returns the state of the paste action: first is whether the action should be enabled second is the te...
Definition: konq_operations.cpp:1028
KonqOperations::droppedUrls
KUrl::List droppedUrls() const
Returns the list of dropped URL's.
Definition: konq_operations.cpp:451
KonqOperations::mkdir
static KIO::SimpleJob * mkdir(QWidget *parent, const KUrl &url)
Create a directory.
Definition: konq_operations.cpp:127
QList
KonqOperations::dropPosition
QPoint dropPosition() const
Returns the position where the drop occurred.
Definition: konq_operations.cpp:456
KonqOperations::ViewShowsHiddenFile
Definition: konq_operations.h:162
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