author | zautrix <zautrix> | 2004-08-01 18:51:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-01 18:51:50 (UTC) |
commit | 3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603 (patch) (side-by-side diff) | |
tree | fc198cac2c1ffa425f98f259f272e7131265b7d7 | |
parent | f968c6f5541463caadee98e200c2ba035fa20959 (diff) | |
download | kdepimpi-3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603.zip kdepimpi-3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603.tar.gz kdepimpi-3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603.tar.bz2 |
Added phone comfig settings
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 98 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.h | 8 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 17 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 14 |
4 files changed, 131 insertions, 6 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 355c05d..c6c5ff8 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -183,21 +183,48 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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 ); 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) ) ); + + + phoneWidget = new QVBox( topFrame); + topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); + ++iii; + QHBox* temphb = new QHBox( phoneWidget ); + new QLabel( i18n("I/O device: "), temphb ); + mPhoneDevice = new QLineEdit( temphb); + button = new QPushButton( i18n("Help..."), temphb ); + connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); + + + temphb = new QHBox( phoneWidget ); + new QLabel( i18n("Connection: "), temphb ); + mPhoneConnection = new QLineEdit( temphb); + button = new QPushButton( i18n("Help..."), temphb ); + connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); + + + temphb = new QHBox( phoneWidget ); + new QLabel( i18n("Model(opt.): "), temphb ); + mPhoneModel = new QLineEdit( temphb); + button = new QPushButton( i18n("Help..."), temphb ); + connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); + // *** local localFileWidget = new QVBox( topFrame); topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); ++iii; - QHBox* temphb = new QHBox( localFileWidget ); + temphb = new QHBox( localFileWidget ); lab = new QLabel( i18n("Local file Cal:"), temphb ); lab = new QLabel( i18n("Local file ABook:"), temphb ); temphb = new QHBox( localFileWidget ); button = new QPushButton( i18n("Choose..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); button = new QPushButton( i18n("Choose..."), temphb ); connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); @@ -307,16 +334,21 @@ void KSyncPrefsDialog::profileChanged( int item ) mRemotePostcommand->setText(prof->getPostSyncCommand()); mLocalTempFile->setText(prof->getLocalTempFile()); mRemoteFile->setText(prof->getRemoteFileName()) ; mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); mLocalTempFileAB->setText(prof->getLocalTempFileAB()); mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; + + mPhoneDevice->setText(prof->getPhoneDevice()); + mPhoneConnection->setText(prof->getPhoneConnection()); + mPhoneModel->setText(prof->getPhoneModel()); + mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); mAskForPreferences->setChecked( prof->getAskForPreferences()); mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); mWriteBackFile->setChecked( prof->getWriteBackFile()); mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); mWriteBackFuture->setChecked( prof->getWriteBackFuture()); mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); @@ -342,21 +374,23 @@ void KSyncPrefsDialog::profileChanged( int item ) break; case 6: //both->setChecked( true); break; default: break; } mIsLocal->setChecked(prof->getIsLocalFileSync()) ; - mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); + mIsPhone->setChecked(prof->getIsPhoneSync()) ; + mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); proGr->setEnabled( item > 2 ); if ( item < 3 ) { - localFileWidget->setEnabled(false); - remoteFileWidget->setEnabled(false); + localFileWidget->hide(); + remoteFileWidget->hide(); + phoneWidget->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" ); @@ -374,18 +408,32 @@ void KSyncPrefsDialog::fillFTP() mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); mLocalTempFileAB->setText("/tmp/std.vcf" ); mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); } void KSyncPrefsDialog::kindChanged( bool b ) { - localFileWidget->setEnabled(b); - remoteFileWidget->setEnabled(!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(); + } } 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")); @@ -415,18 +463,23 @@ void KSyncPrefsDialog::saveProfile() prof->setAskForPreferences( mAskForPreferences->isChecked()); prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); prof->setWriteBackFile( mWriteBackFile->isChecked()); prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); prof->setIncludeInRingSyncAB( mIncludeInRingAB->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->setWriteBackFuture(mWriteBackFuture->isChecked()); prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); + prof->setPhoneDevice( mPhoneDevice->text() ); + prof->setPhoneConnection( mPhoneConnection->text() ); + prof->setPhoneModel( mPhoneModel->text() ); + } } void KSyncPrefsDialog::insertProfiles() { int curItem = mProfileBox->currentItem(); mProfileBox->blockSignals( true ); @@ -522,8 +575,41 @@ void KSyncPrefsDialog::usrWriteConfig() } //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); config.writeEntry("SyncProfileNames",mSyncProfileNames); QString name = mMyMachineName->text(); config.writeEntry("LocalMachineName",name); } +void KSyncPrefsDialog::helpDevice() +{ + QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); +#ifdef _WIN32_ + hint += "leave empty for Irda\n" + "com1:\n(first serial port)\n" + "usb not supported\n" + "???\n(bluetooth device address)\n"; + +#else + hint += "/dev/ircomm\n(Irda)\n" + "/dev/ttyS0\n(first serial port)\n" + "/dev/ttyUSB0\n(first device usb port)\n" + "???\n(bluetooth device address)\n"; +#endif + KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); +} +void KSyncPrefsDialog::helpModel() +{ + QString hint = i18n("Leave empty or\ninsert name of phone model:\n"); + hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; + KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); + +} +void KSyncPrefsDialog::helpConnection() +{ + QString hint = i18n("Insert kind of connection,e.g.:\n"); + hint += "irda | Nokia FBUS over infrared\n" + "irdaat | AT commands infrared\n(Siemens/Sony-Erricsson)\n" + "irdaobex | set model obex\n" + "fbus | Nokia FBUS2 serial\n"; + KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); +} diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index 8c2c59c..3060e78 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h @@ -66,30 +66,34 @@ class KSyncPrefsDialog : public KDialog void kindChanged(bool); void fillSSH(); void fillFTP(); void textChanged( const QString & ); void profileChanged( int ); void chooseFile(); void chooseFileAB(); void slotOK(); + void helpDevice(); + void helpModel(); + void helpConnection(); protected: void usrWriteConfig(); void setupSyncAlgTab(); private: int currentSelection; QPtrList<KSyncProfile> mSyncProfiles; QStringList mSyncProfileNames; QLineEdit * mMyMachineName; QComboBox * mProfileBox; QRadioButton* mIsLocal; QRadioButton* mIsNotLocal; + QRadioButton* mIsPhone; QCheckBox* mIncludeInRing; QCheckBox* mIncludeInRingAB; void addProfile ( KSyncProfile* ); void insertProfiles(); void saveProfile(); QButtonGroup* proGr; QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; @@ -100,20 +104,24 @@ class KSyncPrefsDialog : public KDialog QLineEdit * mRemoteFile; QLineEdit * mLocalTempFile; QLineEdit * mRemotePostcommandAB; QLineEdit * mRemotePrecommandAB; QLineEdit * mRemoteFileAB; QLineEdit * mLocalTempFileAB; + QLineEdit * mPhoneDevice; + QLineEdit * mPhoneConnection; + QLineEdit * mPhoneModel; QWidget* mSetupSyncAlgTab; QVBox* localFileWidget; QVBox* remoteFileWidget; + QVBox* phoneWidget; QCheckBox* mWriteBackFile; QCheckBox* mWriteBackFuture; QSpinBox* mWriteBackFutureWeeks; QCheckBox* mWriteBackExisting; QCheckBox* mAskForPreferences; QCheckBox* mShowSummaryAfterSync; }; diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index f34c309..425285e 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -56,16 +56,17 @@ KSyncProfile* KSyncProfile::clone() myClone->setWriteBackExisting(mWriteBackExisting ); myClone->setWriteBackFile( mWriteBackFile); myClone->setWriteBackFuture( mWriteBackFuture ); myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); myClone->setIncludeInRingSync( mIncludeInRingSync ); myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); myClone->setSyncPrefs( mSyncPrefs); myClone->setIsLocalFileSync( mIsLocalFileSync ); + myClone->setIsPhoneSync( mIsPhoneSync ); myClone->setName( "noName" ); return myClone; } void KSyncProfile::setDefault() { mName = "noName"; @@ -82,16 +83,20 @@ void KSyncProfile::setDefault() mWriteBackExisting = false; mWriteBackFuture = false; mWriteBackFutureWeeks = 12; mWriteBackFile = true; mIncludeInRingSync = false; mIncludeInRingSyncAB = false; mSyncPrefs = SYNC_PREF_ASK; mIsLocalFileSync = true; + mIsPhoneSync = false; + mPhoneDevice = "/dev/ircomm"; + mPhoneConnection = "irda"; + mPhoneModel = "6310i"; } void KSyncProfile::readConfig(KConfig *config ) { config->setGroup("SyncProfiles"); QString prefix = "Profile_"+mName+"_"; //mName = config->readEntry( prefix+ "Name", mName ); mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); @@ -99,49 +104,61 @@ void KSyncProfile::readConfig(KConfig *config ) mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); + + mPhoneDevice = config->readEntry( prefix+ "PhoneDevice", mPhoneDevice ); + mPhoneConnection = config->readEntry( prefix+ "PhoneConnection", mPhoneConnection ); + mPhoneModel = config->readEntry( prefix+ "PhoneModel", mPhoneModel ); + mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks ); mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); + mIsPhoneSync= config->readBoolEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); } void KSyncProfile::writeConfig( KConfig * config ) { config->setGroup("SyncProfiles"); QString prefix = "Profile_"+mName+"_"; // config->writeEntry( prefix+ "Name", mName ); config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); + + config->writeEntry( prefix+ "PhoneDevice", mPhoneDevice ); + config->writeEntry( prefix+ "PhoneConnection", mPhoneConnection ); + config->writeEntry( prefix+ "PhoneModel", mPhoneModel ); + config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); + config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); } /* class KPrefsItemInt : public KPrefsItem { public: KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); virtual ~KPrefsItemInt() {} diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 80094b1..300f70f 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -68,16 +68,22 @@ class KSyncProfile : public QObject { QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} QString getLocalTempFileAB( ) { return mLocalTempFileAB;} void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;} + void setPhoneDevice( const QString& n ) { mPhoneDevice = n;} + QString getPhoneDevice( ) { return mPhoneDevice;} + void setPhoneConnection( const QString& n ) { mPhoneConnection = n;} + QString getPhoneConnection( ) { return mPhoneConnection;} + void setPhoneModel( const QString& n ) { mPhoneModel = n;} + QString getPhoneModel( ) { return mPhoneModel;} /* void set( const QString& n ) { = n;} QString get( ) { return ;} */ void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} void setAskForPreferences( bool b ) { mAskForPreferences= b;} @@ -93,32 +99,40 @@ class KSyncProfile : public QObject { void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} void setSyncPrefs( int n ) { mSyncPrefs= n;} int getSyncPrefs( ) { return mSyncPrefs;} void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} bool getIsLocalFileSync( ) { return mIsLocalFileSync;} + void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} + bool getIsPhoneSync( ) { return mIsPhoneSync;} private: QString mName; QString mPreSyncCommand; QString mPostSyncCommand; QString mLocalTempFile; QString mRemoteFileName; QString mPreSyncCommandAB; QString mPostSyncCommandAB; QString mLocalTempFileAB; QString mRemoteFileNameAB; + + QString mPhoneDevice; + QString mPhoneConnection; + QString mPhoneModel; + bool mIncludeInRingSync; bool mIncludeInRingSyncAB; int mSyncPrefs; bool mWriteBackFile; bool mWriteBackExisting; bool mWriteBackFuture; int mWriteBackFutureWeeks; bool mAskForPreferences; bool mShowSummaryAfterSync; bool mIsLocalFileSync; + bool mIsPhoneSync; }; #endif |