@@ -53,7 +53,7 @@ TrashFileEventReceiver::TrashFileEventReceiver(QObject *parent)
5353 future.waitForFinished ();
5454 fmInfo () << " TrashFileEventReceiver cleanup completed" ;
5555 });
56-
56+
5757 fmInfo () << " TrashFileEventReceiver initialized successfully" ;
5858}
5959
@@ -83,34 +83,33 @@ JobHandlePointer TrashFileEventReceiver::doMoveToTrash(const quint64 windowId, c
8383 }
8484
8585 // gio can only handle canonical file paths
86- QList<QUrl> processedSources = SystemPathUtil::instance ()->canonicalUrlList (sources);
87- const QUrl &sourceFirst = processedSources.first ();
86+ const QUrl &sourceFirst = sources.first ();
8887 JobHandlePointer handle = nullptr ;
8988 bool nullDirDelete = false ;
90- if (processedSources .count () == 1 ) {
89+ if (sources .count () == 1 ) {
9190 auto info = InfoFactory::create<FileInfo>(sourceFirst);
9291 nullDirDelete = info && info->isAttributes (OptInfoType::kIsDir )
9392 && !info->isAttributes (OptInfoType::kIsSymLink )
9493 && !info->isAttributes (OptInfoType::kIsWritable );
9594 }
9695
9796 if (nullDirDelete || !FileUtils::fileCanTrash (sourceFirst)) {
98- fmInfo () << " File cannot be moved to trash, will perform direct delete operation:"
99- << " nullDirDelete=" << nullDirDelete
97+ fmInfo () << " File cannot be moved to trash, will perform direct delete operation:"
98+ << " nullDirDelete=" << nullDirDelete
10099 << " canTrash=" << FileUtils::fileCanTrash (sourceFirst);
101-
102- if (DialogManagerInstance->showDeleteFilesDialog (processedSources , true ) != QDialog::Accepted) {
100+
101+ if (DialogManagerInstance->showDeleteFilesDialog (sources , true ) != QDialog::Accepted) {
103102 fmInfo () << " Delete operation cancelled by user" ;
104103 return nullptr ;
105104 }
106- handle = copyMoveJob->deletes (processedSources , flags, isInit);
105+ handle = copyMoveJob->deletes (sources , flags, isInit);
107106 if (!isInit)
108107 return handle;
109108 } else {
110109 fmInfo () << " Processing normal move to trash operation" ;
111-
110+
112111 // check url permission
113- QList<QUrl> urlsCanTrash = processedSources ;
112+ QList<QUrl> urlsCanTrash = sources ;
114113 if (!flags.testFlag (AbstractJobHandler::JobFlag::kRevocation ) && Application::instance ()->genericAttribute (Application::kShowDeleteConfirmDialog ).toBool ()) {
115114 if (DialogManagerInstance->showNormalDeleteConfirmDialog (urlsCanTrash) != QDialog::Accepted) {
116115 fmInfo () << " Move to trash operation cancelled by user" ;
@@ -123,7 +122,7 @@ JobHandlePointer TrashFileEventReceiver::doMoveToTrash(const quint64 windowId, c
123122 }
124123 if (handleCallback)
125124 handleCallback (handle);
126-
125+
127126 fmInfo () << " Move to trash operation completed successfully" ;
128127 return handle;
129128}
@@ -145,7 +144,7 @@ JobHandlePointer TrashFileEventReceiver::doRestoreFromTrash(const quint64 window
145144 return handle;
146145 if (handleCallback)
147146 handleCallback (handle);
148-
147+
149148 fmInfo () << " Restore from trash operation completed successfully" ;
150149 return handle;
151150}
@@ -166,7 +165,7 @@ JobHandlePointer TrashFileEventReceiver::doCopyFromTrash(const quint64 windowId,
166165 JobHandlePointer handle = copyMoveJob->copyFromTrash (sources, target, flags);
167166 if (handleCallback)
168167 handleCallback (handle);
169-
168+
170169 fmInfo () << " Copy from trash operation completed successfully" ;
171170 return handle;
172171}
@@ -220,7 +219,7 @@ JobHandlePointer TrashFileEventReceiver::doCleanTrash(const quint64 windowId, co
220219 FileOperationsEventHandler::instance ()->handleJobResult (AbstractJobHandler::JobType::kCleanTrashType , handle);
221220 if (handleCallback)
222221 handleCallback (handle);
223-
222+
224223 fmInfo () << " Clean trash operation completed successfully" ;
225224 return handle;
226225}
@@ -232,12 +231,12 @@ void TrashFileEventReceiver::countTrashFile(const quint64 windowId, const DFMBAS
232231 fmWarning () << " Count trash file operation aborted: receiver is stopping" ;
233232 return ;
234233 }
235-
234+
236235 fmInfo () << " Starting trash file enumeration" ;
237236 DFMIO::DEnumerator enumerator (FileUtils::trashRootUrl ());
238237 QList<QUrl> allFilesList;
239238 int processedCount = 0 ;
240-
239+
241240 while (enumerator.hasNext ()) {
242241 if (stoped) {
243242 fmWarning () << " Count trash file operation interrupted by stop signal" ;
@@ -323,7 +322,7 @@ void TrashFileEventReceiver::handleOperationRestoreFromTrash(const quint64 windo
323322 DFMBASE_NAMESPACE::AbstractJobHandler::OperatorCallback callback)
324323{
325324 fmInfo () << " Handling restore from trash operation with callback, window ID:" << windowId << " items count:" << sources.count ();
326-
325+
327326 JobHandlePointer handle = doRestoreFromTrash (windowId, sources, target, flags, handleCallback);
328327 if (callback) {
329328 AbstractJobHandler::CallbackArgus args (new QMap<AbstractJobHandler::CallbackKey, QVariant>);
@@ -341,7 +340,7 @@ void TrashFileEventReceiver::handleOperationCleanTrash(const quint64 windowId, c
341340 const QVariant custom, AbstractJobHandler::OperatorCallback callback)
342341{
343342 fmInfo () << " Handling clean trash operation with callback, window ID:" << windowId << " items count:" << sources.count ();
344-
343+
345344 JobHandlePointer handle = doCleanTrash (windowId, sources, AbstractJobHandler::DeleteDialogNoticeType::kEmptyTrash , handleCallback);
346345 if (callback) {
347346 AbstractJobHandler::CallbackArgus args (new QMap<AbstractJobHandler::CallbackKey, QVariant>);
@@ -371,7 +370,7 @@ void TrashFileEventReceiver::handleOperationCopyFromTrash(const quint64 windowId
371370 AbstractJobHandler::OperatorCallback callback)
372371{
373372 fmInfo () << " Handling copy from trash operation with callback, window ID:" << windowId << " items count:" << sources.count ();
374-
373+
375374 JobHandlePointer handle = doCopyFromTrash (windowId, sources, target, flags, handleCallback);
376375 if (callback) {
377376 AbstractJobHandler::CallbackArgus args (new QMap<AbstractJobHandler::CallbackKey, QVariant>);
@@ -387,7 +386,7 @@ void TrashFileEventReceiver::handleOperationCopyFromTrash(const quint64 windowId
387386void TrashFileEventReceiver::handleSaveRedoOpt (const QString &token, const bool moreThanZero)
388387{
389388 fmInfo () << " Processing save redo operation for token:" << token << " moreThanZero:" << moreThanZero;
390-
389+
391390 QVariantMap ret;
392391 {
393392 QMutexLocker lk (&undoLock);
@@ -401,24 +400,24 @@ void TrashFileEventReceiver::handleSaveRedoOpt(const QString &token, const bool
401400 fmWarning () << " Empty undo operation data for token:" << token;
402401 return ;
403402 }
404-
403+
405404 GlobalEventType undoEventType = static_cast <GlobalEventType>(ret.value (" undoevent" ).value <uint16_t >());
406405 QList<QUrl> undoSources = QUrl::fromStringList (ret.value (" undosources" ).toStringList ());
407406 QList<QUrl> undoTargets = QUrl::fromStringList (ret.value (" undotargets" ).toStringList ());
408407 GlobalEventType redoEventType = static_cast <GlobalEventType>(ret.value (" redoevent" ).value <uint16_t >());
409408 QList<QUrl> redoSources = QUrl::fromStringList (ret.value (" redosources" ).toStringList ());
410409 QList<QUrl> redoTargets = QUrl::fromStringList (ret.value (" redotargets" ).toStringList ());
411-
410+
412411 if (redoEventType == GlobalEventType::kTouchFile && moreThanZero) {
413412 fmInfo () << " Skipping touch file redo operation due to size constraint" ;
414413 return ;
415414 }
416-
417- fmInfo () << " Saving redo operation: undoType=" << static_cast <int >(undoEventType)
415+
416+ fmInfo () << " Saving redo operation: undoType=" << static_cast <int >(undoEventType)
418417 << " redoType=" << static_cast <int >(redoEventType)
419- << " undoSources=" << undoSources.count ()
418+ << " undoSources=" << undoSources.count ()
420419 << " redoSources=" << redoSources.count ();
421-
420+
422421 // save operation by dbus
423422 QVariantMap values;
424423 values.insert (" undoevent" , QVariant::fromValue (static_cast <uint16_t >(redoEventType)));
@@ -428,7 +427,7 @@ void TrashFileEventReceiver::handleSaveRedoOpt(const QString &token, const bool
428427 values.insert (" redosources" , QUrl::toStringList (undoSources));
429428 values.insert (" redotargets" , QUrl::toStringList (undoTargets));
430429 dpfSignalDispatcher->publish (GlobalEventType::kSaveRedoOperator , values);
431-
430+
432431 fmInfo () << " Redo operation saved successfully" ;
433432}
434433
@@ -439,14 +438,14 @@ void TrashFileEventReceiver::handleOperationUndoMoveToTrash(const quint64 window
439438 const QVariantMap &op)
440439{
441440 fmInfo () << " Processing undo move to trash operation, window ID:" << windowId << " items count:" << sources.count ();
442-
441+
443442 auto handle = doMoveToTrash (windowId, sources, flags, handleCallback, false );
444443
445444 if (!handle) {
446445 fmWarning () << " Failed to create job handle for undo move to trash operation" ;
447446 return ;
448447 }
449-
448+
450449 connect (handle.get (), &AbstractJobHandler::requestSaveRedoOperation, this ,
451450 &TrashFileEventReceiver::handleSaveRedoOpt);
452451 {
@@ -459,20 +458,20 @@ void TrashFileEventReceiver::handleOperationUndoMoveToTrash(const quint64 window
459458 if (handleCallback)
460459 handleCallback (handle);
461460 FileOperationsEventHandler::instance ()->handleJobResult (AbstractJobHandler::JobType::kMoveToTrashType , handle);
462-
461+
463462 fmInfo () << " Undo move to trash operation setup completed" ;
464463}
465464
466465void TrashFileEventReceiver::handleOperationUndoRestoreFromTrash (const quint64 windowId, const QList<QUrl> &sources, const QUrl &target, const AbstractJobHandler::JobFlag flags, AbstractJobHandler::OperatorHandleCallback handleCallback, const QVariantMap &op)
467466{
468467 fmInfo () << " Processing undo restore from trash operation, window ID:" << windowId << " items count:" << sources.count ();
469-
468+
470469 auto handle = doRestoreFromTrash (windowId, sources, target, flags, handleCallback, false );
471470 if (!handle) {
472471 fmWarning () << " Failed to create job handle for undo restore from trash operation" ;
473472 return ;
474473 }
475-
474+
476475 connect (handle.get (), &AbstractJobHandler::requestSaveRedoOperation, this ,
477476 &TrashFileEventReceiver::handleSaveRedoOpt);
478477 {
@@ -485,7 +484,7 @@ void TrashFileEventReceiver::handleOperationUndoRestoreFromTrash(const quint64 w
485484 if (handleCallback)
486485 handleCallback (handle);
487486 FileOperationsEventHandler::instance ()->handleJobResult (AbstractJobHandler::JobType::kRestoreType , handle);
488-
487+
489488 fmInfo () << " Undo restore from trash operation setup completed" ;
490489}
491490
@@ -497,7 +496,7 @@ JobHandlePointer TrashFileEventReceiver::onCleanTrashUrls(const quint64 windowId
497496 fmWarning () << " Clean trash URLs operation aborted: receiver is stopping" ;
498497 return nullptr ;
499498 }
500-
499+
501500 fmInfo () << " Executing clean trash URLs operation for" << sources.count () << " items" ;
502501 return doCleanTrash (windowId, sources, deleteNoticeType, handleCallback, false );
503502}
0 commit comments