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

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kio
fileundomanager.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
3  Copyright (C) 2006, 2008 David Faure <faure@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "fileundomanager.h"
22 #include "fileundomanager_p.h"
23 #include "clipboardupdater_p.h"
24 #include "fileundomanager_adaptor.h"
25 
26 #include <kdatetime.h>
27 #include <kdebug.h>
28 #include <kdirnotify.h>
29 #include <kglobal.h>
30 #include <kio/copyjob.h>
31 #include <kio/job.h>
32 #include <kio/jobuidelegate.h>
33 #include <klocale.h>
34 #include <kmessagebox.h>
35 #include <kjobtrackerinterface.h>
36 
37 #include <QtDBus/QtDBus>
38 
39 #include <assert.h>
40 
41 using namespace KIO;
42 
43 static const char* undoStateToString(UndoState state) {
44  static const char* const s_undoStateToString[] = { "MAKINGDIRS", "MOVINGFILES", "STATINGFILE", "REMOVINGDIRS", "REMOVINGLINKS" };
45  return s_undoStateToString[state];
46 }
47 
48 static QDataStream &operator<<(QDataStream &stream, const KIO::BasicOperation &op)
49 {
50  stream << op.m_valid << (qint8)op.m_type << op.m_renamed
51  << op.m_src << op.m_dst << op.m_target << (qint64)op.m_mtime;
52  return stream;
53 }
54 static QDataStream &operator>>(QDataStream &stream, BasicOperation &op)
55 {
56  qint8 type;
57  qint64 mtime;
58  stream >> op.m_valid >> type >> op.m_renamed
59  >> op.m_src >> op.m_dst >> op.m_target >> mtime;
60  op.m_type = static_cast<BasicOperation::Type>(type);
61  op.m_mtime = mtime;
62  return stream;
63 }
64 
65 static QDataStream &operator<<(QDataStream &stream, const UndoCommand &cmd)
66 {
67  stream << cmd.m_valid << (qint8)cmd.m_type << cmd.m_opStack << cmd.m_src << cmd.m_dst;
68  return stream;
69 }
70 
71 static QDataStream &operator>>(QDataStream &stream, UndoCommand &cmd)
72 {
73  qint8 type;
74  stream >> cmd.m_valid >> type >> cmd.m_opStack >> cmd.m_src >> cmd.m_dst;
75  cmd.m_type = static_cast<FileUndoManager::CommandType>(type);
76  return stream;
77 }
78 
102 class KIO::UndoJob : public KIO::Job
103 {
104 public:
105  UndoJob(bool showProgressInfo) : KIO::Job() {
106  if (showProgressInfo)
107  KIO::getJobTracker()->registerJob(this);
108  }
109  virtual ~UndoJob() {}
110 
111  virtual void kill(bool) {
112  FileUndoManager::self()->d->stopUndo(true);
113  KIO::Job::doKill();
114  }
115 
116  void emitCreatingDir(const KUrl &dir)
117  { emit description(this, i18n("Creating directory"),
118  qMakePair(i18n("Directory"), dir.prettyUrl())); }
119  void emitMoving(const KUrl &src, const KUrl &dest)
120  { emit description(this, i18n("Moving"),
121  qMakePair(i18nc("The source of a file operation", "Source"), src.prettyUrl()),
122  qMakePair(i18nc("The destination of a file operation", "Destination"), dest.prettyUrl())); }
123  void emitDeleting(const KUrl &url)
124  { emit description(this, i18n("Deleting"),
125  qMakePair(i18n("File"), url.prettyUrl())); }
126  void emitResult() { KIO::Job::emitResult(); }
127 };
128 
129 CommandRecorder::CommandRecorder(FileUndoManager::CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job)
130  : QObject(job)
131 {
132  m_cmd.m_type = op;
133  m_cmd.m_valid = true;
134  m_cmd.m_serialNumber = FileUndoManager::self()->newCommandSerialNumber();
135  m_cmd.m_src = src;
136  m_cmd.m_dst = dst;
137  connect(job, SIGNAL(result(KJob*)),
138  this, SLOT(slotResult(KJob*)));
139 
140  // TODO whitelist, instead
141  if (op != FileUndoManager::Mkdir && op != FileUndoManager::Put) {
142  connect(job, SIGNAL(copyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool)),
143  this, SLOT(slotCopyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool)));
144  connect(job, SIGNAL(copyingLinkDone(KIO::Job*,KUrl,QString,KUrl)),
145  this, SLOT(slotCopyingLinkDone(KIO::Job*,KUrl,QString,KUrl)));
146  }
147 }
148 
149 CommandRecorder::~CommandRecorder()
150 {
151 }
152 
153 void CommandRecorder::slotResult(KJob *job)
154 {
155  if (job->error())
156  return;
157 
158  FileUndoManager::self()->d->addCommand(m_cmd);
159 }
160 
161 void CommandRecorder::slotCopyingDone(KIO::Job *job, const KUrl &from, const KUrl &to, time_t mtime, bool directory, bool renamed)
162 {
163  BasicOperation op;
164  op.m_valid = true;
165  op.m_type = directory ? BasicOperation::Directory : BasicOperation::File;
166  op.m_renamed = renamed;
167  op.m_src = from;
168  op.m_dst = to;
169  op.m_mtime = mtime;
170 
171  if (m_cmd.m_type == FileUndoManager::Trash)
172  {
173  Q_ASSERT(to.protocol() == "trash");
174  const QMap<QString, QString> metaData = job->metaData();
175  QMap<QString, QString>::ConstIterator it = metaData.find("trashURL-" + from.path());
176  if (it != metaData.constEnd()) {
177  // Update URL
178  op.m_dst = it.value();
179  }
180  }
181 
182  m_cmd.m_opStack.prepend(op);
183 }
184 
185 // TODO merge the signals?
186 void CommandRecorder::slotCopyingLinkDone(KIO::Job *, const KUrl &from, const QString &target, const KUrl &to)
187 {
188  BasicOperation op;
189  op.m_valid = true;
190  op.m_type = BasicOperation::Link;
191  op.m_renamed = false;
192  op.m_src = from;
193  op.m_target = target;
194  op.m_dst = to;
195  op.m_mtime = -1;
196  m_cmd.m_opStack.prepend(op);
197 }
198 
200 
201 class KIO::FileUndoManagerSingleton
202 {
203 public:
204  FileUndoManager self;
205 };
206 K_GLOBAL_STATIC(KIO::FileUndoManagerSingleton, globalFileUndoManager)
207 
208 FileUndoManager *FileUndoManager::self()
209 {
210  return &globalFileUndoManager->self;
211 }
212 
213 
214 // m_nextCommandIndex is initialized to a high number so that konqueror can
215 // assign low numbers to closed items loaded "on-demand" from a config file
216 // in KonqClosedWindowsManager::readConfig and thus maintaining the real
217 // order of the undo items.
218 FileUndoManagerPrivate::FileUndoManagerPrivate(FileUndoManager* qq)
219  : m_uiInterface(new FileUndoManager::UiInterface()),
220  m_undoJob(0), m_nextCommandIndex(1000), q(qq)
221 {
222  m_syncronized = initializeFromKDesky();
223  (void) new KIOFileUndoManagerAdaptor(this);
224  const QString dbusPath = "/FileUndoManager";
225  const QString dbusInterface = "org.kde.kio.FileUndoManager";
226 
227  QDBusConnection dbus = QDBusConnection::sessionBus();
228  dbus.registerObject(dbusPath, this);
229  dbus.connect(QString(), dbusPath, dbusInterface, "lock", this, SLOT(slotLock()));
230  dbus.connect(QString(), dbusPath, dbusInterface, "pop", this, SLOT(slotPop()));
231  dbus.connect(QString(), dbusPath, dbusInterface, "push", this, SLOT(slotPush(QByteArray)));
232  dbus.connect(QString(), dbusPath, dbusInterface, "unlock", this, SLOT(slotUnlock()));
233 }
234 
235 FileUndoManager::FileUndoManager()
236 {
237  d = new FileUndoManagerPrivate(this);
238  d->m_lock = false;
239  d->m_currentJob = 0;
240 }
241 
242 FileUndoManager::~FileUndoManager()
243 {
244  delete d;
245 }
246 
247 void FileUndoManager::recordJob(CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job)
248 {
249  // This records what the job does and calls addCommand when done
250  (void) new CommandRecorder(op, src, dst, job);
251  emit jobRecordingStarted(op);
252 }
253 
254 void FileUndoManager::recordCopyJob(KIO::CopyJob* copyJob)
255 {
256  CommandType commandType;
257  switch (copyJob->operationMode()) {
258  case CopyJob::Copy:
259  commandType = Copy;
260  break;
261  case CopyJob::Move:
262  commandType = Move;
263  break;
264  case CopyJob::Link:
265  default: // prevent "wrong" compiler warning because of possibly uninitialized variable
266  commandType = Link;
267  break;
268  }
269  recordJob(commandType, copyJob->srcUrls(), copyJob->destUrl(), copyJob);
270 }
271 
272 void FileUndoManagerPrivate::addCommand(const UndoCommand &cmd)
273 {
274  broadcastPush(cmd);
275  emit q->jobRecordingFinished(cmd.m_type);
276 }
277 
278 bool FileUndoManager::undoAvailable() const
279 {
280  return (d->m_commands.count() > 0) && !d->m_lock;
281 }
282 
283 QString FileUndoManager::undoText() const
284 {
285  if (d->m_commands.isEmpty())
286  return i18n("Und&o");
287 
288  FileUndoManager::CommandType t = d->m_commands.last().m_type;
289  switch(t) {
290  case FileUndoManager::Copy:
291  return i18n("Und&o: Copy");
292  case FileUndoManager::Link:
293  return i18n("Und&o: Link");
294  case FileUndoManager::Move:
295  return i18n("Und&o: Move");
296  case FileUndoManager::Rename:
297  return i18n("Und&o: Rename");
298  case FileUndoManager::Trash:
299  return i18n("Und&o: Trash");
300  case FileUndoManager::Mkdir:
301  return i18n("Und&o: Create Folder");
302  case FileUndoManager::Put:
303  return i18n("Und&o: Create File");
304  }
305  /* NOTREACHED */
306  return QString();
307 }
308 
309 quint64 FileUndoManager::newCommandSerialNumber()
310 {
311  return ++(d->m_nextCommandIndex);
312 }
313 
314 quint64 FileUndoManager::currentCommandSerialNumber() const
315 {
316  if(!d->m_commands.isEmpty())
317  {
318  const UndoCommand& cmd = d->m_commands.last();
319  assert(cmd.m_valid);
320  return cmd.m_serialNumber;
321  } else
322  return 0;
323 }
324 
325 void FileUndoManager::undo()
326 {
327  if (d->m_commands.isEmpty()) {
328  return;
329  }
330 
331  // Make a copy of the command to undo before broadcastPop() pops it.
332  UndoCommand cmd = d->m_commands.last();
333  assert(cmd.m_valid);
334  d->m_current = cmd;
335 
336  BasicOperation::Stack& opStack = d->m_current.m_opStack;
337  // Note that opStack is empty for simple operations like Mkdir.
338 
339  // Let's first ask for confirmation if we need to delete any file (#99898)
340  KUrl::List fileCleanupStack;
341  BasicOperation::Stack::Iterator it = opStack.begin();
342  for (; it != opStack.end() ; ++it) {
343  BasicOperation::Type type = (*it).m_type;
344  if (type == BasicOperation::File && d->m_current.m_type == FileUndoManager::Copy) {
345  fileCleanupStack.append((*it).m_dst);
346  }
347  }
348  if (d->m_current.m_type == FileUndoManager::Mkdir || d->m_current.m_type == FileUndoManager::Put) {
349  fileCleanupStack.append(d->m_current.m_dst);
350  }
351  if (!fileCleanupStack.isEmpty()) {
352  if (!d->m_uiInterface->confirmDeletion(fileCleanupStack)) {
353  return;
354  }
355  }
356 
357  d->broadcastPop();
358  d->broadcastLock();
359 
360  d->m_dirCleanupStack.clear();
361  d->m_dirStack.clear();
362  d->m_dirsToUpdate.clear();
363 
364  d->m_undoState = MOVINGFILES;
365 
366  // Let's have a look at the basic operations we need to undo.
367  // While we're at it, collect all links that should be deleted.
368 
369  it = opStack.begin();
370  while (it != opStack.end()) // don't cache end() here, erase modifies it
371  {
372  bool removeBasicOperation = false;
373  BasicOperation::Type type = (*it).m_type;
374  if (type == BasicOperation::Directory && !(*it).m_renamed)
375  {
376  // If any directory has to be created/deleted, we'll start with that
377  d->m_undoState = MAKINGDIRS;
378  // Collect all the dirs that have to be created in case of a move undo.
379  if (d->m_current.isMoveCommand())
380  d->m_dirStack.push((*it).m_src);
381  // Collect all dirs that have to be deleted
382  // from the destination in both cases (copy and move).
383  d->m_dirCleanupStack.prepend((*it).m_dst);
384  removeBasicOperation = true;
385  }
386  else if (type == BasicOperation::Link)
387  {
388  d->m_fileCleanupStack.prepend((*it).m_dst);
389 
390  removeBasicOperation = !d->m_current.isMoveCommand();
391  }
392 
393  if (removeBasicOperation)
394  it = opStack.erase(it);
395  else
396  ++it;
397  }
398 
399  if (d->m_current.m_type == FileUndoManager::Put) {
400  d->m_fileCleanupStack.append(d->m_current.m_dst);
401  }
402 
403  kDebug(1203) << "starting with" << undoStateToString(d->m_undoState);
404  d->m_undoJob = new UndoJob(d->m_uiInterface->showProgressInfo());
405  d->undoStep();
406 }
407 
408 void FileUndoManagerPrivate::stopUndo(bool step)
409 {
410  m_current.m_opStack.clear();
411  m_dirCleanupStack.clear();
412  m_fileCleanupStack.clear();
413  m_undoState = REMOVINGDIRS;
414  m_undoJob = 0;
415 
416  if (m_currentJob)
417  m_currentJob->kill();
418 
419  m_currentJob = 0;
420 
421  if (step)
422  undoStep();
423 }
424 
425 void FileUndoManagerPrivate::slotResult(KJob *job)
426 {
427  m_currentJob = 0;
428  if (job->error())
429  {
430  m_uiInterface->jobError(static_cast<KIO::Job*>(job));
431  delete m_undoJob;
432  stopUndo(false);
433  }
434  else if (m_undoState == STATINGFILE)
435  {
436  BasicOperation op = m_current.m_opStack.last();
437  //kDebug(1203) << "stat result for " << op.m_dst;
438  KIO::StatJob* statJob = static_cast<KIO::StatJob*>(job);
439  time_t mtime = statJob->statResult().numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1);
440  if (mtime != op.m_mtime) {
441  kDebug(1203) << op.m_dst << " was modified after being copied!";
442  KDateTime srcTime; srcTime.setTime_t(op.m_mtime); srcTime = srcTime.toLocalZone();
443  KDateTime destTime; destTime.setTime_t(mtime); destTime = destTime.toLocalZone();
444  if (!m_uiInterface->copiedFileWasModified(op.m_src, op.m_dst, srcTime, destTime)) {
445  stopUndo(false);
446  }
447  }
448  }
449 
450  undoStep();
451 }
452 
453 
454 void FileUndoManagerPrivate::addDirToUpdate(const KUrl& url)
455 {
456  if (!m_dirsToUpdate.contains(url))
457  m_dirsToUpdate.prepend(url);
458 }
459 
460 void FileUndoManagerPrivate::undoStep()
461 {
462  m_currentJob = 0;
463 
464  if (m_undoState == MAKINGDIRS)
465  stepMakingDirectories();
466 
467  if (m_undoState == MOVINGFILES || m_undoState == STATINGFILE)
468  stepMovingFiles();
469 
470  if (m_undoState == REMOVINGLINKS)
471  stepRemovingLinks();
472 
473  if (m_undoState == REMOVINGDIRS)
474  stepRemovingDirectories();
475 
476  if (m_currentJob) {
477  if (m_uiInterface)
478  m_currentJob->ui()->setWindow(m_uiInterface->parentWidget());
479  QObject::connect(m_currentJob, SIGNAL(result(KJob*)),
480  this, SLOT(slotResult(KJob*)));
481  }
482 }
483 
484 void FileUndoManagerPrivate::stepMakingDirectories()
485 {
486  if (!m_dirStack.isEmpty()) {
487  KUrl dir = m_dirStack.pop();
488  kDebug(1203) << "creatingDir" << dir;
489  m_currentJob = KIO::mkdir(dir);
490  m_undoJob->emitCreatingDir(dir);
491  }
492  else
493  m_undoState = MOVINGFILES;
494 }
495 
496 // Misnamed method: It moves files back, but it also
497 // renames directories back, recreates symlinks,
498 // deletes copied files, and restores trashed files.
499 void FileUndoManagerPrivate::stepMovingFiles()
500 {
501  if (!m_current.m_opStack.isEmpty())
502  {
503  BasicOperation op = m_current.m_opStack.last();
504  BasicOperation::Type type = op.m_type;
505 
506  assert(op.m_valid);
507  if (type == BasicOperation::Directory)
508  {
509  if (op.m_renamed)
510  {
511  kDebug(1203) << "rename" << op.m_dst << op.m_src;
512  m_currentJob = KIO::rename(op.m_dst, op.m_src, KIO::HideProgressInfo);
513  m_undoJob->emitMoving(op.m_dst, op.m_src);
514  }
515  else
516  assert(0); // this should not happen!
517  }
518  else if (type == BasicOperation::Link)
519  {
520  kDebug(1203) << "symlink" << op.m_target << op.m_src;
521  m_currentJob = KIO::symlink(op.m_target, op.m_src, KIO::Overwrite | KIO::HideProgressInfo);
522  }
523  else if (m_current.m_type == FileUndoManager::Copy)
524  {
525  if (m_undoState == MOVINGFILES) // dest not stat'ed yet
526  {
527  // Before we delete op.m_dst, let's check if it was modified (#20532)
528  kDebug(1203) << "stat" << op.m_dst;
529  m_currentJob = KIO::stat(op.m_dst, KIO::HideProgressInfo);
530  m_undoState = STATINGFILE; // temporarily
531  return; // no pop() yet, we'll finish the work in slotResult
532  }
533  else // dest was stat'ed, and the deletion was approved in slotResult
534  {
535  m_currentJob = KIO::file_delete(op.m_dst, KIO::HideProgressInfo);
536  m_undoJob->emitDeleting(op.m_dst);
537  m_undoState = MOVINGFILES;
538  }
539  }
540  else if (m_current.isMoveCommand()
541  || m_current.m_type == FileUndoManager::Trash)
542  {
543  kDebug(1203) << "file_move" << op.m_dst << op.m_src;
544  m_currentJob = KIO::file_move(op.m_dst, op.m_src, -1, KIO::Overwrite | KIO::HideProgressInfo);
545  KIO::ClipboardUpdater::create(m_currentJob, KIO::ClipboardUpdater::UpdateContent);
546  m_undoJob->emitMoving(op.m_dst, op.m_src);
547  }
548 
549  m_current.m_opStack.removeLast();
550  // The above KIO jobs are lowlevel, they don't trigger KDirNotify notification
551  // So we need to do it ourselves (but schedule it to the end of the undo, to compress them)
552  KUrl url(op.m_dst);
553  url.setPath(url.directory());
554  addDirToUpdate(url);
555 
556  url = op.m_src;
557  url.setPath(url.directory());
558  addDirToUpdate(url);
559  }
560  else
561  m_undoState = REMOVINGLINKS;
562 }
563 
564 void FileUndoManagerPrivate::stepRemovingLinks()
565 {
566  kDebug(1203) << "REMOVINGLINKS";
567  if (!m_fileCleanupStack.isEmpty())
568  {
569  KUrl file = m_fileCleanupStack.pop();
570  kDebug(1203) << "file_delete" << file;
571  m_currentJob = KIO::file_delete(file, KIO::HideProgressInfo);
572  m_undoJob->emitDeleting(file);
573 
574  KUrl url(file);
575  url.setPath(url.directory());
576  addDirToUpdate(url);
577  }
578  else
579  {
580  m_undoState = REMOVINGDIRS;
581 
582  if (m_dirCleanupStack.isEmpty() && m_current.m_type == FileUndoManager::Mkdir)
583  m_dirCleanupStack << m_current.m_dst;
584  }
585 }
586 
587 void FileUndoManagerPrivate::stepRemovingDirectories()
588 {
589  if (!m_dirCleanupStack.isEmpty())
590  {
591  KUrl dir = m_dirCleanupStack.pop();
592  kDebug(1203) << "rmdir" << dir;
593  m_currentJob = KIO::rmdir(dir);
594  m_undoJob->emitDeleting(dir);
595  addDirToUpdate(dir);
596  }
597  else
598  {
599  m_current.m_valid = false;
600  m_currentJob = 0;
601  if (m_undoJob)
602  {
603  kDebug(1203) << "deleting undojob";
604  m_undoJob->emitResult();
605  m_undoJob = 0;
606  }
607  QList<KUrl>::ConstIterator it = m_dirsToUpdate.constBegin();
608  for(; it != m_dirsToUpdate.constEnd(); ++it) {
609  kDebug() << "Notifying FilesAdded for " << *it;
610  org::kde::KDirNotify::emitFilesAdded((*it).url());
611  }
612  emit q->undoJobFinished();
613  broadcastUnlock();
614  }
615 }
616 
617 // const ref doesn't work due to QDataStream
618 void FileUndoManagerPrivate::slotPush(QByteArray data)
619 {
620  QDataStream strm(&data, QIODevice::ReadOnly);
621  UndoCommand cmd;
622  strm >> cmd;
623  pushCommand(cmd);
624 }
625 
626 void FileUndoManagerPrivate::pushCommand(const UndoCommand& cmd)
627 {
628  m_commands.append(cmd);
629  emit q->undoAvailable(true);
630  emit q->undoTextChanged(q->undoText());
631 }
632 
633 void FileUndoManagerPrivate::slotPop()
634 {
635  m_commands.removeLast();
636  emit q->undoAvailable(q->undoAvailable());
637  emit q->undoTextChanged(q->undoText());
638 }
639 
640 void FileUndoManagerPrivate::slotLock()
641 {
642 // assert(!m_lock);
643  m_lock = true;
644  emit q->undoAvailable(q->undoAvailable());
645 }
646 
647 void FileUndoManagerPrivate::slotUnlock()
648 {
649 // assert(m_lock);
650  m_lock = false;
651  emit q->undoAvailable(q->undoAvailable());
652 }
653 
654 QByteArray FileUndoManagerPrivate::get() const
655 {
656  QByteArray data;
657  QDataStream stream(&data, QIODevice::WriteOnly);
658  stream << m_commands;
659  return data;
660 }
661 
662 void FileUndoManagerPrivate::broadcastPush(const UndoCommand &cmd)
663 {
664  if (!m_syncronized) {
665  pushCommand(cmd);
666  return;
667  }
668 
669  QByteArray data;
670  QDataStream stream(&data, QIODevice::WriteOnly);
671  stream << cmd;
672  emit push(data); // DBUS signal
673 }
674 
675 void FileUndoManagerPrivate::broadcastPop()
676 {
677  if (!m_syncronized) {
678  slotPop();
679  return;
680  }
681 
682  emit pop(); // DBUS signal
683 }
684 
685 void FileUndoManagerPrivate::broadcastLock()
686 {
687 // assert(!m_lock);
688 
689  if (!m_syncronized) {
690  slotLock();
691  return;
692  }
693  emit lock(); // DBUS signal
694 }
695 
696 void FileUndoManagerPrivate::broadcastUnlock()
697 {
698 // assert(m_lock);
699 
700  if (!m_syncronized) {
701  slotUnlock();
702  return;
703  }
704  emit unlock(); // DBUS signal
705 }
706 
707 bool FileUndoManagerPrivate::initializeFromKDesky()
708 {
709  // ### workaround for dcop problem and upcoming 2.1 release:
710  // in case of huge io operations the amount of data sent over
711  // dcop (containing undo information broadcasted for global undo
712  // to all konqueror instances) can easily exceed the 64kb limit
713  // of dcop. In order not to run into trouble we disable global
714  // undo for now! (Simon)
715  // ### FIXME: post 2.1
716  // TODO KDE4: port to DBUS and test
717  return false;
718 #if 0
719  DCOPClient *client = kapp->dcopClient();
720 
721  if (client->appId() == "kdesktop") // we are master :)
722  return true;
723 
724  if (!client->isApplicationRegistered("kdesktop"))
725  return false;
726 
727  d->m_commands = DCOPRef("kdesktop", "FileUndoManager").call("get");
728  return true;
729 #endif
730 }
731 
732 void FileUndoManager::setUiInterface(UiInterface* ui)
733 {
734  delete d->m_uiInterface;
735  d->m_uiInterface = ui;
736 }
737 
738 FileUndoManager::UiInterface* FileUndoManager::uiInterface() const
739 {
740  return d->m_uiInterface;
741 }
742 
744 
745 class FileUndoManager::UiInterface::UiInterfacePrivate
746 {
747 public:
748  UiInterfacePrivate()
749  : m_parentWidget(0), m_showProgressInfo(true)
750  {}
751  QWidget* m_parentWidget;
752  bool m_showProgressInfo;
753 };
754 
755 FileUndoManager::UiInterface::UiInterface()
756  : d(new UiInterfacePrivate)
757 {
758 }
759 
760 FileUndoManager::UiInterface::~UiInterface()
761 {
762  delete d;
763 }
764 
765 void FileUndoManager::UiInterface::jobError(KIO::Job* job)
766 {
767  job->ui()->showErrorMessage();
768 }
769 
770 bool FileUndoManager::UiInterface::copiedFileWasModified(const KUrl& src, const KUrl& dest, const KDateTime& srcTime, const KDateTime& destTime)
771 {
772  Q_UNUSED(srcTime); // not sure it should appear in the msgbox
773  // Possible improvement: only show the time if date is today
774  const QString timeStr = KGlobal::locale()->formatDateTime(destTime, KLocale::ShortDate);
775  return KMessageBox::warningContinueCancel(
776  d->m_parentWidget,
777  i18n("The file %1 was copied from %2, but since then it has apparently been modified at %3.\n"
778  "Undoing the copy will delete the file, and all modifications will be lost.\n"
779  "Are you sure you want to delete %4?", dest.pathOrUrl(), src.pathOrUrl(), timeStr, dest.pathOrUrl()),
780  i18n("Undo File Copy Confirmation"),
781  KStandardGuiItem::cont(),
782  KStandardGuiItem::cancel(),
783  QString(),
784  KMessageBox::Notify | KMessageBox::Dangerous) == KMessageBox::Continue;
785 }
786 
787 bool FileUndoManager::UiInterface::confirmDeletion(const KUrl::List& files)
788 {
789  KIO::JobUiDelegate uiDelegate;
790  uiDelegate.setWindow(d->m_parentWidget);
791  // Because undo can happen with an accidental Ctrl-Z, we want to always confirm.
792  return uiDelegate.askDeleteConfirmation(files, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::ForceConfirmation);
793 }
794 
795 QWidget* FileUndoManager::UiInterface::parentWidget() const
796 {
797  return d->m_parentWidget;
798 }
799 
800 void FileUndoManager::UiInterface::setParentWidget(QWidget* parentWidget)
801 {
802  d->m_parentWidget = parentWidget;
803 }
804 
805 void FileUndoManager::UiInterface::setShowProgressInfo(bool b)
806 {
807  d->m_showProgressInfo = b;
808 }
809 
810 bool FileUndoManager::UiInterface::showProgressInfo() const
811 {
812  return d->m_showProgressInfo;
813 }
814 
815 void FileUndoManager::UiInterface::virtual_hook(int, void*)
816 {
817 }
818 
819 #include "fileundomanager_p.moc"
820 #include "fileundomanager.moc"
KIO::JobUiDelegate::setWindow
virtual void setWindow(QWidget *window)
Associate this job with a window given by window.
Definition: jobuidelegate.cpp:58
KIO::BasicOperation::m_src
KUrl m_src
Definition: fileundomanager_p.h:49
KIO::FileUndoManagerPrivate::pushCommand
void pushCommand(const UndoCommand &cmd)
Definition: fileundomanager.cpp:626
KStandardGuiItem::cancel
KGuiItem cancel()
KIO::CopyJob::Link
Definition: copyjob.h:73
KIO::FileUndoManager::setUiInterface
void setUiInterface(UiInterface *ui)
Set a new UiInterface implementation.
Definition: fileundomanager.cpp:732
KIO::FileUndoManagerPrivate::slotPush
void slotPush(QByteArray)
Definition: fileundomanager.cpp:618
i18n
QString i18n(const char *text)
KCompositeJob::kill
bool kill(KillVerbosity verbosity=Quietly)
QList::clear
void clear()
KIO::FileUndoManager
FileUndoManager: makes it possible to undo kio jobs.
Definition: fileundomanager.h:44
KIO::FileUndoManagerPrivate::m_syncronized
bool m_syncronized
Definition: fileundomanager_p.h:140
KIO::Overwrite
When set, automatically overwrite the destination if it exists already.
Definition: jobclasses.h:67
KIO::FileUndoManager::CommandRecorder
friend class CommandRecorder
Definition: fileundomanager.h:211
kapp
#define kapp
QWidget
KIO::UndoCommand::m_dst
KUrl m_dst
Definition: fileundomanager_p.h:73
qint64
KIO::JobUiDelegate::Delete
Definition: jobuidelegate.h:109
KUrl::directory
QString directory(const DirectoryOptions &options=IgnoreTrailingSlash) const
KIO::FileUndoManagerPrivate::stepMakingDirectories
void stepMakingDirectories()
Definition: fileundomanager.cpp:484
KIO::FileUndoManagerPrivate::m_dirsToUpdate
QList< KUrl > m_dirsToUpdate
Definition: fileundomanager_p.h:151
KMessageBox::Continue
KIO::FileUndoManager::UiInterface::~UiInterface
virtual ~UiInterface()
Definition: fileundomanager.cpp:760
KIO::FileUndoManagerPrivate::m_undoState
UndoState m_undoState
Definition: fileundomanager_p.h:147
kdebug.h
KIO::CopyJob::destUrl
KUrl destUrl() const
Returns the destination URL.
Definition: copyjob.cpp:272
KCompositeJob::emitResult
void emitResult()
QStack::pop
T pop()
kdatetime.h
KIO::REMOVINGLINKS
Definition: fileundomanager_p.h:97
KIO::MOVINGFILES
Definition: fileundomanager_p.h:97
KIO::FileUndoManagerPrivate::m_nextCommandIndex
quint64 m_nextCommandIndex
Definition: fileundomanager_p.h:155
KIO::FileUndoManagerPrivate::initializeFromKDesky
bool initializeFromKDesky()
Definition: fileundomanager.cpp:707
KIO::FileUndoManagerPrivate::m_lock
bool m_lock
Definition: fileundomanager_p.h:141
QByteArray
fileundomanager_p.h
kjobtrackerinterface.h
KIO::BasicOperation::m_renamed
bool m_renamed
Definition: fileundomanager_p.h:44
KIO::UndoCommand::m_valid
bool m_valid
Definition: fileundomanager_p.h:68
QDataStream
KIO::FileUndoManagerPrivate::get
QByteArray get() const
called by FileUndoManagerAdaptor
Definition: fileundomanager.cpp:654
kdirnotify.h
KIO::FileUndoManager::UiInterface::copiedFileWasModified
virtual bool copiedFileWasModified(const KUrl &src, const KUrl &dest, const KDateTime &srcTime, const KDateTime &destTime)
Called when dest was modified since it was copied from src.
Definition: fileundomanager.cpp:770
KIO::FileUndoManagerPrivate::unlock
void unlock()
DBUS signal.
K_GLOBAL_STATIC
#define K_GLOBAL_STATIC(TYPE, NAME)
QStack::push
void push(const T &t)
KIO::HideProgressInfo
Hide progress information dialog, i.e.
Definition: jobclasses.h:51
QMap< QString, QString >
KIO::FileUndoManager::UndoJob
friend class UndoJob
Definition: fileundomanager.h:210
KLocale::ShortDate
KIO::FileUndoManager::UiInterface::virtual_hook
virtual void virtual_hook(int id, void *data)
Definition: fileundomanager.cpp:815
KIO::JobUiDelegate::ForceConfirmation
Definition: jobuidelegate.h:116
QDBusConnection::registerObject
bool registerObject(const QString &path, QObject *object, QFlags< QDBusConnection::RegisterOption > options)
KIO::FileUndoManager::undoTextChanged
void undoTextChanged(const QString &text)
Emitted when the value of undoText() changes.
KIO::mkdir
SimpleJob * mkdir(const KUrl &url, int permissions=-1)
Creates a single directory.
Definition: job.cpp:697
KIO::FileUndoManager::jobRecordingFinished
void jobRecordingFinished(CommandType op)
Emitted when a job that has been recorded by FileUndoManager::recordJob() or FileUndoManager::recordC...
KIO::FileUndoManagerPrivate::stepMovingFiles
void stepMovingFiles()
Definition: fileundomanager.cpp:499
KIO::stat
StatJob * stat(const KUrl &url, JobFlags flags=DefaultFlags)
Find all details for one file or directory.
Definition: job.cpp:924
KIO::file_delete
SimpleJob * file_delete(const KUrl &src, JobFlags flags=DefaultFlags)
Delete a single file.
Definition: job.cpp:2487
KIO::FileUndoManager::Put
Definition: fileundomanager.h:135
QDBusConnection
QList::erase
iterator erase(iterator pos)
KIO::StatJob
A KIO job that retrieves information about a file or directory.
Definition: jobclasses.h:440
KIO::UndoCommand
Definition: fileundomanager_p.h:55
KIO::ClipboardUpdater::UpdateContent
Definition: clipboardupdater_p.h:55
QDBusConnection::sessionBus
QDBusConnection sessionBus()
KIO::file_move
FileCopyJob * file_move(const KUrl &src, const KUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
Move a single file.
Definition: job.cpp:2479
KIO::UndoCommand::isMoveCommand
bool isMoveCommand() const
Definition: fileundomanager_p.h:66
KIO::operator<<
QDataStream & operator<<(QDataStream &s, const AuthInfo &a)
Definition: authinfo.cpp:209
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
klocale.h
KIO::FileUndoManagerPrivate::m_dirCleanupStack
QStack< KUrl > m_dirCleanupStack
Definition: fileundomanager_p.h:149
KIO::JobUiDelegate::askDeleteConfirmation
bool askDeleteConfirmation(const KUrl::List &urls, DeletionType deletionType, ConfirmationType confirmationType)
Ask for confirmation before deleting/trashing urls.
Definition: jobuidelegate.cpp:108
KIO::UndoCommand::m_opStack
BasicOperation::Stack m_opStack
Definition: fileundomanager_p.h:71
OrgKdeKDirNotifyInterface::emitFilesAdded
static void emitFilesAdded(const QString &directory)
Definition: kdirnotify.cpp:47
KUrl
KDialogJobUiDelegate::showErrorMessage
virtual void showErrorMessage()
i18nc
QString i18nc(const char *ctxt, const char *text)
KUrl::setPath
void setPath(const QString &path)
KIO::Job::ui
JobUiDelegate * ui() const
Retrieves the UI delegate of this job.
Definition: job.cpp:90
KIO::FileUndoManagerPrivate::push
void push(const QByteArray &command)
DBUS signal.
KIO::FileUndoManagerPrivate::m_undoJob
UndoJob * m_undoJob
Definition: fileundomanager_p.h:154
KIO::FileUndoManager::CommandType
CommandType
The type of job.
Definition: fileundomanager.h:135
KIO::CopyJob::srcUrls
KUrl::List srcUrls() const
Returns the list of source URLs.
Definition: copyjob.cpp:267
KIO::UndoCommand::m_type
FileUndoManager::CommandType m_type
Definition: fileundomanager_p.h:70
KIO::UndoState
UndoState
Definition: fileundomanager_p.h:97
KIO::CopyJob::Move
Definition: copyjob.h:73
KIO::FileUndoManagerPrivate::m_fileCleanupStack
QStack< KUrl > m_fileCleanupStack
Definition: fileundomanager_p.h:150
KIO::FileUndoManagerPrivate::slotResult
void slotResult(KJob *)
Definition: fileundomanager.cpp:425
KDateTime::setTime_t
void setTime_t(qint64 seconds)
KIO::FileUndoManagerPrivate::FileUndoManagerPrivate
FileUndoManagerPrivate(FileUndoManager *qq)
Definition: fileundomanager.cpp:218
KIO::FileUndoManager::jobRecordingStarted
void jobRecordingStarted(CommandType op)
Emitted when a job recording has been started by FileUndoManager::recordJob() or FileUndoManager::rec...
KIO::FileUndoManager::UiInterface::showProgressInfo
bool showProgressInfo() const
Definition: fileundomanager.cpp:810
kglobal.h
QList::count
int count(const T &value) const
KCompositeJob::description
void description(KJob *job, const QString &title, const QPair< QString, QString > &field1=qMakePair(QString(), QString()), const QPair< QString, QString > &field2=qMakePair(QString(), QString()))
KIO::FileUndoManagerPrivate::addCommand
void addCommand(const UndoCommand &cmd)
called by UndoCommandRecorder
Definition: fileundomanager.cpp:272
QList::append
void append(const T &value)
KIO::FileUndoManagerPrivate::stopUndo
void stopUndo(bool step)
called by UndoJob
Definition: fileundomanager.cpp:408
KIO::FileUndoManagerPrivate::lock
void lock()
DBUS signal.
KIO::FileUndoManager::undoJobFinished
void undoJobFinished()
Emitted when an undo job finishes. Used for unit testing.
KIO::FileUndoManagerPrivate::m_uiInterface
FileUndoManager::UiInterface * m_uiInterface
Definition: fileundomanager_p.h:152
KIO::FileUndoManager::UiInterface::confirmDeletion
virtual bool confirmDeletion(const KUrl::List &files)
Called when we are about to remove those files.
Definition: fileundomanager.cpp:787
KIO::CommandRecorder::CommandRecorder
CommandRecorder(FileUndoManager::CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job)
Definition: fileundomanager.cpp:129
KIO::CommandRecorder::~CommandRecorder
virtual ~CommandRecorder()
Definition: fileundomanager.cpp:149
KIO::UDSEntry::numberValue
long long numberValue(uint field, long long defaultValue=0) const
Definition: udsentry.cpp:78
KIO::rename
SimpleJob * rename(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Rename a file or directory.
Definition: job.cpp:731
QObject
KIO::JobUiDelegate
A UI delegate tuned to be used with KIO Jobs.
Definition: jobuidelegate.h:39
KUrl::protocol
QString protocol() const
KIO::FileUndoManagerPrivate::slotUnlock
void slotUnlock()
Definition: fileundomanager.cpp:647
KIO::FileUndoManagerPrivate::broadcastPop
void broadcastPop()
Definition: fileundomanager.cpp:675
QList::isEmpty
bool isEmpty() const
KIO::BasicOperation
Definition: fileundomanager_p.h:36
KIO::FileUndoManagerPrivate::addDirToUpdate
void addDirToUpdate(const KUrl &url)
Definition: fileundomanager.cpp:454
KMessageBox::Notify
QMap::constEnd
const_iterator constEnd() const
KUrl::pathOrUrl
QString pathOrUrl() const
KIO::FileUndoManager::undoText
QString undoText() const
Definition: fileundomanager.cpp:283
KIO::FileUndoManager::undo
void undo()
Undoes the last command Remember to call uiInterface()->setParentWidget(parentWidget) first...
Definition: fileundomanager.cpp:325
copyjob.h
QList< BasicOperation >::Iterator
typedef Iterator
KIO::BasicOperation::m_dst
KUrl m_dst
Definition: fileundomanager_p.h:50
KIO::getJobTracker
KJobTrackerInterface * getJobTracker()
Definition: global.cpp:1246
KIO::FileUndoManager::UiInterface::setParentWidget
void setParentWidget(QWidget *parentWidget)
Sets the parent widget to use for message boxes.
Definition: fileundomanager.cpp:800
KIO::Job::metaData
MetaData metaData() const
Get meta data received from the slave.
Definition: job.cpp:248
KIO::rmdir
SimpleJob * rmdir(const KUrl &url)
Removes a single directory.
Definition: job.cpp:704
QString
QList< BasicOperation >
KIO::REMOVINGDIRS
Definition: fileundomanager_p.h:97
KUrl::path
QString path(AdjustPathOption trailing=LeaveTrailingSlash) const
KIO::FileUndoManager::uiInterface
UiInterface * uiInterface() const
Definition: fileundomanager.cpp:738
KIO::CopyJob::Copy
Definition: copyjob.h:73
KIO::FileUndoManager::Link
Definition: fileundomanager.h:135
KIO::UDSEntry::UDS_MODIFICATION_TIME
The last time the file was modified.
Definition: udsentry.h:173
jobuidelegate.h
QList::end
iterator end()
KIO::symlink
SimpleJob * symlink(const QString &target, const KUrl &dest, JobFlags flags=DefaultFlags)
Create or move a symlink.
Definition: job.cpp:738
KIO::FileUndoManager::Copy
Definition: fileundomanager.h:135
KDateTime
KIO::FileUndoManagerPrivate::slotLock
void slotLock()
Definition: fileundomanager.cpp:640
QList::contains
bool contains(const T &value) const
KIO::FileUndoManager::UiInterface::parentWidget
QWidget * parentWidget() const
Definition: fileundomanager.cpp:795
KLocale::formatDateTime
QString formatDateTime(const QDateTime &dateTime, DateFormat format=ShortDate, bool includeSecs=false) const
KIO::ClipboardUpdater::create
static ClipboardUpdater * create(Job *job, Mode mode)
Returns an instance of clipboard updater if QApplication::type() does not return a tty...
Definition: clipboardupdater.cpp:162
KIO::FileUndoManagerPrivate::q
FileUndoManager * q
Definition: fileundomanager_p.h:157
KGlobal::locale
KLocale * locale()
KIO::operator>>
QDataStream & operator>>(QDataStream &s, AuthInfo &a)
Definition: authinfo.cpp:219
job.h
KIO::FileUndoManagerPrivate::stepRemovingDirectories
void stepRemovingDirectories()
Definition: fileundomanager.cpp:587
KIO::Job::doKill
virtual bool doKill()
Abort this job.
Definition: job.cpp:175
KUrl::List
KIO::FileUndoManager::FileUndoManagerPrivate
friend class FileUndoManagerPrivate
Definition: fileundomanager.h:213
KIO::BasicOperation::Directory
Definition: fileundomanager_p.h:46
KIO::FileUndoManagerPrivate::stepRemovingLinks
void stepRemovingLinks()
Definition: fileundomanager.cpp:564
KIO::STATINGFILE
Definition: fileundomanager_p.h:97
KIO::UndoCommand::m_src
KUrl::List m_src
Definition: fileundomanager_p.h:72
KDateTime::toLocalZone
KDateTime toLocalZone() const
KRecentDirs::dir
QString dir(const QString &fileClass)
Returns the most recently used directory accociated with this file-class.
Definition: krecentdirs.cpp:68
quint64
QList::last
T & last()
fileundomanager.h
KIO::FileUndoManager::newCommandSerialNumber
quint64 newCommandSerialNumber()
These two functions are useful when wrapping FileUndoManager and adding custom commands.
Definition: fileundomanager.cpp:309
KIO::FileUndoManager::Rename
Definition: fileundomanager.h:135
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
KIO::FileUndoManager::Move
Definition: fileundomanager.h:135
QList::removeLast
void removeLast()
KIO::FileUndoManagerPrivate::undoStep
void undoStep()
Definition: fileundomanager.cpp:460
KIO::FileUndoManager::undoAvailable
bool undoAvailable() const
Definition: fileundomanager.cpp:278
KIO::FileUndoManagerPrivate::broadcastPush
void broadcastPush(const UndoCommand &cmd)
Definition: fileundomanager.cpp:662
KIO::MAKINGDIRS
Definition: fileundomanager_p.h:97
KIO::BasicOperation::m_mtime
time_t m_mtime
Definition: fileundomanager_p.h:52
KIO::FileUndoManager::UiInterface::setShowProgressInfo
void setShowProgressInfo(bool b)
Sets whether to show progress info when running the KIO jobs for undoing.
Definition: fileundomanager.cpp:805
KIO::FileUndoManager::currentCommandSerialNumber
quint64 currentCommandSerialNumber() const
Definition: fileundomanager.cpp:314
KIO::FileUndoManager::UiInterface::jobError
virtual void jobError(KIO::Job *job)
Called when an undo job errors; default implementation displays a message box.
Definition: fileundomanager.cpp:765
KIO::FileUndoManager::Mkdir
Definition: fileundomanager.h:135
QList::prepend
void prepend(const T &value)
KIO::BasicOperation::Link
Definition: fileundomanager_p.h:46
KIO::FileUndoManagerPrivate::slotPop
void slotPop()
Definition: fileundomanager.cpp:633
KStandardGuiItem::cont
KGuiItem cont()
KIO::FileUndoManager::Trash
Definition: fileundomanager.h:135
KIO::FileUndoManagerPrivate::m_currentJob
KIO::Job * m_currentJob
Definition: fileundomanager_p.h:146
KJobTrackerInterface::registerJob
virtual void registerJob(KJob *job)
QList::constEnd
const_iterator constEnd() const
undoStateToString
static const char * undoStateToString(UndoState state)
Definition: fileundomanager.cpp:43
KIO::FileUndoManagerPrivate::broadcastLock
void broadcastLock()
Definition: fileundomanager.cpp:685
QList::constBegin
const_iterator constBegin() const
KIO::FileUndoManager::self
static FileUndoManager * self()
Definition: fileundomanager.cpp:208
QDBusConnection::connect
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
clipboardupdater_p.h
KIO::FileUndoManagerPrivate::m_dirStack
QStack< KUrl > m_dirStack
Definition: fileundomanager_p.h:148
KIO::StatJob::statResult
const UDSEntry & statResult() const
Result of the stat operation.
Definition: job.cpp:839
KIO::BasicOperation::m_valid
bool m_valid
Definition: fileundomanager_p.h:43
kmessagebox.h
KIO::CopyJob::operationMode
CopyMode operationMode() const
Returns the mode of the operation (copy, move, or link), depending on whether KIO::copy(), KIO::move() or KIO::link() was called.
Definition: copyjob.cpp:2142
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KMessageBox::Dangerous
KIO::FileUndoManagerPrivate::m_current
UndoCommand m_current
Definition: fileundomanager_p.h:145
KIO::UndoCommand::m_serialNumber
quint64 m_serialNumber
Definition: fileundomanager_p.h:74
KIO::FileUndoManager::UiInterface
Interface for the gui handling of FileUndoManager.
Definition: fileundomanager.h:63
KIO::BasicOperation::m_type
Type m_type
Definition: fileundomanager_p.h:47
KIO::FileUndoManager::UiInterface::UiInterface
UiInterface()
Definition: fileundomanager.cpp:755
KMessageBox::warningContinueCancel
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
KJob
QMap::find
iterator find(const Key &key)
QList::begin
iterator begin()
KUrl::prettyUrl
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
KIO::FileUndoManager::recordCopyJob
void recordCopyJob(KIO::CopyJob *copyJob)
Record this CopyJob while it's happening and add a command for it so that the user can undo it...
Definition: fileundomanager.cpp:254
KIO::BasicOperation::m_target
QString m_target
Definition: fileundomanager_p.h:51
KIO::FileUndoManagerPrivate::pop
void pop()
DBUS signal.
KIO::FileUndoManagerPrivate::broadcastUnlock
void broadcastUnlock()
Definition: fileundomanager.cpp:696
KIO::BasicOperation::File
Definition: fileundomanager_p.h:46
KIO::CopyJob
CopyJob is used to move, copy or symlink files and directories.
Definition: copyjob.h:65
KIO::FileUndoManager::recordJob
void recordJob(CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job)
Record this job while it's happening and add a command for it so that the user can undo it...
Definition: fileundomanager.cpp:247
QMap::value
const T value(const Key &key) const
KIO::FileUndoManagerPrivate::m_commands
UndoCommand::Stack m_commands
Definition: fileundomanager_p.h:143
KIO::BasicOperation::Type
Type
Definition: fileundomanager_p.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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