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