[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kio] src/widgets: [PasteJob] Emit KDirNotify on paste
From:       Kai Uwe Broulik <null () kde ! org>
Date:       2018-09-18 8:46:28
Message-ID: E1g2BeO-0004Ma-GQ () code ! kde ! org
[Download RAW message or body]

Git commit 681501c276ee343a0b7073c529a8d02b0b9748fa by Kai Uwe Broulik.
Committed on 18/09/2018 at 08:45.
Pushed by broulik into branch 'master'.

[PasteJob] Emit KDirNotify on paste

storedPut isn't particularly smart and so after pasting the file tell everyone about \
it

CHANGELOG: Fixed a file being created from pasted clipboard contents showing up only \
after a delay

Differential Revision: https://phabricator.kde.org/D12520

M  +6    -0    src/widgets/paste.cpp

https://commits.kde.org/kio/681501c276ee343a0b7073c529a8d02b0b9748fa

diff --git a/src/widgets/paste.cpp b/src/widgets/paste.cpp
index 4f4fe410..0f0f7283 100644
--- a/src/widgets/paste.cpp
+++ b/src/widgets/paste.cpp
@@ -28,6 +28,7 @@
 #include "kprotocolmanager.h"
 #include "../pathhelpers_p.h"
 
+#include <kdirnotify.h>
 #include <kjobwidgets.h>
 #include <klocalizedstring.h>
 #include <kmessagebox.h>
@@ -125,6 +126,11 @@ static QUrl getNewFileName(const QUrl &u, const QString &text, \
const QString &su  static KIO::Job *putDataAsyncTo(const QUrl &url, const QByteArray \
&data, QWidget *widget, KIO::JobFlags flags)  {
     KIO::Job *job = KIO::storedPut(data, url, -1, flags);
+    QObject::connect(job, &KIO::Job::result, [url](KJob *job) {
+        if (job->error() == KJob::NoError) {
+            org::kde::KDirNotify::emitFilesAdded(url.adjusted(QUrl::RemoveFilename | \
QUrl::StripTrailingSlash)); +        }
+    });
     KJobWidgets::setWindow(job, widget);
     return job;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic