summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-10-06 20:51:01 (UTC)
committer zautrix <zautrix>2004-10-06 20:51:01 (UTC)
commit0afcfa29ace7bc5e42a11fae44301e1e8230a376 (patch) (side-by-side diff)
treeb54f85b19ace24219be1b845469444089cacc94f /libkdepim
parented4675de07d947f55d2672c721599e3a0af1e24b (diff)
downloadkdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.zip
kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.gz
kdepimpi-0afcfa29ace7bc5e42a11fae44301e1e8230a376.tar.bz2
some prefs cleanups
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kpimprefs.h18
-rw-r--r--libkdepim/ksyncmanager.cpp100
-rw-r--r--libkdepim/ksyncmanager.h20
3 files changed, 69 insertions, 69 deletions
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 01c57a3..6f92919 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -53,29 +53,13 @@ class KPimPrefs : public KPrefs
void usrWriteConfig();
public:
QStringList mCustomCategories;
- // sync stuff
- QString mLocalMachineName;
- QStringList mExternSyncProfiles;
- QStringList mSyncProfileNames;
- bool mAskForPreferences;
- bool mShowSyncSummary;
- bool mShowSyncEvents;
- bool mShowTodoInAgenda;
- bool mWriteBackExistingOnly;
- int mSyncAlgoPrefs;
- int mRingSyncAlgoPrefs;
- bool mWriteBackFile;
- int mWriteBackInFuture;
- QString mPhoneDevice;
- QString mPhoneConnection;
- QString mPhoneModel;
- QString mLastSyncedLocalFile; // save!
+
protected:
virtual void setCategoryDefaults();
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 07e6761..c0cc840 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -49,13 +49,13 @@
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kfiledialog.h>
KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
- : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs), mSyncMenu(syncmenu)
+ : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
{
bar = new QProgressBar ( 1, 0 );
bar->setCaption ("");
int w = 300;
if ( QApplication::desktop()->width() < 320 )
@@ -83,13 +83,13 @@ void KSyncManager::fillSyncMenu()
mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
mSyncMenu->insertSeparator();
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
config.setGroup("General");
QStringList prof = config.readListEntry("SyncProfileNames");
- mPrefs->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
+ mLocalMachineName = config.readEntry("LocalMachineName","undefined");
if ( prof.count() < 3 ) {
prof.clear();
prof << i18n("Sharp_DTM");
prof << i18n("Local_file");
prof << i18n("Last_file");
KSyncProfile* temp = new KSyncProfile ();
@@ -102,14 +102,14 @@ void KSyncManager::fillSyncMenu()
config.setGroup("General");
config.writeEntry("SyncProfileNames",prof);
config.writeEntry("ExternSyncProfiles","Sharp_DTM");
config.sync();
delete temp;
}
- mPrefs->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
- mPrefs->mSyncProfileNames = prof;
+ mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
+ mSyncProfileNames = prof;
unsigned int i;
for ( i = 0; i < prof.count(); ++i ) {
mSyncMenu->insertItem( prof[i], 1000+i );
if ( i == 2 )
mSyncMenu->insertSeparator();
}
@@ -118,14 +118,12 @@ void KSyncManager::fillSyncMenu()
if ( mTargetApp == PWMPI) {
mSyncMenu->removeItem( 1000 );
}
else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
mSyncMenu->setItemEnabled( 1000, false );
}
- //probaly useless
- //mView->setupExternSyncProfiles();
}
void KSyncManager::slotSyncMenu( int action )
{
//qDebug("syncaction %d ", action);
if ( action == 0 ) {
@@ -147,26 +145,26 @@ void KSyncManager::slotSyncMenu( int action )
if (blockSave())
return;
setBlockSave(true);
mCurrentSyncProfile = action - 1000 ;
- mCurrentSyncDevice = mPrefs->mSyncProfileNames[mCurrentSyncProfile] ;
- mCurrentSyncName = mPrefs->mLocalMachineName ;
+ mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ;
+ mCurrentSyncName = mLocalMachineName ;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
KSyncProfile* temp = new KSyncProfile ();
- temp->setName(mPrefs->mSyncProfileNames[mCurrentSyncProfile]);
+ temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
- mPrefs->mAskForPreferences = temp->getAskForPreferences();
- mPrefs->mSyncAlgoPrefs = temp->getSyncPrefs();
- mPrefs->mWriteBackFile = temp->getWriteBackFile();
- mPrefs->mWriteBackExistingOnly = temp->getWriteBackExisting();
- mPrefs->mWriteBackInFuture = 0;
+ mAskForPreferences = temp->getAskForPreferences();
+ mSyncAlgoPrefs = temp->getSyncPrefs();
+ mWriteBackFile = temp->getWriteBackFile();
+ mWriteBackExistingOnly = temp->getWriteBackExisting();
+ mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() )
- mPrefs->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- mPrefs->mShowSyncSummary = temp->getShowSummaryAfterSync();
+ mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
+ mShowSyncSummary = temp->getShowSummaryAfterSync();
if ( action == 1000 ) {
syncSharp();
} else if ( action == 1001 ) {
syncLocalFile();
@@ -176,32 +174,32 @@ void KSyncManager::slotSyncMenu( int action )
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
switch(mTargetApp)
{
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
- mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+ mLastSyncedLocalFile = temp->getRemoteFileNameAB();
break;
case (KOPI):
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
+ mLastSyncedLocalFile = temp->getRemoteFileName();
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
- mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
+ mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
break;
}
} else {
if ( temp->getIsPhoneSync() ) {
- mPrefs->mPhoneDevice = temp->getPhoneDevice( ) ;
- mPrefs->mPhoneConnection = temp->getPhoneConnection( );
- mPrefs->mPhoneModel = temp->getPhoneModel( );
+ mPhoneDevice = temp->getPhoneDevice( ) ;
+ mPhoneConnection = temp->getPhoneConnection( );
+ mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else
syncRemote( temp );
}
}
@@ -209,13 +207,13 @@ void KSyncManager::slotSyncMenu( int action )
setBlockSave(false);
}
void KSyncManager::syncLocalFile()
{
- QString fn =mPrefs->mLastSyncedLocalFile;
+ QString fn =mLastSyncedLocalFile;
QString ext;
switch(mTargetApp)
{
case (KAPI):
ext = "(*.vcf)";
@@ -260,30 +258,30 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
mess,
i18n("Sync"), i18n("Cancel"), 0,
0, 1 );
if ( result )
return false;
}
- if ( mPrefs->mAskForPreferences )
+ if ( mAskForPreferences )
edit_sync_options();
if ( result == 0 ) {
//qDebug("Now sycing ... ");
- if ( ret = mImplementation->sync( this, fn, mPrefs->mSyncAlgoPrefs ) )
+ if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
mParent->setCaption( i18n("Synchronization successful") );
else
mParent->setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
if ( ! quick )
- mPrefs->mLastSyncedLocalFile = fn;
+ mLastSyncedLocalFile = fn;
mImplementation->sync_setModified();
}
return ret;
}
void KSyncManager::quickSyncLocalFile()
{
- if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) {
+ if ( syncWithFile( mLastSyncedLocalFile, false ) ) {
qDebug("quick syncLocalFile() successful ");
}
}
void KSyncManager::multiSync( bool askforPrefs )
{
@@ -297,16 +295,16 @@ void KSyncManager::multiSync( bool askforPrefs )
0, 0 ) != 0 ) {
setBlockSave(false);
mParent->setCaption(i18n("Aborted! Nothing synced!"));
return;
}
mCurrentSyncDevice = i18n("Multiple profiles") ;
- mPrefs->mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
+ mSyncAlgoPrefs = mRingSyncAlgoPrefs;
if ( askforPrefs ) {
edit_sync_options();
- mPrefs->mRingSyncAlgoPrefs = mPrefs->mSyncAlgoPrefs;
+ mRingSyncAlgoPrefs = mSyncAlgoPrefs;
}
mParent->setCaption(i18n("Multiple sync started.") );
qApp->processEvents();
int num = ringSync() ;
if ( num > 1 )
ringSync();
@@ -322,15 +320,15 @@ void KSyncManager::multiSync( bool askforPrefs )
int KSyncManager::ringSync()
{
int syncedProfiles = 0;
unsigned int i;
QTime timer;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- QStringList syncProfileNames = mPrefs->mSyncProfileNames;
+ QStringList syncProfileNames = mSyncProfileNames;
KSyncProfile* temp = new KSyncProfile ();
- mPrefs->mAskForPreferences = false;
+ mAskForPreferences = false;
for ( i = 0; i < syncProfileNames.count(); ++i ) {
mCurrentSyncProfile = i;
temp->setName(syncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
QString includeInRingSync;
@@ -352,48 +350,48 @@ int KSyncManager::ringSync()
}
if ( includeInRingSync && ( i < 1 || i > 2 )) {
mParent->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
++syncedProfiles;
- // mPrefs->mAskForPreferences = temp->getAskForPreferences();
- mPrefs->mWriteBackFile = temp->getWriteBackFile();
- mPrefs->mWriteBackExistingOnly = temp->getWriteBackExisting();
- mPrefs->mWriteBackInFuture = 0;
+ // mAskForPreferences = temp->getAskForPreferences();
+ mWriteBackFile = temp->getWriteBackFile();
+ mWriteBackExistingOnly = temp->getWriteBackExisting();
+ mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() )
- mPrefs->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- mPrefs->mShowSyncSummary = false;
+ mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
+ mShowSyncSummary = false;
mCurrentSyncDevice = syncProfileNames[i] ;
- mCurrentSyncName = mPrefs->mLocalMachineName;
+ mCurrentSyncName = mLocalMachineName;
if ( i == 0 ) {
syncSharp();
} else {
if ( temp->getIsLocalFileSync() ) {
switch(mTargetApp)
{
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
- mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
+ mLastSyncedLocalFile = temp->getRemoteFileNameAB();
break;
case (KOPI):
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
+ mLastSyncedLocalFile = temp->getRemoteFileName();
break;
case (PWMPI):
if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
- mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
+ mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
break;
default:
qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
break;
}
} else {
if ( temp->getIsPhoneSync() ) {
- mPrefs->mPhoneDevice = temp->getPhoneDevice( ) ;
- mPrefs->mPhoneConnection = temp->getPhoneConnection( );
- mPrefs->mPhoneModel = temp->getPhoneModel( );
+ mPhoneDevice = temp->getPhoneDevice( ) ;
+ mPhoneConnection = temp->getPhoneConnection( );
+ mPhoneModel = temp->getPhoneModel( );
syncPhone();
} else
syncRemote( temp, false );
}
}
@@ -488,13 +486,13 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
if ( syncWithFile( localTempFile, true ) ) {
// Event* e = mView->getLastSyncEvent();
// e->setReadOnly( false );
// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
// e->setReadOnly( true );
- if ( mPrefs->mWriteBackFile ) {
+ if ( mWriteBackFile ) {
int fi;
if ( (fi = postCommand.find("$PWD$")) > 0 ) {
QString pwd = getPassword();
postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
}
@@ -512,13 +510,13 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
return;
}
void KSyncManager::edit_sync_options()
{
//mDialogManager->showSyncOptions();
- //mPrefs->mSyncAlgoPrefs
+ //mSyncAlgoPrefs
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
QVBoxLayout lay ( &dia );
lay.setSpacing( 2 );
lay.setMargin( 3 );
@@ -530,13 +528,13 @@ void KSyncManager::edit_sync_options()
QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
//QRadioButton both( i18n("Take both on conflict"), &gr );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- switch ( mPrefs->mSyncAlgoPrefs ) {
+ switch ( mSyncAlgoPrefs ) {
case 0:
loc.setChecked( true);
break;
case 1:
rem.setChecked( true );
break;
@@ -556,13 +554,13 @@ void KSyncManager::edit_sync_options()
// both.setChecked( true);
break;
default:
break;
}
if ( dia.exec() ) {
- mPrefs->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
+ mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
}
}
QString KSyncManager::getPassword( )
{
@@ -600,14 +598,14 @@ void KSyncManager::confSync()
#ifndef DESKTOP_VERSION
sp->showMaximized();
#else
sp->show();
#endif
sp->exec();
- mPrefs->mSyncProfileNames = sp->getSyncProfileNames();
- mPrefs->mLocalMachineName = sp->getLocalMachineName ();
+ mSyncProfileNames = sp->getSyncProfileNames();
+ mLocalMachineName = sp->getLocalMachineName ();
fillSyncMenu();
}
void KSyncManager::syncSharp()
{
if ( ! syncExternalApplication("sharp") )
@@ -616,13 +614,13 @@ void KSyncManager::syncSharp()
bool KSyncManager::syncExternalApplication(QString resource)
{
if ( mImplementation->sync_isModified() )
mImplementation->sync_save();
- if ( mPrefs->mAskForPreferences )
+ if ( mAskForPreferences )
edit_sync_options();
qDebug("sync %s", resource.latin1());
bool syncOK = mImplementation->syncExternal(this, resource);
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 9761107..6b10016 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -56,12 +56,31 @@ class KSyncManager : public QObject
QString getCurrentSyncName() { return mCurrentSyncName; }
void showProgressBar(int percentage, QString caption = QString::null, int total=100);
void hideProgressBar();
bool isProgressBarCanceled();
+ // sync stuff
+ QString mLocalMachineName;
+ QStringList mExternSyncProfiles;
+ QStringList mSyncProfileNames;
+ bool mAskForPreferences;
+ bool mShowSyncSummary;
+ bool mShowSyncEvents;
+ bool mShowTodoInAgenda;
+ bool mWriteBackExistingOnly;
+ int mSyncAlgoPrefs;
+ int mRingSyncAlgoPrefs;
+ bool mWriteBackFile;
+ int mWriteBackInFuture;
+ QString mPhoneDevice;
+ QString mPhoneConnection;
+ QString mPhoneModel;
+ QString mLastSyncedLocalFile; // save!
+
+
public slots:
void slotSyncMenu( int );
private:
// LR *******************************
@@ -89,13 +108,12 @@ class KSyncManager : public QObject
bool mBlockSaveFlag;
QWidget* mParent;
KSyncInterface* mImplementation;
TargetApp mTargetApp;
- KPimPrefs* mPrefs;
QPopupMenu* mSyncMenu;
QProgressBar* bar;