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