[Kde-pim] [KIMAP] What signal is emitted when SomeJob is finished ?

Daniel Vrátil dvratil at kde.org
Tue May 31 09:42:17 BST 2016


On Tuesday, May 31, 2016 1:37:11 PM CEST Aditya Sharma wrote:
> Hey !
> 
> I looked through the KIMAP API online. I saw that, KIMAP::Job inherits
> KIMAP::Job, and KIMAP::<Other>Job inherit KIMAP::Job
> 
> One thing I could not figure out, was that which signal is emitted when
> <SomeJob> is finished.

KJob::result(KJob*) or KJob::finished(KJob*), refer to [0] for when to use 
which.

> Take LoginJob[1] for example. It inherits KIMAP::Job publicly, which
> inherits KJob publicly. Signal, finished(KJob*, QPrivateSignal) belongs to
> just KJob, since it's children cannot access it, essentially because moc
> removes the QPrivateSignal struct. 

That is not true. QPrivateSlot restricts who can emit the signal, has no 
effect on QObject::connect(). All Q_SIGNALS in Qt5 are public, so you can 
always connect to them.

> The apidocs doesn't have this bit of
> info about QPrivateSignal so I got related the build errors.

QPrivateSignal is one of those undocumented-yet-widely-used features of Qt :-)

> Similarly, result(KJob*, QprivateSignal) is also a private signal in KJob.
> I do have a emitResult(), a protected utility but that needs to be called
> with an object.

auto login = new KIMAP::LoginJob(this);
connect(login, &KJob::result,
                this, &MyClass::onLoginFinished);

This must work just fine, if you get build errors, please paste the log 
somewhere so we can look (or ping me on IRC).

KJob::emitResult() is to be called from inside the job and causes KJob to emit 
the result() signal. That's why KJob::result() is a QPrivateSignal - to 
prevent KJob subclasses from using "Q_EMIT result(this)" and forces them to 
call emitResult() instead (that's becahse KJob needs to do some more stuff 
internally before it can actually emit the result() signal).

Dan

[0] https://api.kde.org/frameworks/kcoreaddons/html/classKJob.html

> I need to make valid QObject::connects , to dependent jobs.
> 
> [1]:
> https://api.kde.org/4.x-api/pim-apidocs/kimap/html/classKIMAP_1_1LoginJob.ht
> ml
> 
> Thanks
> Aditya
> _______________________________________________
> KDE PIM mailing list kde-pim at kde.org
> https://mail.kde.org/mailman/listinfo/kde-pim
> KDE PIM home page at http://pim.kde.org/


-- 
Daniel Vrátil
www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)

GPG Key: 0x4D69557AECB13683
Fingerprint: 0ABD FA55 A4E6 BEA9 9A83 EA97 4D69 557A ECB1 3683
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20160531/10ae30c1/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list