-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 53 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 1 |
2 files changed, 47 insertions, 7 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index b097277..6f46d19 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -216,23 +216,28 @@ void KSyncPrefsDialog::setupSyncAlgTab() fibo = new QVBox ( gb4 ); new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); mFilterOutAB = new QComboBox( fibo ); //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); //++iii; mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); //++iii; - QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); + QVGroupBox* gb3 = new QVGroupBox( i18n("Time period"), topFrame); connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); + new QLabel( i18n("From ") , gb3 ); - mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); - new QLabel( i18n(" weeks in the past to ") , gb3 ); - mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); - new QLabel( i18n(" weeks in the future ") , gb3 ); + QHBox * tf1 = new QHBox ( gb3 ); + mWriteBackPastWeeks= new QSpinBox(1,104, 1, tf1 ); + mWriteBackPastWeeks->setMaximumWidth( 100 ); + new QLabel( i18n(" weeks in the past to ") ,tf1 ); + QHBox * tf2 = new QHBox ( gb3 ); + mWriteBackFutureWeeks= new QSpinBox(1,104, 1, tf2); + mWriteBackFutureWeeks->setMaximumWidth( 100 ); + new QLabel( i18n(" weeks in the future ") , tf2 ); //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 ) ) ); } @@ -373,41 +378,64 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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 ); + mResTableKapi->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] ); } + + mResourcesKapi.clear(); + + KConfig conf ( locateLocal("config", "kabcrc") ); + + conf.setGroup( "General" ); + + QStringList keys = conf.readListEntry( "ResourceKeys" ); + //keys += conf->readListEntry( "PassiveResourceKeys" ); + + //QString standardKey = mConfig->readEntry( "Standard" ); + + for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { + conf.setGroup("Resource_"+ (*it) ); + QString name = conf.readEntry( "ResourceName" ); + mResourcesKapi.append( name ); + } + mResTableKapi->setNumRows( mResourcesKapi.count() ); + for ( i = 0;i < mResourcesKopi.count(); ++i ) { + mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] ); + } + + } void KSyncPrefsDialog::readFilter() { mFilterKapi.clear(); mFilterKopi.clear(); KConfig cfgko(locateLocal("config","korganizerrc")); KConfig cfgka(locateLocal("config","kaddressbookrc")); cfgko.setGroup("General"); @@ -476,33 +504,37 @@ void KSyncPrefsDialog::chooseFilePWM() { QString fn = QDir::homeDirPath(); fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); if ( fn == "" ) return; mRemoteFilePWM->setText( fn ); } - +void KSyncPrefsDialog::updateMyCaption() +{ + setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences")); +} void KSyncPrefsDialog::textChanged( const QString & s ) { if ( mProfileBox->count() == 0 ) return; if ( currentSelection < 3 ) { //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); mProfileBox->blockSignals( true ); 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; + updateMyCaption(); } void KSyncPrefsDialog::profileChanged( int item ) { //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); KSyncProfile* prof; saveProfile(); readFilter(); readResources(); @@ -607,16 +639,17 @@ void KSyncPrefsDialog::profileChanged( int item ) if ( item < 3 ) { localFileWidget->hide(); remoteFileWidget->hide(); phoneWidget->hide(); piWidget->hide(); } else kindChanged( prof->getIsLocalFileSync() ); + updateMyCaption(); } 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" ); mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); @@ -747,24 +780,30 @@ void KSyncPrefsDialog::saveProfile() 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 ()); + mProfileBox->setFocus(); if ( mIsPiSpecific->isChecked() ) { QStringList res = mResourcesKopi; int i; for ( i = 0;i < mResourcesKopi.count(); ++i ) { res.append( mResTableKopi->text( i, 0 )); } prof->setResSpecKopi( res.join(":")); + res = mResourcesKapi; + for ( i = 0;i < mResourcesKapi.count(); ++i ) { + res.append( mResTableKapi->text( i, 0 )); + } + prof->setResSpecKapi( res.join(":")); } } } void KSyncPrefsDialog::insertProfiles() { int curItem = mProfileBox->currentItem(); mProfileBox->blockSignals( true ); diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index e8a9709..d8c02de 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -79,16 +79,17 @@ class KSyncPrefsDialog : public KDialog void helpConnection(); protected: void usrWriteConfig(); void setupSyncAlgTab(); void readFilter(); void readResources(); private: + void updateMyCaption(); int currentSelection; QPtrList<KSyncProfile> mSyncProfiles; QStringList mSyncProfileNames; QStringList mFilterKapi; QStringList mFilterKopi; QStringList mResourcesKopi; QStringList mResourcesKapi; QLineEdit * mMyMachineName; |