-rw-r--r-- | libkdepim/ksyncprofile.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index 425285e..fcbb326 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp | |||
@@ -3,171 +3,171 @@ | |||
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( const char * name): QObject (0, name ) | 33 | KSyncProfile::KSyncProfile( const char * name): QObject (0, name ) |
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->setShowSummaryAfterSync( mShowSummaryAfterSync ); | 54 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); |
55 | myClone->setAskForPreferences( mAskForPreferences); | 55 | myClone->setAskForPreferences( mAskForPreferences); |
56 | myClone->setWriteBackExisting(mWriteBackExisting ); | 56 | myClone->setWriteBackExisting(mWriteBackExisting ); |
57 | myClone->setWriteBackFile( mWriteBackFile); | 57 | myClone->setWriteBackFile( mWriteBackFile); |
58 | myClone->setWriteBackFuture( mWriteBackFuture ); | 58 | myClone->setWriteBackFuture( mWriteBackFuture ); |
59 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); | 59 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); |
60 | myClone->setIncludeInRingSync( mIncludeInRingSync ); | 60 | myClone->setIncludeInRingSync( mIncludeInRingSync ); |
61 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); | 61 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); |
62 | myClone->setSyncPrefs( mSyncPrefs); | 62 | myClone->setSyncPrefs( mSyncPrefs); |
63 | myClone->setIsLocalFileSync( mIsLocalFileSync ); | 63 | myClone->setIsLocalFileSync( mIsLocalFileSync ); |
64 | myClone->setIsPhoneSync( mIsPhoneSync ); | 64 | myClone->setIsPhoneSync( mIsPhoneSync ); |
65 | myClone->setName( "noName" ); | 65 | myClone->setName( "noName" ); |
66 | return myClone; | 66 | return myClone; |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | void KSyncProfile::setDefault() | 70 | void KSyncProfile::setDefault() |
71 | { | 71 | { |
72 | mName = "noName"; | 72 | mName = "noName"; |
73 | mPreSyncCommand = i18n("command for downloading remote file to local device"); | 73 | mPreSyncCommand = i18n("command for downloading remote file to local device"); |
74 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); | 74 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); |
75 | mLocalTempFile = "/tmp/mycalendar.ics"; | 75 | mLocalTempFile = "/tmp/mycalendar.ics"; |
76 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; | 76 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; |
77 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); | 77 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); |
78 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); | 78 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); |
79 | mLocalTempFileAB = "/tmp/std.vcf"; | 79 | mLocalTempFileAB = "/tmp/std.vcf"; |
80 | mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; | 80 | mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; |
81 | mShowSummaryAfterSync = true; | 81 | mShowSummaryAfterSync = true; |
82 | mAskForPreferences = true; | 82 | mAskForPreferences = true; |
83 | mWriteBackExisting = false; | 83 | mWriteBackExisting = false; |
84 | mWriteBackFuture = false; | 84 | mWriteBackFuture = false; |
85 | mWriteBackFutureWeeks = 12; | 85 | mWriteBackFutureWeeks = 12; |
86 | mWriteBackFile = true; | 86 | mWriteBackFile = true; |
87 | mIncludeInRingSync = false; | 87 | mIncludeInRingSync = false; |
88 | mIncludeInRingSyncAB = false; | 88 | mIncludeInRingSyncAB = false; |
89 | mSyncPrefs = SYNC_PREF_ASK; | 89 | mSyncPrefs = SYNC_PREF_ASK; |
90 | mIsLocalFileSync = true; | 90 | mIsLocalFileSync = true; |
91 | mIsPhoneSync = false; | 91 | mIsPhoneSync = false; |
92 | mPhoneDevice = "/dev/ircomm"; | 92 | mPhoneDevice = "/dev/ircomm"; |
93 | mPhoneConnection = "irda"; | 93 | mPhoneConnection = "irda"; |
94 | mPhoneModel = "6310i"; | 94 | mPhoneModel = "6310i"; |
95 | 95 | ||
96 | } | 96 | } |
97 | void KSyncProfile::readConfig(KConfig *config ) | 97 | void KSyncProfile::readConfig(KConfig *config ) |
98 | { | 98 | { |
99 | config->setGroup("SyncProfiles"); | 99 | config->setGroup(mName); |
100 | QString prefix = "Profile_"+mName+"_"; | 100 | QString prefix = ""; |
101 | //mName = config->readEntry( prefix+ "Name", mName ); | 101 | //mName = config->readEntry( prefix+ "Name", mName ); |
102 | mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); | 102 | mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); |
103 | mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );; | 103 | mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );; |
104 | mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); | 104 | mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); |
105 | mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); | 105 | mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); |
106 | 106 | ||
107 | mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); | 107 | mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); |
108 | mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); | 108 | mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); |
109 | mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); | 109 | mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); |
110 | mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); | 110 | mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); |
111 | 111 | ||
112 | 112 | ||
113 | mPhoneDevice = config->readEntry( prefix+ "PhoneDevice", mPhoneDevice ); | 113 | mPhoneDevice = config->readEntry( prefix+ "PhoneDevice", mPhoneDevice ); |
114 | mPhoneConnection = config->readEntry( prefix+ "PhoneConnection", mPhoneConnection ); | 114 | mPhoneConnection = config->readEntry( prefix+ "PhoneConnection", mPhoneConnection ); |
115 | mPhoneModel = config->readEntry( prefix+ "PhoneModel", mPhoneModel ); | 115 | mPhoneModel = config->readEntry( prefix+ "PhoneModel", mPhoneModel ); |
116 | 116 | ||
117 | mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); | 117 | mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); |
118 | mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 118 | mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
119 | mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 119 | mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
120 | mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); | 120 | mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); |
121 | mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); | 121 | mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); |
122 | mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); | 122 | mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); |
123 | mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); | 123 | mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); |
124 | mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks ); | 124 | mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks ); |
125 | mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); | 125 | mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); |
126 | mIsPhoneSync= config->readBoolEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); | 126 | mIsPhoneSync= config->readBoolEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); |
127 | } | 127 | } |
128 | void KSyncProfile::writeConfig( KConfig * config ) | 128 | void KSyncProfile::writeConfig( KConfig * config ) |
129 | { | 129 | { |
130 | config->setGroup("SyncProfiles"); | 130 | config->setGroup(mName ); |
131 | QString prefix = "Profile_"+mName+"_"; | 131 | QString prefix = ""; |
132 | // config->writeEntry( prefix+ "Name", mName ); | 132 | // config->writeEntry( prefix+ "Name", mName ); |
133 | config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); | 133 | config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); |
134 | config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); | 134 | config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); |
135 | config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); | 135 | config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); |
136 | config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); | 136 | config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); |
137 | 137 | ||
138 | config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); | 138 | config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); |
139 | config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); | 139 | config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); |
140 | config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); | 140 | config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); |
141 | config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); | 141 | config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); |
142 | 142 | ||
143 | config->writeEntry( prefix+ "PhoneDevice", mPhoneDevice ); | 143 | config->writeEntry( prefix+ "PhoneDevice", mPhoneDevice ); |
144 | config->writeEntry( prefix+ "PhoneConnection", mPhoneConnection ); | 144 | config->writeEntry( prefix+ "PhoneConnection", mPhoneConnection ); |
145 | config->writeEntry( prefix+ "PhoneModel", mPhoneModel ); | 145 | config->writeEntry( prefix+ "PhoneModel", mPhoneModel ); |
146 | 146 | ||
147 | config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); | 147 | config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); |
148 | config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 148 | config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
149 | config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 149 | config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
150 | config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); | 150 | config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); |
151 | config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); | 151 | config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); |
152 | config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); | 152 | config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); |
153 | config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); | 153 | config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); |
154 | config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); | 154 | config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); |
155 | config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); | 155 | config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); |
156 | config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); | 156 | config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); |
157 | } | 157 | } |
158 | 158 | ||
159 | /* | 159 | /* |
160 | class KPrefsItemInt : public KPrefsItem { | 160 | class KPrefsItemInt : public KPrefsItem { |
161 | public: | 161 | public: |
162 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); | 162 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); |
163 | virtual ~KPrefsItemInt() {} | 163 | virtual ~KPrefsItemInt() {} |
164 | 164 | ||
165 | void setDefault(); | 165 | void setDefault(); |
166 | void readConfig(KConfig *); | 166 | void readConfig(KConfig *); |
167 | void writeConfig(KConfig *); | 167 | void writeConfig(KConfig *); |
168 | 168 | ||
169 | private: | 169 | private: |
170 | int *mReference; | 170 | int *mReference; |
171 | int mDefault; | 171 | int mDefault; |
172 | }; | 172 | }; |
173 | */ | 173 | */ |