summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
authorzautrix <zautrix>2005-01-13 03:53:45 (UTC)
committer zautrix <zautrix>2005-01-13 03:53:45 (UTC)
commit7d00f1441b5e1270dcd447bfb7920dbd3a21503d (patch) (unidiff)
tree8eb3b053e8104914021eff6f39772024784fff64 /libkdepim/ksyncprefsdialog.cpp
parent7a4a866cded40032766acb4fe8d02b6347b1d12e (diff)
downloadkdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.zip
kdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.tar.gz
kdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.tar.bz2
sync dialog fixes
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp333
1 files changed, 190 insertions, 143 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 03265d2..8a3f4cf 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -1,723 +1,770 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qdir.h> 32#include <qdir.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qvbox.h> 35#include <qvbox.h>
36#include <qhbox.h> 36#include <qhbox.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
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#include <qvgroupbox.h>
47#include <qhgroupbox.h>
46 48
47#include <kcolorbutton.h> 49#include <kcolorbutton.h>
48#include <kdebug.h> 50#include <kdebug.h>
49#include <klocale.h> 51#include <klocale.h>
50#include <kglobal.h> 52#include <kglobal.h>
51#include <kfontdialog.h> 53#include <kfontdialog.h>
52#include <kmessagebox.h> 54#include <kmessagebox.h>
53#include <kcolordialog.h> 55#include <kcolordialog.h>
54#include <kiconloader.h> 56#include <kiconloader.h>
55#include <kemailsettings.h> 57#include <kemailsettings.h>
56#include <kstandarddirs.h> 58#include <kstandarddirs.h>
57#include <kfiledialog.h> 59#include <kfiledialog.h>
58#include <kmessagebox.h> 60#include <kmessagebox.h>
59 61
60//#include <kurlrequester.h> 62//#include <kurlrequester.h>
61#include <klineedit.h> 63#include <klineedit.h>
62#include "ksyncprofile.h" 64#include "ksyncprofile.h"
63 65
64 66
65//#include "koprefs.h" 67//#include "koprefs.h"
66 68
67#include "ksyncprefsdialog.h" 69#include "ksyncprefsdialog.h"
68//#include "koglobals.h" 70//#include "koglobals.h"
69 71
70 72
71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 73KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
72 KDialog(parent,name,true) 74 KDialog(parent,name,true)
73{ 75{
74 76
75 setCaption( i18n("Synchronization Preferences")); 77 setCaption( i18n("Synchronization Preferences"));
76 78
77 mSyncProfiles.setAutoDelete( true ); 79 mSyncProfiles.setAutoDelete( true );
78 setupSyncAlgTab(); 80 setupSyncAlgTab();
79} 81}
80 82
81 83
82KSyncPrefsDialog::~KSyncPrefsDialog() 84KSyncPrefsDialog::~KSyncPrefsDialog()
83{ 85{
84} 86}
85 87
86void KSyncPrefsDialog::setupSyncAlgTab() 88void KSyncPrefsDialog::setupSyncAlgTab()
87{ 89{
88 QLabel * lab; 90 QLabel * lab;
89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0); 91 //QFrame *page = addPage(i18n("Sync Prefs"),0,0);
90 QVBox * mainbox = new QVBox( this ); 92 QVBox * mainbox = new QVBox( this );
91 QScrollView* sv = new QScrollView( mainbox ); 93 QScrollView* sv = new QScrollView( mainbox );
92 QHBoxLayout * lay = new QHBoxLayout( this ); 94 QHBoxLayout * lay = new QHBoxLayout( this );
93 lay->addWidget( mainbox ); 95 lay->addWidget( mainbox );
94 QHBox * b_box = new QHBox( mainbox ); 96 QHBox * b_box = new QHBox( mainbox );
95 97
96 QPushButton* button = new QPushButton( i18n("Ok"), b_box ); 98 QPushButton* button = new QPushButton( i18n("Ok"), b_box );
97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); 99 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) );
98 button = new QPushButton( i18n("Cancel"), b_box ); 100 button = new QPushButton( i18n("Cancel"), b_box );
99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); 101 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) );
100 //QBoxLayout * sl = new QVBoxLayout(this ); 102 //QBoxLayout * sl = new QVBoxLayout(this );
101 //sl->addWidget ( sv ); 103 //sl->addWidget ( sv );
102 sv->setResizePolicy ( QScrollView::AutoOneFit ); 104 sv->setResizePolicy ( QScrollView::AutoOneFit );
103 QFrame *topFrame = new QFrame ( sv ); 105 QFrame *topFrame = new QFrame ( sv );
104 sv->addChild( topFrame ); 106 sv->addChild( topFrame );
105 mSetupSyncAlgTab = topFrame; 107 mSetupSyncAlgTab = topFrame;
106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 108 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
107 topLayout->setSpacing(spacingHint()); 109 topLayout->setSpacing(spacingHint());
108 topLayout->setMargin(marginHint()); 110 topLayout->setMargin(marginHint());
109 111
110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); 112 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame);
111 int iii = 0; 113 int iii = 0;
112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1); 114 //topLayout->addMultiCellWidget(lab , iii,iii,0,1);
113 //++iii; 115 //++iii;
114 116
115 mMyMachineName = new QLineEdit(topFrame); 117 mMyMachineName = new QLineEdit(topFrame);
116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); 118 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
117 topLayout->addWidget(lab ,iii,0); 119 topLayout->addWidget(lab ,iii,0);
118 topLayout->addWidget(mMyMachineName,iii,1); 120 topLayout->addWidget(mMyMachineName,iii,1);
119 ++iii; 121 ++iii;
120 122
121 QHBox* buttonbox = new QHBox( topFrame); 123 QHBox* buttonbox = new QHBox( topFrame);
122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); 124 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
123 ++iii; 125 ++iii;
124 button = new QPushButton( i18n("New profile"), buttonbox ); 126 button = new QPushButton( i18n("New profile"), buttonbox );
125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); 127 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
126 128
127 button = new QPushButton( i18n("Clone profile"), buttonbox ); 129 button = new QPushButton( i18n("Clone profile"), buttonbox );
128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); 130 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
129 131
130 button = new QPushButton( i18n("Delete profile"), buttonbox ); 132 button = new QPushButton( i18n("Delete profile"), buttonbox );
131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); 133 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
132 134
133 mProfileBox = new QComboBox(topFrame); 135 mProfileBox = new QComboBox(topFrame);
134 mProfileBox->setEditable ( true ); 136 mProfileBox->setEditable ( true );
135 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); 137 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion);
136 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 138 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
137 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 139 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
138 140
139 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 141 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
140 topLayout->addWidget(lab ,iii,0); 142 topLayout->addWidget(lab ,iii,0);
141 topLayout->addWidget(mProfileBox, iii,1); 143 topLayout->addWidget(mProfileBox, iii,1);
142 ++iii; 144 ++iii;
143 145
144 QHBox *iims = new QHBox( topFrame ); 146
147
148 QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame);
145 new QLabel( i18n("Include in multiple "), iims ); 149 new QLabel( i18n("Include in multiple "), iims );
146 mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); 150 mIncludeInRing = new QCheckBox( i18n("calendar "), iims );
147 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); 151 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims );
148 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); 152 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims );
149 new QLabel( i18n(" sync"), iims ); 153 new QLabel( i18n(" sync"), iims );
150 topLayout->addMultiCellWidget(iims, iii,iii,0,1); 154 topLayout->addMultiCellWidget(iims, iii,iii,0,1);
151 ++iii; 155 ++iii;
152 156 QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame);
153 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 157 topLayout->addMultiCellWidget(gb0, iii,iii,0,1);
154 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
155 ++iii;
156 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
157 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
158 ++iii;
159 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
160 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
161 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
162 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_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
165 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
166
167 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
168 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
169 ++iii;
170
171 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
172 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
173 ++iii; 158 ++iii;
159 QButtonGroup* gr;
160 {
161 QVGroupBox* topFrame = gb0;
162 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
163 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
164 //++iii;
165 gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
166 //topLayout->addMultiCellWidget(gr, iii,iii,0,1);
167 //++iii;
168 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
169 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
170 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
171 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
172 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
173 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
174 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
175
176 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
177 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
178 //++iii;
179
180 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
181 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
182 // ++iii;
174 183
175 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 184 QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame);
176 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 185 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1);
177 ++iii; 186 //++iii;
178 187 {
179 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 188 QVGroupBox*topFrame = gb2;
180 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 189 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame );
181 ++iii; 190 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
182 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 191 //++iii;
183 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 192 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame );
184 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 193 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
185 ++iii; 194 //++iii;
186 195 QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame);
196 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) );
197 new QLabel( i18n("From ") , gb3 );
198 mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3);
199 new QLabel( i18n(" weeks in the past to ") , gb3 );
200 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3);
201 new QLabel( i18n(" weeks in the future ") , gb3 );
202 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
203 //++iii;
204 gb3->setEnabled( false );
205 }
206 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
207
208 }
187 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 209 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
188 gr = proGr; 210 gr = proGr;
189 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 211 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
190 ++iii; 212 ++iii;
191 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 213 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
192 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); 214 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr );
193 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 215 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
194 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 216 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
195 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 217 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
196 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 218 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
197 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 219 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
198 220
199 221 QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame);
200 phoneWidget = new QVBox( topFrame); 222 topLayout->addMultiCellWidget(gb1, iii,iii,0,1);
201 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
202 ++iii;
203 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
204 QHBox* temphb = new QHBox( phoneWidget );
205 new QLabel( i18n("I/O device: "), temphb );
206 mPhoneDevice = new QLineEdit( temphb);
207 button = new QPushButton( i18n("Help..."), temphb );
208 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
209
210
211 temphb = new QHBox( phoneWidget );
212 new QLabel( i18n("Connection: "), temphb );
213 mPhoneConnection = new QLineEdit( temphb);
214 button = new QPushButton( i18n("Help..."), temphb );
215 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
216
217
218 temphb = new QHBox( phoneWidget );
219 new QLabel( i18n("Model(opt.): "), temphb );
220 mPhoneModel = new QLineEdit( temphb);
221 button = new QPushButton( i18n("Help..."), temphb );
222 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
223
224 // *** local
225 localFileWidget = new QVBox( topFrame);
226 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
227 ++iii; 223 ++iii;
228 temphb = new QHBox( localFileWidget );
229
230 lab = new QLabel( i18n("Local file Cal:"), temphb );
231 lab = new QLabel( i18n("Local file ABook:"), temphb );
232 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
233 temphb = new QHBox( localFileWidget );
234 button = new QPushButton( i18n("Choose..."), temphb );
235 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
236 button = new QPushButton( i18n("Choose..."), temphb );
237 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
238 button = new QPushButton( i18n("Choose..."), temphb );
239 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
240 temphb = new QHBox( localFileWidget );
241
242 mRemoteFile = new QLineEdit( temphb);
243 mRemoteFileAB = new QLineEdit( temphb);
244 mRemoteFilePWM = new QLineEdit( temphb);
245 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
246
247
248 // *** remote
249 remoteFileWidget = new QVBox( topFrame);
250 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
251 ++iii;
252 temphb = new QHBox( remoteFileWidget );
253 new QLabel( i18n("Calendar:"), temphb);
254 new QLabel( i18n("AddressBook:"), temphb);
255 new QLabel( i18n("PWManager:"), temphb);
256
257 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
258 temphb = new QHBox( remoteFileWidget );
259 mRemotePrecommand = new QLineEdit(temphb);
260 mRemotePrecommandAB = new QLineEdit(temphb);
261 mRemotePrecommandPWM = new QLineEdit(temphb);
262
263 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
264 temphb = new QHBox( remoteFileWidget );
265 mLocalTempFile = new QLineEdit(temphb);
266 mLocalTempFileAB = new QLineEdit(temphb);
267 mLocalTempFilePWM = new QLineEdit(temphb);
268
269 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
270 temphb = new QHBox( remoteFileWidget );
271 mRemotePostcommand = new QLineEdit(temphb );
272 mRemotePostcommandAB = new QLineEdit(temphb );
273 mRemotePostcommandPWM = new QLineEdit(temphb );
274 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
275 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
276 temphb = new QHBox( remoteFileWidget );
277 button = new QPushButton( i18n("ssh/scp"), temphb );
278 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
279 button = new QPushButton( i18n("ftp"), temphb );
280 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
281 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
282
283 // *** pi-sync
284 piWidget = new QVBox( topFrame);
285 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
286 ++iii;
287 temphb = new QHBox( piWidget );
288 new QLabel( i18n("Calendar:"), temphb);
289 new QLabel( i18n("AddressBook:"), temphb);
290 new QLabel( i18n("PWManager:"), temphb);
291
292 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
293 temphb = new QHBox( piWidget );
294 mRemotePw = new QLineEdit(temphb);
295 mRemotePwAB = new QLineEdit(temphb);
296 mRemotePwPWM = new QLineEdit(temphb);
297
298 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
299 temphb = new QHBox( piWidget );
300 mRemoteIP = new QLineEdit(temphb);
301 mRemoteIPAB = new QLineEdit(temphb);
302 mRemoteIPPWM = new QLineEdit(temphb);
303
304 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
305 temphb = new QHBox( piWidget );
306 mRemotePort = new QLineEdit(temphb);
307 mRemotePortAB = new QLineEdit(temphb);
308 mRemotePortPWM = new QLineEdit(temphb);
309 224
225 // ******************************************
226 // Profile kind specific settings
227 {
228 // *** phone *******************************
229 QVGroupBox* topFrame = gb1;
230 phoneWidget = new QVBox( topFrame);
231 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
232 //++iii;
233 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
234 QHBox* temphb = new QHBox( phoneWidget );
235 new QLabel( i18n("I/O device: "), temphb );
236 mPhoneDevice = new QLineEdit( temphb);
237 button = new QPushButton( i18n("Help..."), temphb );
238 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
239
240
241 temphb = new QHBox( phoneWidget );
242 new QLabel( i18n("Connection: "), temphb );
243 mPhoneConnection = new QLineEdit( temphb);
244 button = new QPushButton( i18n("Help..."), temphb );
245 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
246
247
248 temphb = new QHBox( phoneWidget );
249 new QLabel( i18n("Model(opt.): "), temphb );
250 mPhoneModel = new QLineEdit( temphb);
251 button = new QPushButton( i18n("Help..."), temphb );
252 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
253
254 // *** local*******************************
255 localFileWidget = new QVBox( topFrame);
256 //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
257 //++iii;
258 temphb = new QHBox( localFileWidget );
259
260 lab = new QLabel( i18n("Local file Cal:"), temphb );
261 lab = new QLabel( i18n("Local file ABook:"), temphb );
262 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
263 temphb = new QHBox( localFileWidget );
264 button = new QPushButton( i18n("Choose..."), temphb );
265 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
266 button = new QPushButton( i18n("Choose..."), temphb );
267 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
268 button = new QPushButton( i18n("Choose..."), temphb );
269 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
270 temphb = new QHBox( localFileWidget );
271
272 mRemoteFile = new QLineEdit( temphb);
273 mRemoteFileAB = new QLineEdit( temphb);
274 mRemoteFilePWM = new QLineEdit( temphb);
275 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
276
277
278 // *** remote*******************************
279 remoteFileWidget = new QVBox( topFrame);
280 //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
281 //++iii;
282 temphb = new QHBox( remoteFileWidget );
283 new QLabel( i18n("Calendar:"), temphb);
284 new QLabel( i18n("AddressBook:"), temphb);
285 new QLabel( i18n("PWManager:"), temphb);
286
287 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
288 temphb = new QHBox( remoteFileWidget );
289 mRemotePrecommand = new QLineEdit(temphb);
290 mRemotePrecommandAB = new QLineEdit(temphb);
291 mRemotePrecommandPWM = new QLineEdit(temphb);
292
293 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
294 temphb = new QHBox( remoteFileWidget );
295 mLocalTempFile = new QLineEdit(temphb);
296 mLocalTempFileAB = new QLineEdit(temphb);
297 mLocalTempFilePWM = new QLineEdit(temphb);
298
299 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
300 temphb = new QHBox( remoteFileWidget );
301 mRemotePostcommand = new QLineEdit(temphb );
302 mRemotePostcommandAB = new QLineEdit(temphb );
303 mRemotePostcommandPWM = new QLineEdit(temphb );
304 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
305 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
306 temphb = new QHBox( remoteFileWidget );
307 button = new QPushButton( i18n("ssh/scp"), temphb );
308 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
309 button = new QPushButton( i18n("ftp"), temphb );
310 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
311 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
312
313 // *** pi-sync*******************************
314 piWidget = new QVBox( topFrame);
315 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
316 //++iii;
317 temphb = new QHBox( piWidget );
318 new QLabel( i18n("Calendar:"), temphb);
319 new QLabel( i18n("AddressBook:"), temphb);
320 new QLabel( i18n("PWManager:"), temphb);
321
322 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
323 temphb = new QHBox( piWidget );
324 mRemotePw = new QLineEdit(temphb);
325 mRemotePwAB = new QLineEdit(temphb);
326 mRemotePwPWM = new QLineEdit(temphb);
327
328 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
329 temphb = new QHBox( piWidget );
330 mRemoteIP = new QLineEdit(temphb);
331 mRemoteIPAB = new QLineEdit(temphb);
332 mRemoteIPPWM = new QLineEdit(temphb);
333
334 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
335 temphb = new QHBox( piWidget );
336 mRemotePort = new QLineEdit(temphb);
337 mRemotePortAB = new QLineEdit(temphb);
338 mRemotePortPWM = new QLineEdit(temphb);
339 }
340 // ******************************************
341 // Profile kind specific settings END
342
310} 343}
311 344
312 345
313 346
347void KSyncPrefsDialog::readFilter()
348{
349 mFilterKapi.clear();
350 mFilterKopi.clear();
351 mFilterKopi.append(i18n("No Filter") );
352 mFilterKapi.append(i18n("No Filter") );
353 KConfig cfgko(locateLocal("config","korganizerrc"));
354 KConfig cfgka(locateLocal("config","kaddressbookrc"));
355 cfgko.setGroup("General");
356 mFilterKopi = cfgko.readListEntry("CalendarFilters");
357 mFilterKopi.prepend(i18n("No Filter") );
358}
314 359
315 360
316void KSyncPrefsDialog::slotOK() 361void KSyncPrefsDialog::slotOK()
317{ 362{
318 if ( mMyMachineName->text() == "undefined" ) { 363 if ( mMyMachineName->text() == "undefined" ) {
319 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 364 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
320 return; 365 return;
321 } 366 }
322 int i; 367 int i;
323 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 368 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
324 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 369 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
325 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 370 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
326 return; 371 return;
327 } 372 }
328 } 373 }
329 usrWriteConfig(); 374 usrWriteConfig();
330 QDialog::accept(); 375 QDialog::accept();
331} 376}
332void KSyncPrefsDialog::accept() 377void KSyncPrefsDialog::accept()
333{ 378{
334 slotOK(); 379 slotOK();
335} 380}
336void KSyncPrefsDialog::chooseFile() 381void KSyncPrefsDialog::chooseFile()
337{ 382{
338 QString fn = QDir::homeDirPath(); 383 QString fn = QDir::homeDirPath();
339 384
340 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 385 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
341 if ( fn == "" ) 386 if ( fn == "" )
342 return; 387 return;
343 mRemoteFile->setText( fn ); 388 mRemoteFile->setText( fn );
344} 389}
345 390
346void KSyncPrefsDialog::chooseFileAB() 391void KSyncPrefsDialog::chooseFileAB()
347{ 392{
348 QString fn = QDir::homeDirPath(); 393 QString fn = QDir::homeDirPath();
349 394
350 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); 395 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
351 if ( fn == "" ) 396 if ( fn == "" )
352 return; 397 return;
353 mRemoteFileAB->setText( fn ); 398 mRemoteFileAB->setText( fn );
354} 399}
355 400
356void KSyncPrefsDialog::chooseFilePWM() 401void KSyncPrefsDialog::chooseFilePWM()
357{ 402{
358 QString fn = QDir::homeDirPath(); 403 QString fn = QDir::homeDirPath();
359 404
360 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 405 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
361 if ( fn == "" ) 406 if ( fn == "" )
362 return; 407 return;
363 mRemoteFilePWM->setText( fn ); 408 mRemoteFilePWM->setText( fn );
364} 409}
365 410
366void KSyncPrefsDialog::textChanged( const QString & s ) 411void KSyncPrefsDialog::textChanged( const QString & s )
367{ 412{
368 if ( mProfileBox->count() == 0 ) 413 if ( mProfileBox->count() == 0 )
369 return; 414 return;
370 if ( currentSelection < 3 ) { 415 if ( currentSelection < 3 ) {
371 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 416 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
372 mProfileBox->blockSignals( true ); 417 mProfileBox->blockSignals( true );
373 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 418 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
374 mProfileBox->blockSignals( false ); 419 mProfileBox->blockSignals( false );
375 return; 420 return;
376 } 421 }
377 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 422 //qDebug("cur i %d ",mProfileBox-> currentItem () );
378 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 423 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
379 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 424 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
380 prof->setName( s ); 425 prof->setName( s );
381 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 426 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
382} 427}
383void KSyncPrefsDialog::profileChanged( int item ) 428void KSyncPrefsDialog::profileChanged( int item )
384{ 429{
385 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); 430 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
386 KSyncProfile* prof; 431 KSyncProfile* prof;
387 saveProfile(); 432 saveProfile();
388 currentSelection = item; 433 currentSelection = item;
389 prof = mSyncProfiles.at(item) ; 434 prof = mSyncProfiles.at(item) ;
390 435
391 mRemotePw->setText(prof->getRemotePw()); 436 mRemotePw->setText(prof->getRemotePw());
392 mRemoteIP->setText(prof->getRemoteIP()); 437 mRemoteIP->setText(prof->getRemoteIP());
393 mRemotePort->setText(prof->getRemotePort()); 438 mRemotePort->setText(prof->getRemotePort());
394 439
395 mRemotePwAB->setText(prof->getRemotePwAB()); 440 mRemotePwAB->setText(prof->getRemotePwAB());
396 mRemoteIPAB->setText(prof->getRemoteIPAB()); 441 mRemoteIPAB->setText(prof->getRemoteIPAB());
397 mRemotePortAB->setText(prof->getRemotePortAB()); 442 mRemotePortAB->setText(prof->getRemotePortAB());
398 443
399 mRemotePwPWM->setText(prof->getRemotePwPWM()); 444 mRemotePwPWM->setText(prof->getRemotePwPWM());
400 mRemoteIPPWM->setText(prof->getRemoteIPPWM()); 445 mRemoteIPPWM->setText(prof->getRemoteIPPWM());
401 mRemotePortPWM->setText(prof->getRemotePortPWM()); 446 mRemotePortPWM->setText(prof->getRemotePortPWM());
402 447
403 mRemotePrecommand->setText(prof->getPreSyncCommand()); 448 mRemotePrecommand->setText(prof->getPreSyncCommand());
404 mRemotePostcommand->setText(prof->getPostSyncCommand()); 449 mRemotePostcommand->setText(prof->getPostSyncCommand());
405 mLocalTempFile->setText(prof->getLocalTempFile()); 450 mLocalTempFile->setText(prof->getLocalTempFile());
406 mRemoteFile->setText(prof->getRemoteFileName()) ; 451 mRemoteFile->setText(prof->getRemoteFileName()) ;
407 452
408 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 453 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
409 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 454 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
410 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 455 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
411 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 456 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
412 457
413 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 458 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
414 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 459 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
415 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 460 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
416 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 461 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
417 462
418 if ( mWriteContactToSIM ) 463 if ( mWriteContactToSIM )
419 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 464 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
420 mPhoneDevice->setText(prof->getPhoneDevice()); 465 mPhoneDevice->setText(prof->getPhoneDevice());
421 mPhoneConnection->setText(prof->getPhoneConnection()); 466 mPhoneConnection->setText(prof->getPhoneConnection());
422 mPhoneModel->setText(prof->getPhoneModel()); 467 mPhoneModel->setText(prof->getPhoneModel());
423 468
424 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 469 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
425 mAskForPreferences->setChecked( prof->getAskForPreferences()); 470 mAskForPreferences->setChecked( prof->getAskForPreferences());
426 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 471 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
427 mWriteBackFile->setChecked( prof->getWriteBackFile()); 472 mWriteBackFile->setChecked( prof->getWriteBackFile());
428 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 473 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
429 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 474 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
430 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 475 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
431 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 476 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
432 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 477 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
478 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() );
433 479
434 switch ( prof->getSyncPrefs() ) { 480 switch ( prof->getSyncPrefs() ) {
435 case 0: 481 case 0:
436 loc->setChecked( true); 482 loc->setChecked( true);
437 break; 483 break;
438 case 1: 484 case 1:
439 rem->setChecked( true ); 485 rem->setChecked( true );
440 break; 486 break;
441 case 2: 487 case 2:
442 newest->setChecked( true); 488 newest->setChecked( true);
443 break; 489 break;
444 case 3: 490 case 3:
445 ask->setChecked( true); 491 ask->setChecked( true);
446 break; 492 break;
447 case 4: 493 case 4:
448 f_loc->setChecked( true); 494 f_loc->setChecked( true);
449 break; 495 break;
450 case 5: 496 case 5:
451 f_rem->setChecked( true); 497 f_rem->setChecked( true);
452 break; 498 break;
453 case 6: 499 case 6:
454 //both->setChecked( true); 500 //both->setChecked( true);
455 break; 501 break;
456 default: 502 default:
457 break; 503 break;
458 } 504 }
459 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 505 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
460 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 506 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
461 mIsPi->setChecked(prof->getIsPiSync()) ; 507 mIsPi->setChecked(prof->getIsPiSync()) ;
462 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; 508 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
463 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; 509 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
464 510
465 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); 511 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() );
466 proGr->setEnabled( item > 2 ); 512 proGr->setEnabled( item > 2 );
467 if ( item < 3 ) { 513 if ( item < 3 ) {
468 localFileWidget->hide(); 514 localFileWidget->hide();
469 remoteFileWidget->hide(); 515 remoteFileWidget->hide();
470 phoneWidget->hide(); 516 phoneWidget->hide();
471 piWidget->hide(); 517 piWidget->hide();
472 518
473 } else 519 } else
474 kindChanged( prof->getIsLocalFileSync() ); 520 kindChanged( prof->getIsLocalFileSync() );
475} 521}
476 522
477void KSyncPrefsDialog::fillSSH() 523void KSyncPrefsDialog::fillSSH()
478{ 524{
479 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 525 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
480 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 526 mLocalTempFile->setText("/tmp/mycalendar.ics" );
481 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 527 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
482 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 528 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
483 mLocalTempFileAB->setText("/tmp/std.vcf" ); 529 mLocalTempFileAB->setText("/tmp/std.vcf" );
484 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 530 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
485 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 531 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
486 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 532 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
487 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 533 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
488} 534}
489void KSyncPrefsDialog::fillFTP() 535void KSyncPrefsDialog::fillFTP()
490{ 536{
491 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 537 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
492 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 538 mLocalTempFile->setText("/tmp/mycalendar.ics" );
493 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 539 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
494 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 540 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
495 mLocalTempFileAB->setText("/tmp/std.vcf" ); 541 mLocalTempFileAB->setText("/tmp/std.vcf" );
496 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 542 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
497 543
498 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 544 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
499 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 545 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
500 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 546 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
501 547
502} 548}
503void KSyncPrefsDialog::kindChanged( bool b ) 549void KSyncPrefsDialog::kindChanged( bool b )
504{ 550{
505 551
506 if ( mIsLocal->isChecked () ) { 552 if ( mIsLocal->isChecked () ) {
507 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() ); 553 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() );
508 } else { 554 } else {
509 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() ); 555 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() );
510 } 556 }
511 557
512 if ( mIsLocal->isChecked () ) 558 if ( mIsLocal->isChecked () )
513 localFileWidget->show(); 559 localFileWidget->show();
514 else 560 else
515 localFileWidget->hide(); 561 localFileWidget->hide();
516 562
517 if ( mIsNotLocal->isChecked () ) 563 if ( mIsNotLocal->isChecked () )
518 remoteFileWidget->show(); 564 remoteFileWidget->show();
519 else 565 else
520 remoteFileWidget->hide(); 566 remoteFileWidget->hide();
521 567
522 if ( mIsPhone->isChecked () ) { 568 if ( mIsPhone->isChecked () ) {
523 phoneWidget->show(); 569 phoneWidget->show();
524 } 570 }
525 else { 571 else {
526 phoneWidget->hide(); 572 phoneWidget->hide();
527 } 573 }
528 if ( mIsPi->isChecked () ) { 574 if ( mIsPi->isChecked () ) {
529 piWidget->show(); 575 piWidget->show();
530 } 576 }
531 else { 577 else {
532 piWidget->hide(); 578 piWidget->hide();
533 } 579 }
534 580
535} 581}
536void KSyncPrefsDialog::deleteProfile() 582void KSyncPrefsDialog::deleteProfile()
537{ 583{
538 //qDebug("KSyncPrefsDialog::deleteProfile() "); 584 //qDebug("KSyncPrefsDialog::deleteProfile() ");
539 if ( currentSelection >= 0 ) { 585 if ( currentSelection >= 0 ) {
540 if ( currentSelection < 3 ) { 586 if ( currentSelection < 3 ) {
541 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 587 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
542 return; 588 return;
543 } 589 }
544 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 590 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
545 mSyncProfiles.remove( temp ); 591 mSyncProfiles.remove( temp );
546 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 592 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
547 insertProfiles(); 593 insertProfiles();
548 } 594 }
549} 595}
550 596
551void KSyncPrefsDialog::saveProfile() 597void KSyncPrefsDialog::saveProfile()
552{ 598{
553 KSyncProfile* prof; 599 KSyncProfile* prof;
554 if ( currentSelection >= 0 ) { 600 if ( currentSelection >= 0 ) {
555 prof = mSyncProfiles.at(currentSelection) ; 601 prof = mSyncProfiles.at(currentSelection) ;
556 602
557 prof->setRemotePw( mRemotePw->text()); 603 prof->setRemotePw( mRemotePw->text());
558 prof->setRemoteIP( mRemoteIP->text()); 604 prof->setRemoteIP( mRemoteIP->text());
559 prof->setRemotePort( mRemotePort->text()); 605 prof->setRemotePort( mRemotePort->text());
560 606
561 prof->setRemotePwAB( mRemotePwAB->text()); 607 prof->setRemotePwAB( mRemotePwAB->text());
562 prof->setRemoteIPAB( mRemoteIPAB->text()); 608 prof->setRemoteIPAB( mRemoteIPAB->text());
563 prof->setRemotePortAB( mRemotePortAB->text()); 609 prof->setRemotePortAB( mRemotePortAB->text());
564 610
565 prof->setRemotePwPWM( mRemotePwPWM->text()); 611 prof->setRemotePwPWM( mRemotePwPWM->text());
566 prof->setRemoteIPPWM( mRemoteIPPWM->text()); 612 prof->setRemoteIPPWM( mRemoteIPPWM->text());
567 prof->setRemotePortPWM( mRemotePortPWM->text()); 613 prof->setRemotePortPWM( mRemotePortPWM->text());
568 614
569 prof->setPreSyncCommand( mRemotePrecommand->text()); 615 prof->setPreSyncCommand( mRemotePrecommand->text());
570 prof->setPostSyncCommand( mRemotePostcommand->text() ); 616 prof->setPostSyncCommand( mRemotePostcommand->text() );
571 prof->setLocalTempFile( mLocalTempFile->text()); 617 prof->setLocalTempFile( mLocalTempFile->text());
572 prof->setRemoteFileName( mRemoteFile->text() ); 618 prof->setRemoteFileName( mRemoteFile->text() );
573 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 619 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
574 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 620 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
575 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 621 prof->setLocalTempFileAB( mLocalTempFileAB->text());
576 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 622 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
577 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); 623 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
578 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); 624 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
579 prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); 625 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
580 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); 626 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
581 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 627 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
582 prof->setAskForPreferences( mAskForPreferences->isChecked()); 628 prof->setAskForPreferences( mAskForPreferences->isChecked());
583 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 629 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
584 prof->setWriteBackFile( mWriteBackFile->isChecked()); 630 prof->setWriteBackFile( mWriteBackFile->isChecked());
585 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 631 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
586 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 632 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
587 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); 633 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
588 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 634 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
589 prof->setSyncPrefs( syncprefs); 635 prof->setSyncPrefs( syncprefs);
590 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 636 prof->setIsLocalFileSync( mIsLocal->isChecked() );
591 prof->setIsPhoneSync( mIsPhone->isChecked() ); 637 prof->setIsPhoneSync( mIsPhone->isChecked() );
592 prof->setIsPiSync( mIsPi->isChecked() ); 638 prof->setIsPiSync( mIsPi->isChecked() );
593 prof->setIsKapiFile( mIsKapiFileL->isChecked() ); 639 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
594 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 640 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
595 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 641 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
642 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value());
596 if ( mWriteContactToSIM ) 643 if ( mWriteContactToSIM )
597 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 644 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
598 prof->setPhoneDevice( mPhoneDevice->text() ); 645 prof->setPhoneDevice( mPhoneDevice->text() );
599 prof->setPhoneConnection( mPhoneConnection->text() ); 646 prof->setPhoneConnection( mPhoneConnection->text() );
600 prof->setPhoneModel( mPhoneModel->text() ); 647 prof->setPhoneModel( mPhoneModel->text() );
601 648
602 } 649 }
603 650
604} 651}
605 652
606void KSyncPrefsDialog::insertProfiles() 653void KSyncPrefsDialog::insertProfiles()
607{ 654{
608 int curItem = mProfileBox->currentItem(); 655 int curItem = mProfileBox->currentItem();
609 mProfileBox->blockSignals( true ); 656 mProfileBox->blockSignals( true );
610 mProfileBox->clear(); 657 mProfileBox->clear();
611 mProfileBox->insertStringList (mSyncProfileNames ); 658 mProfileBox->insertStringList (mSyncProfileNames );
612 int item = mSyncProfileNames.count() -1; 659 int item = mSyncProfileNames.count() -1;
613 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 660 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
614 mProfileBox->setCurrentItem( curItem ); 661 mProfileBox->setCurrentItem( curItem );
615 else if ( item >= 0 ) { 662 else if ( item >= 0 ) {
616 mProfileBox->setCurrentItem( item ); 663 mProfileBox->setCurrentItem( item );
617 } 664 }
618 currentSelection = -1; 665 currentSelection = -1;
619 if ( mSyncProfileNames.count() > 0 ) { 666 if ( mSyncProfileNames.count() > 0 ) {
620 //qDebug(" profileChanged( mProfileBox->currentItem() "); 667 //qDebug(" profileChanged( mProfileBox->currentItem() ");
621 profileChanged( mProfileBox->currentItem() ); 668 profileChanged( mProfileBox->currentItem() );
622 currentSelection = mProfileBox->currentItem(); 669 currentSelection = mProfileBox->currentItem();
623 } 670 }
624 mProfileBox->blockSignals( false ); 671 mProfileBox->blockSignals( false );
625} 672}
626 673
627void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 674void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
628{ 675{
629 saveProfile(); 676 saveProfile();
630 mSyncProfiles.append( temp ); 677 mSyncProfiles.append( temp );
631 mSyncProfileNames << temp->getName(); 678 mSyncProfileNames << temp->getName();
632 insertProfiles(); 679 insertProfiles();
633 int last = mProfileBox->count() -1; 680 int last = mProfileBox->count() -1;
634 mProfileBox->blockSignals( true ); 681 mProfileBox->blockSignals( true );
635 mProfileBox->setCurrentItem( last ); 682 mProfileBox->setCurrentItem( last );
636 mProfileBox->blockSignals( false ); 683 mProfileBox->blockSignals( false );
637 profileChanged(last); 684 profileChanged(last);
638} 685}
639void KSyncPrefsDialog::newProfile() 686void KSyncPrefsDialog::newProfile()
640{ 687{
641 addProfile ( new KSyncProfile () ); 688 addProfile ( new KSyncProfile () );
642} 689}
643 690
644void KSyncPrefsDialog::cloneProfile() 691void KSyncPrefsDialog::cloneProfile()
645{ 692{
646 if ( currentSelection >= 0 ) 693 if ( currentSelection >= 0 )
647 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 694 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
648 else 695 else
649 newProfile(); 696 newProfile();
650} 697}
651 698
652void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) 699void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
653{ 700{
654 mMyMachineName->setText( name ); 701 mMyMachineName->setText( name );
655 702
656} 703}
657QString KSyncPrefsDialog::getLocalMachineName ( ) 704QString KSyncPrefsDialog::getLocalMachineName ( )
658{ 705{
659 return mMyMachineName->text(); 706 return mMyMachineName->text();
660} 707}
661 708
662QStringList KSyncPrefsDialog::getSyncProfileNames() 709QStringList KSyncPrefsDialog::getSyncProfileNames()
663{ 710{
664 return mSyncProfileNames; 711 return mSyncProfileNames;
665} 712}
666void KSyncPrefsDialog::usrReadConfig() 713void KSyncPrefsDialog::usrReadConfig()
667{ 714{
668 //KConfig *config = KOGlobals::config(); 715 //KConfig *config = KOGlobals::config();
669 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 716 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
670 config.setGroup("General"); 717 config.setGroup("General");
671 mSyncProfileNames =config.readListEntry("SyncProfileNames"); 718 mSyncProfileNames =config.readListEntry("SyncProfileNames");
672 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); 719 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
673 int i; 720 int i;
674 KSyncProfile* temp ; 721 KSyncProfile* temp ;
675 mSyncProfiles.clear(); 722 mSyncProfiles.clear();
676 for ( i = 0; i < mSyncProfileNames.count();++i ) { 723 for ( i = 0; i < mSyncProfileNames.count();++i ) {
677 temp = new KSyncProfile (); 724 temp = new KSyncProfile ();
678 temp->setName( mSyncProfileNames[i] ); 725 temp->setName( mSyncProfileNames[i] );
679 temp->readConfig( &config ); 726 temp->readConfig( &config );
680 mSyncProfiles.append( temp ); 727 mSyncProfiles.append( temp );
681 } 728 }
682 insertProfiles(); 729 insertProfiles();
683 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); 730 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
684} 731}
685 732
686 733
687void KSyncPrefsDialog::usrWriteConfig() 734void KSyncPrefsDialog::usrWriteConfig()
688{ 735{
689 saveProfile(); 736 saveProfile();
690 if ( currentSelection >= 0 ) 737 if ( currentSelection >= 0 )
691 profileChanged(currentSelection); 738 profileChanged(currentSelection);
692 //KConfig *config = KOGlobals::config(); 739 //KConfig *config = KOGlobals::config();
693 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 740 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
694 KSyncProfile* prof = mSyncProfiles.first(); 741 KSyncProfile* prof = mSyncProfiles.first();
695 QStringList externalSyncProfileNames; 742 QStringList externalSyncProfileNames;
696 externalSyncProfileNames.append("Sharp_DTM");; 743 externalSyncProfileNames.append("Sharp_DTM");;
697 while ( prof ) { 744 while ( prof ) {
698 prof->writeConfig(&config); 745 prof->writeConfig(&config);
699 if ( prof->getIsPhoneSync( ) ) 746 if ( prof->getIsPhoneSync( ) )
700 externalSyncProfileNames.append(prof->getName( ) ); 747 externalSyncProfileNames.append(prof->getName( ) );
701 prof = mSyncProfiles.next(); 748 prof = mSyncProfiles.next();
702 } 749 }
703 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; 750 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
704 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); 751 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
705 config.setGroup("General"); 752 config.setGroup("General");
706 config.writeEntry("SyncProfileNames",mSyncProfileNames); 753 config.writeEntry("SyncProfileNames",mSyncProfileNames);
707 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); 754 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames);
708 config.writeEntry("LocalMachineName",mMyMachineName->text()); 755 config.writeEntry("LocalMachineName",mMyMachineName->text());
709 config.sync(); 756 config.sync();
710} 757}
711 758
712void KSyncPrefsDialog::helpDevice() 759void KSyncPrefsDialog::helpDevice()
713{ 760{
714 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); 761 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n");
715#ifdef _WIN32_ 762#ifdef _WIN32_
716 hint += "Leave empty for Irda.\n" 763 hint += "Leave empty for Irda.\n"
717 "com1:\n(first serial port)\n" 764 "com1:\n(first serial port)\n"
718 "usb not supported\n" 765 "usb not supported\n"
719 "???\n(bluetooth device address)\n"; 766 "???\n(bluetooth device address)\n";
720 767
721#else 768#else
722 hint += "/dev/ircomm\n(Irda)\n" 769 hint += "/dev/ircomm\n(Irda)\n"
723 "/dev/ttyS0\n(first serial port)\n" 770 "/dev/ttyS0\n(first serial port)\n"