diff options
author | Max Brazhnikov <makc@FreeBSD.org> | 2009-01-22 23:44:38 +0000 |
---|---|---|
committer | Max Brazhnikov <makc@FreeBSD.org> | 2009-01-22 23:44:38 +0000 |
commit | 668bcf3de74f7efc6ce87d4026a9efadd986f0e9 (patch) | |
tree | 608c619fbe6809f376270f3e15fb86933695146a /deskutils | |
parent | 086a644dc2abb1b37a4ea1ed79bf25c9f4f6ff13 (diff) |
Notes
Diffstat (limited to 'deskutils')
-rw-r--r-- | deskutils/kdepim4/Makefile | 1 | ||||
-rw-r--r-- | deskutils/kdepim4/files/patch-kmail_accountmanager.cpp | 131 | ||||
-rw-r--r-- | deskutils/kdepim4/files/patch-kmail_accountmanager.h | 39 | ||||
-rw-r--r-- | deskutils/kdepim4/files/patch-kmail_kmkernel.cpp | 12 | ||||
-rw-r--r-- | deskutils/kdepim44/Makefile | 1 | ||||
-rw-r--r-- | deskutils/kdepim44/files/patch-kmail_accountmanager.cpp | 131 | ||||
-rw-r--r-- | deskutils/kdepim44/files/patch-kmail_accountmanager.h | 39 | ||||
-rw-r--r-- | deskutils/kdepim44/files/patch-kmail_kmkernel.cpp | 12 |
8 files changed, 366 insertions, 0 deletions
diff --git a/deskutils/kdepim4/Makefile b/deskutils/kdepim4/Makefile index 2a1264153347..f2338d0ccca3 100644 --- a/deskutils/kdepim4/Makefile +++ b/deskutils/kdepim4/Makefile @@ -6,6 +6,7 @@ PORTNAME= kdepim PORTVERSION= ${KDE4_VERSION} +PORTREVISION= 1 CATEGORIES= deskutils kde ipv6 MASTER_SITES= ${MASTER_SITE_KDE} MASTER_SITE_SUBDIR= stable/${PORTVERSION}/src diff --git a/deskutils/kdepim4/files/patch-kmail_accountmanager.cpp b/deskutils/kdepim4/files/patch-kmail_accountmanager.cpp new file mode 100644 index 000000000000..6d6c1e53e6bf --- /dev/null +++ b/deskutils/kdepim4/files/patch-kmail_accountmanager.cpp @@ -0,0 +1,131 @@ +--- ../kmail/accountmanager.cpp 2009/01/20 11:56:48 914004 ++++ ../kmail/accountmanager.cpp 2009/01/20 12:11:59 914005 +@@ -39,88 +39,68 @@ + qDeleteAll(mAcctList); + } + ++//----------------------------------------------------------------------------- ++QStringList AccountManager::accountGroups() const ++{ ++ return KMKernel::config()->groupList().filter( QRegExp( "Account \\d+" ) ); ++} + + //----------------------------------------------------------------------------- + void AccountManager::writeConfig( bool withSync ) + { + KConfig* config = KMKernel::config(); + +- // Delete all accounts for groups in the config file not having +- // Enabled=false flag (accountGroups) +- // and replace them with account groups existing in memory (mAcctList) +- uint accounts = 0; +- QStringList accountGroups = +- config->groupList().filter( QRegExp( "Account \\d+" ) ); +- AccountList::ConstIterator enabledAccountIt = mAcctList.constBegin(); +- for ( QStringList::ConstIterator it = accountGroups.constBegin() ;; ) { +- QString groupName; +- bool appendNewGroup = false; +- if ( it == accountGroups.constEnd() ) { +- if ( enabledAccountIt == mAcctList.constEnd() ) +- break; +- appendNewGroup = true; +- groupName.sprintf( "Account %d", accounts + 1 ); +- } +- else { +- groupName = *it; +- ++it; +- } ++ QStringList accountGroupsInConfig = accountGroups(); ++ QStringList accountGroupsToKeep; + +- KConfigGroup group(config, groupName); +- uint id = group.readEntry( "Id", 0 ); +- if ( mDisabledAccounts.contains( id ) ) +- accounts++; // do not modify disabled account - skip +- else { +- if ( appendNewGroup ) { +- (*enabledAccountIt)->writeConfig( group ); +- ++enabledAccountIt; +- accounts++; +- } +- else // no such account on the list - disabled / enabled +- config->deleteGroup( groupName ); +- } ++ // Write all account config groups to the config file and remember ++ // the config group names ++ foreach( KMAccount *account, mAcctList ) { ++ uint accountId = account->id(); ++ QString groupName = QString( "Account %1" ).arg( accountId ); ++ accountGroupsToKeep += groupName; ++ KConfigGroup group( config, groupName ); ++ account->writeConfig( group ); + } + +- KConfigGroup group(config, "General"); +- group.writeEntry("accounts", accounts); ++ // Now, delete all config groups with "Account" in them which don't ++ // belong to the accounts we just saved (these are deleted accounts, then ++ // NOTE: This has to be done _after_ writing out the accounts, otherwise ++ // there is the risk of data loss, see bug 169166 ++ foreach( const QString &groupName, accountGroupsInConfig ) { ++ if ( !accountGroupsToKeep.contains( groupName ) ) ++ config->deleteGroup( groupName ); ++ } + +- if (withSync) config->sync(); ++ if ( withSync ) ++ config->sync(); + } + + + //----------------------------------------------------------------------------- + void AccountManager::readConfig(void) + { +- KConfig* config = KMKernel::config(); +- KMAccount* acct; +- QString acctName; +- QString groupName; +- int i, num; +- ++ // Delete all in-memory accounts + for ( AccountList::Iterator it( mAcctList.begin() ), end( mAcctList.end() ); it != end; ++it ) + delete *it; + mAcctList.clear(); + +- KConfigGroup general(config, "General"); +- num = general.readEntry( "accounts", 0 ); +- +- for (i=1; i<=num; i++) +- { +- groupName.sprintf("Account %d", i); +- KConfigGroup group(config, groupName); ++ // Now loop over all account groups and load the accounts in them ++ KConfig* config = KMKernel::config(); ++ QStringList accountGroupNames = accountGroups(); ++ int accountNum = 1; ++ foreach( const QString &accountGroupName, accountGroupNames ) { ++ KConfigGroup group( config, accountGroupName ); + uint id = group.readEntry( "Id", 0 ); +- if ( !group.readEntry("Enabled", true) ) { +- mDisabledAccounts += id; +- continue; +- } +- + KAccount::Type acctType = KAccount::typeForName( group.readEntry( "Type" ) ); +- acctName = group.readEntry("Name"); +- if (acctName.isEmpty()) acctName = i18n("Account %1", i); +- acct = create(acctType, acctName, id); +- if (!acct) continue; +- add(acct); +- acct->readConfig(group); ++ QString accountName = group.readEntry( "Name" ); ++ if ( accountName.isEmpty() ) ++ accountName = i18n( "Account %1", accountNum++ ); ++ KMAccount *account = create( acctType, accountName, id ); ++ if ( !account ) ++ continue; ++ add( account ); ++ account->readConfig( group ); + } + } + diff --git a/deskutils/kdepim4/files/patch-kmail_accountmanager.h b/deskutils/kdepim4/files/patch-kmail_accountmanager.h new file mode 100644 index 000000000000..af0d5132723b --- /dev/null +++ b/deskutils/kdepim4/files/patch-kmail_accountmanager.h @@ -0,0 +1,39 @@ +--- ../kmail/accountmanager.h 2009/01/20 11:56:48 914004 ++++ ../kmail/accountmanager.h 2009/01/20 12:11:59 914005 +@@ -80,13 +80,6 @@ + KMAccount *find( const uint id ) const; + + /** +- @return true if account with ID @p id is enabled. +- Accounts can be disabled by setting "enabled" flag to false +- in "Account #" groups of kmailrc. +- */ +- bool isEnabled( const uint id ) const { return !mDisabledAccounts.contains(id); } +- +- /** + Physically remove account. Also deletes the given account object ! + Returns false and does nothing if the account cannot be removed. + */ +@@ -163,6 +156,12 @@ + */ + uint createId(); + ++ /** ++ * Return a list of config group names of all config groups that store ++ * receiving accounts. ++ */ ++ QStringList accountGroups() const; ++ + AccountList mAcctList; + AccountList::Iterator mPtrListInterfaceProxyIterator; + AccountList mAcctChecking; +@@ -176,9 +175,6 @@ + + // if a summary should be displayed + bool mDisplaySummary; +- +- // IDs of disabled accounts, used in AccountManager::writeConfig() +- QSet<uint> mDisabledAccounts; + }; + + } // namespace KMail diff --git a/deskutils/kdepim4/files/patch-kmail_kmkernel.cpp b/deskutils/kdepim4/files/patch-kmail_kmkernel.cpp new file mode 100644 index 000000000000..e561b7a9a5f9 --- /dev/null +++ b/deskutils/kdepim4/files/patch-kmail_kmkernel.cpp @@ -0,0 +1,12 @@ +--- ../kmail/kmkernel.cpp 2009/01/20 11:56:48 914004 ++++ ../kmail/kmkernel.cpp 2009/01/20 12:11:59 914005 +@@ -1480,8 +1480,7 @@ + { + KMFolderNode *node = *it; + if (node->isDir() || ((acct = the_acctMgr->find(node->id())) +- && ( acct->type() == KAccount::Imap )) +- || !the_acctMgr->isEnabled( node->id() )) ++ && ( acct->type() == KAccount::Imap ))) + { + ++it; + } else { diff --git a/deskutils/kdepim44/Makefile b/deskutils/kdepim44/Makefile index 2a1264153347..f2338d0ccca3 100644 --- a/deskutils/kdepim44/Makefile +++ b/deskutils/kdepim44/Makefile @@ -6,6 +6,7 @@ PORTNAME= kdepim PORTVERSION= ${KDE4_VERSION} +PORTREVISION= 1 CATEGORIES= deskutils kde ipv6 MASTER_SITES= ${MASTER_SITE_KDE} MASTER_SITE_SUBDIR= stable/${PORTVERSION}/src diff --git a/deskutils/kdepim44/files/patch-kmail_accountmanager.cpp b/deskutils/kdepim44/files/patch-kmail_accountmanager.cpp new file mode 100644 index 000000000000..6d6c1e53e6bf --- /dev/null +++ b/deskutils/kdepim44/files/patch-kmail_accountmanager.cpp @@ -0,0 +1,131 @@ +--- ../kmail/accountmanager.cpp 2009/01/20 11:56:48 914004 ++++ ../kmail/accountmanager.cpp 2009/01/20 12:11:59 914005 +@@ -39,88 +39,68 @@ + qDeleteAll(mAcctList); + } + ++//----------------------------------------------------------------------------- ++QStringList AccountManager::accountGroups() const ++{ ++ return KMKernel::config()->groupList().filter( QRegExp( "Account \\d+" ) ); ++} + + //----------------------------------------------------------------------------- + void AccountManager::writeConfig( bool withSync ) + { + KConfig* config = KMKernel::config(); + +- // Delete all accounts for groups in the config file not having +- // Enabled=false flag (accountGroups) +- // and replace them with account groups existing in memory (mAcctList) +- uint accounts = 0; +- QStringList accountGroups = +- config->groupList().filter( QRegExp( "Account \\d+" ) ); +- AccountList::ConstIterator enabledAccountIt = mAcctList.constBegin(); +- for ( QStringList::ConstIterator it = accountGroups.constBegin() ;; ) { +- QString groupName; +- bool appendNewGroup = false; +- if ( it == accountGroups.constEnd() ) { +- if ( enabledAccountIt == mAcctList.constEnd() ) +- break; +- appendNewGroup = true; +- groupName.sprintf( "Account %d", accounts + 1 ); +- } +- else { +- groupName = *it; +- ++it; +- } ++ QStringList accountGroupsInConfig = accountGroups(); ++ QStringList accountGroupsToKeep; + +- KConfigGroup group(config, groupName); +- uint id = group.readEntry( "Id", 0 ); +- if ( mDisabledAccounts.contains( id ) ) +- accounts++; // do not modify disabled account - skip +- else { +- if ( appendNewGroup ) { +- (*enabledAccountIt)->writeConfig( group ); +- ++enabledAccountIt; +- accounts++; +- } +- else // no such account on the list - disabled / enabled +- config->deleteGroup( groupName ); +- } ++ // Write all account config groups to the config file and remember ++ // the config group names ++ foreach( KMAccount *account, mAcctList ) { ++ uint accountId = account->id(); ++ QString groupName = QString( "Account %1" ).arg( accountId ); ++ accountGroupsToKeep += groupName; ++ KConfigGroup group( config, groupName ); ++ account->writeConfig( group ); + } + +- KConfigGroup group(config, "General"); +- group.writeEntry("accounts", accounts); ++ // Now, delete all config groups with "Account" in them which don't ++ // belong to the accounts we just saved (these are deleted accounts, then ++ // NOTE: This has to be done _after_ writing out the accounts, otherwise ++ // there is the risk of data loss, see bug 169166 ++ foreach( const QString &groupName, accountGroupsInConfig ) { ++ if ( !accountGroupsToKeep.contains( groupName ) ) ++ config->deleteGroup( groupName ); ++ } + +- if (withSync) config->sync(); ++ if ( withSync ) ++ config->sync(); + } + + + //----------------------------------------------------------------------------- + void AccountManager::readConfig(void) + { +- KConfig* config = KMKernel::config(); +- KMAccount* acct; +- QString acctName; +- QString groupName; +- int i, num; +- ++ // Delete all in-memory accounts + for ( AccountList::Iterator it( mAcctList.begin() ), end( mAcctList.end() ); it != end; ++it ) + delete *it; + mAcctList.clear(); + +- KConfigGroup general(config, "General"); +- num = general.readEntry( "accounts", 0 ); +- +- for (i=1; i<=num; i++) +- { +- groupName.sprintf("Account %d", i); +- KConfigGroup group(config, groupName); ++ // Now loop over all account groups and load the accounts in them ++ KConfig* config = KMKernel::config(); ++ QStringList accountGroupNames = accountGroups(); ++ int accountNum = 1; ++ foreach( const QString &accountGroupName, accountGroupNames ) { ++ KConfigGroup group( config, accountGroupName ); + uint id = group.readEntry( "Id", 0 ); +- if ( !group.readEntry("Enabled", true) ) { +- mDisabledAccounts += id; +- continue; +- } +- + KAccount::Type acctType = KAccount::typeForName( group.readEntry( "Type" ) ); +- acctName = group.readEntry("Name"); +- if (acctName.isEmpty()) acctName = i18n("Account %1", i); +- acct = create(acctType, acctName, id); +- if (!acct) continue; +- add(acct); +- acct->readConfig(group); ++ QString accountName = group.readEntry( "Name" ); ++ if ( accountName.isEmpty() ) ++ accountName = i18n( "Account %1", accountNum++ ); ++ KMAccount *account = create( acctType, accountName, id ); ++ if ( !account ) ++ continue; ++ add( account ); ++ account->readConfig( group ); + } + } + diff --git a/deskutils/kdepim44/files/patch-kmail_accountmanager.h b/deskutils/kdepim44/files/patch-kmail_accountmanager.h new file mode 100644 index 000000000000..af0d5132723b --- /dev/null +++ b/deskutils/kdepim44/files/patch-kmail_accountmanager.h @@ -0,0 +1,39 @@ +--- ../kmail/accountmanager.h 2009/01/20 11:56:48 914004 ++++ ../kmail/accountmanager.h 2009/01/20 12:11:59 914005 +@@ -80,13 +80,6 @@ + KMAccount *find( const uint id ) const; + + /** +- @return true if account with ID @p id is enabled. +- Accounts can be disabled by setting "enabled" flag to false +- in "Account #" groups of kmailrc. +- */ +- bool isEnabled( const uint id ) const { return !mDisabledAccounts.contains(id); } +- +- /** + Physically remove account. Also deletes the given account object ! + Returns false and does nothing if the account cannot be removed. + */ +@@ -163,6 +156,12 @@ + */ + uint createId(); + ++ /** ++ * Return a list of config group names of all config groups that store ++ * receiving accounts. ++ */ ++ QStringList accountGroups() const; ++ + AccountList mAcctList; + AccountList::Iterator mPtrListInterfaceProxyIterator; + AccountList mAcctChecking; +@@ -176,9 +175,6 @@ + + // if a summary should be displayed + bool mDisplaySummary; +- +- // IDs of disabled accounts, used in AccountManager::writeConfig() +- QSet<uint> mDisabledAccounts; + }; + + } // namespace KMail diff --git a/deskutils/kdepim44/files/patch-kmail_kmkernel.cpp b/deskutils/kdepim44/files/patch-kmail_kmkernel.cpp new file mode 100644 index 000000000000..e561b7a9a5f9 --- /dev/null +++ b/deskutils/kdepim44/files/patch-kmail_kmkernel.cpp @@ -0,0 +1,12 @@ +--- ../kmail/kmkernel.cpp 2009/01/20 11:56:48 914004 ++++ ../kmail/kmkernel.cpp 2009/01/20 12:11:59 914005 +@@ -1480,8 +1480,7 @@ + { + KMFolderNode *node = *it; + if (node->isDir() || ((acct = the_acctMgr->find(node->id())) +- && ( acct->type() == KAccount::Imap )) +- || !the_acctMgr->isEnabled( node->id() )) ++ && ( acct->type() == KAccount::Imap ))) + { + ++it; + } else { |