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