summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprofile.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprofile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprofile.cpp125
1 files changed, 125 insertions, 0 deletions
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
new file mode 100644
index 0000000..d6d8fa3
--- a/dev/null
+++ b/libkdepim/ksyncprofile.cpp
@@ -0,0 +1,125 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
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
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21// $Id$
22
23#include <qcolor.h>
24
25#include <kconfig.h>
26#include <kstandarddirs.h>
27#include <kglobal.h>
28#include <kdebug.h>
29
30#include "ksyncprofile.h"
31
32
33KSyncProfile::KSyncProfile( const char * name): QObject (0, name )
34{
35 setDefault();
36}
37KSyncProfile::~KSyncProfile()
38{
39
40}
41
42
43KSyncProfile* KSyncProfile::clone()
44{
45 KSyncProfile* myClone = new KSyncProfile();
46 myClone->setPreSyncCommand( mPreSyncCommand );
47 myClone->setPostSyncCommand( mPostSyncCommand );
48 myClone->setLocalTempFile( mLocalTempFile);
49 myClone->setRemoteFileName( mRemoteFileName );
50 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
51 myClone->setAskForPreferences( mAskForPreferences);
52 myClone->setWriteBackExisting(mWriteBackExisting );
53 myClone->setWriteBackFile( mWriteBackFile);
54 myClone->setIncludeInRingSync( mIncludeInRingSync );
55 myClone->setSyncPrefs( mSyncPrefs);
56 myClone->setIsLocalFileSync( mIsLocalFileSync );
57 myClone->setName( "noName" );
58 return myClone;
59}
60
61
62void KSyncProfile::setDefault()
63{
64 mName = "noName";
65 mPreSyncCommand = i18n("command for downloading remote file to local device");
66 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
67 mLocalTempFile = "/tmp/mycalendar.ics";
68 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
69 mShowSummaryAfterSync = true;
70 mAskForPreferences = true;
71 mWriteBackExisting = false;
72 mWriteBackFile = true;
73 mIncludeInRingSync = false;
74 mSyncPrefs = SYNC_PREF_ASK;
75 mIsLocalFileSync = true;
76
77}
78void KSyncProfile::readConfig(KConfig *config )
79{
80 config->setGroup("SyncProfiles");
81 QString prefix = "Profile_"+mName+"_";
82 //mName = config->readEntry( prefix+ "Name", mName );
83 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
84 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );
85 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
86 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile );
87 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName );
88 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
89 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences );
90 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
91 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs );
92 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
93}
94void KSyncProfile::writeConfig( KConfig * config )
95{
96 config->setGroup("SyncProfiles");
97 QString prefix = "Profile_"+mName+"_";
98 // config->writeEntry( prefix+ "Name", mName );
99 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
100 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand );
101 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
102 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile );
103 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName );
104 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
105 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences );
106 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
107 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs );
108 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
109}
110
111/*
112class KPrefsItemInt : public KPrefsItem {
113 public:
114 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
115 virtual ~KPrefsItemInt() {}
116
117 void setDefault();
118 void readConfig(KConfig *);
119 void writeConfig(KConfig *);
120
121 private:
122 int *mReference;
123 int mDefault;
124};
125*/