-- 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.


svn path=/branches/kdepim/enterprise/kdepim/; revision=883206
wilder-work
Pradeepto Bhattacharya 18 years ago
parent ebcfeaecbe
commit 62c8affaaa
  1. 1
      kmailicalIface.h
  2. 24
      kmailicalifaceimpl.cpp
  3. 4
      kmailicalifaceimpl.h

@ -131,6 +131,7 @@ k_dcop:
* Causes all resource folders of the given type to be synced with the server.
*/
virtual bool triggerSync( const QString & ) = 0;
virtual void changeResourceUIName( const QString &folderPath, const QString &newName ) = 0;
k_dcop_signals:
void incidenceAdded( const QString& type, const QString& folder,

@ -76,6 +76,8 @@ using KMail::AccountManager;
using namespace KMail;
QMap<QString, QString> *KMailICalIfaceImpl::mSubResourceUINamesMap = new QMap<QString, QString>;
// Local helper methods
static void vPartMicroParser( const QString& str, QString& s );
static void reloadFolderTree();
@ -655,8 +657,13 @@ static int dimapAccountCount()
static QString subresourceLabelForPresentation( const KMFolder * folder )
{
if( KMailICalIfaceImpl::getResourceMap()->contains( folder->location() ) ) {
return folder->label();
}
QString label = folder->prettyURL();
QStringList parts = QStringList::split( QString::fromLatin1("/"), label );
// In the common special case of some other user's folder shared with us
// the url looks like "Server Name/user/$USERNAME/Folder/Name". Make
// those a bit nicer.
@ -1579,7 +1586,6 @@ void KMailICalIfaceImpl::slotFolderPropertiesChanged( KMFolder* folder )
subresourceAdded( contentsTypeStr, location, subresourceLabelForPresentation( folder ),
!folder->isReadOnly(), folderIsAlarmRelevant( folder ) );
}
}
@ -1630,6 +1636,18 @@ KMFolder* KMailICalIfaceImpl::findResourceFolder( const QString& resource )
return 0;
}
void KMailICalIfaceImpl::changeResourceUIName( const QString &folderPath, const QString &newName )
{
kdDebug() << "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
*/
@ -1903,6 +1921,10 @@ void KMailICalIfaceImpl::readConfig()
subresourceAdded( folderContentsType( KMail::ContentsTypeNote ), mNotes->location(), mNotes->label(), true, false );
}
KConfig *config = kmkernel->config();
config->setGroup("Resource UINames");
*KMailICalIfaceImpl::mSubResourceUINamesMap = config->entryMap( "Resource UINames" );
reloadFolderTree();
}

@ -223,6 +223,8 @@ public:
bool isResourceQuiet() const;
void setResourceQuiet(bool q);
static QMap<QString, QString>* getResourceMap() { return mSubResourceUINamesMap; }
public slots:
/* (Re-)Read configuration file */
void readConfig();
@ -235,6 +237,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* );
@ -344,6 +347,7 @@ private:
QMap<Q_UINT32, bool> mTheUnGetMes;
QMap<QString, QString> mPendingUpdates;
QMap<QString, bool> mInTransit;
static QMap<QString, QString> *mSubResourceUINamesMap;
};

Loading…
Cancel
Save