D5030: kioexec: delegate upload to a kded module

David Faure noreply at phabricator.kde.org
Mon Mar 27 20:02:22 UTC 2017


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kioexecd.cpp:74
> +    m_watcher->addFile(path);
> +    m_watched.insert(path, QUrl::fromUserInput(destUrl));
> +}

QUrl(destUrl) would be enough, you use toString() in the caller.

> kioexecd.cpp:93
> +    auto job = KIO::copy(QUrl::fromLocalFile(path), dest);
> +    if (!job->exec()) {
> +        KMessageBox::error(nullptr, job->errorString());

Nested event loop! In a multi-purpose daemon, very bad idea.
Been there...

Just connect the job to a lambda.

> main.cpp:123
> +                QDBusInterface kioexecd(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/kioexecd"), QStringLiteral("org.kde.KIOExecd"));
> +                kioexecd.call(QStringLiteral("watch"), file.path, file.url.toString());
> +                mUseDaemon = !kioexecd.lastError().isValid();

Using a qdbusxml2cpp-generated header would provide more compile-time checking.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D5030

To: elvisangelaccio, dfaure
Cc: #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170327/bb1b8c97/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list