author | zautrix <zautrix> | 2005-11-25 09:55:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 09:55:37 (UTC) |
commit | 90b62d1158d00f162a258541e24aaed4c967480b (patch) (side-by-side diff) | |
tree | 96f76bc60fae40113101aa1f321ff869bbd7979b /libkdepim | |
parent | d0de047797095f1862f4ff77b8dcd0d22643882d (diff) | |
download | kdepimpi-90b62d1158d00f162a258541e24aaed4c967480b.zip kdepimpi-90b62d1158d00f162a258541e24aaed4c967480b.tar.gz kdepimpi-90b62d1158d00f162a258541e24aaed4c967480b.tar.bz2 |
sync
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 68 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 10 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 7 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 11 |
4 files changed, 93 insertions, 3 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 8873ed1..292cde1 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -232,26 +232,28 @@ void KSyncPrefsDialog::setupSyncAlgTab() //++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 { @@ -357,30 +359,60 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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 ) ); @@ -464,24 +496,25 @@ void KSyncPrefsDialog::textChanged( const QString & s ) //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()); @@ -544,28 +577,39 @@ void KSyncPrefsDialog::profileChanged( int item ) 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() @@ -610,31 +654,39 @@ void KSyncPrefsDialog::kindChanged( bool b ) 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 )); @@ -675,37 +727,47 @@ void KSyncPrefsDialog::saveProfile() 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 ); diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index 24543e1..e8a9709 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -17,24 +17,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef _KSYNCPREFSDIALOG_H #define _KSYNCPREFSDIALOG_H #include <kdialogbase.h> #include <qptrlist.h> +#include <qtable.h> +#include <qhbox.h> //#include <libkdepim/kprefsdialog.h> class KColorButton; class QSpinBox;; class QRadioButton; class QCheckBox; class QSlider; class KURLRequester; class QComboBox; class QButtonGroup; class QLineEdit; @@ -71,43 +73,51 @@ class KSyncPrefsDialog : public KDialog void chooseFile(); void chooseFileAB(); void chooseFilePWM(); void slotOK(); void helpDevice(); void helpModel(); void helpConnection(); protected: void usrWriteConfig(); void setupSyncAlgTab(); void readFilter(); + void readResources(); private: int currentSelection; QPtrList<KSyncProfile> mSyncProfiles; QStringList mSyncProfileNames; QStringList mFilterKapi; QStringList mFilterKopi; + QStringList mResourcesKopi; + QStringList mResourcesKapi; QLineEdit * mMyMachineName; QComboBox * mProfileBox; QRadioButton* mIsLocal; QRadioButton* mIsNotLocal; QRadioButton* mIsPhone; QRadioButton* mIsPi; + QRadioButton* mIsPiSpecific; QCheckBox* mIncludeInRing; QCheckBox* mIncludeInRingAB; QCheckBox* mIncludeInRingPWM; void addProfile ( KSyncProfile* ); void insertProfiles(); void saveProfile(); QButtonGroup* proGr; + QHBox * mTableBox; + QTable* mResTableKopi; + QTable* mResTableKapi; + QTable* mResTablePwmpi; QComboBox * mFilterOutCal; QComboBox * mFilterInCal; QComboBox * mFilterOutAB; QComboBox * mFilterInAB; QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; QLineEdit * mRemotePostcommand; QLineEdit * mRemotePrecommand; QLineEdit * mRemoteFile; diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index 0d72fc9..d6620c8 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -123,24 +123,25 @@ void KSyncProfile::setDefault() mWriteBackFuture = false; mWriteBackFutureWeeks = 12; mWriteBackPastWeeks = 2; mWriteBackFile = true; mIncludeInRingSync = false; mIncludeInRingSyncAB = false; mIncludeInRingSyncPWM = false; mSyncPrefs = SYNC_PREF_ASK; mIsLocalFileSync = true; mName = "noName"; mIsPhoneSync = false; mIsPiSync = false; + mIsPiSyncSpec = false; mIsKapiFile = false; mWriteContactToSIM = false; mPhoneDevice = "/dev/ircomm"; mPhoneConnection = "irda"; mPhoneModel = "6310i"; mFilterInCal = "no filter"; mFilterOutCal = "no filter"; mFilterInAB = "no filter"; mFilterOutAB = "no filter"; } void KSyncProfile::readConfig(KConfig *config ) { @@ -186,30 +187,33 @@ void KSyncProfile::readConfig(KConfig *config ) mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); mWriteBackPastWeeks = config->readNumEntry( "WriteBackPastWeeks", mWriteBackPastWeeks ); mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); mIsPiSync= config->readBoolEntry( "IsPiSync", mIsPiSync ); + mIsPiSyncSpec= config->readBoolEntry( "IsPiSyncSpec", mIsPiSyncSpec ); mIsKapiFile = config->readBoolEntry( "IsKapiFile", mIsKapiFile ); mFilterInCal = config->readEntry( "FilterInCal", mFilterInCal ); mFilterOutCal = config->readEntry( "FilterOutCal", mFilterOutCal ); mFilterInAB = config->readEntry( "FilterInAB", mFilterInAB ); mFilterOutAB = config->readEntry( "FilterOutAB", mFilterOutAB ); + mResSpecKopi = config->readEntry( "ResSpecKopi", mResSpecKopi ); + mResSpecKapi = config->readEntry( "ResSpecKapi", mResSpecKapi ); } else { setDefault(); } } void KSyncProfile::deleteConfig(KConfig *config ) { config->deleteGroup( mName ); } @@ -256,20 +260,23 @@ void KSyncProfile::writeConfig( KConfig * config ) config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); config->writeEntry( "AskForPreferences",mAskForPreferences ); config->writeEntry( "WriteBackExisting",mWriteBackExisting ); config->writeEntry( "WriteBackFuture",mWriteBackFuture ); config->writeEntry( "WriteBackFile",mWriteBackFile ); config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); config->writeEntry( "SyncPrefs", mSyncPrefs ); config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); config->writeEntry( "WriteBackPastWeeks", mWriteBackPastWeeks); config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); config->writeEntry( "IsPhoneSync", mIsPhoneSync ); config->writeEntry( "IsPiSync", mIsPiSync ); + config->writeEntry( "IsPiSyncSpec", mIsPiSyncSpec ); config->writeEntry( "IsKapiFile", mIsKapiFile ); config->writeEntry( "FilterInCal", mFilterInCal ); config->writeEntry( "FilterOutCal", mFilterOutCal ); config->writeEntry( "FilterInAB", mFilterInAB ); 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 @@ -135,27 +135,35 @@ class KSyncProfile : public QObject { bool getIncludeInRingSyncPWM( ) { return mIncludeInRingSyncPWM;} void setSyncPrefs( int n ) { mSyncPrefs= n;} int getSyncPrefs( ) { return mSyncPrefs;} void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} void setWriteBackPastWeeks( int n ) { mWriteBackPastWeeks= n;} int getWriteBackPastWeeks( ) { return mWriteBackPastWeeks;} void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} bool getIsLocalFileSync( ) { return mIsLocalFileSync;} void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} 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; QString mPreSyncCommand; QString mPostSyncCommand; QString mLocalTempFile; QString mRemoteFileName; QString mPreSyncCommandAB; QString mPostSyncCommandAB; QString mLocalTempFileAB; QString mRemoteFileNameAB; QString mPreSyncCommandPWM; QString mPostSyncCommandPWM; @@ -190,16 +198,19 @@ class KSyncProfile : public QObject { bool mWriteBackFile; bool mWriteBackExisting; bool mWriteBackFuture; int mWriteBackFutureWeeks; int mWriteBackPastWeeks; bool mAskForPreferences; bool mShowSummaryAfterSync; bool mIsLocalFileSync; bool mIsPhoneSync; bool mWriteContactToSIM; bool mIsPiSync; + bool mIsPiSyncSpec; bool mIsKapiFile; + QString mResSpecKopi; + QString mResSpecKapi; }; #endif |