From cb2d07c56237489982186e8caa0ff1cc3dd623f4 Mon Sep 17 00:00:00 2001 From: Will Stephenson Date: Thu, 24 Jul 2008 13:59:16 +0000 Subject: [PATCH] Backport fix to IMAP resources to 4.1. I'll try and get this into the openSUSE KDE 4.1.0 rpms too. svn path=/branches/KDE/4.1/kdepim/; revision=837368 --- configuredialog.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/configuredialog.cpp b/configuredialog.cpp index 1bb62e19f..346f02263 100644 --- a/configuredialog.cpp +++ b/configuredialog.cpp @@ -5368,6 +5368,24 @@ void MiscPage::GroupwareTab::save() KMFolder* folder = mFolderCombo->folder(); if ( folder ) folderId = 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() ) { + for (QList::iterator it = a->folder()->child()->begin(); + it != a->folder()->child()->end(); + ++it) { + if ( *it && static_cast(*it) == folder ) { + account = a; + break; + } + } + } + } + GlobalSettings::self()->setTheIMAPResourceAccount( account ? account->id() : 0 ); } else { // Inbox folder of the selected account KMAccount* acct = mAccountCombo->currentAccount();