From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kresources/lib/addressbookadaptor.cpp | 16 +++++++---- kresources/lib/folderselectdialog.cpp | 7 ++++- kresources/lib/folderselectdialog.h | 1 + kresources/lib/kcal_resourcegroupwarebase.cpp | 40 +++++++++++++-------------- 4 files changed, 37 insertions(+), 27 deletions(-) (limited to 'kresources/lib') diff --git a/kresources/lib/addressbookadaptor.cpp b/kresources/lib/addressbookadaptor.cpp index 900772e56..80da39421 100644 --- a/kresources/lib/addressbookadaptor.cpp +++ b/kresources/lib/addressbookadaptor.cpp @@ -32,9 +32,9 @@ using namespace KABC; -AddressBookUploadItem::AddressBookUploadItem( - KPIM::GroupwareDataAdaptor *adaptor, - KABC::Addressee addr, +AddressBookUploadItem::AddressBookUploadItem( + KPIM::GroupwareDataAdaptor *adaptor, + KABC::Addressee addr, GroupwareUploadItem::UploadType type ) : GroupwareUploadItem( type ) { @@ -42,7 +42,11 @@ AddressBookUploadItem::AddressBookUploadItem( setUrl( addr.custom( adaptor->identifier(), "storagelocation" ) ); setUid( addr.uid() ); KABC::VCardConverter vcard; +#if defined(KABC_VCARD_ENCODING_FIX) + setData( vcard.createVCardRaw( addr ) ); +#else setData( vcard.createVCard( addr ) ); +#endif } @@ -105,12 +109,12 @@ void AddressBookAdaptor::addressbookItemDownloaded( KABC::Addressee addr, deleteItem( newLocalId ); TQString localId = idMapper()->localId( remoteId.path() ); if ( !localId.isEmpty() ) deleteItem( localId ); - + // add the new item addr.insertCustom( identifier(), "storagelocation", storagelocation ); if ( !localId.isEmpty() ) addr.setUid( localId ); addItem( addr ); - + // update the fingerprint and the ids in the idMapper idMapper()->removeRemoteId( localId ); idMapper()->removeRemoteId( newLocalId ); @@ -123,7 +127,7 @@ void AddressBookAdaptor::clearChange( const TQString &uid ) mResource->clearChange( uid ); } -KPIM::GroupwareUploadItem *AddressBookAdaptor::newUploadItem( +KPIM::GroupwareUploadItem *AddressBookAdaptor::newUploadItem( KABC::Addressee addr, KPIM::GroupwareUploadItem::UploadType type ) { return new AddressBookUploadItem( this, addr, type ); diff --git a/kresources/lib/folderselectdialog.cpp b/kresources/lib/folderselectdialog.cpp index 0942f8223..c4d343598 100644 --- a/kresources/lib/folderselectdialog.cpp +++ b/kresources/lib/folderselectdialog.cpp @@ -39,7 +39,7 @@ using namespace KPIM; FolderSelectDialog::FolderSelectDialog( const TQString& caption, const TQString& label, const TQStringList& list ) - : KDialogBase(0, 0, true, caption, Ok, Ok, true) + : KDialogBase(0, 0, true, caption, Ok|Cancel, Ok, true) { TQFrame* frame = makeMainWidget(); TQVBoxLayout* layout = new TQVBoxLayout( frame, 0, spacingHint() ); @@ -81,3 +81,8 @@ void FolderSelectDialog::closeEvent(TQCloseEvent *event) { event->ignore(); } + +void FolderSelectDialog::reject() +{ +} + diff --git a/kresources/lib/folderselectdialog.h b/kresources/lib/folderselectdialog.h index a7879f9a0..e5901239a 100644 --- a/kresources/lib/folderselectdialog.h +++ b/kresources/lib/folderselectdialog.h @@ -49,6 +49,7 @@ public: protected: virtual void closeEvent(TQCloseEvent *event); + void reject(); private: KListBox* mListBox; }; diff --git a/kresources/lib/kcal_resourcegroupwarebase.cpp b/kresources/lib/kcal_resourcegroupwarebase.cpp index 7499b224d..823943c2b 100644 --- a/kresources/lib/kcal_resourcegroupwarebase.cpp +++ b/kresources/lib/kcal_resourcegroupwarebase.cpp @@ -39,13 +39,13 @@ using namespace KCal; ResourceGroupwareBase::ResourceGroupwareBase() - : ResourceCached( 0 ), mPrefs(0), mFolderLister(0), + : ResourceCached( 0 ), mPrefs(0), mFolderLister(0), mLock( true ), mAdaptor(0), mDownloadJob(0), mUploadJob(0) { } ResourceGroupwareBase::ResourceGroupwareBase( const KConfig *config ) - : ResourceCached( config ), mPrefs(0), mFolderLister(0), + : ResourceCached( config ), mPrefs(0), mFolderLister(0), mLock( true ), mAdaptor(0), mDownloadJob(0), mUploadJob(0) { if ( config ) readConfig( config ); @@ -69,7 +69,7 @@ bool ResourceGroupwareBase::addEvent( Event *event ) { if ( adaptor() && ( adaptor()->supports( KPIM::FolderLister::Event ) || adaptor()->supports( KPIM::FolderLister::All ) ) ) { - return ResourceCached::addEvent( event ); + return ResourceCached::addEvent( event, TQString() ); } else return false; } @@ -77,7 +77,7 @@ bool ResourceGroupwareBase::addTodo( Todo *todo ) { if ( adaptor() && ( adaptor()->supports( KPIM::FolderLister::Todo ) || adaptor()->supports( KPIM::FolderLister::All ) ) ) { - return ResourceCached::addTodo( todo ); + return ResourceCached::addTodo( todo, TQString() ); } else return false; } @@ -85,30 +85,30 @@ bool ResourceGroupwareBase::addJournal( Journal *journal ) { if ( adaptor() && ( adaptor()->supports( KPIM::FolderLister::Journal ) || adaptor()->supports( KPIM::FolderLister::All ) ) ) { - return ResourceCached::addJournal( journal ); + return ResourceCached::addJournal( journal, TQString() ); } else return false; } -KPIM::GroupwareDownloadJob *ResourceGroupwareBase::createDownloadJob( +KPIM::GroupwareDownloadJob *ResourceGroupwareBase::createDownloadJob( CalendarAdaptor *adaptor ) { return new KPIM::GroupwareDownloadJob( adaptor ); } -KPIM::GroupwareUploadJob *ResourceGroupwareBase::createUploadJob( +KPIM::GroupwareUploadJob *ResourceGroupwareBase::createUploadJob( CalendarAdaptor *adaptor ) { return new KPIM::GroupwareUploadJob( adaptor ); } -void ResourceGroupwareBase::setPrefs( KPIM::GroupwarePrefsBase *newprefs ) +void ResourceGroupwareBase::setPrefs( KPIM::GroupwarePrefsBase *newprefs ) { if ( !newprefs ) return; if ( mPrefs ) delete mPrefs; mPrefs = newprefs; mPrefs->addGroupPrefix( identifier() ); - + mPrefs->readConfig(); if ( mFolderLister ) mFolderLister->readConfig( mPrefs ); } @@ -236,7 +236,7 @@ void ResourceGroupwareBase::doClose() ResourceCached::doClose(); if ( mDownloadJob ) mDownloadJob->kill(); - if ( adaptor() && + if ( adaptor() && adaptor()->flags() & KPIM::GroupwareDataAdaptor::GWResNeedsLogoff ) { KIO::Job *logoffJob = adaptor()->createLogoffJob( prefs()->url(), prefs()->user(), prefs()->password() ); connect( logoffJob, TQT_SIGNAL( result( KIO::Job * ) ), @@ -267,7 +267,7 @@ bool ResourceGroupwareBase::doLoad() kdWarning() << "Download still in progress" << endl; return false; } - + mCalendar.close(); clearChanges(); disableChangeNotification(); @@ -292,7 +292,7 @@ void ResourceGroupwareBase::slotDownloadJobResult( KPIM::GroupwareJob *job ) mIsShowingError = false; } else { kdDebug(5800) << "Successfully downloaded data" << endl; - + clearChanges(); saveCache(); enableChangeNotification(); @@ -318,9 +318,9 @@ bool ResourceGroupwareBase::doSave() // to upload only certain changes and discard the rest. This is // particularly important for resources like the blogging resource, // where uploading would mean a republication of the blog, not only - // a modifications. + // a modifications. if ( !confirmSave() ) return false; - + mUploadJob = createUploadJob( adaptor() ); connect( mUploadJob, TQT_SIGNAL( result( KPIM::GroupwareJob * ) ), TQT_SLOT( slotUploadJobResult( KPIM::GroupwareJob * ) ) ); @@ -331,20 +331,20 @@ bool ResourceGroupwareBase::doSave() inc = addedIncidences(); for( it = inc.begin(); it != inc.end(); ++it ) { - addedItems.append( adaptor()->newUploadItem( *it, + addedItems.append( adaptor()->newUploadItem( *it, KPIM::GroupwareUploadItem::Added ) ); } // TODO: Check if the item has changed on the server... - // In particular, check if the version we based our change on is still current + // In particular, check if the version we based our change on is still current // on the server inc = changedIncidences(); for( it = inc.begin(); it != inc.end(); ++it ) { - changedItems.append( adaptor()->newUploadItem( *it, + changedItems.append( adaptor()->newUploadItem( *it, KPIM::GroupwareUploadItem::Changed ) ); } inc = deletedIncidences(); for( it = inc.begin(); it != inc.end(); ++it ) { - deletedItems.append( adaptor()->newUploadItem( *it, + deletedItems.append( adaptor()->newUploadItem( *it, KPIM::GroupwareUploadItem::Deleted ) ); } @@ -368,10 +368,10 @@ void ResourceGroupwareBase::slotUploadJobResult( KPIM::GroupwareJob *job ) mIsShowingError = false; } else { kdDebug(5800) << "Successfully uploaded data" << endl; - /* + /* * After the put the server might have expanded recurring events and will * also change the uids of the uploaded events. Remove them from the cache - * and get the fresh delta and download. + * and get the fresh delta and download. */ if ( !mDownloadJob ) { -- cgit v1.2.1