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 @@ + + + +