-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 72 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 10 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 7 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 11 |
4 files changed, 95 insertions, 5 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 8873ed1..292cde1 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -242,6 +242,8 @@ void KSyncPrefsDialog::setupSyncAlgTab() ++iii; mIsLocal = new QRadioButton ( i18n("Local file"), gr ); - mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); + mIsPi = new QRadioButton ( i18n("Pi-Sync - all resources ( direct Kx/Pi to Kx/Pi sync )"), gr ); connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); + mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected resources ( direct Kx/Pi to Kx/Pi sync )"), gr ); + connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); @@ -367,4 +369,14 @@ void KSyncPrefsDialog::setupSyncAlgTab() mRemotePortAB = new QLineEdit(temphb); mRemotePortPWM = new QLineEdit(temphb); + + lab = new QLabel( i18n("Local/remote Resource sync partners"), piWidget); + mTableBox = new QHBox( piWidget ); + mResTableKopi = new QTable( 1, 1, mTableBox ); + mResTableKapi = new QTable( 1, 1, mTableBox ); + mResTablePwmpi = new QTable( 1, 1, mTableBox ); + mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); + mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); + mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); + mResTableKopi->setLeftMargin( 80 ); } // ****************************************** @@ -373,4 +385,24 @@ void KSyncPrefsDialog::setupSyncAlgTab() } +void KSyncPrefsDialog::readResources() +{ + mResourcesKopi.clear(); + mResourcesKapi.clear(); + KConfig fc(locateLocal("config","kopicalendarrc")); + fc.setGroup("CC"); + int numCals = fc.readNumEntry("NumberCalendars",0 ); + int curCal = 1; + while ( curCal <= numCals ) { + QString prefix = "Cal_" +QString::number( curCal ); + QString name = fc.readEntry( prefix+"_Name", "Calendar"); + mResourcesKopi.append( name ); + ++curCal; + } + mResTableKopi->setNumRows( mResourcesKopi.count() ); + int i; + for ( i = 0;i < mResourcesKopi.count(); ++i ) { + mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); + } +} void KSyncPrefsDialog::readFilter() { @@ -474,4 +506,5 @@ void KSyncPrefsDialog::profileChanged( int item ) saveProfile(); readFilter(); + readResources(); currentSelection = item; prof = mSyncProfiles.at(item) ; @@ -554,8 +587,19 @@ void KSyncPrefsDialog::profileChanged( int item ) mIsPhone->setChecked(prof->getIsPhoneSync()) ; mIsPi->setChecked(prof->getIsPiSync()) ; + mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; - mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); + + QStringList res = QStringList::split( ":",prof->getResSpecKopi()); + int i; + for ( i = 0;i < res.count(); ++i ) { + mResTableKopi->setText( i, 0, res[i] ); + } + res = QStringList::split( ":",prof->getResSpecKapi()); + for ( i = 0;i < res.count(); ++i ) { + mResTableKapi->setText( i, 0, res[i] ); + } + mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); proGr->setEnabled( item > 2 ); if ( item < 3 ) { @@ -619,11 +663,19 @@ void KSyncPrefsDialog::kindChanged( bool b ) else { phoneWidget->hide(); - } - if ( mIsPi->isChecked () ) { + } + + if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) { piWidget->show(); + if (mIsPiSpecific->isChecked () ) { + mTableBox->show(); + } + else { + mTableBox->hide(); + } } else { piWidget->hide(); - } + } + } @@ -685,4 +737,5 @@ void KSyncPrefsDialog::saveProfile() prof->setIsPhoneSync( mIsPhone->isChecked() ); prof->setIsPiSync( mIsPi->isChecked() ); + prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); prof->setIsKapiFile( mIsKapiFileL->isChecked() ); prof->setWriteBackFuture(mWriteBackFuture->isChecked()); @@ -698,4 +751,13 @@ void KSyncPrefsDialog::saveProfile() prof->setFilterInAB ( mFilterInAB ->currentText ()); prof->setFilterOutAB ( mFilterOutAB ->currentText ()); + if ( mIsPiSpecific->isChecked() ) { + + QStringList res; + int i; + for ( i = 0;i < mResourcesKopi.count(); ++i ) { + res.append( mResTableKopi->text( i, 0 )); + } + prof->setResSpecKopi( res.join(":")); + } } } diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index 24543e1..e8a9709 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -27,4 +27,6 @@ #include <kdialogbase.h> #include <qptrlist.h> +#include <qtable.h> +#include <qhbox.h> //#include <libkdepim/kprefsdialog.h> @@ -81,4 +83,5 @@ class KSyncPrefsDialog : public KDialog void setupSyncAlgTab(); void readFilter(); + void readResources(); private: int currentSelection; @@ -87,4 +90,6 @@ class KSyncPrefsDialog : public KDialog QStringList mFilterKapi; QStringList mFilterKopi; + QStringList mResourcesKopi; + QStringList mResourcesKapi; QLineEdit * mMyMachineName; QComboBox * mProfileBox; @@ -93,4 +98,5 @@ class KSyncPrefsDialog : public KDialog QRadioButton* mIsPhone; QRadioButton* mIsPi; + QRadioButton* mIsPiSpecific; QCheckBox* mIncludeInRing; QCheckBox* mIncludeInRingAB; @@ -100,4 +106,8 @@ class KSyncPrefsDialog : public KDialog void saveProfile(); QButtonGroup* proGr; + QHBox * mTableBox; + QTable* mResTableKopi; + QTable* mResTableKapi; + QTable* mResTablePwmpi; QComboBox * mFilterOutCal; diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index 0d72fc9..d6620c8 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -133,4 +133,5 @@ void KSyncProfile::setDefault() mIsPhoneSync = false; mIsPiSync = false; + mIsPiSyncSpec = false; mIsKapiFile = false; mWriteContactToSIM = false; @@ -196,4 +197,5 @@ void KSyncProfile::readConfig(KConfig *config ) mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); mIsPiSync= config->readBoolEntry( "IsPiSync", mIsPiSync ); + mIsPiSyncSpec= config->readBoolEntry( "IsPiSyncSpec", mIsPiSyncSpec ); mIsKapiFile = config->readBoolEntry( "IsKapiFile", mIsKapiFile ); @@ -202,4 +204,6 @@ void KSyncProfile::readConfig(KConfig *config ) mFilterInAB = config->readEntry( "FilterInAB", mFilterInAB ); mFilterOutAB = config->readEntry( "FilterOutAB", mFilterOutAB ); + mResSpecKopi = config->readEntry( "ResSpecKopi", mResSpecKopi ); + mResSpecKapi = config->readEntry( "ResSpecKapi", mResSpecKapi ); } @@ -266,4 +270,5 @@ void KSyncProfile::writeConfig( KConfig * config ) config->writeEntry( "IsPhoneSync", mIsPhoneSync ); config->writeEntry( "IsPiSync", mIsPiSync ); + config->writeEntry( "IsPiSyncSpec", mIsPiSyncSpec ); config->writeEntry( "IsKapiFile", mIsKapiFile ); config->writeEntry( "FilterInCal", mFilterInCal ); @@ -272,4 +277,6 @@ void KSyncProfile::writeConfig( KConfig * config ) config->writeEntry( "FilterOutAB", mFilterOutAB ); + config->writeEntry( "ResSpecKopi", mResSpecKopi ); + config->writeEntry( "ResSpecKapi", mResSpecKapi ); } diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index aad63d3..91fcfc5 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -145,7 +145,15 @@ class KSyncProfile : public QObject { bool getIsPhoneSync( ) { return mIsPhoneSync;} void setIsPiSync( bool b ) { mIsPiSync= b;} + void setIsPiSyncSpec( bool b ) { mIsPiSyncSpec= b;} bool getIsPiSync( ) { return mIsPiSync;} + bool getIsPiSyncSpec( ) { return mIsPiSyncSpec;} void setIsKapiFile( bool b ) { mIsKapiFile= b;} bool getIsKapiFile( ) { return mIsKapiFile;} + + + QString getResSpecKopi() { return mResSpecKopi;} + QString getResSpecKapi() { return mResSpecKapi;} + void setResSpecKopi( const QString& n ) {mResSpecKopi = n;} + void setResSpecKapi( const QString& n ) {mResSpecKapi = n;} private: QString mName; @@ -200,5 +208,8 @@ class KSyncProfile : public QObject { bool mIsPiSync; + bool mIsPiSyncSpec; bool mIsKapiFile; + QString mResSpecKopi; + QString mResSpecKapi; }; |