summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
authorzautrix <zautrix>2004-08-01 18:51:50 (UTC)
committer zautrix <zautrix>2004-08-01 18:51:50 (UTC)
commit3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603 (patch) (side-by-side diff)
treefc198cac2c1ffa425f98f259f272e7131265b7d7 /libkdepim/ksyncprefsdialog.cpp
parentf968c6f5541463caadee98e200c2ba035fa20959 (diff)
downloadkdepimpi-3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603.zip
kdepimpi-3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603.tar.gz
kdepimpi-3e1e7285cd2b94c0f6a041a639a0ea0a0cb72603.tar.bz2
Added phone comfig settings
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp98
1 files changed, 92 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
@@ -175,37 +175,64 @@ void KSyncPrefsDialog::setupSyncAlgTab()
mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
++iii;
topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
++iii;
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() ) );
temphb = new QHBox( localFileWidget );
mRemoteFile = new QLineEdit( temphb);
mRemoteFileAB = new QLineEdit( temphb);
// *** remote
remoteFileWidget = new QVBox( topFrame);
topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
@@ -299,32 +326,37 @@ void KSyncPrefsDialog::textChanged( const QString & s )
void KSyncPrefsDialog::profileChanged( int item )
{
//qDebug("KSyncPrefsDialog::profileChanged %d ", item );
KSyncProfile* prof;
saveProfile();
currentSelection = item;
prof = mSyncProfiles.at(item) ;
mRemotePrecommand->setText(prof->getPreSyncCommand());
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() );
switch ( prof->getSyncPrefs() ) {
case 0:
loc->setChecked( true);
break;
case 1:
rem->setChecked( true );
break;
@@ -334,66 +366,82 @@ void KSyncPrefsDialog::profileChanged( int item )
case 3:
ask->setChecked( true);
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()) ;
- 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" );
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" );
mLocalTempFileAB->setText("/tmp/std.vcf" );
mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
}
void KSyncPrefsDialog::fillFTP()
{
mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
mLocalTempFile->setText("/tmp/mycalendar.ics" );
mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
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"));
return;
}
KSyncProfile* temp = mSyncProfiles.at(currentSelection);
mSyncProfiles.remove( temp );
mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
insertProfiles();
}
}
@@ -407,34 +455,39 @@ void KSyncPrefsDialog::saveProfile()
prof->setPostSyncCommand( mRemotePostcommand->text() );
prof->setLocalTempFile( mLocalTempFile->text());
prof->setRemoteFileName( mRemoteFile->text() );
prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
prof->setLocalTempFileAB( mLocalTempFileAB->text());
prof->setRemoteFileNameAB( mRemoteFileAB->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() );
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 );
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 );
}
@@ -514,16 +567,49 @@ void KSyncPrefsDialog::usrWriteConfig()
profileChanged(currentSelection);
//KConfig *config = KOGlobals::config();
KConfig config ( locateLocal( "config","syncprofilesrc" ) );
config.setGroup("SyncProfiles");
KSyncProfile* prof = mSyncProfiles.first();
while ( prof ) {
prof->writeConfig(&config);
prof = mSyncProfiles.next();
}
//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"));
+}