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
@@ -228,34 +228,36 @@ void KSyncPrefsDialog::setupSyncAlgTab()
new QLabel( i18n(" weeks in the past to ") , gb3 );
mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3);
new QLabel( i18n(" weeks in the future ") , gb3 );
//topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
//++iii;
gb3->setEnabled( false );
connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) );
}
connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
}
proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
gr = proGr;
topLayout->addMultiCellWidget(gr, iii,iii,0,1);
++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) ) );
mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame);
topLayout->addMultiCellWidget(gb1, iii,iii,0,1);
++iii;
// ******************************************
// Profile kind specific settings
{
// *** phone *******************************
QVGroupBox* topFrame = gb1;
phoneWidget = new QVBox( topFrame);
//topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
@@ -353,38 +355,68 @@ void KSyncPrefsDialog::setupSyncAlgTab()
temphb = new QHBox( piWidget );
mRemotePw = new QLineEdit(temphb);
mRemotePwAB = new QLineEdit(temphb);
mRemotePwPWM = new QLineEdit(temphb);
lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
temphb = new QHBox( piWidget );
mRemoteIP = new QLineEdit(temphb);
mRemoteIPAB = new QLineEdit(temphb);
mRemoteIPPWM = new QLineEdit(temphb);
lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
temphb = new QHBox( piWidget );
mRemotePort = new QLineEdit(temphb);
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 );
}
// ******************************************
// Profile kind specific settings END
}
+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()
{
mFilterKapi.clear();
mFilterKopi.clear();
KConfig cfgko(locateLocal("config","korganizerrc"));
KConfig cfgka(locateLocal("config","kaddressbookrc"));
cfgko.setGroup("General");
mFilterKopi = cfgko.readListEntry("CalendarFilters");
cfgka.setGroup("Filter");
int count = cfgka.readNumEntry( "Count", 0 );
for ( int i = 0; i < count; i++ ) {
cfgka.setGroup("Filter_"+QString::number( i ) );
mFilterKapi.append( cfgka.readEntry("Name", "internal error") );
}
mFilterOutCal->clear();
mFilterInCal->clear();
@@ -460,32 +492,33 @@ void KSyncPrefsDialog::textChanged( const QString & s )
mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
mProfileBox->blockSignals( false );
return;
}
//qDebug("cur i %d ",mProfileBox-> currentItem () );
mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
prof->setName( s );
mSyncProfileNames[mProfileBox-> currentItem ()] = s;
}
void KSyncPrefsDialog::profileChanged( int item )
{
//qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
KSyncProfile* prof;
saveProfile();
readFilter();
+ readResources();
currentSelection = item;
prof = mSyncProfiles.at(item) ;
mRemotePw->setText(prof->getRemotePw());
mRemoteIP->setText(prof->getRemoteIP());
mRemotePort->setText(prof->getRemotePort());
mRemotePwAB->setText(prof->getRemotePwAB());
mRemoteIPAB->setText(prof->getRemoteIPAB());
mRemotePortAB->setText(prof->getRemotePortAB());
mRemotePwPWM->setText(prof->getRemotePwPWM());
mRemoteIPPWM->setText(prof->getRemoteIPPWM());
mRemotePortPWM->setText(prof->getRemotePortPWM());
mRemotePrecommand->setText(prof->getPreSyncCommand());
@@ -540,36 +573,47 @@ void KSyncPrefsDialog::profileChanged( int item )
break;
case 4:
f_loc->setChecked( true);
break;
case 5:
f_rem->setChecked( true);
break;
case 6:
//both->setChecked( true);
break;
default:
break;
}
mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
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 ) {
localFileWidget->hide();
remoteFileWidget->hide();
phoneWidget->hide();
piWidget->hide();
} else
kindChanged( prof->getIsLocalFileSync() );
}
void KSyncPrefsDialog::fillSSH()
{
mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
mLocalTempFile->setText("/tmp/mycalendar.ics" );
mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
@@ -605,39 +649,47 @@ void KSyncPrefsDialog::kindChanged( bool b )
if ( mIsLocal->isChecked () )
localFileWidget->show();
else
localFileWidget->hide();
if ( mIsNotLocal->isChecked () )
remoteFileWidget->show();
else
remoteFileWidget->hide();
if ( mIsPhone->isChecked () ) {
phoneWidget->show();
}
else {
phoneWidget->hide();
- }
- if ( mIsPi->isChecked () ) {
+ }
+
+ if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) {
piWidget->show();
+ if (mIsPiSpecific->isChecked () ) {
+ mTableBox->show();
+ }
+ else {
+ mTableBox->hide();
+ }
}
else {
piWidget->hide();
- }
+ }
+
}
void KSyncPrefsDialog::deleteProfile()
{
//qDebug("KSyncPrefsDialog::deleteProfile() ");
if ( currentSelection >= 0 ) {
if ( currentSelection < 3 ) {
KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
return;
}
KSyncProfile* temp = mSyncProfiles.at(currentSelection);
mSyncProfiles.remove( temp );
mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
insertProfiles();
}
}
@@ -671,45 +723,55 @@ void KSyncPrefsDialog::saveProfile()
prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
prof->setAskForPreferences( mAskForPreferences->isChecked());
prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
prof->setWriteBackFile( mWriteBackFile->isChecked());
prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
prof->setSyncPrefs( syncprefs);
prof->setIsLocalFileSync( mIsLocal->isChecked() );
prof->setIsPhoneSync( mIsPhone->isChecked() );
prof->setIsPiSync( mIsPi->isChecked() );
+ prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() );
prof->setIsKapiFile( mIsKapiFileL->isChecked() );
prof->setWriteBackFuture(mWriteBackFuture->isChecked());
prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value());
if ( mWriteContactToSIM )
prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
prof->setPhoneDevice( mPhoneDevice->text() );
prof->setPhoneConnection( mPhoneConnection->text() );
prof->setPhoneModel( mPhoneModel->text() );
prof->setFilterInCal ( mFilterInCal->currentText ());
prof->setFilterOutCal ( mFilterOutCal ->currentText ());
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(":"));
+ }
}
}
void KSyncPrefsDialog::insertProfiles()
{
int curItem = mProfileBox->currentItem();
mProfileBox->blockSignals( true );
mProfileBox->clear();
mProfileBox->insertStringList (mSyncProfileNames );
int item = mSyncProfileNames.count() -1;
if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
mProfileBox->setCurrentItem( curItem );
else if ( item >= 0 ) {
mProfileBox->setCurrentItem( item );
}
currentSelection = -1;