summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp72
1 files changed, 67 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
@@ -243,4 +243,6 @@ void KSyncPrefsDialog::setupSyncAlgTab()
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 );
@@ -368,2 +370,12 @@ void KSyncPrefsDialog::setupSyncAlgTab()
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 );
}
@@ -374,2 +386,22 @@ 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()
@@ -475,2 +507,3 @@ void KSyncPrefsDialog::profileChanged( int item )
readFilter();
+ readResources();
currentSelection = item;
@@ -555,2 +588,3 @@ void KSyncPrefsDialog::profileChanged( int item )
mIsPi->setChecked(prof->getIsPiSync()) ;
+ mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ;
mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
@@ -558,3 +592,13 @@ void KSyncPrefsDialog::profileChanged( int item )
- 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 );
@@ -620,5 +664,12 @@ void KSyncPrefsDialog::kindChanged( bool b )
phoneWidget->hide();
- }
- if ( mIsPi->isChecked () ) {
+ }
+
+ if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) {
piWidget->show();
+ if (mIsPiSpecific->isChecked () ) {
+ mTableBox->show();
+ }
+ else {
+ mTableBox->hide();
+ }
}
@@ -626,3 +677,4 @@ void KSyncPrefsDialog::kindChanged( bool b )
piWidget->hide();
- }
+ }
+
@@ -686,2 +738,3 @@ void KSyncPrefsDialog::saveProfile()
prof->setIsPiSync( mIsPi->isChecked() );
+ prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() );
prof->setIsKapiFile( mIsKapiFileL->isChecked() );
@@ -699,2 +752,11 @@ void KSyncPrefsDialog::saveProfile()
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(":"));
+ }
}