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