summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprofile.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprofile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprofile.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index ea41a85..f34c309 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -1,129 +1,156 @@
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 * name): QObject (0, name ) 33KSyncProfile::KSyncProfile( const char * name): QObject (0, name )
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 );
51 myClone->setPostSyncCommandAB( mPostSyncCommandAB );
52 myClone->setLocalTempFileAB( mLocalTempFileAB);
53 myClone->setRemoteFileNameAB( mRemoteFileNameAB );
50 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); 54 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
51 myClone->setAskForPreferences( mAskForPreferences); 55 myClone->setAskForPreferences( mAskForPreferences);
52 myClone->setWriteBackExisting(mWriteBackExisting ); 56 myClone->setWriteBackExisting(mWriteBackExisting );
53 myClone->setWriteBackFile( mWriteBackFile); 57 myClone->setWriteBackFile( mWriteBackFile);
58 myClone->setWriteBackFuture( mWriteBackFuture );
59 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
54 myClone->setIncludeInRingSync( mIncludeInRingSync ); 60 myClone->setIncludeInRingSync( mIncludeInRingSync );
55 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); 61 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
56 myClone->setSyncPrefs( mSyncPrefs); 62 myClone->setSyncPrefs( mSyncPrefs);
57 myClone->setIsLocalFileSync( mIsLocalFileSync ); 63 myClone->setIsLocalFileSync( mIsLocalFileSync );
58 myClone->setName( "noName" ); 64 myClone->setName( "noName" );
59 return myClone; 65 return myClone;
60} 66}
61 67
62 68
63void KSyncProfile::setDefault() 69void KSyncProfile::setDefault()
64{ 70{
65 mName = "noName"; 71 mName = "noName";
66 mPreSyncCommand = i18n("command for downloading remote file to local device"); 72 mPreSyncCommand = i18n("command for downloading remote file to local device");
67 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 73 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
68 mLocalTempFile = "/tmp/mycalendar.ics"; 74 mLocalTempFile = "/tmp/mycalendar.ics";
69 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; 75 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
76 mPreSyncCommandAB = i18n("command for downloading remote file to local device");
77 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
78 mLocalTempFileAB = "/tmp/std.vcf";
79 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf";
70 mShowSummaryAfterSync = true; 80 mShowSummaryAfterSync = true;
71 mAskForPreferences = true; 81 mAskForPreferences = true;
72 mWriteBackExisting = false; 82 mWriteBackExisting = false;
83 mWriteBackFuture = false;
84 mWriteBackFutureWeeks = 12;
73 mWriteBackFile = true; 85 mWriteBackFile = true;
74 mIncludeInRingSync = false; 86 mIncludeInRingSync = false;
75 mIncludeInRingSyncAB = false; 87 mIncludeInRingSyncAB = false;
76 mSyncPrefs = SYNC_PREF_ASK; 88 mSyncPrefs = SYNC_PREF_ASK;
77 mIsLocalFileSync = true; 89 mIsLocalFileSync = true;
78 90
79} 91}
80void KSyncProfile::readConfig(KConfig *config ) 92void KSyncProfile::readConfig(KConfig *config )
81{ 93{
82 config->setGroup("SyncProfiles"); 94 config->setGroup("SyncProfiles");
83 QString prefix = "Profile_"+mName+"_"; 95 QString prefix = "Profile_"+mName+"_";
84 //mName = config->readEntry( prefix+ "Name", mName ); 96 //mName = config->readEntry( prefix+ "Name", mName );
85 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 97 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
86 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); 98 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );;
87 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
88 mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
89 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); 99 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile );
90 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); 100 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName );
101
102 mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB );
103 mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB );
104 mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB );
105 mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB );
106
107 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
108 mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
91 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 109 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
92 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); 110 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences );
93 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 111 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
112 mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture );
94 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); 113 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs );
114 mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks );
95 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 115 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
96} 116}
97void KSyncProfile::writeConfig( KConfig * config ) 117void KSyncProfile::writeConfig( KConfig * config )
98{ 118{
99 config->setGroup("SyncProfiles"); 119 config->setGroup("SyncProfiles");
100 QString prefix = "Profile_"+mName+"_"; 120 QString prefix = "Profile_"+mName+"_";
101 // config->writeEntry( prefix+ "Name", mName ); 121 // config->writeEntry( prefix+ "Name", mName );
102 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 122 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
103 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); 123 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand );
104 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
105 config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
106 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); 124 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile );
107 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); 125 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName );
126
127 config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB );
128 config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB );
129 config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB );
130 config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB );
131 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
132 config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
108 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 133 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
109 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); 134 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences );
110 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 135 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
136 config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture );
111 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); 137 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs );
138 config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks);
112 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 139 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
113} 140}
114 141
115/* 142/*
116class KPrefsItemInt : public KPrefsItem { 143class KPrefsItemInt : public KPrefsItem {
117 public: 144 public:
118 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); 145 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
119 virtual ~KPrefsItemInt() {} 146 virtual ~KPrefsItemInt() {}
120 147
121 void setDefault(); 148 void setDefault();
122 void readConfig(KConfig *); 149 void readConfig(KConfig *);
123 void writeConfig(KConfig *); 150 void writeConfig(KConfig *);
124 151
125 private: 152 private:
126 int *mReference; 153 int *mReference;
127 int mDefault; 154 int mDefault;
128}; 155};
129*/ 156*/