author | ulf69 <ulf69> | 2004-08-02 17:47:20 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-02 17:47:20 (UTC) |
commit | d8b187d8760766416a9527f3e12789198b30840a (patch) (unidiff) | |
tree | 20a6c1ea46568761e05c9bad7ea7afda503dc092 /libkdepim | |
parent | f6a823824e6a8be3d842e99b43dacd495bb02ba4 (diff) | |
download | kdepimpi-d8b187d8760766416a9527f3e12789198b30840a.zip kdepimpi-d8b187d8760766416a9527f3e12789198b30840a.tar.gz kdepimpi-d8b187d8760766416a9527f3e12789198b30840a.tar.bz2 |
added changes to support Ka/Pi resources in combination of
syncprofiles.
Attention: The old format is not compatible with the new.
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 140 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 16 |
2 files changed, 89 insertions, 67 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index fcbb326..15dc152 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp | |||
@@ -29,11 +29,16 @@ | |||
29 | 29 | ||
30 | #include "ksyncprofile.h" | 30 | #include "ksyncprofile.h" |
31 | 31 | ||
32 | 32 | ||
33 | KSyncProfile::KSyncProfile( const char * name): QObject (0, name ) | 33 | KSyncProfile::KSyncProfile( const char * identifier): QObject (0, identifier ) |
34 | { | 34 | { |
35 | setDefault(); | 35 | setIdentifier( identifier ); |
36 | |||
37 | if (getIdentifier().isEmpty()) | ||
38 | setIdentifier( "noID" ); | ||
39 | |||
40 | setDefault(); | ||
36 | } | 41 | } |
37 | KSyncProfile::~KSyncProfile() | 42 | KSyncProfile::~KSyncProfile() |
38 | { | 43 | { |
39 | 44 | ||
@@ -62,15 +67,15 @@ KSyncProfile* KSyncProfile::clone() | |||
62 | myClone->setSyncPrefs( mSyncPrefs); | 67 | myClone->setSyncPrefs( mSyncPrefs); |
63 | myClone->setIsLocalFileSync( mIsLocalFileSync ); | 68 | myClone->setIsLocalFileSync( mIsLocalFileSync ); |
64 | myClone->setIsPhoneSync( mIsPhoneSync ); | 69 | myClone->setIsPhoneSync( mIsPhoneSync ); |
65 | myClone->setName( "noName" ); | 70 | myClone->setName( "noName" ); |
71 | myClone->setIdentifier( "noID" ); | ||
66 | return myClone; | 72 | return myClone; |
67 | } | 73 | } |
68 | 74 | ||
69 | 75 | ||
70 | void KSyncProfile::setDefault() | 76 | void KSyncProfile::setDefault() |
71 | { | 77 | { |
72 | mName = "noName"; | ||
73 | mPreSyncCommand = i18n("command for downloading remote file to local device"); | 78 | mPreSyncCommand = i18n("command for downloading remote file to local device"); |
74 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); | 79 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); |
75 | mLocalTempFile = "/tmp/mycalendar.ics"; | 80 | mLocalTempFile = "/tmp/mycalendar.ics"; |
76 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; | 81 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; |
@@ -87,82 +92,95 @@ void KSyncProfile::setDefault() | |||
87 | mIncludeInRingSync = false; | 92 | mIncludeInRingSync = false; |
88 | mIncludeInRingSyncAB = false; | 93 | mIncludeInRingSyncAB = false; |
89 | mSyncPrefs = SYNC_PREF_ASK; | 94 | mSyncPrefs = SYNC_PREF_ASK; |
90 | mIsLocalFileSync = true; | 95 | mIsLocalFileSync = true; |
91 | mIsPhoneSync = false; | 96 | mName = "noName"; |
97 | mIsPhoneSync = false; | ||
92 | mPhoneDevice = "/dev/ircomm"; | 98 | mPhoneDevice = "/dev/ircomm"; |
93 | mPhoneConnection = "irda"; | 99 | mPhoneConnection = "irda"; |
94 | mPhoneModel = "6310i"; | 100 | mPhoneModel = "6310i"; |
95 | |||
96 | } | 101 | } |
97 | void KSyncProfile::readConfig(KConfig *config ) | 102 | void KSyncProfile::readConfig(KConfig *config ) |
98 | { | 103 | { |
99 | config->setGroup(mName); | 104 | if (config) |
100 | QString prefix = ""; | 105 | { |
101 | //mName = config->readEntry( prefix+ "Name", mName ); | 106 | |
102 | mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); | 107 | config->setGroup("SyncProfile_" + mIdentifier); |
103 | mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );; | 108 | |
104 | mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); | 109 | mName = config->readEntry( "Name", mName ); |
105 | mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); | 110 | mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); |
106 | 111 | mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); | |
107 | mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); | 112 | mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); |
108 | mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); | 113 | mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); |
109 | mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); | 114 | |
110 | mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); | 115 | mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
111 | 116 | mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); | |
112 | 117 | mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); | |
113 | mPhoneDevice = config->readEntry( prefix+ "PhoneDevice", mPhoneDevice ); | 118 | mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
114 | mPhoneConnection = config->readEntry( prefix+ "PhoneConnection", mPhoneConnection ); | 119 | |
115 | mPhoneModel = config->readEntry( prefix+ "PhoneModel", mPhoneModel ); | 120 | mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); |
116 | 121 | mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); | |
117 | mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); | 122 | mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); |
118 | mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 123 | |
119 | mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 124 | mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); |
120 | mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); | 125 | mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
121 | mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); | 126 | mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
122 | mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); | 127 | mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); |
123 | mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); | 128 | mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); |
124 | mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks ); | 129 | mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); |
125 | mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); | 130 | mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); |
126 | mIsPhoneSync= config->readBoolEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); | 131 | mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); |
132 | mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); | ||
133 | mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | setDefault(); | ||
138 | } | ||
127 | } | 139 | } |
140 | |||
141 | void KSyncProfile::deleteConfig(KConfig *config ) | ||
142 | { | ||
143 | config->deleteGroup( "SyncProfile_" + mIdentifier ); | ||
144 | } | ||
145 | |||
128 | void KSyncProfile::writeConfig( KConfig * config ) | 146 | void KSyncProfile::writeConfig( KConfig * config ) |
129 | { | 147 | { |
130 | config->setGroup(mName ); | 148 | config->setGroup("SyncProfile_" + mIdentifier); |
131 | QString prefix = ""; | 149 | |
132 | // config->writeEntry( prefix+ "Name", mName ); | 150 | config->writeEntry( "Name", mName ); |
133 | config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); | 151 | config->writeEntry( "PreSyncCommand",mPreSyncCommand ); |
134 | config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); | 152 | config->writeEntry( "PostSyncCommand", mPostSyncCommand ); |
135 | config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); | 153 | config->writeEntry( "LocalTempFile", mLocalTempFile ); |
136 | config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); | 154 | config->writeEntry( "RemoteFileName", mRemoteFileName ); |
137 | 155 | ||
138 | config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); | 156 | config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
139 | config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); | 157 | config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); |
140 | config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); | 158 | config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); |
141 | config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); | 159 | config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
142 | 160 | ||
143 | config->writeEntry( prefix+ "PhoneDevice", mPhoneDevice ); | 161 | config->writeEntry( "PhoneDevice", mPhoneDevice ); |
144 | config->writeEntry( prefix+ "PhoneConnection", mPhoneConnection ); | 162 | config->writeEntry( "PhoneConnection", mPhoneConnection ); |
145 | config->writeEntry( prefix+ "PhoneModel", mPhoneModel ); | 163 | config->writeEntry( "PhoneModel", mPhoneModel ); |
146 | 164 | ||
147 | config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); | 165 | config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); |
148 | config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 166 | config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
149 | config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 167 | config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
150 | config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); | 168 | config->writeEntry( "AskForPreferences",mAskForPreferences ); |
151 | config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); | 169 | config->writeEntry( "WriteBackExisting",mWriteBackExisting ); |
152 | config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); | 170 | config->writeEntry( "WriteBackFuture",mWriteBackFuture ); |
153 | config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); | 171 | config->writeEntry( "SyncPrefs", mSyncPrefs ); |
154 | config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); | 172 | config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); |
155 | config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); | 173 | config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); |
156 | config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); | 174 | config->writeEntry( "IsPhoneSync", mIsPhoneSync ); |
157 | } | 175 | } |
158 | 176 | ||
159 | /* | 177 | /* |
160 | class KPrefsItemInt : public KPrefsItem { | 178 | class KPrefsItemInt : public KPrefsItem { |
161 | public: | 179 | public: |
162 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); | 180 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); |
163 | virtual ~KPrefsItemInt() {} | 181 | virtual ~KPrefsItemInt() {} |
164 | 182 | ||
165 | void setDefault(); | 183 | void setDefault(); |
166 | void readConfig(KConfig *); | 184 | void readConfig(KConfig *); |
167 | void writeConfig(KConfig *); | 185 | void writeConfig(KConfig *); |
168 | 186 | ||
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 300f70f..8995def 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h | |||
@@ -36,26 +36,28 @@ class KConfig; | |||
36 | /** | 36 | /** |
37 | @short Class for storing a preferences setting | 37 | @short Class for storing a preferences setting |
38 | @author Cornelius Schumacher | 38 | @author Cornelius Schumacher |
39 | @see KPref | 39 | @see KPref |
40 | 40 | ||
41 | This class represents one preferences setting as used by @ref KPrefs. | 41 | This class represents one preferences setting as used by @ref KPrefs. |
42 | Subclasses of KPrefsItem implement storage functions for a certain type of | 42 | Subclasses of KPrefsItem implement storage functions for a certain type of |
43 | setting. Normally you don't have to use this class directly. Use the special | 43 | setting. Normally you don't have to use this class directly. Use the special |
44 | addItem() functions of KPrefs instead. If you subclass this class you will | 44 | addItem() functions of KPrefs instead. If you subclass this class you will |
45 | have to register instances with the function KPrefs::addItem(). | 45 | have to register instances with the function KPrefs::addItem(). |
46 | */ | 46 | */ |
47 | class KSyncProfile : public QObject { | 47 | class KSyncProfile : public QObject { |
48 | public: | 48 | public: |
49 | KSyncProfile( const char * name = 0); | 49 | KSyncProfile( const char * identifier = 0); |
50 | ~KSyncProfile() ; | 50 | ~KSyncProfile() ; |
51 | 51 | ||
52 | KSyncProfile* clone(); | 52 | KSyncProfile* clone(); |
53 | void setDefault(); | 53 | void setDefault(); |
54 | void readConfig(KConfig *); | 54 | void readConfig(KConfig *); |
55 | void writeConfig(KConfig *); | 55 | void writeConfig(KConfig *); |
56 | void setName( const QString& n ) {mName = n;} | 56 | void deleteConfig(KConfig *); |
57 | QString getName( ) { return mName;} | 57 | |
58 | void setIdentifier( const QString& i ) {mIdentifier = i;} | ||
59 | QString getIdentifier( ) { return mIdentifier;} | ||
58 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} | 60 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} |
59 | QString getPreSyncCommand( ) { return mPreSyncCommand; } | 61 | QString getPreSyncCommand( ) { return mPreSyncCommand; } |
60 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} | 62 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} |
61 | QString getPostSyncCommand( ) { return mPostSyncCommand;} | 63 | QString getPostSyncCommand( ) { return mPostSyncCommand;} |
@@ -83,8 +85,10 @@ class KSyncProfile : public QObject { | |||
83 | void set( const QString& n ) { = n;} | 85 | void set( const QString& n ) { = n;} |
84 | QString get( ) { return ;} | 86 | QString get( ) { return ;} |
85 | */ | 87 | */ |
86 | 88 | ||
89 | void setName( const QString& n ) {mName = n;} | ||
90 | QString getName( ) { return mName;} | ||
87 | void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} | 91 | void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} |
88 | bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} | 92 | bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} |
89 | void setAskForPreferences( bool b ) { mAskForPreferences= b;} | 93 | void setAskForPreferences( bool b ) { mAskForPreferences= b;} |
90 | bool getAskForPreferences( ) { return mAskForPreferences;} | 94 | bool getAskForPreferences( ) { return mAskForPreferences;} |
@@ -105,11 +109,11 @@ class KSyncProfile : public QObject { | |||
105 | void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} | 109 | void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} |
106 | bool getIsLocalFileSync( ) { return mIsLocalFileSync;} | 110 | bool getIsLocalFileSync( ) { return mIsLocalFileSync;} |
107 | void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} | 111 | void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} |
108 | bool getIsPhoneSync( ) { return mIsPhoneSync;} | 112 | bool getIsPhoneSync( ) { return mIsPhoneSync;} |
109 | |||
110 | private: | 113 | private: |
111 | QString mName; | 114 | QString mName; |
115 | QString mIdentifier; | ||
112 | QString mPreSyncCommand; | 116 | QString mPreSyncCommand; |
113 | QString mPostSyncCommand; | 117 | QString mPostSyncCommand; |
114 | QString mLocalTempFile; | 118 | QString mLocalTempFile; |
115 | QString mRemoteFileName; | 119 | QString mRemoteFileName; |