[Kde-pim] Akonadi Resource - setOnline troubles

Daniel Vrátil dvratil at redhat.com
Tue Feb 18 15:31:43 GMT 2014


On Monday 17 of February 2014 22:21:09 Martin Koller wrote:
> In the patch I created for the DAV resource (to make it automatically
> offline when it can not reach the server) I see a problem with the
> online/offline switching:
> When I use setOnline(false), the baseclass stores this as "desired status ==
> offline", which also means whenever the network goes away (e.g. suspend
> Laptop) and comes again (resume Laptop) detected by Solid, it would not
> automatically try to set the resource to online, because the baseclass
> still thinks, my desire is to have it offline.
> 
> How can I overcome this ?
> 
> I want to set the resource to "temporarily offline" and therefore to
> activate the change recorder, but as soon as possible (either via my QTimer
> or when Solid detects network activation) I want that the resource retries
> to go online.
> 
> I could also listen to the Solid events, but I see this as an ugly solution,
> as this is something every network needing resource should do.
> 
> What about a new method in AgentBase ?, e.g.
> void setTemporaryOffline() { setOnlineInternal(false); }  // not storing
> state as desired state

Yup, this sounds reasonable. Maybe setTemporaryOffline could even take an 
argument for timeout, set up a timer internally and then emit a signal, that 
resource implementations would connect to to check whether we are online 
already. Afaik this is pretty much what you've done in the DAV resource and 
similar solution would be used in other resources too, so having this as part 
of ResourceBase would prevent some code duplication.

Cheers,
Dan

> 
> (or maybe setTemporaryOnline(bool state), don't know if "true" would ever be
> used here)

-- 
Daniel Vrátil | dvratil at redhat.com | dvratil on #kde-devel, #kontact, #akonadi
KDE Desktop Team
Associate Software Engineer, Red Hat, Inc.

GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20140218/89f6e5bc/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