summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-02 00:19:45 (UTC)
committer ulf69 <ulf69>2004-10-02 00:19:45 (UTC)
commitba1176743a536e19bb8b9d68b1c0c0023a0f3101 (patch) (unidiff)
tree352e97763d1b90eca9884651ab5533ef8ae8affc
parent7810fe355bd75c83bcdaed646cd1dde8d3c94fcb (diff)
downloadkdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.zip
kdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.tar.gz
kdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.tar.bz2
fixed a crash when pressing return(enter) in the syncprofilenames combobox
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp3
-rw-r--r--libkdepim/ksyncprofile.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 6e6e631..28aac45 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -39,192 +39,193 @@
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qscrollview.h> 45#include <qscrollview.h>
46 46
47#include <kcolorbutton.h> 47#include <kcolorbutton.h>
48#include <kdebug.h> 48#include <kdebug.h>
49#include <klocale.h> 49#include <klocale.h>
50#include <kglobal.h> 50#include <kglobal.h>
51#include <kfontdialog.h> 51#include <kfontdialog.h>
52#include <kmessagebox.h> 52#include <kmessagebox.h>
53#include <kcolordialog.h> 53#include <kcolordialog.h>
54#include <kiconloader.h> 54#include <kiconloader.h>
55#include <kemailsettings.h> 55#include <kemailsettings.h>
56#include <kstandarddirs.h> 56#include <kstandarddirs.h>
57#include <kfiledialog.h> 57#include <kfiledialog.h>
58#include <kmessagebox.h> 58#include <kmessagebox.h>
59 59
60//#include <kurlrequester.h> 60//#include <kurlrequester.h>
61#include <klineedit.h> 61#include <klineedit.h>
62#include "ksyncprofile.h" 62#include "ksyncprofile.h"
63 63
64 64
65//#include "koprefs.h" 65//#include "koprefs.h"
66 66
67#include "ksyncprefsdialog.h" 67#include "ksyncprefsdialog.h"
68//#include "koglobals.h" 68//#include "koglobals.h"
69 69
70 70
71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
72 KDialog(parent,name,true) 72 KDialog(parent,name,true)
73{ 73{
74 74
75 setCaption( i18n("Synchronization Preferences")); 75 setCaption( i18n("Synchronization Preferences"));
76 76
77 mSyncProfiles.setAutoDelete( true ); 77 mSyncProfiles.setAutoDelete( true );
78 setupSyncAlgTab(); 78 setupSyncAlgTab();
79} 79}
80 80
81 81
82KSyncPrefsDialog::~KSyncPrefsDialog() 82KSyncPrefsDialog::~KSyncPrefsDialog()
83{ 83{
84} 84}
85 85
86void KSyncPrefsDialog::setupSyncAlgTab() 86void KSyncPrefsDialog::setupSyncAlgTab()
87{ 87{
88 QLabel * lab; 88 QLabel * lab;
89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0); 89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0);
90 QVBox * mainbox = new QVBox( this ); 90 QVBox * mainbox = new QVBox( this );
91 QScrollView* sv = new QScrollView( mainbox ); 91 QScrollView* sv = new QScrollView( mainbox );
92 QHBoxLayout * lay = new QHBoxLayout( this ); 92 QHBoxLayout * lay = new QHBoxLayout( this );
93 lay->addWidget( mainbox ); 93 lay->addWidget( mainbox );
94 QHBox * b_box = new QHBox( mainbox ); 94 QHBox * b_box = new QHBox( mainbox );
95 95
96 QPushButton* button = new QPushButton( i18n("Ok"), b_box ); 96 QPushButton* button = new QPushButton( i18n("Ok"), b_box );
97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); 97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) );
98 button = new QPushButton( i18n("Cancel"), b_box ); 98 button = new QPushButton( i18n("Cancel"), b_box );
99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); 99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) );
100 //QBoxLayout * sl = new QVBoxLayout(this ); 100 //QBoxLayout * sl = new QVBoxLayout(this );
101 //sl->addWidget ( sv ); 101 //sl->addWidget ( sv );
102 sv->setResizePolicy ( QScrollView::AutoOneFit ); 102 sv->setResizePolicy ( QScrollView::AutoOneFit );
103 QFrame *topFrame = new QFrame ( sv ); 103 QFrame *topFrame = new QFrame ( sv );
104 sv->addChild( topFrame ); 104 sv->addChild( topFrame );
105 mSetupSyncAlgTab = topFrame; 105 mSetupSyncAlgTab = topFrame;
106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
107 topLayout->setSpacing(spacingHint()); 107 topLayout->setSpacing(spacingHint());
108 topLayout->setMargin(marginHint()); 108 topLayout->setMargin(marginHint());
109 109
110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); 110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame);
111 int iii = 0; 111 int iii = 0;
112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1); 112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1);
113 //++iii; 113 //++iii;
114 114
115 mMyMachineName = new QLineEdit(topFrame); 115 mMyMachineName = new QLineEdit(topFrame);
116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); 116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
117 topLayout->addWidget(lab ,iii,0); 117 topLayout->addWidget(lab ,iii,0);
118 topLayout->addWidget(mMyMachineName,iii,1); 118 topLayout->addWidget(mMyMachineName,iii,1);
119 ++iii; 119 ++iii;
120 120
121 QHBox* buttonbox = new QHBox( topFrame); 121 QHBox* buttonbox = new QHBox( topFrame);
122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); 122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
123 ++iii; 123 ++iii;
124 button = new QPushButton( i18n("New profile"), buttonbox ); 124 button = new QPushButton( i18n("New profile"), buttonbox );
125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); 125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
126 126
127 button = new QPushButton( i18n("Clone profile"), buttonbox ); 127 button = new QPushButton( i18n("Clone profile"), buttonbox );
128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); 128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
129 129
130 button = new QPushButton( i18n("Delete profile"), buttonbox ); 130 button = new QPushButton( i18n("Delete profile"), buttonbox );
131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); 131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
132 132
133 mProfileBox = new QComboBox(topFrame); 133 mProfileBox = new QComboBox(topFrame);
134 mProfileBox->setEditable ( true ); 134 mProfileBox->setEditable ( true );
135 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion);
135 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 136 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
136 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 137 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
137 138
138 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 139 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
139 topLayout->addWidget(lab ,iii,0); 140 topLayout->addWidget(lab ,iii,0);
140 topLayout->addWidget(mProfileBox, iii,1); 141 topLayout->addWidget(mProfileBox, iii,1);
141 ++iii; 142 ++iii;
142 143
143 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); 144 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame );
144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); 145 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1);
145 ++iii; 146 ++iii;
146 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); 147 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame );
147 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); 148 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1);
148 ++iii; 149 ++iii;
149 mIncludeInRingPWM = new QCheckBox( i18n("Include in multiple pwmanager sync"), topFrame ); 150 mIncludeInRingPWM = new QCheckBox( i18n("Include in multiple pwmanager sync"), topFrame );
150 topLayout->addMultiCellWidget(mIncludeInRingPWM, iii,iii,0,1); 151 topLayout->addMultiCellWidget(mIncludeInRingPWM, iii,iii,0,1);
151 ++iii; 152 ++iii;
152 153
153 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 154 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
154 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 155 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
155 ++iii; 156 ++iii;
156 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 157 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
157 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 158 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
158 ++iii; 159 ++iii;
159 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 160 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
160 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 161 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
161 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 162 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
162 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 163 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
163 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 164 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
164 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 165 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
165 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 166 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
166 167
167 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 168 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
168 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 169 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
169 ++iii; 170 ++iii;
170 171
171 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 172 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
172 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 173 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
173 ++iii; 174 ++iii;
174 175
175 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 176 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame );
176 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 177 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
177 ++iii; 178 ++iii;
178 179
179 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 180 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
180 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 181 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
181 ++iii; 182 ++iii;
182 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 183 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
183 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 184 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
184 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 185 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
185 ++iii; 186 ++iii;
186 187
187 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 188 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
188 gr = proGr; 189 gr = proGr;
189 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 190 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
190 ++iii; 191 ++iii;
191 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 192 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
192 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 193 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
193 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 194 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
194 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 195 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
195 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 196 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
196 197
197 198
198 phoneWidget = new QVBox( topFrame); 199 phoneWidget = new QVBox( topFrame);
199 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 200 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
200 ++iii; 201 ++iii;
201 mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); 202 mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
202 QHBox* temphb = new QHBox( phoneWidget ); 203 QHBox* temphb = new QHBox( phoneWidget );
203 new QLabel( i18n("I/O device: "), temphb ); 204 new QLabel( i18n("I/O device: "), temphb );
204 mPhoneDevice = new QLineEdit( temphb); 205 mPhoneDevice = new QLineEdit( temphb);
205 button = new QPushButton( i18n("Help..."), temphb ); 206 button = new QPushButton( i18n("Help..."), temphb );
206 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 207 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
207 208
208 209
209 temphb = new QHBox( phoneWidget ); 210 temphb = new QHBox( phoneWidget );
210 new QLabel( i18n("Connection: "), temphb ); 211 new QLabel( i18n("Connection: "), temphb );
211 mPhoneConnection = new QLineEdit( temphb); 212 mPhoneConnection = new QLineEdit( temphb);
212 button = new QPushButton( i18n("Help..."), temphb ); 213 button = new QPushButton( i18n("Help..."), temphb );
213 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 214 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
214 215
215 216
216 temphb = new QHBox( phoneWidget ); 217 temphb = new QHBox( phoneWidget );
217 new QLabel( i18n("Model(opt.): "), temphb ); 218 new QLabel( i18n("Model(opt.): "), temphb );
218 mPhoneModel = new QLineEdit( temphb); 219 mPhoneModel = new QLineEdit( temphb);
219 button = new QPushButton( i18n("Help..."), temphb ); 220 button = new QPushButton( i18n("Help..."), temphb );
220 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 221 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
221 222
222 // *** local 223 // *** local
223 localFileWidget = new QVBox( topFrame); 224 localFileWidget = new QVBox( topFrame);
224 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 225 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
225 ++iii; 226 ++iii;
226 temphb = new QHBox( localFileWidget ); 227 temphb = new QHBox( localFileWidget );
227 228
228 lab = new QLabel( i18n("Local file Cal:"), temphb ); 229 lab = new QLabel( i18n("Local file Cal:"), temphb );
229 lab = new QLabel( i18n("Local file ABook:"), temphb ); 230 lab = new QLabel( i18n("Local file ABook:"), temphb );
230 lab = new QLabel( i18n("Local file PWMgr:"), temphb ); 231 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
@@ -254,193 +255,193 @@ void KSyncPrefsDialog::setupSyncAlgTab()
254 temphb = new QHBox( remoteFileWidget ); 255 temphb = new QHBox( remoteFileWidget );
255 mRemotePrecommand = new QLineEdit(temphb); 256 mRemotePrecommand = new QLineEdit(temphb);
256 mRemotePrecommandAB = new QLineEdit(temphb); 257 mRemotePrecommandAB = new QLineEdit(temphb);
257 mRemotePrecommandPWM = new QLineEdit(temphb); 258 mRemotePrecommandPWM = new QLineEdit(temphb);
258 259
259 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 260 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
260 temphb = new QHBox( remoteFileWidget ); 261 temphb = new QHBox( remoteFileWidget );
261 mLocalTempFile = new QLineEdit(temphb); 262 mLocalTempFile = new QLineEdit(temphb);
262 mLocalTempFileAB = new QLineEdit(temphb); 263 mLocalTempFileAB = new QLineEdit(temphb);
263 mLocalTempFilePWM = new QLineEdit(temphb); 264 mLocalTempFilePWM = new QLineEdit(temphb);
264 265
265 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 266 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
266 temphb = new QHBox( remoteFileWidget ); 267 temphb = new QHBox( remoteFileWidget );
267 mRemotePostcommand = new QLineEdit(temphb ); 268 mRemotePostcommand = new QLineEdit(temphb );
268 mRemotePostcommandAB = new QLineEdit(temphb ); 269 mRemotePostcommandAB = new QLineEdit(temphb );
269 mRemotePostcommandPWM = new QLineEdit(temphb ); 270 mRemotePostcommandPWM = new QLineEdit(temphb );
270 271
271 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 272 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
272 temphb = new QHBox( remoteFileWidget ); 273 temphb = new QHBox( remoteFileWidget );
273 button = new QPushButton( i18n("ssh/scp"), temphb ); 274 button = new QPushButton( i18n("ssh/scp"), temphb );
274 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 275 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
275 button = new QPushButton( i18n("ftp"), temphb ); 276 button = new QPushButton( i18n("ftp"), temphb );
276 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 277 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
277 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 278 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
278 279
279 280
280} 281}
281void KSyncPrefsDialog::slotOK() 282void KSyncPrefsDialog::slotOK()
282{ 283{
283 if ( mMyMachineName->text() == "undefined" ) { 284 if ( mMyMachineName->text() == "undefined" ) {
284 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 285 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
285 return; 286 return;
286 } 287 }
287 int i; 288 int i;
288 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 289 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
289 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 290 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
290 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 291 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
291 return; 292 return;
292 } 293 }
293 } 294 }
294 usrWriteConfig(); 295 usrWriteConfig();
295 QDialog::accept(); 296 QDialog::accept();
296} 297}
297void KSyncPrefsDialog::accept() 298void KSyncPrefsDialog::accept()
298{ 299{
299 slotOK(); 300 slotOK();
300} 301}
301void KSyncPrefsDialog::chooseFile() 302void KSyncPrefsDialog::chooseFile()
302{ 303{
303 QString fn = QDir::homeDirPath(); 304 QString fn = QDir::homeDirPath();
304 305
305 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 306 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
306 if ( fn == "" ) 307 if ( fn == "" )
307 return; 308 return;
308 mRemoteFile->setText( fn ); 309 mRemoteFile->setText( fn );
309} 310}
310 311
311void KSyncPrefsDialog::chooseFileAB() 312void KSyncPrefsDialog::chooseFileAB()
312{ 313{
313 QString fn = QDir::homeDirPath(); 314 QString fn = QDir::homeDirPath();
314 315
315 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); 316 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
316 if ( fn == "" ) 317 if ( fn == "" )
317 return; 318 return;
318 mRemoteFileAB->setText( fn ); 319 mRemoteFileAB->setText( fn );
319} 320}
320 321
321void KSyncPrefsDialog::chooseFilePWM() 322void KSyncPrefsDialog::chooseFilePWM()
322{ 323{
323 QString fn = QDir::homeDirPath(); 324 QString fn = QDir::homeDirPath();
324 325
325 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 326 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
326 if ( fn == "" ) 327 if ( fn == "" )
327 return; 328 return;
328 mRemoteFilePWM->setText( fn ); 329 mRemoteFilePWM->setText( fn );
329} 330}
330 331
331void KSyncPrefsDialog::textChanged( const QString & s ) 332void KSyncPrefsDialog::textChanged( const QString & s )
332{ 333{
333 if ( mProfileBox->count() == 0 ) 334 if ( mProfileBox->count() == 0 )
334 return; 335 return;
335 if ( currentSelection < 3 ) { 336 if ( currentSelection < 3 ) {
336 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 337 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
337 mProfileBox->blockSignals( true ); 338 mProfileBox->blockSignals( true );
338 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 339 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
339 mProfileBox->blockSignals( false ); 340 mProfileBox->blockSignals( false );
340 return; 341 return;
341 } 342 }
342 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 343 //qDebug("cur i %d ",mProfileBox-> currentItem () );
343 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 344 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
344 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 345 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
345 prof->setName( s ); 346 prof->setName( s );
346 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 347 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
347} 348}
348void KSyncPrefsDialog::profileChanged( int item ) 349void KSyncPrefsDialog::profileChanged( int item )
349{ 350{
350 //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); 351 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
351 KSyncProfile* prof; 352 KSyncProfile* prof;
352 saveProfile(); 353 saveProfile();
353 currentSelection = item; 354 currentSelection = item;
354 prof = mSyncProfiles.at(item) ; 355 prof = mSyncProfiles.at(item) ;
355 mRemotePrecommand->setText(prof->getPreSyncCommand()); 356 mRemotePrecommand->setText(prof->getPreSyncCommand());
356 mRemotePostcommand->setText(prof->getPostSyncCommand()); 357 mRemotePostcommand->setText(prof->getPostSyncCommand());
357 mLocalTempFile->setText(prof->getLocalTempFile()); 358 mLocalTempFile->setText(prof->getLocalTempFile());
358 mRemoteFile->setText(prof->getRemoteFileName()) ; 359 mRemoteFile->setText(prof->getRemoteFileName()) ;
359 360
360 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 361 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
361 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 362 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
362 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 363 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
363 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 364 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
364 365
365 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 366 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
366 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 367 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
367 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 368 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
368 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 369 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
369 370
370 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 371 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
371 mPhoneDevice->setText(prof->getPhoneDevice()); 372 mPhoneDevice->setText(prof->getPhoneDevice());
372 mPhoneConnection->setText(prof->getPhoneConnection()); 373 mPhoneConnection->setText(prof->getPhoneConnection());
373 mPhoneModel->setText(prof->getPhoneModel()); 374 mPhoneModel->setText(prof->getPhoneModel());
374 375
375 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 376 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
376 mAskForPreferences->setChecked( prof->getAskForPreferences()); 377 mAskForPreferences->setChecked( prof->getAskForPreferences());
377 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 378 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
378 mWriteBackFile->setChecked( prof->getWriteBackFile()); 379 mWriteBackFile->setChecked( prof->getWriteBackFile());
379 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 380 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
380 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 381 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
381 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 382 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
382 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 383 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
383 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 384 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
384 385
385 switch ( prof->getSyncPrefs() ) { 386 switch ( prof->getSyncPrefs() ) {
386 case 0: 387 case 0:
387 loc->setChecked( true); 388 loc->setChecked( true);
388 break; 389 break;
389 case 1: 390 case 1:
390 rem->setChecked( true ); 391 rem->setChecked( true );
391 break; 392 break;
392 case 2: 393 case 2:
393 newest->setChecked( true); 394 newest->setChecked( true);
394 break; 395 break;
395 case 3: 396 case 3:
396 ask->setChecked( true); 397 ask->setChecked( true);
397 break; 398 break;
398 case 4: 399 case 4:
399 f_loc->setChecked( true); 400 f_loc->setChecked( true);
400 break; 401 break;
401 case 5: 402 case 5:
402 f_rem->setChecked( true); 403 f_rem->setChecked( true);
403 break; 404 break;
404 case 6: 405 case 6:
405 //both->setChecked( true); 406 //both->setChecked( true);
406 break; 407 break;
407 default: 408 default:
408 break; 409 break;
409 } 410 }
410 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 411 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
411 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 412 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
412 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); 413 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() );
413 proGr->setEnabled( item > 2 ); 414 proGr->setEnabled( item > 2 );
414 if ( item < 3 ) { 415 if ( item < 3 ) {
415 localFileWidget->hide(); 416 localFileWidget->hide();
416 remoteFileWidget->hide(); 417 remoteFileWidget->hide();
417 phoneWidget->hide(); 418 phoneWidget->hide();
418 419
419 } else 420 } else
420 kindChanged( prof->getIsLocalFileSync() ); 421 kindChanged( prof->getIsLocalFileSync() );
421} 422}
422 423
423void KSyncPrefsDialog::fillSSH() 424void KSyncPrefsDialog::fillSSH()
424{ 425{
425 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 426 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
426 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 427 mLocalTempFile->setText("/tmp/mycalendar.ics" );
427 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 428 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
428 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 429 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
429 mLocalTempFileAB->setText("/tmp/std.vcf" ); 430 mLocalTempFileAB->setText("/tmp/std.vcf" );
430 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 431 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
431 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 432 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
432 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 433 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
433 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 434 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
434} 435}
435void KSyncPrefsDialog::fillFTP() 436void KSyncPrefsDialog::fillFTP()
436{ 437{
437 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 438 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
438 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 439 mLocalTempFile->setText("/tmp/mycalendar.ics" );
439 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 440 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
440 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 441 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
441 mLocalTempFileAB->setText("/tmp/std.vcf" ); 442 mLocalTempFileAB->setText("/tmp/std.vcf" );
442 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 443 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
443 444
444 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 445 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
445 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 446 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
446 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 447 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index a43ebe2..2bf4e6c 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -1,182 +1,182 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
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(): QObject () 33KSyncProfile::KSyncProfile(): QObject ()
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 ); 50 myClone->setPreSyncCommandAB( mPreSyncCommandAB );
51 myClone->setPostSyncCommandAB( mPostSyncCommandAB ); 51 myClone->setPostSyncCommandAB( mPostSyncCommandAB );
52 myClone->setLocalTempFileAB( mLocalTempFileAB); 52 myClone->setLocalTempFileAB( mLocalTempFileAB);
53 myClone->setRemoteFileNameAB( mRemoteFileNameAB ); 53 myClone->setRemoteFileNameAB( mRemoteFileNameAB );
54 myClone->setPreSyncCommandPWM( mPreSyncCommandPWM ); 54 myClone->setPreSyncCommandPWM( mPreSyncCommandPWM );
55 myClone->setPostSyncCommandPWM( mPostSyncCommandPWM ); 55 myClone->setPostSyncCommandPWM( mPostSyncCommandPWM );
56 myClone->setLocalTempFilePWM( mLocalTempFilePWM); 56 myClone->setLocalTempFilePWM( mLocalTempFilePWM);
57 myClone->setRemoteFileNamePWM( mRemoteFileNamePWM ); 57 myClone->setRemoteFileNamePWM( mRemoteFileNamePWM );
58 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); 58 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
59 myClone->setAskForPreferences( mAskForPreferences); 59 myClone->setAskForPreferences( mAskForPreferences);
60 myClone->setWriteBackExisting(mWriteBackExisting ); 60 myClone->setWriteBackExisting(mWriteBackExisting );
61 myClone->setWriteBackFile( mWriteBackFile); 61 myClone->setWriteBackFile( mWriteBackFile);
62 myClone->setWriteBackFuture( mWriteBackFuture ); 62 myClone->setWriteBackFuture( mWriteBackFuture );
63 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); 63 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
64 myClone->setIncludeInRingSync( mIncludeInRingSync ); 64 myClone->setIncludeInRingSync( mIncludeInRingSync );
65 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); 65 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
66 myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM ); 66 myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM );
67 myClone->setSyncPrefs( mSyncPrefs); 67 myClone->setSyncPrefs( mSyncPrefs);
68 myClone->setIsLocalFileSync( mIsLocalFileSync ); 68 myClone->setIsLocalFileSync( mIsLocalFileSync );
69 myClone->setIsPhoneSync( mIsPhoneSync ); 69 myClone->setIsPhoneSync( mIsPhoneSync );
70 myClone->setWriteContactToSIM( mWriteContactToSIM ); 70 myClone->setWriteContactToSIM( mWriteContactToSIM );
71 myClone->setName( "noName" ); 71 myClone->setName( "noName" );
72 //myClone->setIdentifier( "noID" ); 72 //myClone->setIdentifier( "noID" );
73 return myClone; 73 return myClone;
74} 74}
75 75
76 76
77void KSyncProfile::setDefault() 77void KSyncProfile::setDefault()
78{ 78{
79 mPreSyncCommand = i18n("command for downloading remote file to local device"); 79 mPreSyncCommand = i18n("command for downloading remote file to local device");
80 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 80 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
81 mLocalTempFile = "/tmp/mycalendar.ics"; 81 mLocalTempFile = "/tmp/mycalendar.ics";
82 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; 82 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
83 mPreSyncCommandAB = i18n("command for downloading remote file to local device"); 83 mPreSyncCommandAB = i18n("command for downloading remote file to local device");
84 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); 84 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
85 mLocalTempFileAB = "/tmp/std.vcf"; 85 mLocalTempFileAB = "/tmp/std.vcf";
86 mRemoteFileNamePWM = "/home/polo/kdepim/apps/kabc/localfile.vcf"; 86 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf";
87 mPreSyncCommandPWM = i18n("command for downloading remote file to local device"); 87 mPreSyncCommandPWM = i18n("command for downloading remote file to local device");
88 mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device"); 88 mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device");
89 mLocalTempFilePWM = "/tmp/passwords.pwm"; 89 mLocalTempFilePWM = "/tmp/passwords.pwm";
90 mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm"; 90 mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm";
91 mShowSummaryAfterSync = true; 91 mShowSummaryAfterSync = true;
92 mAskForPreferences = true; 92 mAskForPreferences = true;
93 mWriteBackExisting = false; 93 mWriteBackExisting = false;
94 mWriteBackFuture = false; 94 mWriteBackFuture = false;
95 mWriteBackFutureWeeks = 12; 95 mWriteBackFutureWeeks = 12;
96 mWriteBackFile = true; 96 mWriteBackFile = true;
97 mIncludeInRingSync = false; 97 mIncludeInRingSync = false;
98 mIncludeInRingSyncAB = false; 98 mIncludeInRingSyncAB = false;
99 mIncludeInRingSyncPWM = false; 99 mIncludeInRingSyncPWM = false;
100 mSyncPrefs = SYNC_PREF_ASK; 100 mSyncPrefs = SYNC_PREF_ASK;
101 mIsLocalFileSync = true; 101 mIsLocalFileSync = true;
102 mName = "noName"; 102 mName = "noName";
103 mIsPhoneSync = false; 103 mIsPhoneSync = false;
104 mWriteContactToSIM = false; 104 mWriteContactToSIM = false;
105 mPhoneDevice = "/dev/ircomm"; 105 mPhoneDevice = "/dev/ircomm";
106 mPhoneConnection = "irda"; 106 mPhoneConnection = "irda";
107 mPhoneModel = "6310i"; 107 mPhoneModel = "6310i";
108} 108}
109void KSyncProfile::readConfig(KConfig *config ) 109void KSyncProfile::readConfig(KConfig *config )
110{ 110{
111 if (config) 111 if (config)
112 { 112 {
113 113
114 config->setGroup( mName ); 114 config->setGroup( mName );
115 115
116 mName = config->readEntry( "Name", mName ); 116 mName = config->readEntry( "Name", mName );
117 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); 117 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand );
118 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); 118 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand );
119 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); 119 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile );
120 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); 120 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName );
121 121
122 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 122 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB );
123 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 123 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB );
124 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); 124 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB );
125 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 125 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB );
126 126
127 mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); 127 mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM );
128 mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); 128 mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM );
129 mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM ); 129 mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM );
130 mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); 130 mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM );
131 131
132 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); 132 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice );
133 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); 133 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection );
134 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); 134 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel );
135 135
136 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); 136 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync );
137 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 137 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
138 mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); 138 mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM );
139 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); 139 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
140 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); 140 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences );
141 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); 141 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting );
142 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); 142 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture );
143 mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); 143 mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile );
144 mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); 144 mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM );
145 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); 145 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs );
146 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); 146 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks );
147 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); 147 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync );
148 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); 148 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync );
149 } 149 }
150 else 150 else
151 { 151 {
152 setDefault(); 152 setDefault();
153 } 153 }
154} 154}
155 155
156void KSyncProfile::deleteConfig(KConfig *config ) 156void KSyncProfile::deleteConfig(KConfig *config )
157{ 157{
158 config->deleteGroup( mName ); 158 config->deleteGroup( mName );
159} 159}
160 160
161void KSyncProfile::writeConfig( KConfig * config ) 161void KSyncProfile::writeConfig( KConfig * config )
162{ 162{
163 config->setGroup(mName); 163 config->setGroup(mName);
164 164
165 config->writeEntry( "Name", mName ); 165 config->writeEntry( "Name", mName );
166 config->writeEntry( "PreSyncCommand",mPreSyncCommand ); 166 config->writeEntry( "PreSyncCommand",mPreSyncCommand );
167 config->writeEntry( "PostSyncCommand", mPostSyncCommand ); 167 config->writeEntry( "PostSyncCommand", mPostSyncCommand );
168 config->writeEntry( "LocalTempFile", mLocalTempFile ); 168 config->writeEntry( "LocalTempFile", mLocalTempFile );
169 config->writeEntry( "RemoteFileName", mRemoteFileName ); 169 config->writeEntry( "RemoteFileName", mRemoteFileName );
170 170
171 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 171 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB );
172 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 172 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB );
173 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); 173 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB );
174 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 174 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB );
175 175
176 config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); 176 config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM );
177 config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); 177 config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM );
178 config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM ); 178 config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM );
179 config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); 179 config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM );
180 180
181 config->writeEntry( "PhoneDevice", mPhoneDevice ); 181 config->writeEntry( "PhoneDevice", mPhoneDevice );
182 config->writeEntry( "PhoneConnection", mPhoneConnection ); 182 config->writeEntry( "PhoneConnection", mPhoneConnection );