When the groupware folders can't be created on startup because the INBOX doesn't exist yet

(as is the case after the first startup), connect to finishedCheck() and try again then.
Had to add the config key TheIMAPResourceAccount for that.

svn path=/trunk/kdepim/; revision=331178
wilder-work
David Faure 22 years ago
parent 12d2e31ccc
commit 7ba6ed8798
  1. 17
      configuredialog.cpp
  2. 6
      kmail.kcfg
  3. 27
      kmailicalifaceimpl.cpp
  4. 2
      kmailicalifaceimpl.h

@ -4176,6 +4176,23 @@ void MiscPage::GroupwareTab::save() {
GlobalSettings::setTheIMAPResourceEnabled( enabled );
GlobalSettings::setTheIMAPResourceFolderLanguage( mLanguageCombo->currentItem() );
GlobalSettings::setTheIMAPResourceFolderParent( folder? folder->idString(): "" );
KMAccount* account = 0;
// Didn't find an easy way to find the account for a given folder...
// Fallback: iterate over accounts to select folderId if found (as an inbox folder)
for( KMAccount *a = kmkernel->acctMgr()->first();
a && !account; // stop when found
a = kmkernel->acctMgr()->next() ) {
if( a->folder() && a->folder()->child() ) {
KMFolderNode *node;
for (node = a->folder()->child()->first(); node; node = a->folder()->child()->next())
if ( node && static_cast<KMFolder*>(node) == folder ) {
account = a;
break;
}
}
}
GlobalSettings::setTheIMAPResourceAccount( account ? account->id() : 0 );
}

@ -139,6 +139,12 @@
"the IMAP inbox to be the parent.&lt;/p&gt;</whatsthis>
</entry>
<entry name="TheIMAPResourceAccount" type="Int">
<default></default>
<whatsthis>&lt;p&gt;This is the ID of the account holding the IMAP resource "
"folders.&lt;/p&gt;</whatsthis>
</entry>
<entry name="TheIMAPResourceFolderLanguage" type="Int">
<default>0</default>
<whatsthis>&lt;p&gt;If you want to set the folder names of the "

@ -45,6 +45,7 @@
#include "kmmsgdict.h"
#include "kmfolderimap.h"
#include "globalsettings.h"
#include "kmacctmgr.h"
#include <mimelib/enum.h>
@ -644,7 +645,17 @@ void KMailICalIfaceImpl::readConfig()
if( folderParent == 0 ) {
// Parent folder not found. It was probably deleted. The user will have to
// configure things again.
kdWarning(5006) << "Groupware folder " << parentName << " not found. Groupware functionality disabled" << endl;
kdDebug(5006) << "Groupware folder " << parentName << " not found. Groupware functionality disabled" << endl;
// Or maybe the inbox simply wasn't created on the first startup
KMAccount* account = kmkernel->acctMgr()->find( GlobalSettings::theIMAPResourceAccount() );
Q_ASSERT( account );
if ( account ) {
// just in case we were connected already
disconnect( account, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( slotCheckDone() ) );
connect( account, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( slotCheckDone() ) );
}
mUseResourceIMAP = false;
return;
} else {
@ -744,6 +755,20 @@ void KMailICalIfaceImpl::readConfig()
reloadFolderTree();
}
void KMailICalIfaceImpl::slotCheckDone()
{
QString parentName = GlobalSettings::theIMAPResourceFolderParent();
KMFolder* folderParent = kmkernel->findFolderById( parentName );
if ( folderParent ) // cool it exists now
{
KMAccount* account = kmkernel->acctMgr()->find( GlobalSettings::theIMAPResourceAccount() );
if ( account )
disconnect( account, SIGNAL( finishedCheck( bool, CheckStatus ) ),
this, SLOT( slotCheckDone() ) );
readConfig();
}
}
void KMailICalIfaceImpl::slotRefreshCalendar() { slotRefresh( "Calendar" ); }
void KMailICalIfaceImpl::slotRefreshTasks() { slotRefresh( "Task" ); }
void KMailICalIfaceImpl::slotRefreshJournals() { slotRefresh( "Journal" ); }

@ -141,6 +141,8 @@ private slots:
void slotRefreshContacts();
void slotRefreshNotes();
void slotCheckDone();
private:
/** Helper function for initFolders. Initializes a single folder. */
KMFolder* initFolder( KFolderTreeItem::Type itemType, const char* typeString );

Loading…
Cancel
Save