[Kde-pim] Proposal for a solution for bug 77682

Guy Maurel guy-kde at maurel.de
Fri May 7 17:27:53 BST 2010


Hi!

The bug reports that the problem occurs as the network changes.
No part of imap within kmail takes care of this.                                                                            

Use the NetworkManager. If your distribution hasn't it, have a look at:                                                     
  git clone git://git.freedesktop.org/git/NetworkManager/NetworkManager.git

I propose to connect to the "Solid::Networking::notifier",                                                                    
which sends informations about the network as described at:                                                                 
  kdelibs/solid/solid/networking.h:42
    /**
     * Describes the state of the networking system                                                                         
     */                                                                                                                     
    enum Status {
        Unknown, /**< the networking system is not active or unable to
                                report its status - proceed with caution */                                                           
        Unconnected,/**< the system is not connected to any network */
        Disconnecting, /**< the system is breaking the connection */                                                        
        Connecting, /**< the system is not connected to any network */                                                      
        Connected /**< the system is currently connected to a network */
    };

Create a new slot within "kmkernel".
Make the connect at "void KMKernel::init()".

The new slot
  "void KMKernel::slotNetworkStatusHasChanged( Solid::Networking::Status status)"
gets the changes of the network.

If "Solid::Networking::Unconnected" occurs, we check all the accounts for "KAccount::Imap".

Get the slave address
  lmSlave = imapAcct->slave();
and the pid of the slave
  pid = lmSlave->slave_pid();
prepare the kill-command
  killCommand = "kill "+ s_pid;
and let it works
  system( killCommand.toAscii());

Test and what appens:
After having a connection to the imap-server we have the processes:
  3996 19:00 pts/1 00:00:06 kmail --nofork
  4001 19:00 ?     00:00:00 kdeinit4: kio_imap4 [kdeinit] imap local:/tmp/ksocket-guy-kde

as we unplug (to test it) the ethernet (after a maximum of 60 seconds) we get
  kmail(3996) KMKernel::slotNetworkStatusHasChanged: Networking is now: Unconnected
  kmail(3996) KMKernel::slotNetworkStatusHasChanged: imapAcct->slave: KIO::Slave(0xbc3960)
  kmail(3996) KMKernel::slotNetworkStatusHasChanged: slave_pid: 4001
  kmail(3996) KMKernel::slotNetworkStatusHasChanged: kill-command "kill 4001"

as the process is killed, the slave get an input
  kmail(3996)/kio (Slave) KIO::Slave::gotInput: slave died pid =  4001
  kmail(3996)/kio (Scheduler) KIO::SchedulerPrivate::disconnectSlave: _disconnectSlave(  KIO::Slave(0xbc3960) )
  kmail(3996)/kdeui (KNotification) KNotificationManager::notificationClosed: 234

kmail is now able to go on for a new imap-connection after the network is on again.
-- 
guy maurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kmkernel.diff
Type: text/x-patch
Size: 3645 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100507/c9a99651/attachment.bin>
-------------- 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