D17260: Port some core Q_PRIVATE_SLOTS to new connect syntax

Kai Uwe Broulik noreply at phabricator.kde.org
Fri Nov 30 15:30:11 GMT 2018


broulik added inline comments.

INLINE COMMENTS

> filecopyjob.cpp:225
>      KIO_ARGS << m_src << m_dest << m_permissions << (qint8)(m_flags & Overwrite);
> -    m_copyJob = new DirectCopyJob(slave_url, packedArgs);
> +    auto job = new DirectCopyJob(slave_url, packedArgs);
> +    m_copyJob = job;

Why this change?

> filecopyjob.cpp:259
> +
> +    q->connect(job, &KJob::processedSize, [this](KJob *job, qulonglong processedSize) {
> +       slotProcessedSize(job, processedSize);

Add `q` context

> filecopyjob.cpp:260
> +    q->connect(job, &KJob::processedSize, [this](KJob *job, qulonglong processedSize) {
> +       slotProcessedSize(job, processedSize);
> +    });

All `slotProcessedSize` does is call `q->setProcessedAmount` so you can probably call this directly

> filecopyjob.cpp:263
>  
> -    q->connect(job, SIGNAL(processedSize(KJob*,qulonglong)),
> -               SLOT(slotProcessedSize(KJob*,qulonglong)));
> +    q->connect(job, QOverload<KJob*,ulong>::of(&KJob::percent), [this](KJob *job, ulong percent) {
> +        slotPercent(job, percent);

Same as `processedSize`

> job.cpp:88
>          // Forward information from that subjob.
> -        connect(job, SIGNAL(speed(KJob*,ulong)),
> -                SLOT(slotSpeed(KJob*,ulong)));
> -
> +        connect(job, &KJob::speed, this, [=](KJob *job, ulong speed) {
> +            Q_UNUSED(job);

Capture only `this`

REPOSITORY
  R241 KIO

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

To: davidedmundson
Cc: broulik, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181130/70217725/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list