From 3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 01 Aug 2004 18:51:50 +0000 Subject: Added phone comfig settings --- diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 355c05d..c6c5ff8 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -188,11 +188,38 @@ void KSyncPrefsDialog::setupSyncAlgTab() 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 ); @@ -312,6 +339,11 @@ void KSyncPrefsDialog::profileChanged( int item ) 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() ); @@ -347,11 +379,13 @@ void KSyncPrefsDialog::profileChanged( int item ) 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() ); @@ -379,8 +413,22 @@ void KSyncPrefsDialog::fillFTP() 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() @@ -420,8 +468,13 @@ void KSyncPrefsDialog::saveProfile() 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() ); + } } @@ -527,3 +580,36 @@ void KSyncPrefsDialog::usrWriteConfig() 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 @@ -71,6 +71,9 @@ class KSyncPrefsDialog : public KDialog void chooseFile(); void chooseFileAB(); void slotOK(); + void helpDevice(); + void helpModel(); + void helpConnection(); protected: void usrWriteConfig(); @@ -85,6 +88,7 @@ class KSyncPrefsDialog : public KDialog QComboBox * mProfileBox; QRadioButton* mIsLocal; QRadioButton* mIsNotLocal; + QRadioButton* mIsPhone; QCheckBox* mIncludeInRing; QCheckBox* mIncludeInRingAB; void addProfile ( KSyncProfile* ); @@ -105,10 +109,14 @@ class KSyncPrefsDialog : public KDialog QLineEdit * mRemoteFileAB; QLineEdit * mLocalTempFileAB; + QLineEdit * mPhoneDevice; + QLineEdit * mPhoneConnection; + QLineEdit * mPhoneModel; QWidget* mSetupSyncAlgTab; QVBox* localFileWidget; QVBox* remoteFileWidget; + QVBox* phoneWidget; QCheckBox* mWriteBackFile; QCheckBox* mWriteBackFuture; QSpinBox* mWriteBackFutureWeeks; diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index f34c309..425285e 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -61,6 +61,7 @@ KSyncProfile* KSyncProfile::clone() myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); myClone->setSyncPrefs( mSyncPrefs); myClone->setIsLocalFileSync( mIsLocalFileSync ); + myClone->setIsPhoneSync( mIsPhoneSync ); myClone->setName( "noName" ); return myClone; } @@ -87,6 +88,10 @@ void KSyncProfile::setDefault() mIncludeInRingSyncAB = false; mSyncPrefs = SYNC_PREF_ASK; mIsLocalFileSync = true; + mIsPhoneSync = false; + mPhoneDevice = "/dev/ircomm"; + mPhoneConnection = "irda"; + mPhoneModel = "6310i"; } void KSyncProfile::readConfig(KConfig *config ) @@ -104,6 +109,11 @@ void KSyncProfile::readConfig(KConfig *config ) 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 ); @@ -113,6 +123,7 @@ void KSyncProfile::readConfig(KConfig *config ) 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 ) { @@ -128,6 +139,11 @@ void KSyncProfile::writeConfig( KConfig * config ) 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 ); @@ -137,6 +153,7 @@ void KSyncProfile::writeConfig( KConfig * config ) config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); + config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); } /* diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 80094b1..300f70f 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h @@ -73,6 +73,12 @@ class KSyncProfile : public QObject { 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 ;} @@ -98,6 +104,8 @@ class KSyncProfile : public QObject { 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; @@ -109,6 +117,11 @@ class KSyncProfile : public QObject { QString mPostSyncCommandAB; QString mLocalTempFileAB; QString mRemoteFileNameAB; + + QString mPhoneDevice; + QString mPhoneConnection; + QString mPhoneModel; + bool mIncludeInRingSync; bool mIncludeInRingSyncAB; int mSyncPrefs; @@ -119,6 +132,7 @@ class KSyncProfile : public QObject { bool mAskForPreferences; bool mShowSummaryAfterSync; bool mIsLocalFileSync; + bool mIsPhoneSync; }; #endif -- cgit v0.9.0.2