[Kde-pim] Akonadi Resource - setOnline troubles
Kevin Krammer
krammer at kde.org
Tue Feb 18 15:41:35 GMT 2014
On Tuesday, 2014-02-18, 16:31:43, Daniel Vrátil wrote:
> 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.
I think we have discussed something similar before, i.e. the need to have more
states than just online/offline.
The earlier discussion was mostly about distingushing different forms of
"offline", i.e. whether the resource or the user is the originator of the
state.
Maybe this is just another good reason to get this rolling? :)
Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20140218/d9635e66/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