summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprofile.cpp
authorzautrix <zautrix>2004-08-07 16:10:09 (UTC)
committer zautrix <zautrix>2004-08-07 16:10:09 (UTC)
commitef8a09ce74ad3f0a51484d03fdf009bd5b3677bf (patch) (unidiff)
tree7ff6c37e8ad6b7f1dbd672d28de6fcea916caf8f /libkdepim/ksyncprofile.cpp
parenta9a774e19c02f03de948b6064804b913abd4f08b (diff)
downloadkdepimpi-ef8a09ce74ad3f0a51484d03fdf009bd5b3677bf.zip
kdepimpi-ef8a09ce74ad3f0a51484d03fdf009bd5b3677bf.tar.gz
kdepimpi-ef8a09ce74ad3f0a51484d03fdf009bd5b3677bf.tar.bz2
Fix of the syncprofiles
Diffstat (limited to 'libkdepim/ksyncprofile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprofile.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index 15dc152..e7c35fb 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -1,191 +1,186 @@
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
33KSyncProfile::KSyncProfile( const char * identifier): QObject (0, identifier ) 33KSyncProfile::KSyncProfile(): QObject ()
34{ 34{
35 setIdentifier( identifier );
36
37 if (getIdentifier().isEmpty())
38 setIdentifier( "noID" );
39
40 setDefault(); 35 setDefault();
41} 36}
42KSyncProfile::~KSyncProfile() 37KSyncProfile::~KSyncProfile()
43{ 38{
44 39
45} 40}
46 41
47 42
48KSyncProfile* KSyncProfile::clone() 43KSyncProfile* KSyncProfile::clone()
49{ 44{
50 KSyncProfile* myClone = new KSyncProfile(); 45 KSyncProfile* myClone = new KSyncProfile();
51 myClone->setPreSyncCommand( mPreSyncCommand ); 46 myClone->setPreSyncCommand( mPreSyncCommand );
52 myClone->setPostSyncCommand( mPostSyncCommand ); 47 myClone->setPostSyncCommand( mPostSyncCommand );
53 myClone->setLocalTempFile( mLocalTempFile); 48 myClone->setLocalTempFile( mLocalTempFile);
54 myClone->setRemoteFileName( mRemoteFileName ); 49 myClone->setRemoteFileName( mRemoteFileName );
55 myClone->setPreSyncCommandAB( mPreSyncCommandAB ); 50 myClone->setPreSyncCommandAB( mPreSyncCommandAB );
56 myClone->setPostSyncCommandAB( mPostSyncCommandAB ); 51 myClone->setPostSyncCommandAB( mPostSyncCommandAB );
57 myClone->setLocalTempFileAB( mLocalTempFileAB); 52 myClone->setLocalTempFileAB( mLocalTempFileAB);
58 myClone->setRemoteFileNameAB( mRemoteFileNameAB ); 53 myClone->setRemoteFileNameAB( mRemoteFileNameAB );
59 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); 54 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
60 myClone->setAskForPreferences( mAskForPreferences); 55 myClone->setAskForPreferences( mAskForPreferences);
61 myClone->setWriteBackExisting(mWriteBackExisting ); 56 myClone->setWriteBackExisting(mWriteBackExisting );
62 myClone->setWriteBackFile( mWriteBackFile); 57 myClone->setWriteBackFile( mWriteBackFile);
63 myClone->setWriteBackFuture( mWriteBackFuture ); 58 myClone->setWriteBackFuture( mWriteBackFuture );
64 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); 59 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
65 myClone->setIncludeInRingSync( mIncludeInRingSync ); 60 myClone->setIncludeInRingSync( mIncludeInRingSync );
66 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); 61 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
67 myClone->setSyncPrefs( mSyncPrefs); 62 myClone->setSyncPrefs( mSyncPrefs);
68 myClone->setIsLocalFileSync( mIsLocalFileSync ); 63 myClone->setIsLocalFileSync( mIsLocalFileSync );
69 myClone->setIsPhoneSync( mIsPhoneSync ); 64 myClone->setIsPhoneSync( mIsPhoneSync );
70 myClone->setName( "noName" ); 65 myClone->setName( "noName" );
71 myClone->setIdentifier( "noID" ); 66 //myClone->setIdentifier( "noID" );
72 return myClone; 67 return myClone;
73} 68}
74 69
75 70
76void KSyncProfile::setDefault() 71void KSyncProfile::setDefault()
77{ 72{
78 mPreSyncCommand = i18n("command for downloading remote file to local device"); 73 mPreSyncCommand = i18n("command for downloading remote file to local device");
79 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 74 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
80 mLocalTempFile = "/tmp/mycalendar.ics"; 75 mLocalTempFile = "/tmp/mycalendar.ics";
81 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; 76 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
82 mPreSyncCommandAB = i18n("command for downloading remote file to local device"); 77 mPreSyncCommandAB = i18n("command for downloading remote file to local device");
83 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); 78 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
84 mLocalTempFileAB = "/tmp/std.vcf"; 79 mLocalTempFileAB = "/tmp/std.vcf";
85 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; 80 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf";
86 mShowSummaryAfterSync = true; 81 mShowSummaryAfterSync = true;
87 mAskForPreferences = true; 82 mAskForPreferences = true;
88 mWriteBackExisting = false; 83 mWriteBackExisting = false;
89 mWriteBackFuture = false; 84 mWriteBackFuture = false;
90 mWriteBackFutureWeeks = 12; 85 mWriteBackFutureWeeks = 12;
91 mWriteBackFile = true; 86 mWriteBackFile = true;
92 mIncludeInRingSync = false; 87 mIncludeInRingSync = false;
93 mIncludeInRingSyncAB = false; 88 mIncludeInRingSyncAB = false;
94 mSyncPrefs = SYNC_PREF_ASK; 89 mSyncPrefs = SYNC_PREF_ASK;
95 mIsLocalFileSync = true; 90 mIsLocalFileSync = true;
96 mName = "noName"; 91 mName = "noName";
97 mIsPhoneSync = false; 92 mIsPhoneSync = false;
98 mPhoneDevice = "/dev/ircomm"; 93 mPhoneDevice = "/dev/ircomm";
99 mPhoneConnection = "irda"; 94 mPhoneConnection = "irda";
100 mPhoneModel = "6310i"; 95 mPhoneModel = "6310i";
101} 96}
102void KSyncProfile::readConfig(KConfig *config ) 97void KSyncProfile::readConfig(KConfig *config )
103{ 98{
104 if (config) 99 if (config)
105 { 100 {
106 101
107 config->setGroup("SyncProfile_" + mIdentifier); 102 config->setGroup( mName );
108 103
109 mName = config->readEntry( "Name", mName ); 104 mName = config->readEntry( "Name", mName );
110 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); 105 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand );
111 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); 106 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand );
112 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); 107 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile );
113 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); 108 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName );
114 109
115 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 110 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB );
116 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 111 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB );
117 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); 112 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB );
118 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 113 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB );
119 114
120 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); 115 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice );
121 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); 116 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection );
122 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); 117 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel );
123 118
124 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); 119 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync );
125 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 120 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
126 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); 121 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
127 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); 122 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences );
128 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); 123 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting );
129 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); 124 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture );
130 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); 125 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs );
131 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); 126 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks );
132 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); 127 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync );
133 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); 128 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync );
134 } 129 }
135 else 130 else
136 { 131 {
137 setDefault(); 132 setDefault();
138 } 133 }
139} 134}
140 135
141void KSyncProfile::deleteConfig(KConfig *config ) 136void KSyncProfile::deleteConfig(KConfig *config )
142{ 137{
143 config->deleteGroup( "SyncProfile_" + mIdentifier ); 138 config->deleteGroup( mName );
144} 139}
145 140
146void KSyncProfile::writeConfig( KConfig * config ) 141void KSyncProfile::writeConfig( KConfig * config )
147{ 142{
148 config->setGroup("SyncProfile_" + mIdentifier); 143 config->setGroup(mName);
149 144
150 config->writeEntry( "Name", mName ); 145 config->writeEntry( "Name", mName );
151 config->writeEntry( "PreSyncCommand",mPreSyncCommand ); 146 config->writeEntry( "PreSyncCommand",mPreSyncCommand );
152 config->writeEntry( "PostSyncCommand", mPostSyncCommand ); 147 config->writeEntry( "PostSyncCommand", mPostSyncCommand );
153 config->writeEntry( "LocalTempFile", mLocalTempFile ); 148 config->writeEntry( "LocalTempFile", mLocalTempFile );
154 config->writeEntry( "RemoteFileName", mRemoteFileName ); 149 config->writeEntry( "RemoteFileName", mRemoteFileName );
155 150
156 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 151 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB );
157 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 152 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB );
158 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); 153 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB );
159 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 154 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB );
160 155
161 config->writeEntry( "PhoneDevice", mPhoneDevice ); 156 config->writeEntry( "PhoneDevice", mPhoneDevice );
162 config->writeEntry( "PhoneConnection", mPhoneConnection ); 157 config->writeEntry( "PhoneConnection", mPhoneConnection );
163 config->writeEntry( "PhoneModel", mPhoneModel ); 158 config->writeEntry( "PhoneModel", mPhoneModel );
164 159
165 config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); 160 config->writeEntry( "IncludeInRingSync",mIncludeInRingSync );
166 config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 161 config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
167 config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); 162 config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
168 config->writeEntry( "AskForPreferences",mAskForPreferences ); 163 config->writeEntry( "AskForPreferences",mAskForPreferences );
169 config->writeEntry( "WriteBackExisting",mWriteBackExisting ); 164 config->writeEntry( "WriteBackExisting",mWriteBackExisting );
170 config->writeEntry( "WriteBackFuture",mWriteBackFuture ); 165 config->writeEntry( "WriteBackFuture",mWriteBackFuture );
171 config->writeEntry( "SyncPrefs", mSyncPrefs ); 166 config->writeEntry( "SyncPrefs", mSyncPrefs );
172 config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); 167 config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks);
173 config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); 168 config->writeEntry( "IsLocalFileSync", mIsLocalFileSync );
174 config->writeEntry( "IsPhoneSync", mIsPhoneSync ); 169 config->writeEntry( "IsPhoneSync", mIsPhoneSync );
175} 170}
176 171
177/* 172/*
178class KPrefsItemInt : public KPrefsItem { 173class KPrefsItemInt : public KPrefsItem {
179 public: 174 public:
180 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); 175 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
181 virtual ~KPrefsItemInt() {} 176 virtual ~KPrefsItemInt() {}
182 177
183 void setDefault(); 178 void setDefault();
184 void readConfig(KConfig *); 179 void readConfig(KConfig *);
185 void writeConfig(KConfig *); 180 void writeConfig(KConfig *);
186 181
187 private: 182 private:
188 int *mReference; 183 int *mReference;
189 int mDefault; 184 int mDefault;
190}; 185};
191*/ 186*/