-rw-r--r-- | libkdepim/ksyncprofile.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index c599208..a43ebe2 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp | |||
@@ -1,177 +1,199 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include <qcolor.h> | 23 | #include <qcolor.h> |
24 | 24 | ||
25 | #include <kconfig.h> | 25 | #include <kconfig.h> |
26 | #include <kstandarddirs.h> | 26 | #include <kstandarddirs.h> |
27 | #include <kglobal.h> | 27 | #include <kglobal.h> |
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include "ksyncprofile.h" | 30 | #include "ksyncprofile.h" |
31 | 31 | ||
32 | 32 | ||
33 | KSyncProfile::KSyncProfile(): QObject () | 33 | KSyncProfile::KSyncProfile(): QObject () |
34 | { | 34 | { |
35 | setDefault(); | 35 | setDefault(); |
36 | } | 36 | } |
37 | KSyncProfile::~KSyncProfile() | 37 | KSyncProfile::~KSyncProfile() |
38 | { | 38 | { |
39 | 39 | ||
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | KSyncProfile* KSyncProfile::clone() | 43 | KSyncProfile* KSyncProfile::clone() |
44 | { | 44 | { |
45 | KSyncProfile* myClone = new KSyncProfile(); | 45 | KSyncProfile* myClone = new KSyncProfile(); |
46 | myClone->setPreSyncCommand( mPreSyncCommand ); | 46 | myClone->setPreSyncCommand( mPreSyncCommand ); |
47 | myClone->setPostSyncCommand( mPostSyncCommand ); | 47 | myClone->setPostSyncCommand( mPostSyncCommand ); |
48 | myClone->setLocalTempFile( mLocalTempFile); | 48 | myClone->setLocalTempFile( mLocalTempFile); |
49 | myClone->setRemoteFileName( mRemoteFileName ); | 49 | myClone->setRemoteFileName( mRemoteFileName ); |
50 | myClone->setPreSyncCommandAB( mPreSyncCommandAB ); | 50 | myClone->setPreSyncCommandAB( mPreSyncCommandAB ); |
51 | myClone->setPostSyncCommandAB( mPostSyncCommandAB ); | 51 | myClone->setPostSyncCommandAB( mPostSyncCommandAB ); |
52 | myClone->setLocalTempFileAB( mLocalTempFileAB); | 52 | myClone->setLocalTempFileAB( mLocalTempFileAB); |
53 | myClone->setRemoteFileNameAB( mRemoteFileNameAB ); | 53 | myClone->setRemoteFileNameAB( mRemoteFileNameAB ); |
54 | myClone->setPreSyncCommandPWM( mPreSyncCommandPWM ); | ||
55 | myClone->setPostSyncCommandPWM( mPostSyncCommandPWM ); | ||
56 | myClone->setLocalTempFilePWM( mLocalTempFilePWM); | ||
57 | myClone->setRemoteFileNamePWM( mRemoteFileNamePWM ); | ||
54 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); | 58 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); |
55 | myClone->setAskForPreferences( mAskForPreferences); | 59 | myClone->setAskForPreferences( mAskForPreferences); |
56 | myClone->setWriteBackExisting(mWriteBackExisting ); | 60 | myClone->setWriteBackExisting(mWriteBackExisting ); |
57 | myClone->setWriteBackFile( mWriteBackFile); | 61 | myClone->setWriteBackFile( mWriteBackFile); |
58 | myClone->setWriteBackFuture( mWriteBackFuture ); | 62 | myClone->setWriteBackFuture( mWriteBackFuture ); |
59 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); | 63 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); |
60 | myClone->setIncludeInRingSync( mIncludeInRingSync ); | 64 | myClone->setIncludeInRingSync( mIncludeInRingSync ); |
61 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); | 65 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); |
66 | myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM ); | ||
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->setWriteContactToSIM( mWriteContactToSIM ); | 70 | myClone->setWriteContactToSIM( mWriteContactToSIM ); |
66 | myClone->setName( "noName" ); | 71 | myClone->setName( "noName" ); |
67 | //myClone->setIdentifier( "noID" ); | 72 | //myClone->setIdentifier( "noID" ); |
68 | return myClone; | 73 | return myClone; |
69 | } | 74 | } |
70 | 75 | ||
71 | 76 | ||
72 | void KSyncProfile::setDefault() | 77 | void KSyncProfile::setDefault() |
73 | { | 78 | { |
74 | mPreSyncCommand = i18n("command for downloading remote file to local device"); | 79 | mPreSyncCommand = i18n("command for downloading remote file to local device"); |
75 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); | 80 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); |
76 | mLocalTempFile = "/tmp/mycalendar.ics"; | 81 | mLocalTempFile = "/tmp/mycalendar.ics"; |
77 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; | 82 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; |
78 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); | 83 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); |
79 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); | 84 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); |
80 | mLocalTempFileAB = "/tmp/std.vcf"; | 85 | mLocalTempFileAB = "/tmp/std.vcf"; |
81 | mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; | 86 | mRemoteFileNamePWM = "/home/polo/kdepim/apps/kabc/localfile.vcf"; |
87 | mPreSyncCommandPWM = i18n("command for downloading remote file to local device"); | ||
88 | mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device"); | ||
89 | mLocalTempFilePWM = "/tmp/passwords.pwm"; | ||
90 | mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm"; | ||
82 | mShowSummaryAfterSync = true; | 91 | mShowSummaryAfterSync = true; |
83 | mAskForPreferences = true; | 92 | mAskForPreferences = true; |
84 | mWriteBackExisting = false; | 93 | mWriteBackExisting = false; |
85 | mWriteBackFuture = false; | 94 | mWriteBackFuture = false; |
86 | mWriteBackFutureWeeks = 12; | 95 | mWriteBackFutureWeeks = 12; |
87 | mWriteBackFile = true; | 96 | mWriteBackFile = true; |
88 | mIncludeInRingSync = false; | 97 | mIncludeInRingSync = false; |
89 | mIncludeInRingSyncAB = false; | 98 | mIncludeInRingSyncAB = false; |
99 | mIncludeInRingSyncPWM = false; | ||
90 | mSyncPrefs = SYNC_PREF_ASK; | 100 | mSyncPrefs = SYNC_PREF_ASK; |
91 | mIsLocalFileSync = true; | 101 | mIsLocalFileSync = true; |
92 | mName = "noName"; | 102 | mName = "noName"; |
93 | mIsPhoneSync = false; | 103 | mIsPhoneSync = false; |
94 | mWriteContactToSIM = false; | 104 | mWriteContactToSIM = false; |
95 | mPhoneDevice = "/dev/ircomm"; | 105 | mPhoneDevice = "/dev/ircomm"; |
96 | mPhoneConnection = "irda"; | 106 | mPhoneConnection = "irda"; |
97 | mPhoneModel = "6310i"; | 107 | mPhoneModel = "6310i"; |
98 | } | 108 | } |
99 | void KSyncProfile::readConfig(KConfig *config ) | 109 | void KSyncProfile::readConfig(KConfig *config ) |
100 | { | 110 | { |
101 | if (config) | 111 | if (config) |
102 | { | 112 | { |
103 | 113 | ||
104 | config->setGroup( mName ); | 114 | config->setGroup( mName ); |
105 | 115 | ||
106 | mName = config->readEntry( "Name", mName ); | 116 | mName = config->readEntry( "Name", mName ); |
107 | mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); | 117 | mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); |
108 | mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); | 118 | mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); |
109 | mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); | 119 | mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); |
110 | mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); | 120 | mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); |
111 | 121 | ||
112 | mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); | 122 | mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
113 | mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); | 123 | mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); |
114 | mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); | 124 | mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); |
115 | mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); | 125 | mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
116 | 126 | ||
127 | mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); | ||
128 | mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); | ||
129 | mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM ); | ||
130 | mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); | ||
131 | |||
117 | mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); | 132 | mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); |
118 | mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); | 133 | mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); |
119 | mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); | 134 | mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); |
120 | 135 | ||
121 | mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); | 136 | mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); |
122 | mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 137 | mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
138 | mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); | ||
123 | mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 139 | mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
124 | mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); | 140 | mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); |
125 | mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); | 141 | mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); |
126 | mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); | 142 | mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); |
127 | mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); | 143 | mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); |
128 | mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); | 144 | mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); |
129 | mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); | 145 | mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); |
130 | mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); | 146 | mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); |
131 | mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); | 147 | mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); |
132 | mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); | 148 | mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); |
133 | } | 149 | } |
134 | else | 150 | else |
135 | { | 151 | { |
136 | setDefault(); | 152 | setDefault(); |
137 | } | 153 | } |
138 | } | 154 | } |
139 | 155 | ||
140 | void KSyncProfile::deleteConfig(KConfig *config ) | 156 | void KSyncProfile::deleteConfig(KConfig *config ) |
141 | { | 157 | { |
142 | config->deleteGroup( mName ); | 158 | config->deleteGroup( mName ); |
143 | } | 159 | } |
144 | 160 | ||
145 | void KSyncProfile::writeConfig( KConfig * config ) | 161 | void KSyncProfile::writeConfig( KConfig * config ) |
146 | { | 162 | { |
147 | config->setGroup(mName); | 163 | config->setGroup(mName); |
148 | 164 | ||
149 | config->writeEntry( "Name", mName ); | 165 | config->writeEntry( "Name", mName ); |
150 | config->writeEntry( "PreSyncCommand",mPreSyncCommand ); | 166 | config->writeEntry( "PreSyncCommand",mPreSyncCommand ); |
151 | config->writeEntry( "PostSyncCommand", mPostSyncCommand ); | 167 | config->writeEntry( "PostSyncCommand", mPostSyncCommand ); |
152 | config->writeEntry( "LocalTempFile", mLocalTempFile ); | 168 | config->writeEntry( "LocalTempFile", mLocalTempFile ); |
153 | config->writeEntry( "RemoteFileName", mRemoteFileName ); | 169 | config->writeEntry( "RemoteFileName", mRemoteFileName ); |
154 | 170 | ||
155 | config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); | 171 | config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
156 | config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); | 172 | config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); |
157 | config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); | 173 | config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); |
158 | config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); | 174 | config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
159 | 175 | ||
176 | config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); | ||
177 | config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); | ||
178 | config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM ); | ||
179 | config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); | ||
180 | |||
160 | config->writeEntry( "PhoneDevice", mPhoneDevice ); | 181 | config->writeEntry( "PhoneDevice", mPhoneDevice ); |
161 | config->writeEntry( "PhoneConnection", mPhoneConnection ); | 182 | config->writeEntry( "PhoneConnection", mPhoneConnection ); |
162 | config->writeEntry( "PhoneModel", mPhoneModel ); | 183 | config->writeEntry( "PhoneModel", mPhoneModel ); |
163 | 184 | ||
164 | config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); | 185 | config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); |
165 | config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 186 | config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
187 | config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); | ||
166 | config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 188 | config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
167 | config->writeEntry( "AskForPreferences",mAskForPreferences ); | 189 | config->writeEntry( "AskForPreferences",mAskForPreferences ); |
168 | config->writeEntry( "WriteBackExisting",mWriteBackExisting ); | 190 | config->writeEntry( "WriteBackExisting",mWriteBackExisting ); |
169 | config->writeEntry( "WriteBackFuture",mWriteBackFuture ); | 191 | config->writeEntry( "WriteBackFuture",mWriteBackFuture ); |
170 | config->writeEntry( "WriteBackFile",mWriteBackFile ); | 192 | config->writeEntry( "WriteBackFile",mWriteBackFile ); |
171 | config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); | 193 | config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); |
172 | config->writeEntry( "SyncPrefs", mSyncPrefs ); | 194 | config->writeEntry( "SyncPrefs", mSyncPrefs ); |
173 | config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); | 195 | config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); |
174 | config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); | 196 | config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); |
175 | config->writeEntry( "IsPhoneSync", mIsPhoneSync ); | 197 | config->writeEntry( "IsPhoneSync", mIsPhoneSync ); |
176 | } | 198 | } |
177 | 199 | ||