diff --git a/accountcombobox.cpp b/accountcombobox.cpp index 58eadca41..27a22c21b 100644 --- a/accountcombobox.cpp +++ b/accountcombobox.cpp @@ -98,31 +98,17 @@ QValueList 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; diff --git a/configuredialog.cpp b/configuredialog.cpp index bd9edd811..61b5ac212 100644 --- a/configuredialog.cpp +++ b/configuredialog.cpp @@ -46,11 +46,14 @@ #include #include #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 @@ -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(node); + if ( acct && acct->hasInbox() ) { + // it's an (d)imap account + ImapAccountBase * imapAcct = dynamic_cast( acct ); + if ( imapAcct ) { + KMFolderNode *node = imapAcct->rootFolder()->folder()->child()->first(); + while ( node && !folder ) { + if (!node->isDir() && (node->name().upper() == "INBOX" ) ) + folder = static_cast(node); + node = imapAcct->rootFolder()->folder()->child()->next(); + } + } } if ( acct ) GlobalSettings::setTheIMAPResourceAccount( acct->id() );