[Kde-pim] kmail network-awareness patch

Martin Bednár serafean at gmail.com
Sat Aug 20 17:12:18 BST 2011


Le Samedi 20 d'août 2011 17:56:49 vous avez écrit :
> Le Saturday 20 August 2011 13:45:58 Martin Bednár a écrit :
> > Le Samedi 20 d'août 2011 12:53:19 vous avez écrit :
> > > Le Saturday 20 August 2011 11:59:08 Martin Bednár a écrit :
> > > > Hi,
> > > > 
> > > > I played around with some kmail code to make it a bit more
> > > > networkstatus-
> > > 
> > > aware
> > > 
> > > > (via solid) than it was. I'm not sure it's really needed
> > > > functionality-wise, but my ultimate goal being a
> > > > connected/disconnected icon in the status bar,
> > > 
> > > I
> > > 
> > > > think these changes are useful.
> > > > 
> > > > Also, what's your view on merging setAccountOnline() and
> > > > setAccountOffline() from kmkernel.cpp into one function
> > > > setAccountStatus(bool) ?
> > > > 
> > > > Cheers,
> > > > 
> > > > Martin
> > > 
> > > Hi,
> > > for me patch is good.
> > > And yes please merge setAccountOnline/Offline
> > 
> > Will do but in another patch.
> 
> ok
> 
> > > Just a little pb:
> > > "+void KMMainWidget::slotNetworkStatusChanged (
> > > Solid::Networking::Status status)
> > > +{
> > > +  if ( status == Solid::Networking::Connected &&
> > > GlobalSettings::self()-> > 
> > > >networkState() == GlobalSettings::EnumNetworkState::Online ) {
> > > 
> > > +    BroadcastStatus::instance()->setStatusMsg(i18n("Network
> > > connection
> > > detected, all network jobs resumed"));
> > > +    kmkernel->setAccountOnline();
> > > +  }
> > > +  else {
> > > +    BroadcastStatus::instance()->setStatusMsg(i18n("No network
> > > connection detected, all network jobs are suspended"));
> > > +    kmkernel->setAccountOffline();
> > > +  }
> > > +}
> > > " if ( status == Solid::Networking::Connected &&
> > > GlobalSettings::self()- networkState() ==
> > > GlobalSettings::EnumNetworkState::Online ) {"
> > > 
> > > When status is connected and
> > > "GlobalSettings::EnumNetworkState::Offline" you display "No network
> > > connection detected, all network jobs are suspended" it's not
> > > right. for me because you are connection but just kmail is offline.
> > > 
> > > 
> > > => perhaps:
> > > 
> > > Not necessary to display change network status when we are offline.
> > > 
> > > void KMMainWidget::slotNetworkStatusChanged (
> > > Solid::Networking::Status
> > > status)
> > > {
> > > 
> > >  if( GlobalSettings::self()->networkState() ==
> > > 
> > > GlobalSettings::EnumNetworkState::Offline )
> > > 
> > >     return;
> > >   
> > >   if ( status == Solid::Networking::Connected  ) {
> > >   
> > >     BroadcastStatus::instance()->setStatusMsg(i18n("Network
> > >     connection
> > > 
> > > detected, all network jobs resumed"));
> > > 
> > >     kmkernel->setAccountOnline();
> > >   
> > >   }
> > >   else {
> > >   
> > >     BroadcastStatus::instance()->setStatusMsg(i18n("No network
> > >     connection> > 
> > > detected, all network jobs are suspended"));
> > > 
> > >     kmkernel->setAccountOffline();
> > >   
> > >   }
> > > 
> > > }
> > 
> > Hadn't noticed that, modified accordingly.
> > I also added another i18n for the case that the user chooses to go
> > online,
> but
> 
> > there is no network connection. Now I'm left wondering what to do with
> > this> 
> >   if (
> >   MessageComposer::MessageComposerSettings::self()->sendImmediate() )
> >   {>   
> >     kmkernel->msgSender()->sendQueued();
> >   
> >   }
> > 
> > Should I add it to setAccountOnline()? Does it make sense to call it
> > when a network connection appears?
> 
> If we are not network access not call sendQueued it will not work I think.

If I understand correctly what it does, then actually putting it into 
setAccountOnline  might not be a bad idea, since it will get called when a 
network connection appears, thus immediately sending all queued mails. 
Attaching modified patch to this effect.

The kmail-setaccountStatus patch is the merger of setAccountOnline() and 
setAccountOffline() functions. It should be applied after the autoOffline patch.

> 
> > > Otherwise it's ok to commit in master (not in 4.7 because it adds
> > > new
> 
> i18n)
> 
> > Someone else will have to do that, I can't.
> 
> Ok will do it if you want.

Thanks

> 
> > > Thanks
> > > Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kmail-autoOffline2.patch
Type: text/x-patch
Size: 5867 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110820/325ebaf1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kmail-setAccountStatus.patch
Type: text/x-patch
Size: 3493 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110820/325ebaf1/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110820/325ebaf1/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