-rw-r--r-- | libkdepim/ksyncprofile.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index d6d8fa3..ea41a85 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp | |||
@@ -1,125 +1,129 @@ | |||
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->setShowSummaryAfterSync( mShowSummaryAfterSync ); | 50 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); |
51 | myClone->setAskForPreferences( mAskForPreferences); | 51 | myClone->setAskForPreferences( mAskForPreferences); |
52 | myClone->setWriteBackExisting(mWriteBackExisting ); | 52 | myClone->setWriteBackExisting(mWriteBackExisting ); |
53 | myClone->setWriteBackFile( mWriteBackFile); | 53 | myClone->setWriteBackFile( mWriteBackFile); |
54 | myClone->setIncludeInRingSync( mIncludeInRingSync ); | 54 | myClone->setIncludeInRingSync( mIncludeInRingSync ); |
55 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); | ||
55 | myClone->setSyncPrefs( mSyncPrefs); | 56 | myClone->setSyncPrefs( mSyncPrefs); |
56 | myClone->setIsLocalFileSync( mIsLocalFileSync ); | 57 | myClone->setIsLocalFileSync( mIsLocalFileSync ); |
57 | myClone->setName( "noName" ); | 58 | myClone->setName( "noName" ); |
58 | return myClone; | 59 | return myClone; |
59 | } | 60 | } |
60 | 61 | ||
61 | 62 | ||
62 | void KSyncProfile::setDefault() | 63 | void KSyncProfile::setDefault() |
63 | { | 64 | { |
64 | mName = "noName"; | 65 | mName = "noName"; |
65 | mPreSyncCommand = i18n("command for downloading remote file to local device"); | 66 | mPreSyncCommand = i18n("command for downloading remote file to local device"); |
66 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); | 67 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); |
67 | mLocalTempFile = "/tmp/mycalendar.ics"; | 68 | mLocalTempFile = "/tmp/mycalendar.ics"; |
68 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; | 69 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; |
69 | mShowSummaryAfterSync = true; | 70 | mShowSummaryAfterSync = true; |
70 | mAskForPreferences = true; | 71 | mAskForPreferences = true; |
71 | mWriteBackExisting = false; | 72 | mWriteBackExisting = false; |
72 | mWriteBackFile = true; | 73 | mWriteBackFile = true; |
73 | mIncludeInRingSync = false; | 74 | mIncludeInRingSync = false; |
75 | mIncludeInRingSyncAB = false; | ||
74 | mSyncPrefs = SYNC_PREF_ASK; | 76 | mSyncPrefs = SYNC_PREF_ASK; |
75 | mIsLocalFileSync = true; | 77 | mIsLocalFileSync = true; |
76 | 78 | ||
77 | } | 79 | } |
78 | void KSyncProfile::readConfig(KConfig *config ) | 80 | void KSyncProfile::readConfig(KConfig *config ) |
79 | { | 81 | { |
80 | config->setGroup("SyncProfiles"); | 82 | config->setGroup("SyncProfiles"); |
81 | QString prefix = "Profile_"+mName+"_"; | 83 | QString prefix = "Profile_"+mName+"_"; |
82 | //mName = config->readEntry( prefix+ "Name", mName ); | 84 | //mName = config->readEntry( prefix+ "Name", mName ); |
83 | mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); | 85 | mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); |
84 | mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); | 86 | mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); |
85 | mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); | 87 | mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); |
88 | mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | ||
86 | mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); | 89 | mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); |
87 | mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); | 90 | mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); |
88 | mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 91 | mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
89 | mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); | 92 | mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); |
90 | mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); | 93 | mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); |
91 | mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); | 94 | mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); |
92 | mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); | 95 | mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); |
93 | } | 96 | } |
94 | void KSyncProfile::writeConfig( KConfig * config ) | 97 | void KSyncProfile::writeConfig( KConfig * config ) |
95 | { | 98 | { |
96 | config->setGroup("SyncProfiles"); | 99 | config->setGroup("SyncProfiles"); |
97 | QString prefix = "Profile_"+mName+"_"; | 100 | QString prefix = "Profile_"+mName+"_"; |
98 | // config->writeEntry( prefix+ "Name", mName ); | 101 | // config->writeEntry( prefix+ "Name", mName ); |
99 | config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); | 102 | config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); |
100 | config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); | 103 | config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); |
101 | config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); | 104 | config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); |
105 | config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | ||
102 | config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); | 106 | config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); |
103 | config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); | 107 | config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); |
104 | config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 108 | config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
105 | config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); | 109 | config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); |
106 | config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); | 110 | config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); |
107 | config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); | 111 | config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); |
108 | config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); | 112 | config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); |
109 | } | 113 | } |
110 | 114 | ||
111 | /* | 115 | /* |
112 | class KPrefsItemInt : public KPrefsItem { | 116 | class KPrefsItemInt : public KPrefsItem { |
113 | public: | 117 | public: |
114 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); | 118 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); |
115 | virtual ~KPrefsItemInt() {} | 119 | virtual ~KPrefsItemInt() {} |
116 | 120 | ||
117 | void setDefault(); | 121 | void setDefault(); |
118 | void readConfig(KConfig *); | 122 | void readConfig(KConfig *); |
119 | void writeConfig(KConfig *); | 123 | void writeConfig(KConfig *); |
120 | 124 | ||
121 | private: | 125 | private: |
122 | int *mReference; | 126 | int *mReference; |
123 | int mDefault; | 127 | int mDefault; |
124 | }; | 128 | }; |
125 | */ | 129 | */ |