summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp2
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--korganizer/calendarview.cpp19
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/koprefs.cpp10
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--libkdepim/ksyncmanager.cpp51
-rw-r--r--libkdepim/ksyncmanager.h8
-rw-r--r--libkdepim/ksyncprefsdialog.cpp6
9 files changed, 80 insertions, 21 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 033e537..2dea619 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -3306,5 +3306,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
3306 3306
3307//this is a overwritten callbackmethods from the syncinterface 3307//this is a overwritten callbackmethods from the syncinterface
3308bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 3308bool KABCore::sync(KSyncManager* manager, QString filename, int mode,QString resource)
3309{ 3309{
3310 3310
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 42b7709..c4a0b3b 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -513,5 +513,5 @@ class KABCore : public QWidget, public KSyncInterface
513 513
514 //this are the overwritten callbackmethods from the syncinterface 514 //this are the overwritten callbackmethods from the syncinterface
515 virtual bool sync(KSyncManager* manager, QString filename, int mode); 515 virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource);
516 virtual bool syncExternal(KSyncManager* manager, QString resource); 516 virtual bool syncExternal(KSyncManager* manager, QString resource);
517 virtual void removeSyncInfo( QString syncProfile); 517 virtual void removeSyncInfo( QString syncProfile);
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 31e103d..8965d3b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1979,5 +1979,4 @@ void CalendarView::syncExternal( int mode )
1979{ 1979{
1980 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1980 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1981
1982 qApp->processEvents(); 1981 qApp->processEvents();
1983 CalendarLocal* calendar = new CalendarLocal(); 1982 CalendarLocal* calendar = new CalendarLocal();
@@ -5035,5 +5034,5 @@ void CalendarView::keyPressEvent ( QKeyEvent *e)
5035 5034
5036 5035
5037bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 5036bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource)
5038{ 5037{
5039 5038
@@ -5045,5 +5044,19 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
5045 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 5044 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
5046 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 5045 mCurrentSyncName = mSyncManager->getCurrentSyncName();
5047 return syncCalendar( filename, mode ); 5046 if ( !resource.isEmpty() ) {
5047 int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource );
5048 qDebug( "KO: Sync request for resource: %s", resource.latin1() );
5049
5050 if ( !exclusiveSyncResource ) {
5051 qDebug( "KO: Requested sync resource not found: %s", resource.latin1() );
5052 return false;
5053 }
5054 mCalendar->setDefaultCalendar( exclusiveSyncResource );
5055 mCalendar->setDefaultCalendarEnabledOnly();
5056 }
5057 bool result = syncCalendar( filename, mode );
5058 if ( !resource.isEmpty() )
5059 restoreCalendarSettings();
5060 return result;
5048} 5061}
5049bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 5062bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 80f7ed4..f85b6a3 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -519,5 +519,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
519 // returns KMsgBox::yesNoCancel() 519 // returns KMsgBox::yesNoCancel()
520 int msgCalModified(); 520 int msgCalModified();
521 virtual bool sync(KSyncManager* manager, QString filename, int mode); 521 virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource);
522 522
523 virtual bool syncExternal(KSyncManager* manager, QString resource); 523 virtual bool syncExternal(KSyncManager* manager, QString resource);
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1b0e5f4..31ef338 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -529,4 +529,14 @@ int KOPrefs::getCalendarID( const QString & name )
529 return 1; 529 return 1;
530} 530}
531int KOPrefs::getFuzzyCalendarID( const QString & name )
532{
533 KopiCalendarFile * kkf = mCalendars.first();
534 while ( kkf ) {
535 if ( name.lower() == kkf->mName.lower())
536 return kkf->mCalNumber;
537 kkf = mCalendars.next();
538 }
539 return 0;
540}
531QString KOPrefs::calName( int calNum) const 541QString KOPrefs::calName( int calNum) const
532{ 542{
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index bac8010..70da096 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -106,4 +106,5 @@ class KOPrefs : public KPimPrefs
106 QString calName( int ) const; 106 QString calName( int ) const;
107 int getCalendarID( const QString & name ); 107 int getCalendarID( const QString & name );
108 int getFuzzyCalendarID( const QString & name );
108 protected: 109 protected:
109 void setTimeZoneIdDefault(); 110 void setTimeZoneIdDefault();
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index d71264f..a64eb34 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -197,4 +197,5 @@ void KSyncManager::slotSyncMenu( int action )
197{ 197{
198 qDebug("KSM::syncaction %d ", action); 198 qDebug("KSM::syncaction %d ", action);
199 mCurrentResourceLocal = "";
199 if ( action == 5000 ) 200 if ( action == 5000 )
200 return; 201 return;
@@ -314,5 +315,6 @@ void KSyncManager::slotSyncMenu( int action )
314 mPhoneModel = temp->getPhoneModel( ); 315 mPhoneModel = temp->getPhoneModel( );
315 syncPhone(); 316 syncPhone();
316 } else if ( temp->getIsPiSync() ) { 317 } else if ( temp->getIsPiSync()|| temp->getIsPiSyncSpec()) {
318 mSpecificResources.clear();
317 if ( mTargetApp == KAPI ) { 319 if ( mTargetApp == KAPI ) {
318 mPassWordPiSync = temp->getRemotePwAB(); 320 mPassWordPiSync = temp->getRemotePwAB();
@@ -320,4 +322,6 @@ void KSyncManager::slotSyncMenu( int action )
320 mActiveSyncIP = temp->getRemoteIPAB(); 322 mActiveSyncIP = temp->getRemoteIPAB();
321 } else if ( mTargetApp == KOPI ) { 323 } else if ( mTargetApp == KOPI ) {
324 if ( temp->getIsPiSyncSpec() )
325 mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() );
322 mPassWordPiSync = temp->getRemotePw(); 326 mPassWordPiSync = temp->getRemotePw();
323 mActiveSyncPort = temp->getRemotePort(); 327 mActiveSyncPort = temp->getRemotePort();
@@ -504,5 +508,5 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
504 if ( result == 0 ) { 508 if ( result == 0 ) {
505 //qDebug("Now sycing ... "); 509 //qDebug("Now sycing ... ");
506 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 510 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ,mCurrentResourceLocal ) )
507 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 511 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
508 else 512 else
@@ -528,4 +532,5 @@ void KSyncManager::multiSync( bool askforPrefs )
528 return; 532 return;
529 setBlockSave(true); 533 setBlockSave(true);
534 mCurrentResourceLocal = "";
530 if ( askforPrefs ) { 535 if ( askforPrefs ) {
531 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 536 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
@@ -573,4 +578,5 @@ int KSyncManager::ringSync()
573 KSyncProfile* temp = new KSyncProfile (); 578 KSyncProfile* temp = new KSyncProfile ();
574 mAskForPreferences = false; 579 mAskForPreferences = false;
580 mCurrentResourceLocal = "";
575 for ( i = 0; i < syncProfileNames.count(); ++i ) { 581 for ( i = 0; i < syncProfileNames.count(); ++i ) {
576 mCurrentSyncProfile = i; 582 mCurrentSyncProfile = i;
@@ -650,5 +656,6 @@ int KSyncManager::ringSync()
650 mPhoneModel = temp->getPhoneModel( ); 656 mPhoneModel = temp->getPhoneModel( );
651 syncPhone(); 657 syncPhone();
652 } else if ( temp->getIsPiSync() ) { 658 } else if ( temp->getIsPiSync() || temp->getIsPiSyncSpec()) {
659 mSpecificResources.clear();
653 if ( mTargetApp == KAPI ) { 660 if ( mTargetApp == KAPI ) {
654 mPassWordPiSync = temp->getRemotePwAB(); 661 mPassWordPiSync = temp->getRemotePwAB();
@@ -656,4 +663,5 @@ int KSyncManager::ringSync()
656 mActiveSyncIP = temp->getRemoteIPAB(); 663 mActiveSyncIP = temp->getRemoteIPAB();
657 } else if ( mTargetApp == KOPI ) { 664 } else if ( mTargetApp == KOPI ) {
665 mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() );
658 mPassWordPiSync = temp->getRemotePw(); 666 mPassWordPiSync = temp->getRemotePw();
659 mActiveSyncPort = temp->getRemotePort(); 667 mActiveSyncPort = temp->getRemotePort();
@@ -1128,7 +1136,27 @@ void KSyncManager::syncPi()
1128 return; 1136 return;
1129 } 1137 }
1130 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); 1138 mCurrentResourceLocal = "";
1131 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 1139 mCurrentResourceRemote = "";
1132 commandSocket->readFile( syncFileName() ); 1140 if ( mSpecificResources.count() ) {
1141 int startLocal = 0;
1142 int startRemote = mSpecificResources.count()/2;
1143 while ( startLocal < mSpecificResources.count()/2 ) {
1144 mPisyncFinished = false;
1145 mCurrentResourceLocal = mSpecificResources[ startLocal ];
1146 mCurrentResourceRemote = mSpecificResources[ startRemote ];
1147 KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
1148 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
1149 commandSocket->readFile( syncFileName() );
1150 while ( !mPisyncFinished ) {
1151 //qDebug("waiting ");
1152 qApp->processEvents();
1153 }
1154 ++startLocal;
1155 }
1156 } else {
1157 KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
1158 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
1159 commandSocket->readFile( syncFileName() );
1160 }
1133} 1161}
1134 1162
@@ -1155,5 +1183,5 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
1155 delete s; 1183 delete s;
1156 if ( state == KCommandSocket::errorR ) { 1184 if ( state == KCommandSocket::errorR ) {
1157 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); 1185 KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget());
1158 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1186 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1159 commandSocket->sendStop(); 1187 commandSocket->sendStop();
@@ -1192,5 +1220,5 @@ void KSyncManager::readFileFromSocket()
1192 syncOK = false; 1220 syncOK = false;
1193 } 1221 }
1194 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); 1222 KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() );
1195 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1223 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1196 if ( mWriteBackFile && syncOK ) { 1224 if ( mWriteBackFile && syncOK ) {
@@ -1463,6 +1491,9 @@ void KServerSocket::readBackFileFromSocket()
1463} 1491}
1464 1492
1465KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) 1493KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name )
1466{ 1494{
1495 mRemoteResource = remres;
1496 if ( mRemoteResource.isEmpty() )
1497 mRemoteResource = "ALL";
1467 mPassWord = password; 1498 mPassWord = password;
1468 mSocket = 0; 1499 mSocket = 0;
@@ -1491,5 +1522,5 @@ void KCommandSocket::sendFileRequest()
1491 1522
1492 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); 1523 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
1493 os << "GET " << mPassWord << curDt <<"\r\n\r\n"; 1524 os << "GET " << mPassWord << curDt << mRemoteResource << "\r\n\r\n";
1494} 1525}
1495 1526
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index d3734da..f4654ce 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -82,5 +82,5 @@ class KCommandSocket : public QObject
82 public: 82 public:
83 enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; 83 enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet };
84 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); 84 KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
85 void readFile( QString ); 85 void readFile( QString );
86 void writeFile( QString ); 86 void writeFile( QString );
@@ -99,4 +99,5 @@ class KCommandSocket : public QObject
99 void writeFileToSocket(); 99 void writeFileToSocket();
100 private : 100 private :
101 QString mRemoteResource;
101 int mConnectCount; 102 int mConnectCount;
102 int mConnectMax; 103 int mConnectMax;
@@ -203,4 +204,7 @@ class KSyncManager : public QObject
203 QString getPassword( ); 204 QString getPassword( );
204 bool mPisyncFinished; 205 bool mPisyncFinished;
206 QStringList mSpecificResources;
207 QString mCurrentResourceLocal;
208 QString mCurrentResourceRemote;
205 bool mBlockSaveFlag; 209 bool mBlockSaveFlag;
206 QWidget* mParent; 210 QWidget* mParent;
@@ -223,5 +227,5 @@ class KSyncInterface
223 public : 227 public :
224 virtual void removeSyncInfo( QString syncProfile) = 0; 228 virtual void removeSyncInfo( QString syncProfile) = 0;
225 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; 229 virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0;
226 virtual bool syncExternal(KSyncManager* manager, QString resource) 230 virtual bool syncExternal(KSyncManager* manager, QString resource)
227 { 231 {
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 292cde1..27f7932 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -593,6 +593,6 @@ void KSyncPrefsDialog::profileChanged( int item )
593 593
594 QStringList res = QStringList::split( ":",prof->getResSpecKopi()); 594 QStringList res = QStringList::split( ":",prof->getResSpecKopi());
595 int i; 595 int i= res.count()/2;
596 for ( i = 0;i < res.count(); ++i ) { 596 for ( ;i < res.count(); ++i ) {
597 mResTableKopi->setText( i, 0, res[i] ); 597 mResTableKopi->setText( i, 0, res[i] );
598 } 598 }
@@ -753,5 +753,5 @@ void KSyncPrefsDialog::saveProfile()
753 if ( mIsPiSpecific->isChecked() ) { 753 if ( mIsPiSpecific->isChecked() ) {
754 754
755 QStringList res; 755 QStringList res = mResourcesKopi;
756 int i; 756 int i;
757 for ( i = 0;i < mResourcesKopi.count(); ++i ) { 757 for ( i = 0;i < mResourcesKopi.count(); ++i ) {