[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise/kdepim
From: Pradeepto Bhattacharya <pradeepto () kde ! org>
Date: 2008-11-12 13:09:16
Message-ID: 1226495356.001002.21847.nullmailer () svn ! kde ! org
[Download RAW message or body]
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.
M +1 -0 kmail/kmailicalIface.h
M +23 -1 kmail/kmailicalifaceimpl.cpp
M +4 -0 kmail/kmailicalifaceimpl.h
M +30 -6 korganizer/resourceview.cpp
--- branches/kdepim/enterprise/kdepim/kmail/kmailicalIface.h #883205:883206
@@ -131,6 +131,7 @@
* 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,
--- branches/kdepim/enterprise/kdepim/kmail/kmailicalifaceimpl.cpp #883205:883206
@@ -76,6 +76,8 @@
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 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 @@
subresourceAdded( contentsTypeStr, location, subresourceLabelForPresentation( \
folder ),
!folder->isReadOnly(), folderIsAlarmRelevant( folder ) );
-
}
}
@@ -1630,6 +1636,18 @@
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 @@
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();
}
--- branches/kdepim/enterprise/kdepim/kmail/kmailicalifaceimpl.h #883205:883206
@@ -223,6 +223,8 @@
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 @@
// 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 @@
QMap<Q_UINT32, bool> mTheUnGetMes;
QMap<QString, QString> mPendingUpdates;
QMap<QString, bool> mInTransit;
+ static QMap<QString, QString> *mSubResourceUINamesMap;
};
--- branches/kdepim/enterprise/kdepim/korganizer/resourceview.cpp #883205:883206
@@ -25,6 +25,7 @@
#include "resourceview.h"
+#include <dcopref.h>
#include <kcolordialog.h>
#include <kdialog.h>
#include <klistview.h>
@@ -37,6 +38,7 @@
#include <kresources/resource.h>
#include <kresources/configdialog.h>
#include <libkcal/calendarresources.h>
+#include <kconfig.h>
#include <qhbox.h>
#include <qheader.h>
@@ -518,19 +520,41 @@
void ResourceView::editResource()
{
+ bool ok = false;
ResourceItem *item = currentItem();
if (!item) return;
ResourceCalendar *resource = item->resource();
- KRES::ConfigDialog dlg( this, QString("calendar"), resource,
+ if ( item->isSubresource() ) {
+ if ( resource->type() == "imap" || resource->type() == "scalix" ) {
+ QString identifier = item->resourceIdentifier();
+ const QString newResourceName = KInputDialog::getText( i18n( "Rename \
Subresource" ), + i18n( "Please enter a new name for the subresource" \
), item->text(), + &ok, this );
+ if ( !ok )
+ return;
+
+ DCOPRef ref( "kmail", "KMailICalIface" );
+ DCOPReply reply = ref.call( "changeResourceUIName", identifier, \
newResourceName ); + if ( !reply.isValid() ) {
+ kdDebug() << "DCOP Call changeResourceUIName() failed " << endl;
+ }
+ } else {
+ KMessageBox::sorry( this,
+ i18n ("<qt>Cannot edit the subresource \
<b>%1</b>.</qt>").arg( item->resource()->name() ) ); + }
+ } else {
+ KRES::ConfigDialog dlg( this, QString("calendar"), resource,
"KRES::ConfigDialog" );
- if ( dlg.exec() ) {
- item->setText( 0, resource->resourceName() );
+ if ( dlg.exec() ) {
+ item->setText( 0, resource->resourceName() );
- mCalendar->resourceManager()->change( resource );
- }
- emitResourcesChanged();
+ mCalendar->resourceManager()->change( resource );
+ }
+ }
+ emitResourcesChanged();
+
}
void ResourceView::currentChanged( QListViewItem *item )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic