File kmail-networkstatus-support.diff of Package kdepim3
--- kmail/kmacctmgr.cpp
+++ kmail/kmacctmgr.cpp 2005/03/04 14:24:43
@@ -17,6 +17,7 @@
#include "kmfiltermgr.h"
#include "globalsettings.h"
+#include <dcopclient.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kdebug.h>
@@ -154,9 +155,14 @@
}
}
}
+ else
+ {
+ kdDebug(5006) << "account " << acct->name() << " is still chekcing" << endl;
+ }
}
if (mAcctChecking.isEmpty())
{
+ kdDebug(5006) << "processNextCheck, done checking" << endl;
// all checks finished, display summary
if ( mDisplaySummary )
BroadcastStatus::instance()->setStatusMsgTransmissionCompleted(
@@ -210,6 +216,34 @@
return;
}
+ if ( curAccount->type() == "imap" || curAccount->type() == "cachedimap" || curAccount->type() == "pop" )
+ {
+ // Check with the network status daemon whether the network is available
+ const int NetWorkStatusUnknown = 1;
+ const int NetWorkStatusOnline = 8;
+ QCString replyType;
+ QByteArray params;
+ QByteArray reply;
+
+ QDataStream stream( params, IO_WriteOnly );
+ stream << static_cast<NetworkAccount*>( curAccount )->host();
+
+ if ( kapp->dcopClient()->call( "kded", "networkstatus", "status(QString)",
+ params, replyType, reply ) && ( replyType == "int" ) )
+ {
+ int result;
+ QDataStream stream2( reply, IO_ReadOnly );
+ stream2 >> result;
+ kdDebug() << k_funcinfo << "networkstatus status = " << result << endl;
+ // if it's not unknown (no networks announced by network control apps), and not offline, give up now
+ if ( ( result != NetWorkStatusUnknown ) && ( result != NetWorkStatusOnline ) )
+ {
+ emit checkedMail( false, interactive, mTotalNewInFolder );
+ return;
+ }
+ }
+ }
+
connect( curAccount, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( processNextCheck( bool ) ) );