summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncprofile.cpp134
-rw-r--r--libkdepim/ksyncprofile.h12
2 files changed, 84 insertions, 62 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index fcbb326..15dc152 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -27,14 +27,19 @@
#include <kglobal.h>
#include <kdebug.h>
#include "ksyncprofile.h"
-KSyncProfile::KSyncProfile( const char * name): QObject (0, name )
+KSyncProfile::KSyncProfile( const char * identifier): QObject (0, identifier )
{
+ setIdentifier( identifier );
+
+ if (getIdentifier().isEmpty())
+ setIdentifier( "noID" );
+
setDefault();
}
KSyncProfile::~KSyncProfile()
{
}
@@ -60,19 +65,19 @@ KSyncProfile* KSyncProfile::clone()
myClone->setIncludeInRingSync( mIncludeInRingSync );
myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
myClone->setSyncPrefs( mSyncPrefs);
myClone->setIsLocalFileSync( mIsLocalFileSync );
myClone->setIsPhoneSync( mIsPhoneSync );
myClone->setName( "noName" );
+ myClone->setIdentifier( "noID" );
return myClone;
}
void KSyncProfile::setDefault()
{
- mName = "noName";
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");
mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
@@ -85,78 +90,91 @@ void KSyncProfile::setDefault()
mWriteBackFutureWeeks = 12;
mWriteBackFile = true;
mIncludeInRingSync = false;
mIncludeInRingSyncAB = false;
mSyncPrefs = SYNC_PREF_ASK;
mIsLocalFileSync = true;
+ mName = "noName";
mIsPhoneSync = false;
mPhoneDevice = "/dev/ircomm";
mPhoneConnection = "irda";
mPhoneModel = "6310i";
-
}
void KSyncProfile::readConfig(KConfig *config )
{
- config->setGroup(mName);
- QString prefix = "";
- //mName = config->readEntry( prefix+ "Name", mName );
- mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
- mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );;
- 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 );
+ if (config)
+ {
+
+ config->setGroup("SyncProfile_" + mIdentifier);
+
+ mName = config->readEntry( "Name", mName );
+ mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand );
+ mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand );
+ mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile );
+ mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName );
+
+ mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB );
+ mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB );
+ mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB );
+ mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB );
+
+ mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice );
+ mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection );
+ mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel );
+
+ mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync );
+ mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
+ mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
+ mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences );
+ mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting );
+ mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture );
+ mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs );
+ mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks );
+ mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync );
+ mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync );
}
+ else
+ {
+ setDefault();
+ }
+}
+
+void KSyncProfile::deleteConfig(KConfig *config )
+{
+ config->deleteGroup( "SyncProfile_" + mIdentifier );
+}
+
void KSyncProfile::writeConfig( KConfig * config )
{
- config->setGroup(mName );
- QString prefix = "";
- // 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 );
+ config->setGroup("SyncProfile_" + mIdentifier);
+
+ config->writeEntry( "Name", mName );
+ config->writeEntry( "PreSyncCommand",mPreSyncCommand );
+ config->writeEntry( "PostSyncCommand", mPostSyncCommand );
+ config->writeEntry( "LocalTempFile", mLocalTempFile );
+ config->writeEntry( "RemoteFileName", mRemoteFileName );
+
+ config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB );
+ config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB );
+ config->writeEntry( "LocalTempFileAB", mLocalTempFileAB );
+ config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB );
+
+ config->writeEntry( "PhoneDevice", mPhoneDevice );
+ config->writeEntry( "PhoneConnection", mPhoneConnection );
+ config->writeEntry( "PhoneModel", mPhoneModel );
+
+ config->writeEntry( "IncludeInRingSync",mIncludeInRingSync );
+ config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
+ config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
+ config->writeEntry( "AskForPreferences",mAskForPreferences );
+ config->writeEntry( "WriteBackExisting",mWriteBackExisting );
+ config->writeEntry( "WriteBackFuture",mWriteBackFuture );
+ config->writeEntry( "SyncPrefs", mSyncPrefs );
+ config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks);
+ config->writeEntry( "IsLocalFileSync", mIsLocalFileSync );
+ config->writeEntry( "IsPhoneSync", mIsPhoneSync );
}
/*
class KPrefsItemInt : public KPrefsItem {
public:
KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h
index 300f70f..8995def 100644
--- a/libkdepim/ksyncprofile.h
+++ b/libkdepim/ksyncprofile.h
@@ -43,21 +43,23 @@ class KConfig;
setting. Normally you don't have to use this class directly. Use the special
addItem() functions of KPrefs instead. If you subclass this class you will
have to register instances with the function KPrefs::addItem().
*/
class KSyncProfile : public QObject {
public:
- KSyncProfile( const char * name = 0);
+ KSyncProfile( const char * identifier = 0);
~KSyncProfile() ;
KSyncProfile* clone();
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
- void setName( const QString& n ) {mName = n;}
- QString getName( ) { return mName;}
+ void deleteConfig(KConfig *);
+
+ void setIdentifier( const QString& i ) {mIdentifier = i;}
+ QString getIdentifier( ) { return mIdentifier;}
void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;}
QString getPreSyncCommand( ) { return mPreSyncCommand; }
void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;}
QString getPostSyncCommand( ) { return mPostSyncCommand;}
void setLocalTempFile( const QString& n ) { mLocalTempFile= n;}
QString getLocalTempFile( ) { return mLocalTempFile;}
@@ -81,12 +83,14 @@ class KSyncProfile : public QObject {
QString getPhoneModel( ) { return mPhoneModel;}
/*
void set( const QString& n ) { = n;}
QString get( ) { return ;}
*/
+ 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;}
@@ -103,15 +107,15 @@ class KSyncProfile : public QObject {
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 mIdentifier;
QString mPreSyncCommand;
QString mPostSyncCommand;
QString mLocalTempFile;
QString mRemoteFileName;
QString mPreSyncCommandAB;
QString mPostSyncCommandAB;