-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 3 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 2 |
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 | |||
@@ -71,128 +71,129 @@ | |||
71 | KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : | 71 | KSyncPrefsDialog::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 | ||
82 | KSyncPrefsDialog::~KSyncPrefsDialog() | 82 | KSyncPrefsDialog::~KSyncPrefsDialog() |
83 | { | 83 | { |
84 | } | 84 | } |
85 | 85 | ||
86 | void KSyncPrefsDialog::setupSyncAlgTab() | 86 | void 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); |
@@ -286,129 +287,129 @@ void KSyncPrefsDialog::slotOK() | |||
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 | } |
297 | void KSyncPrefsDialog::accept() | 298 | void KSyncPrefsDialog::accept() |
298 | { | 299 | { |
299 | slotOK(); | 300 | slotOK(); |
300 | } | 301 | } |
301 | void KSyncPrefsDialog::chooseFile() | 302 | void 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 | ||
311 | void KSyncPrefsDialog::chooseFileAB() | 312 | void 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 | ||
321 | void KSyncPrefsDialog::chooseFilePWM() | 322 | void 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 | ||
331 | void KSyncPrefsDialog::textChanged( const QString & s ) | 332 | void 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 | } |
348 | void KSyncPrefsDialog::profileChanged( int item ) | 349 | void 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 ) { |
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index a43ebe2..2bf4e6c 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp | |||
@@ -22,129 +22,129 @@ | |||
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 | ||
33 | KSyncProfile::KSyncProfile(): QObject () | 33 | KSyncProfile::KSyncProfile(): QObject () |
34 | { | 34 | { |
35 | setDefault(); | 35 | setDefault(); |
36 | } | 36 | } |
37 | KSyncProfile::~KSyncProfile() | 37 | 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 ); | 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 | ||
77 | void KSyncProfile::setDefault() | 77 | void 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 | } |
109 | void KSyncProfile::readConfig(KConfig *config ) | 109 | void 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 |