-rw-r--r-- | libkdepim/ksyncprofile.cpp | 37 |
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 | |||
@@ -38,86 +38,113 @@ 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->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 | ||
63 | void KSyncProfile::setDefault() | 69 | void 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 | } |
80 | void KSyncProfile::readConfig(KConfig *config ) | 92 | void 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 | } |
97 | void KSyncProfile::writeConfig( KConfig * config ) | 117 | void 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 | /* |
116 | class KPrefsItemInt : public KPrefsItem { | 143 | class 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 *); |