From f994cffe8b45ba4d48d8ce8117e976ce72d7af61 Mon Sep 17 00:00:00 2001 From: Pradeepto Bhattacharya Date: Fri, 21 Nov 2008 06:50:31 +0000 Subject: [PATCH] -- Forward port of MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN commit 883206 by pradeepto:  -- Fixing wrong default name when renaming IMAP ressources. Only enabled for kolab or scalix resources. Making a dcop call from korg to kmail to change the subresource name so that the change is reflected across both the apps. And also using kmailrc for persistence.    kolab/Issue 2908. ( adapted to dbus from dcop ) svn path=/branches/kdepim/enterprise4/kdepim/; revision=887109 --- kmailicalifaceimpl.cpp | 22 ++++++++++++++++++++++ kmailicalifaceimpl.h | 4 +++- org.kde.kmail.groupware.xml | 4 ++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/kmailicalifaceimpl.cpp b/kmailicalifaceimpl.cpp index fae89e5af..a40d361d8 100644 --- a/kmailicalifaceimpl.cpp +++ b/kmailicalifaceimpl.cpp @@ -76,6 +76,8 @@ using KMail::AccountManager; using namespace KMail; +QMap *KMailICalIfaceImpl::mSubResourceUINamesMap = new QMap; + // Local helper methods static void vPartMicroParser( const QString& str, QString& s ); static void reloadFolderTree(); @@ -665,6 +667,10 @@ static int dimapAccountCount() static QString subresourceLabelForPresentation( const KMFolder * folder ) { + if( KMailICalIfaceImpl::getResourceMap()->contains( folder->location() ) ) { + return folder->label(); + } + QString label = folder->prettyUrl(); QStringList parts = label.split( QChar('/') ); // In the common special case of some other user's folder shared with us @@ -1636,6 +1642,18 @@ KMFolder* KMailICalIfaceImpl::findResourceFolder( const QString& resource ) return 0; } +void KMailICalIfaceImpl::changeResourceUIName( const QString &folderPath, const QString &newName ) +{ + kDebug() << "Folder path " << folderPath << endl; + KMFolder *f = findResourceFolder( folderPath ); + if ( f ) { + KMailICalIfaceImpl::getResourceMap()->insert( folderPath, newName ); + kmkernel->folderMgr()->renameFolder( f, newName ); + KConfigGroup configGroup( kmkernel->config(), "Resource UINames" ); + configGroup.writeEntry( folderPath, newName ); + } +} + /**************************** * The config stuff */ @@ -1935,6 +1953,10 @@ void KMailICalIfaceImpl::readConfig() mNotes->location(), mNotes->label(), true, false ); } + KConfig *config = kmkernel->config(); + KConfigGroup cf = config->group("Resource UINames"); + *KMailICalIfaceImpl::mSubResourceUINamesMap = cf.entryMap(); + reloadFolderTree(); if ( justEnabled ) { diff --git a/kmailicalifaceimpl.h b/kmailicalifaceimpl.h index c16a2288b..02c145cb7 100644 --- a/kmailicalifaceimpl.h +++ b/kmailicalifaceimpl.h @@ -236,6 +236,7 @@ public: // See CachedImapJob::slotPutMessageResult bool isResourceQuiet() const; void setResourceQuiet(bool q); + static QMap* getResourceMap() { return mSubResourceUINamesMap; } public slots: /* (Re-)Read configuration file */ @@ -249,6 +250,7 @@ public slots: // Called when a folder is made readonly or readwrite, or renamed, // or any other similar change that affects the resources void slotFolderPropertiesChanged( KMFolder* folder ); + void changeResourceUIName( const QString &folderPath, const QString &newName ); private slots: void slotRefreshFolder( KMFolder* ); @@ -370,7 +372,7 @@ private: QMap mTheUnGetMes; QMap mPendingUpdates; QMap mInTransit; - + static QMap *mSubResourceUINamesMap; }; #endif // KMAILICALIFACEIMPL_H diff --git a/org.kde.kmail.groupware.xml b/org.kde.kmail.groupware.xml index e18d1c791..05344cfcf 100644 --- a/org.kde.kmail.groupware.xml +++ b/org.kde.kmail.groupware.xml @@ -110,5 +110,9 @@ + + + +