summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprofile.cpp
authorulf69 <ulf69>2004-08-02 17:47:20 (UTC)
committer ulf69 <ulf69>2004-08-02 17:47:20 (UTC)
commitd8b187d8760766416a9527f3e12789198b30840a (patch) (unidiff)
tree20a6c1ea46568761e05c9bad7ea7afda503dc092 /libkdepim/ksyncprofile.cpp
parentf6a823824e6a8be3d842e99b43dacd495bb02ba4 (diff)
downloadkdepimpi-d8b187d8760766416a9527f3e12789198b30840a.zip
kdepimpi-d8b187d8760766416a9527f3e12789198b30840a.tar.gz
kdepimpi-d8b187d8760766416a9527f3e12789198b30840a.tar.bz2
added changes to support Ka/Pi resources in combination of
syncprofiles. Attention: The old format is not compatible with the new.
Diffstat (limited to 'libkdepim/ksyncprofile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprofile.cpp140
1 files changed, 79 insertions, 61 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index fcbb326..15dc152 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -30,9 +30,14 @@
30#include "ksyncprofile.h" 30#include "ksyncprofile.h"
31 31
32 32
33KSyncProfile::KSyncProfile( const char * name): QObject (0, name ) 33KSyncProfile::KSyncProfile( const char * identifier): QObject (0, identifier )
34{ 34{
35 setDefault(); 35 setIdentifier( identifier );
36
37 if (getIdentifier().isEmpty())
38 setIdentifier( "noID" );
39
40 setDefault();
36} 41}
37KSyncProfile::~KSyncProfile() 42KSyncProfile::~KSyncProfile()
38{ 43{
@@ -63,13 +68,13 @@ KSyncProfile* KSyncProfile::clone()
63 myClone->setIsLocalFileSync( mIsLocalFileSync ); 68 myClone->setIsLocalFileSync( mIsLocalFileSync );
64 myClone->setIsPhoneSync( mIsPhoneSync ); 69 myClone->setIsPhoneSync( mIsPhoneSync );
65 myClone->setName( "noName" ); 70 myClone->setName( "noName" );
71 myClone->setIdentifier( "noID" );
66 return myClone; 72 return myClone;
67} 73}
68 74
69 75
70void KSyncProfile::setDefault() 76void KSyncProfile::setDefault()
71{ 77{
72 mName = "noName";
73 mPreSyncCommand = i18n("command for downloading remote file to local device"); 78 mPreSyncCommand = i18n("command for downloading remote file to local device");
74 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 79 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
75 mLocalTempFile = "/tmp/mycalendar.ics"; 80 mLocalTempFile = "/tmp/mycalendar.ics";
@@ -88,72 +93,85 @@ void KSyncProfile::setDefault()
88 mIncludeInRingSyncAB = false; 93 mIncludeInRingSyncAB = false;
89 mSyncPrefs = SYNC_PREF_ASK; 94 mSyncPrefs = SYNC_PREF_ASK;
90 mIsLocalFileSync = true; 95 mIsLocalFileSync = true;
91 mIsPhoneSync = false; 96 mName = "noName";
97 mIsPhoneSync = false;
92 mPhoneDevice = "/dev/ircomm"; 98 mPhoneDevice = "/dev/ircomm";
93 mPhoneConnection = "irda"; 99 mPhoneConnection = "irda";
94 mPhoneModel = "6310i"; 100 mPhoneModel = "6310i";
95
96} 101}
97void KSyncProfile::readConfig(KConfig *config ) 102void KSyncProfile::readConfig(KConfig *config )
98{ 103{
99 config->setGroup(mName); 104 if (config)
100 QString prefix = ""; 105 {
101 //mName = config->readEntry( prefix+ "Name", mName ); 106
102 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 107 config->setGroup("SyncProfile_" + mIdentifier);
103 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );; 108
104 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); 109 mName = config->readEntry( "Name", mName );
105 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); 110 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand );
106 111 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand );
107 mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); 112 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile );
108 mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); 113 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName );
109 mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); 114
110 mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); 115 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB );
111 116 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB );
112 117 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB );
113 mPhoneDevice = config->readEntry( prefix+ "PhoneDevice", mPhoneDevice ); 118 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB );
114 mPhoneConnection = config->readEntry( prefix+ "PhoneConnection", mPhoneConnection ); 119
115 mPhoneModel = config->readEntry( prefix+ "PhoneModel", mPhoneModel ); 120 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice );
116 121 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection );
117 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); 122 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel );
118 mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 123
119 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 124 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync );
120 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); 125 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
121 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 126 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
122 mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); 127 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences );
123 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); 128 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting );
124 mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks ); 129 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture );
125 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 130 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs );
126 mIsPhoneSync= config->readBoolEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); 131 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks );
132 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync );
133 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync );
134 }
135 else
136 {
137 setDefault();
138 }
127} 139}
140
141void KSyncProfile::deleteConfig(KConfig *config )
142{
143 config->deleteGroup( "SyncProfile_" + mIdentifier );
144}
145
128void KSyncProfile::writeConfig( KConfig * config ) 146void KSyncProfile::writeConfig( KConfig * config )
129{ 147{
130 config->setGroup(mName ); 148 config->setGroup("SyncProfile_" + mIdentifier);
131 QString prefix = ""; 149
132 // config->writeEntry( prefix+ "Name", mName ); 150 config->writeEntry( "Name", mName );
133 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 151 config->writeEntry( "PreSyncCommand",mPreSyncCommand );
134 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); 152 config->writeEntry( "PostSyncCommand", mPostSyncCommand );
135 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); 153 config->writeEntry( "LocalTempFile", mLocalTempFile );
136 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); 154 config->writeEntry( "RemoteFileName", mRemoteFileName );
137 155
138 config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); 156 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB );
139 config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); 157 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB );
140 config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); 158 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB );
141 config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); 159 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB );
142 160
143 config->writeEntry( prefix+ "PhoneDevice", mPhoneDevice ); 161 config->writeEntry( "PhoneDevice", mPhoneDevice );
144 config->writeEntry( prefix+ "PhoneConnection", mPhoneConnection ); 162 config->writeEntry( "PhoneConnection", mPhoneConnection );
145 config->writeEntry( prefix+ "PhoneModel", mPhoneModel ); 163 config->writeEntry( "PhoneModel", mPhoneModel );
146 164
147 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); 165 config->writeEntry( "IncludeInRingSync",mIncludeInRingSync );
148 config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 166 config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
149 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 167 config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
150 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); 168 config->writeEntry( "AskForPreferences",mAskForPreferences );
151 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 169 config->writeEntry( "WriteBackExisting",mWriteBackExisting );
152 config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); 170 config->writeEntry( "WriteBackFuture",mWriteBackFuture );
153 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); 171 config->writeEntry( "SyncPrefs", mSyncPrefs );
154 config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); 172 config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks);
155 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 173 config->writeEntry( "IsLocalFileSync", mIsLocalFileSync );
156 config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); 174 config->writeEntry( "IsPhoneSync", mIsPhoneSync );
157} 175}
158 176
159/* 177/*
@@ -161,7 +179,7 @@ class KPrefsItemInt : public KPrefsItem {
161 public: 179 public:
162 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); 180 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
163 virtual ~KPrefsItemInt() {} 181 virtual ~KPrefsItemInt() {}
164 182
165 void setDefault(); 183 void setDefault();
166 void readConfig(KConfig *); 184 void readConfig(KConfig *);
167 void writeConfig(KConfig *); 185 void writeConfig(KConfig *);