Check for the existance of an inbox using account->hasInbox() rather than

looking for one by iterating. Find the inbox by iterating from rootFolder()
not folder(), which does not work for online imap, in the config dialo.

svn path=/branches/proko2/kdepim/; revision=338778
wilder-work
Till Adam 22 years ago
parent a4b3dd8a83
commit 268b5af592
  1. 34
      accountcombobox.cpp
  2. 20
      configuredialog.cpp

@ -98,31 +98,17 @@ QValueList<KMAccount *> KMail::AccountComboBox::applicableAccounts() const
for( KMAccount *a = kmkernel->acctMgr()->first(); a;
a = kmkernel->acctMgr()->next() ) {
if ( a && a->type() != "local" ) { //// ## proko2 hack. Need a list of allowed account types as ctor param
disconnect( a, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( slotRefreshAccounts() ) );
bool ok = false;
if ( mNeedsInbox ) {
if ( a->folder() ) {
KMFolderDir* child = a->folder()->child();
Q_ASSERT( child );
if ( child ) {
for (KMFolderNode* node = child->first(); node; node = child->next()) {
if (!node->isDir() && node->name() == "INBOX") {
ok = true;
break;
}
}
}
}
if ( !ok ) { // no inbox? maybe there'll be one on the next sync
kdDebug() << k_funcinfo << "No INBOX in " << a->name() << " yet, waiting for sync" << endl;
connect( a, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( slotRefreshAccounts() ) );
}
} else
ok = true;
if ( ok )
disconnect( a, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( slotRefreshAccounts() ) );
bool ok = true;
if ( mNeedsInbox && !a->hasInbox() ) {
// no inbox? maybe there'll be one on the next sync
kdDebug() << k_funcinfo << "No INBOX in " << a->name() << " yet, waiting for sync" << endl;
connect( a, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( slotRefreshAccounts() ) );
} else {
lst.append( a );
}
}
}
return lst;

@ -46,11 +46,14 @@
#include <warningconfiguration.h>
#include <smimeconfiguration.h>
#include "accountcombobox.h"
#include "imapaccountbase.h"
#include "folderstorage.h"
using KMail::IdentityListView;
using KMail::IdentityListViewItem;
#include "identitydialog.h"
using KMail::IdentityDialog;
using KMail::ImapAccountBase;
// other kdenetwork headers:
#include <libkpimidentities/identity.h>
@ -4264,12 +4267,17 @@ void MiscPage::GroupwareTab::save() {
else {
// Inbox folder of the selected account
KMAccount* acct = mAccountCombo->currentAccount();
if ( acct && acct->folder() ) {
// Look inside that folder for an INBOX
KMFolderNode *node;
for (node = acct->folder()->child()->first(); node; node = acct->folder()->child()->next())
if (!node->isDir() && node->name() == "INBOX")
folder = static_cast<KMFolder*>(node);
if ( acct && acct->hasInbox() ) {
// it's an (d)imap account
ImapAccountBase * imapAcct = dynamic_cast<ImapAccountBase*>( acct );
if ( imapAcct ) {
KMFolderNode *node = imapAcct->rootFolder()->folder()->child()->first();
while ( node && !folder ) {
if (!node->isDir() && (node->name().upper() == "INBOX" ) )
folder = static_cast<KMFolder*>(node);
node = imapAcct->rootFolder()->folder()->child()->next();
}
}
}
if ( acct )
GlobalSettings::setTheIMAPResourceAccount( acct->id() );

Loading…
Cancel
Save