summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index a1eebec..6e6e631 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -101,417 +101,456 @@ void KSyncPrefsDialog::setupSyncAlgTab()
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 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 135 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
136 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 136 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
137 137
138 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 138 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
139 topLayout->addWidget(lab ,iii,0); 139 topLayout->addWidget(lab ,iii,0);
140 topLayout->addWidget(mProfileBox, iii,1); 140 topLayout->addWidget(mProfileBox, iii,1);
141 ++iii; 141 ++iii;
142 142
143 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); 143 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame );
144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); 144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1);
145 ++iii; 145 ++iii;
146 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); 146 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame );
147 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); 147 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1);
148 ++iii; 148 ++iii;
149 mIncludeInRingPWM = new QCheckBox( i18n("Include in multiple pwmanager sync"), topFrame );
150 topLayout->addMultiCellWidget(mIncludeInRingPWM, iii,iii,0,1);
151 ++iii;
149 152
150 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 153 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
151 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 154 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
152 ++iii; 155 ++iii;
153 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 156 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
154 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 157 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
155 ++iii; 158 ++iii;
156 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 159 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
157 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 160 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
158 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 161 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
159 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 162 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
160 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 163 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
161 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 164 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
162 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 165 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
163 166
164 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 167 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
165 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 168 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
166 ++iii; 169 ++iii;
167 170
168 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 171 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
169 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 172 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
170 ++iii; 173 ++iii;
171 174
172 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 175 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame );
173 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 176 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
174 ++iii; 177 ++iii;
175 178
176 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 179 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
177 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 180 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
178 ++iii; 181 ++iii;
179 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 182 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
180 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 183 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
181 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 184 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
182 ++iii; 185 ++iii;
183 186
184 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 187 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
185 gr = proGr; 188 gr = proGr;
186 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 189 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
187 ++iii; 190 ++iii;
188 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 191 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
189 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 192 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
190 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 193 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
191 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 194 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
192 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 195 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
193 196
194 197
195 phoneWidget = new QVBox( topFrame); 198 phoneWidget = new QVBox( topFrame);
196 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 199 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
197 ++iii; 200 ++iii;
198 mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); 201 mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
199 QHBox* temphb = new QHBox( phoneWidget ); 202 QHBox* temphb = new QHBox( phoneWidget );
200 new QLabel( i18n("I/O device: "), temphb ); 203 new QLabel( i18n("I/O device: "), temphb );
201 mPhoneDevice = new QLineEdit( temphb); 204 mPhoneDevice = new QLineEdit( temphb);
202 button = new QPushButton( i18n("Help..."), temphb ); 205 button = new QPushButton( i18n("Help..."), temphb );
203 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 206 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
204 207
205 208
206 temphb = new QHBox( phoneWidget ); 209 temphb = new QHBox( phoneWidget );
207 new QLabel( i18n("Connection: "), temphb ); 210 new QLabel( i18n("Connection: "), temphb );
208 mPhoneConnection = new QLineEdit( temphb); 211 mPhoneConnection = new QLineEdit( temphb);
209 button = new QPushButton( i18n("Help..."), temphb ); 212 button = new QPushButton( i18n("Help..."), temphb );
210 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 213 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
211 214
212 215
213 temphb = new QHBox( phoneWidget ); 216 temphb = new QHBox( phoneWidget );
214 new QLabel( i18n("Model(opt.): "), temphb ); 217 new QLabel( i18n("Model(opt.): "), temphb );
215 mPhoneModel = new QLineEdit( temphb); 218 mPhoneModel = new QLineEdit( temphb);
216 button = new QPushButton( i18n("Help..."), temphb ); 219 button = new QPushButton( i18n("Help..."), temphb );
217 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 220 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
218 221
219 // *** local 222 // *** local
220 localFileWidget = new QVBox( topFrame); 223 localFileWidget = new QVBox( topFrame);
221 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 224 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
222 ++iii; 225 ++iii;
223 temphb = new QHBox( localFileWidget ); 226 temphb = new QHBox( localFileWidget );
224 227
225 lab = new QLabel( i18n("Local file Cal:"), temphb ); 228 lab = new QLabel( i18n("Local file Cal:"), temphb );
226 lab = new QLabel( i18n("Local file ABook:"), temphb ); 229 lab = new QLabel( i18n("Local file ABook:"), temphb );
230 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
227 temphb = new QHBox( localFileWidget ); 231 temphb = new QHBox( localFileWidget );
228 button = new QPushButton( i18n("Choose..."), temphb ); 232 button = new QPushButton( i18n("Choose..."), temphb );
229 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 233 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
230 button = new QPushButton( i18n("Choose..."), temphb ); 234 button = new QPushButton( i18n("Choose..."), temphb );
231 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); 235 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
236 button = new QPushButton( i18n("Choose..."), temphb );
237 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
232 temphb = new QHBox( localFileWidget ); 238 temphb = new QHBox( localFileWidget );
233 239
234 mRemoteFile = new QLineEdit( temphb); 240 mRemoteFile = new QLineEdit( temphb);
235 mRemoteFileAB = new QLineEdit( temphb); 241 mRemoteFileAB = new QLineEdit( temphb);
242 mRemoteFilePWM = new QLineEdit( temphb);
236 243
237 // *** remote 244 // *** remote
238 remoteFileWidget = new QVBox( topFrame); 245 remoteFileWidget = new QVBox( topFrame);
239 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 246 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
240 ++iii; 247 ++iii;
241 temphb = new QHBox( remoteFileWidget ); 248 temphb = new QHBox( remoteFileWidget );
242 new QLabel( i18n("Calendar:"), temphb); 249 new QLabel( i18n("Calendar:"), temphb);
243 new QLabel( i18n("AddressBook:"), temphb); 250 new QLabel( i18n("AddressBook:"), temphb);
251 new QLabel( i18n("PWManager:"), temphb);
244 252
245 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 253 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
246 temphb = new QHBox( remoteFileWidget ); 254 temphb = new QHBox( remoteFileWidget );
247 mRemotePrecommand = new QLineEdit(temphb); 255 mRemotePrecommand = new QLineEdit(temphb);
248 mRemotePrecommandAB = new QLineEdit(temphb); 256 mRemotePrecommandAB = new QLineEdit(temphb);
257 mRemotePrecommandPWM = new QLineEdit(temphb);
249 258
250 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 259 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
251 temphb = new QHBox( remoteFileWidget ); 260 temphb = new QHBox( remoteFileWidget );
252 mLocalTempFile = new QLineEdit(temphb); 261 mLocalTempFile = new QLineEdit(temphb);
253 mLocalTempFileAB = new QLineEdit(temphb); 262 mLocalTempFileAB = new QLineEdit(temphb);
263 mLocalTempFilePWM = new QLineEdit(temphb);
254 264
255 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 265 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
256 temphb = new QHBox( remoteFileWidget ); 266 temphb = new QHBox( remoteFileWidget );
257 mRemotePostcommand = new QLineEdit(temphb ); 267 mRemotePostcommand = new QLineEdit(temphb );
258 mRemotePostcommandAB = new QLineEdit(temphb ); 268 mRemotePostcommandAB = new QLineEdit(temphb );
269 mRemotePostcommandPWM = new QLineEdit(temphb );
259 270
260 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 271 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
261 temphb = new QHBox( remoteFileWidget ); 272 temphb = new QHBox( remoteFileWidget );
262 button = new QPushButton( i18n("ssh/scp"), temphb ); 273 button = new QPushButton( i18n("ssh/scp"), temphb );
263 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 274 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
264 button = new QPushButton( i18n("ftp"), temphb ); 275 button = new QPushButton( i18n("ftp"), temphb );
265 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 276 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
266 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 277 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
267 278
268 279
269} 280}
270void KSyncPrefsDialog::slotOK() 281void KSyncPrefsDialog::slotOK()
271{ 282{
272 if ( mMyMachineName->text() == "undefined" ) { 283 if ( mMyMachineName->text() == "undefined" ) {
273 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 284 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
274 return; 285 return;
275 } 286 }
276 int i; 287 int i;
277 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 288 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
278 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 289 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
279 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 290 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
280 return; 291 return;
281 } 292 }
282 } 293 }
283 usrWriteConfig(); 294 usrWriteConfig();
284 QDialog::accept(); 295 QDialog::accept();
285} 296}
286void KSyncPrefsDialog::accept() 297void KSyncPrefsDialog::accept()
287{ 298{
288 slotOK(); 299 slotOK();
289} 300}
290void KSyncPrefsDialog::chooseFile() 301void KSyncPrefsDialog::chooseFile()
291{ 302{
292 QString fn = QDir::homeDirPath(); 303 QString fn = QDir::homeDirPath();
293 304
294 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 305 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
295 if ( fn == "" ) 306 if ( fn == "" )
296 return; 307 return;
297 mRemoteFile->setText( fn ); 308 mRemoteFile->setText( fn );
298} 309}
299 310
300void KSyncPrefsDialog::chooseFileAB() 311void KSyncPrefsDialog::chooseFileAB()
301{ 312{
302 QString fn = QDir::homeDirPath(); 313 QString fn = QDir::homeDirPath();
303 314
304 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 315 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
305 if ( fn == "" ) 316 if ( fn == "" )
306 return; 317 return;
307 mRemoteFileAB->setText( fn ); 318 mRemoteFileAB->setText( fn );
308} 319}
309 320
321void KSyncPrefsDialog::chooseFilePWM()
322{
323 QString fn = QDir::homeDirPath();
324
325 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
326 if ( fn == "" )
327 return;
328 mRemoteFilePWM->setText( fn );
329}
330
310void KSyncPrefsDialog::textChanged( const QString & s ) 331void KSyncPrefsDialog::textChanged( const QString & s )
311{ 332{
312 if ( mProfileBox->count() == 0 ) 333 if ( mProfileBox->count() == 0 )
313 return; 334 return;
314 if ( currentSelection < 3 ) { 335 if ( currentSelection < 3 ) {
315 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 336 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
316 mProfileBox->blockSignals( true ); 337 mProfileBox->blockSignals( true );
317 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 338 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
318 mProfileBox->blockSignals( false ); 339 mProfileBox->blockSignals( false );
319 return; 340 return;
320 } 341 }
321 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 342 //qDebug("cur i %d ",mProfileBox-> currentItem () );
322 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 343 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
323 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 344 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
324 prof->setName( s ); 345 prof->setName( s );
325 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 346 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
326} 347}
327void KSyncPrefsDialog::profileChanged( int item ) 348void KSyncPrefsDialog::profileChanged( int item )
328{ 349{
329 //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); 350 //qDebug("KSyncPrefsDialog::profileChanged %d ", item );
330 KSyncProfile* prof; 351 KSyncProfile* prof;
331 saveProfile(); 352 saveProfile();
332 currentSelection = item; 353 currentSelection = item;
333 prof = mSyncProfiles.at(item) ; 354 prof = mSyncProfiles.at(item) ;
334 mRemotePrecommand->setText(prof->getPreSyncCommand()); 355 mRemotePrecommand->setText(prof->getPreSyncCommand());
335 mRemotePostcommand->setText(prof->getPostSyncCommand()); 356 mRemotePostcommand->setText(prof->getPostSyncCommand());
336 mLocalTempFile->setText(prof->getLocalTempFile()); 357 mLocalTempFile->setText(prof->getLocalTempFile());
337 mRemoteFile->setText(prof->getRemoteFileName()) ; 358 mRemoteFile->setText(prof->getRemoteFileName()) ;
338 359
339 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 360 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
340 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 361 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
341 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 362 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
342 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 363 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
343 364
365 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
366 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
367 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
368 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
369
344 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 370 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
345 mPhoneDevice->setText(prof->getPhoneDevice()); 371 mPhoneDevice->setText(prof->getPhoneDevice());
346 mPhoneConnection->setText(prof->getPhoneConnection()); 372 mPhoneConnection->setText(prof->getPhoneConnection());
347 mPhoneModel->setText(prof->getPhoneModel()); 373 mPhoneModel->setText(prof->getPhoneModel());
348 374
349 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 375 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
350 mAskForPreferences->setChecked( prof->getAskForPreferences()); 376 mAskForPreferences->setChecked( prof->getAskForPreferences());
351 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 377 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
352 mWriteBackFile->setChecked( prof->getWriteBackFile()); 378 mWriteBackFile->setChecked( prof->getWriteBackFile());
353 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 379 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
354 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 380 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
381 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
355 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 382 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
356 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 383 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
357 384
358 switch ( prof->getSyncPrefs() ) { 385 switch ( prof->getSyncPrefs() ) {
359 case 0: 386 case 0:
360 loc->setChecked( true); 387 loc->setChecked( true);
361 break; 388 break;
362 case 1: 389 case 1:
363 rem->setChecked( true ); 390 rem->setChecked( true );
364 break; 391 break;
365 case 2: 392 case 2:
366 newest->setChecked( true); 393 newest->setChecked( true);
367 break; 394 break;
368 case 3: 395 case 3:
369 ask->setChecked( true); 396 ask->setChecked( true);
370 break; 397 break;
371 case 4: 398 case 4:
372 f_loc->setChecked( true); 399 f_loc->setChecked( true);
373 break; 400 break;
374 case 5: 401 case 5:
375 f_rem->setChecked( true); 402 f_rem->setChecked( true);
376 break; 403 break;
377 case 6: 404 case 6:
378 //both->setChecked( true); 405 //both->setChecked( true);
379 break; 406 break;
380 default: 407 default:
381 break; 408 break;
382 } 409 }
383 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 410 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
384 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 411 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
385 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); 412 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() );
386 proGr->setEnabled( item > 2 ); 413 proGr->setEnabled( item > 2 );
387 if ( item < 3 ) { 414 if ( item < 3 ) {
388 localFileWidget->hide(); 415 localFileWidget->hide();
389 remoteFileWidget->hide(); 416 remoteFileWidget->hide();
390 phoneWidget->hide(); 417 phoneWidget->hide();
391 418
392 } else 419 } else
393 kindChanged( prof->getIsLocalFileSync() ); 420 kindChanged( prof->getIsLocalFileSync() );
394} 421}
395 422
396void KSyncPrefsDialog::fillSSH() 423void KSyncPrefsDialog::fillSSH()
397{ 424{
398 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 425 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
399 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 426 mLocalTempFile->setText("/tmp/mycalendar.ics" );
400 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 427 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
401 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 428 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
402 mLocalTempFileAB->setText("/tmp/std.vcf" ); 429 mLocalTempFileAB->setText("/tmp/std.vcf" );
403 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 430 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 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
433 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
404} 434}
405void KSyncPrefsDialog::fillFTP() 435void KSyncPrefsDialog::fillFTP()
406{ 436{
407 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 437 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
408 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 438 mLocalTempFile->setText("/tmp/mycalendar.ics" );
409 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 439 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
410 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 440 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
411 mLocalTempFileAB->setText("/tmp/std.vcf" ); 441 mLocalTempFileAB->setText("/tmp/std.vcf" );
412 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 442 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
443
444 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
445 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" );
413 447
414} 448}
415void KSyncPrefsDialog::kindChanged( bool b ) 449void KSyncPrefsDialog::kindChanged( bool b )
416{ 450{
417 451
418 if ( mIsLocal->isChecked () ) 452 if ( mIsLocal->isChecked () )
419 localFileWidget->show(); 453 localFileWidget->show();
420 else 454 else
421 localFileWidget->hide(); 455 localFileWidget->hide();
422 456
423 if ( mIsNotLocal->isChecked () ) 457 if ( mIsNotLocal->isChecked () )
424 remoteFileWidget->show(); 458 remoteFileWidget->show();
425 else 459 else
426 remoteFileWidget->hide(); 460 remoteFileWidget->hide();
427 461
428 if ( mIsPhone->isChecked () ) { 462 if ( mIsPhone->isChecked () ) {
429 phoneWidget->show(); 463 phoneWidget->show();
430 } 464 }
431 else { 465 else {
432 phoneWidget->hide(); 466 phoneWidget->hide();
433 } 467 }
434 468
435} 469}
436void KSyncPrefsDialog::deleteProfile() 470void KSyncPrefsDialog::deleteProfile()
437{ 471{
438 //qDebug("KSyncPrefsDialog::deleteProfile() "); 472 //qDebug("KSyncPrefsDialog::deleteProfile() ");
439 if ( currentSelection >= 0 ) { 473 if ( currentSelection >= 0 ) {
440 if ( currentSelection < 3 ) { 474 if ( currentSelection < 3 ) {
441 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 475 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
442 return; 476 return;
443 } 477 }
444 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 478 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
445 mSyncProfiles.remove( temp ); 479 mSyncProfiles.remove( temp );
446 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 480 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
447 insertProfiles(); 481 insertProfiles();
448 } 482 }
449} 483}
450 484
451void KSyncPrefsDialog::saveProfile() 485void KSyncPrefsDialog::saveProfile()
452{ 486{
453 KSyncProfile* prof; 487 KSyncProfile* prof;
454 if ( currentSelection >= 0 ) { 488 if ( currentSelection >= 0 ) {
455 prof = mSyncProfiles.at(currentSelection) ; 489 prof = mSyncProfiles.at(currentSelection) ;
456 prof->setPreSyncCommand( mRemotePrecommand->text()); 490 prof->setPreSyncCommand( mRemotePrecommand->text());
457 prof->setPostSyncCommand( mRemotePostcommand->text() ); 491 prof->setPostSyncCommand( mRemotePostcommand->text() );
458 prof->setLocalTempFile( mLocalTempFile->text()); 492 prof->setLocalTempFile( mLocalTempFile->text());
459 prof->setRemoteFileName( mRemoteFile->text() ); 493 prof->setRemoteFileName( mRemoteFile->text() );
460 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 494 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
461 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 495 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
462 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 496 prof->setLocalTempFileAB( mLocalTempFileAB->text());
463 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 497 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
498 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
499 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
500 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
501 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
464 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 502 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
465 prof->setAskForPreferences( mAskForPreferences->isChecked()); 503 prof->setAskForPreferences( mAskForPreferences->isChecked());
466 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 504 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
467 prof->setWriteBackFile( mWriteBackFile->isChecked()); 505 prof->setWriteBackFile( mWriteBackFile->isChecked());
468 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 506 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
469 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 507 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
508 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
470 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 509 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
471 prof->setSyncPrefs( syncprefs); 510 prof->setSyncPrefs( syncprefs);
472 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 511 prof->setIsLocalFileSync( mIsLocal->isChecked() );
473 prof->setIsPhoneSync( mIsPhone->isChecked() ); 512 prof->setIsPhoneSync( mIsPhone->isChecked() );
474 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 513 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
475 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 514 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
476 515
477 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 516 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
478 prof->setPhoneDevice( mPhoneDevice->text() ); 517 prof->setPhoneDevice( mPhoneDevice->text() );
479 prof->setPhoneConnection( mPhoneConnection->text() ); 518 prof->setPhoneConnection( mPhoneConnection->text() );
480 prof->setPhoneModel( mPhoneModel->text() ); 519 prof->setPhoneModel( mPhoneModel->text() );
481 520
482 } 521 }
483 522
484} 523}
485 524
486void KSyncPrefsDialog::insertProfiles() 525void KSyncPrefsDialog::insertProfiles()
487{ 526{
488 int curItem = mProfileBox->currentItem(); 527 int curItem = mProfileBox->currentItem();
489 mProfileBox->blockSignals( true ); 528 mProfileBox->blockSignals( true );
490 mProfileBox->clear(); 529 mProfileBox->clear();
491 mProfileBox->insertStringList (mSyncProfileNames ); 530 mProfileBox->insertStringList (mSyncProfileNames );
492 int item = mSyncProfileNames.count() -1; 531 int item = mSyncProfileNames.count() -1;
493 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 532 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
494 mProfileBox->setCurrentItem( curItem ); 533 mProfileBox->setCurrentItem( curItem );
495 else if ( item >= 0 ) { 534 else if ( item >= 0 ) {
496 mProfileBox->setCurrentItem( item ); 535 mProfileBox->setCurrentItem( item );
497 } 536 }
498 currentSelection = -1; 537 currentSelection = -1;
499 if ( mSyncProfileNames.count() > 0 ) { 538 if ( mSyncProfileNames.count() > 0 ) {
500 //qDebug(" profileChanged( mProfileBox->currentItem() "); 539 //qDebug(" profileChanged( mProfileBox->currentItem() ");
501 profileChanged( mProfileBox->currentItem() ); 540 profileChanged( mProfileBox->currentItem() );
502 currentSelection = mProfileBox->currentItem(); 541 currentSelection = mProfileBox->currentItem();
503 } 542 }
504 mProfileBox->blockSignals( false ); 543 mProfileBox->blockSignals( false );
505} 544}
506 545
507void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 546void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
508{ 547{
509 saveProfile(); 548 saveProfile();
510 mSyncProfiles.append( temp ); 549 mSyncProfiles.append( temp );
511 mSyncProfileNames << temp->getName(); 550 mSyncProfileNames << temp->getName();
512 insertProfiles(); 551 insertProfiles();
513 int last = mProfileBox->count() -1; 552 int last = mProfileBox->count() -1;
514 mProfileBox->blockSignals( true ); 553 mProfileBox->blockSignals( true );
515 mProfileBox->setCurrentItem( last ); 554 mProfileBox->setCurrentItem( last );
516 mProfileBox->blockSignals( false ); 555 mProfileBox->blockSignals( false );
517 profileChanged(last); 556 profileChanged(last);