summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-01-14 21:17:00 (UTC)
committer zautrix <zautrix>2005-01-14 21:17:00 (UTC)
commitee9df90c4898f4ed624be2d4e94918fcc80060e9 (patch) (side-by-side diff)
treed15e5e2e7fd4120d09fdda2ab4331ade67082e84 /libkdepim
parent620f8de219ee34c209960f02c8296c0568dd5d8b (diff)
downloadkdepimpi-ee9df90c4898f4ed624be2d4e94918fcc80060e9.zip
kdepimpi-ee9df90c4898f4ed624be2d4e94918fcc80060e9.tar.gz
kdepimpi-ee9df90c4898f4ed624be2d4e94918fcc80060e9.tar.bz2
sync settings
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp45
-rw-r--r--libkdepim/ksyncprefsdialog.h5
-rw-r--r--libkdepim/ksyncprofile.cpp19
-rw-r--r--libkdepim/ksyncprofile.h14
4 files changed, 80 insertions, 3 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 8a3f4cf..6e42fd4 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -150,67 +150,86 @@ void KSyncPrefsDialog::setupSyncAlgTab()
mIncludeInRing = new QCheckBox( i18n("calendar "), iims );
mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims );
mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims );
new QLabel( i18n(" sync"), iims );
topLayout->addMultiCellWidget(iims, iii,iii,0,1);
++iii;
QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame);
topLayout->addMultiCellWidget(gb0, iii,iii,0,1);
++iii;
QButtonGroup* gr;
{
QVGroupBox* topFrame = gb0;
+
+
+
mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
//topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
//++iii;
gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
//topLayout->addMultiCellWidget(gr, iii,iii,0,1);
//++iii;
loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
// both = new QRadioButton ( i18n("Take both on conflict"), gr );
mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
//topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
//++iii;
+ QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame);
+ QVBox * fibo2 = new QVBox ( gb5 );
+ new QLabel ( i18n("Incoming calendar filter:"), fibo2 );
+ mFilterInCal = new QComboBox( fibo2 );
+ fibo2 = new QVBox ( gb5 );
+ new QLabel ( i18n("Incoming adressbook filter:"), fibo2 );
+ mFilterInAB = new QComboBox( fibo2 );
+
mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
// topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
// ++iii;
QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame);
//topLayout->addMultiCellWidget(gb2, iii,iii,0,1);
//++iii;
{
QVGroupBox*topFrame = gb2;
mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame );
+ QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame);
+ QVBox * fibo = new QVBox ( gb4 );
+ new QLabel ( i18n("Outgoing calendar filter:"), fibo );
+ mFilterOutCal = new QComboBox( fibo );
+ 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);
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 );
//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 ) ) );
}
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 );
connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
@@ -345,25 +364,37 @@ void KSyncPrefsDialog::setupSyncAlgTab()
void KSyncPrefsDialog::readFilter()
{
mFilterKapi.clear();
mFilterKopi.clear();
mFilterKopi.append(i18n("No Filter") );
mFilterKapi.append(i18n("No Filter") );
KConfig cfgko(locateLocal("config","korganizerrc"));
KConfig cfgka(locateLocal("config","kaddressbookrc"));
cfgko.setGroup("General");
mFilterKopi = cfgko.readListEntry("CalendarFilters");
- mFilterKopi.prepend(i18n("No Filter") );
+ mFilterKapi = mFilterKopi;
+ mFilterOutCal->clear();
+ mFilterInCal->clear();
+ mFilterOutAB->clear();
+ mFilterInAB->clear();
+ QStringList temp = mFilterKopi;
+ temp.prepend(i18n("No Filter") );
+ mFilterOutCal->insertStringList( temp );
+ mFilterInCal->insertStringList( temp );
+ temp = mFilterKapi;
+ temp.prepend(i18n("No Filter") );
+ mFilterOutAB->insertStringList( temp );
+ mFilterInAB->insertStringList( temp );
}
void KSyncPrefsDialog::slotOK()
{
if ( mMyMachineName->text() == "undefined" ) {
KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
return;
}
int i;
for (i = 0; i < mSyncProfileNames.count(); ++ i) {
if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
@@ -421,24 +452,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();
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());
@@ -467,24 +499,29 @@ void KSyncPrefsDialog::profileChanged( int item )
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() );
mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
mWriteBackFuture->setChecked( prof->getWriteBackFuture());
mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() );
+
+ mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 );
+ mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 );
+ mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 );
+ mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 );
switch ( prof->getSyncPrefs() ) {
case 0:
loc->setChecked( true);
break;
case 1:
rem->setChecked( true );
break;
case 2:
newest->setChecked( true);
break;
case 3:
@@ -636,27 +673,29 @@ void KSyncPrefsDialog::saveProfile()
prof->setIsLocalFileSync( mIsLocal->isChecked() );
prof->setIsPhoneSync( mIsPhone->isChecked() );
prof->setIsPiSync( mIsPi->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 ());
}
-
}
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 ) {
diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h
index 997f524..24543e1 100644
--- a/libkdepim/ksyncprefsdialog.h
+++ b/libkdepim/ksyncprefsdialog.h
@@ -91,24 +91,29 @@ class KSyncPrefsDialog : public KDialog
QRadioButton* mIsLocal;
QRadioButton* mIsNotLocal;
QRadioButton* mIsPhone;
QRadioButton* mIsPi;
QCheckBox* mIncludeInRing;
QCheckBox* mIncludeInRingAB;
QCheckBox* mIncludeInRingPWM;
void addProfile ( KSyncProfile* );
void insertProfiles();
void saveProfile();
QButtonGroup* proGr;
+ QComboBox * mFilterOutCal;
+ QComboBox * mFilterInCal;
+ QComboBox * mFilterOutAB;
+ QComboBox * mFilterInAB;
+
QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both;
QLineEdit * mRemotePostcommand;
QLineEdit * mRemotePrecommand;
QLineEdit * mRemoteFile;
QLineEdit * mLocalTempFile;
QLineEdit * mRemotePostcommandAB;
QLineEdit * mRemotePrecommandAB;
QLineEdit * mRemoteFileAB;
QLineEdit * mLocalTempFileAB;
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index 9f404cb..0d72fc9 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -72,24 +72,28 @@ KSyncProfile* KSyncProfile::clone()
myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
myClone->setWriteBackPastWeeks( mWriteBackPastWeeks );
myClone->setIncludeInRingSync( mIncludeInRingSync );
myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM );
myClone->setSyncPrefs( mSyncPrefs);
myClone->setIsLocalFileSync( mIsLocalFileSync );
myClone->setIsPhoneSync( mIsPhoneSync );
myClone->setIsKapiFile( mIsKapiFile );
myClone->setIsPiSync( mIsPiSync );
myClone->setWriteContactToSIM( mWriteContactToSIM );
myClone->setName( "noName" );
+ myClone->setFilterInCal ( mFilterInCal );
+ myClone->setFilterOutCal ( mFilterOutCal );
+ myClone->setFilterInAB ( mFilterInAB );
+ myClone->setFilterOutAB ( mFilterOutAB );
//myClone->setIdentifier( "noID" );
return myClone;
}
void KSyncProfile::setDefault()
{
mPreSyncCommand = i18n("command for downloading remote file to local device");
mPostSyncCommand = i18n("command for uploading local temp file to remote device");
mLocalTempFile = "/tmp/mycalendar.ics";
mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
mPreSyncCommandAB = i18n("command for downloading remote file to local device");
@@ -124,24 +128,28 @@ void KSyncProfile::setDefault()
mIncludeInRingSyncAB = false;
mIncludeInRingSyncPWM = false;
mSyncPrefs = SYNC_PREF_ASK;
mIsLocalFileSync = true;
mName = "noName";
mIsPhoneSync = false;
mIsPiSync = 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 )
{
if (config)
{
config->setGroup( mName );
mName = config->readEntry( "Name", mName );
mRemotePw = config->readEntry( "RemotePw",mRemotePw );
mRemoteIP = config->readEntry( "RemoteIP",mRemoteIP );
@@ -179,24 +187,30 @@ void KSyncProfile::readConfig(KConfig *config )
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 );
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 );
+
}
else
{
setDefault();
}
}
void KSyncProfile::deleteConfig(KConfig *config )
{
config->deleteGroup( mName );
}
@@ -243,14 +257,19 @@ void KSyncProfile::writeConfig( KConfig * config )
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( "IsKapiFile", mIsKapiFile );
+ config->writeEntry( "FilterInCal", mFilterInCal );
+ config->writeEntry( "FilterOutCal", mFilterOutCal );
+ config->writeEntry( "FilterInAB", mFilterInAB );
+ config->writeEntry( "FilterOutAB", mFilterOutAB );
+
}
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h
index e970b50..aad63d3 100644
--- a/libkdepim/ksyncprofile.h
+++ b/libkdepim/ksyncprofile.h
@@ -95,24 +95,33 @@ class KSyncProfile : public QObject {
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 setFilterInCal (const QString& n ){ mFilterInCal = n;}
+ void setFilterOutCal (const QString& n ){ mFilterOutCal = n;}
+ void setFilterInAB (const QString& n ){ mFilterInAB = n;}
+ void setFilterOutAB (const QString& n ){ mFilterOutAB = n;}
+ QString getFilterInCal () { return mFilterInCal ;}
+ QString getFilterOutCal () { return mFilterOutCal ;}
+ QString getFilterInAB () { return mFilterInAB ;}
+ QString getFilterOutAB () { return mFilterOutAB ;}
+
void setName( const QString& n ) {mName = n;}
QString getName( ) { return mName;}
void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;}
bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;}
void setAskForPreferences( bool b ) { mAskForPreferences= b;}
bool getAskForPreferences( ) { return mAskForPreferences;}
void setWriteBackExisting( bool b ) { mWriteBackExisting = b;}
bool getWriteBackExisting( ) { return mWriteBackExisting;}
void setWriteBackFuture( bool b ) { mWriteBackFuture = b;}
bool getWriteBackFuture( ) { return mWriteBackFuture;}
void setWriteBackFile( bool b ) { mWriteBackFile= b;}
bool getWriteBackFile( ) { return mWriteBackFile;}
@@ -160,24 +169,29 @@ class KSyncProfile : public QObject {
QString mRemotePwAB;
QString mRemoteIPAB;
QString mRemotePortAB;
QString mRemotePwPWM;
QString mRemoteIPPWM;
QString mRemotePortPWM;
QString mPhoneDevice;
QString mPhoneConnection;
QString mPhoneModel;
+ QString mFilterInCal;
+ QString mFilterOutCal;
+ QString mFilterInAB;
+ QString mFilterOutAB;
+
bool mIncludeInRingSync;
bool mIncludeInRingSyncAB;
bool mIncludeInRingSyncPWM;
int mSyncPrefs;
bool mWriteBackFile;
bool mWriteBackExisting;
bool mWriteBackFuture;
int mWriteBackFutureWeeks;
int mWriteBackPastWeeks;
bool mAskForPreferences;
bool mShowSummaryAfterSync;
bool mIsLocalFileSync;