summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
authorzautrix <zautrix>2004-10-13 03:05:35 (UTC)
committer zautrix <zautrix>2004-10-13 03:05:35 (UTC)
commit8f852fddc2dc5b63511d6ad1c85a1e74141969ff (patch) (unidiff)
tree123c7e845e1520a4dcd50dd2361252cc6ab7a76a /libkdepim/ksyncprefsdialog.cpp
parente7833b80c28e38bfe6316ee5fce150635cdebe03 (diff)
downloadkdepimpi-8f852fddc2dc5b63511d6ad1c85a1e74141969ff.zip
kdepimpi-8f852fddc2dc5b63511d6ad1c85a1e74141969ff.tar.gz
kdepimpi-8f852fddc2dc5b63511d6ad1c85a1e74141969ff.tar.bz2
fixed one syncing problem
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index cf8f996..03265d2 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -1,732 +1,744 @@
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 = 0;//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 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
246
245 247
246 // *** remote 248 // *** remote
247 remoteFileWidget = new QVBox( topFrame); 249 remoteFileWidget = new QVBox( topFrame);
248 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 250 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
249 ++iii; 251 ++iii;
250 temphb = new QHBox( remoteFileWidget ); 252 temphb = new QHBox( remoteFileWidget );
251 new QLabel( i18n("Calendar:"), temphb); 253 new QLabel( i18n("Calendar:"), temphb);
252 new QLabel( i18n("AddressBook:"), temphb); 254 new QLabel( i18n("AddressBook:"), temphb);
253 new QLabel( i18n("PWManager:"), temphb); 255 new QLabel( i18n("PWManager:"), temphb);
254 256
255 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 257 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
256 temphb = new QHBox( remoteFileWidget ); 258 temphb = new QHBox( remoteFileWidget );
257 mRemotePrecommand = new QLineEdit(temphb); 259 mRemotePrecommand = new QLineEdit(temphb);
258 mRemotePrecommandAB = new QLineEdit(temphb); 260 mRemotePrecommandAB = new QLineEdit(temphb);
259 mRemotePrecommandPWM = new QLineEdit(temphb); 261 mRemotePrecommandPWM = new QLineEdit(temphb);
260 262
261 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 263 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
262 temphb = new QHBox( remoteFileWidget ); 264 temphb = new QHBox( remoteFileWidget );
263 mLocalTempFile = new QLineEdit(temphb); 265 mLocalTempFile = new QLineEdit(temphb);
264 mLocalTempFileAB = new QLineEdit(temphb); 266 mLocalTempFileAB = new QLineEdit(temphb);
265 mLocalTempFilePWM = new QLineEdit(temphb); 267 mLocalTempFilePWM = new QLineEdit(temphb);
266 268
267 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 269 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
268 temphb = new QHBox( remoteFileWidget ); 270 temphb = new QHBox( remoteFileWidget );
269 mRemotePostcommand = new QLineEdit(temphb ); 271 mRemotePostcommand = new QLineEdit(temphb );
270 mRemotePostcommandAB = new QLineEdit(temphb ); 272 mRemotePostcommandAB = new QLineEdit(temphb );
271 mRemotePostcommandPWM = new QLineEdit(temphb ); 273 mRemotePostcommandPWM = new QLineEdit(temphb );
272 274 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
273 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 275 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
274 temphb = new QHBox( remoteFileWidget ); 276 temphb = new QHBox( remoteFileWidget );
275 button = new QPushButton( i18n("ssh/scp"), temphb ); 277 button = new QPushButton( i18n("ssh/scp"), temphb );
276 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 278 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
277 button = new QPushButton( i18n("ftp"), temphb ); 279 button = new QPushButton( i18n("ftp"), temphb );
278 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 280 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
279 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 281 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
280 282
281 // *** pi-sync 283 // *** pi-sync
282 piWidget = new QVBox( topFrame); 284 piWidget = new QVBox( topFrame);
283 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); 285 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
284 ++iii; 286 ++iii;
285 temphb = new QHBox( piWidget ); 287 temphb = new QHBox( piWidget );
286 new QLabel( i18n("Calendar:"), temphb); 288 new QLabel( i18n("Calendar:"), temphb);
287 new QLabel( i18n("AddressBook:"), temphb); 289 new QLabel( i18n("AddressBook:"), temphb);
288 new QLabel( i18n("PWManager:"), temphb); 290 new QLabel( i18n("PWManager:"), temphb);
289 291
290 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); 292 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
291 temphb = new QHBox( piWidget ); 293 temphb = new QHBox( piWidget );
292 mRemotePw = new QLineEdit(temphb); 294 mRemotePw = new QLineEdit(temphb);
293 mRemotePwAB = new QLineEdit(temphb); 295 mRemotePwAB = new QLineEdit(temphb);
294 mRemotePwPWM = new QLineEdit(temphb); 296 mRemotePwPWM = new QLineEdit(temphb);
295 297
296 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); 298 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
297 temphb = new QHBox( piWidget ); 299 temphb = new QHBox( piWidget );
298 mRemoteIP = new QLineEdit(temphb); 300 mRemoteIP = new QLineEdit(temphb);
299 mRemoteIPAB = new QLineEdit(temphb); 301 mRemoteIPAB = new QLineEdit(temphb);
300 mRemoteIPPWM = new QLineEdit(temphb); 302 mRemoteIPPWM = new QLineEdit(temphb);
301 303
302 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); 304 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
303 temphb = new QHBox( piWidget ); 305 temphb = new QHBox( piWidget );
304 mRemotePort = new QLineEdit(temphb); 306 mRemotePort = new QLineEdit(temphb);
305 mRemotePortAB = new QLineEdit(temphb); 307 mRemotePortAB = new QLineEdit(temphb);
306 mRemotePortPWM = new QLineEdit(temphb); 308 mRemotePortPWM = new QLineEdit(temphb);
307 309
308} 310}
309 311
310 312
311 313
312 314
313 315
314void KSyncPrefsDialog::slotOK() 316void KSyncPrefsDialog::slotOK()
315{ 317{
316 if ( mMyMachineName->text() == "undefined" ) { 318 if ( mMyMachineName->text() == "undefined" ) {
317 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 319 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
318 return; 320 return;
319 } 321 }
320 int i; 322 int i;
321 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 323 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
322 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 324 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")); 325 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
324 return; 326 return;
325 } 327 }
326 } 328 }
327 usrWriteConfig(); 329 usrWriteConfig();
328 QDialog::accept(); 330 QDialog::accept();
329} 331}
330void KSyncPrefsDialog::accept() 332void KSyncPrefsDialog::accept()
331{ 333{
332 slotOK(); 334 slotOK();
333} 335}
334void KSyncPrefsDialog::chooseFile() 336void KSyncPrefsDialog::chooseFile()
335{ 337{
336 QString fn = QDir::homeDirPath(); 338 QString fn = QDir::homeDirPath();
337 339
338 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 340 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
339 if ( fn == "" ) 341 if ( fn == "" )
340 return; 342 return;
341 mRemoteFile->setText( fn ); 343 mRemoteFile->setText( fn );
342} 344}
343 345
344void KSyncPrefsDialog::chooseFileAB() 346void KSyncPrefsDialog::chooseFileAB()
345{ 347{
346 QString fn = QDir::homeDirPath(); 348 QString fn = QDir::homeDirPath();
347 349
348 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); 350 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
349 if ( fn == "" ) 351 if ( fn == "" )
350 return; 352 return;
351 mRemoteFileAB->setText( fn ); 353 mRemoteFileAB->setText( fn );
352} 354}
353 355
354void KSyncPrefsDialog::chooseFilePWM() 356void KSyncPrefsDialog::chooseFilePWM()
355{ 357{
356 QString fn = QDir::homeDirPath(); 358 QString fn = QDir::homeDirPath();
357 359
358 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 360 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
359 if ( fn == "" ) 361 if ( fn == "" )
360 return; 362 return;
361 mRemoteFilePWM->setText( fn ); 363 mRemoteFilePWM->setText( fn );
362} 364}
363 365
364void KSyncPrefsDialog::textChanged( const QString & s ) 366void KSyncPrefsDialog::textChanged( const QString & s )
365{ 367{
366 if ( mProfileBox->count() == 0 ) 368 if ( mProfileBox->count() == 0 )
367 return; 369 return;
368 if ( currentSelection < 3 ) { 370 if ( currentSelection < 3 ) {
369 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 371 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
370 mProfileBox->blockSignals( true ); 372 mProfileBox->blockSignals( true );
371 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 373 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
372 mProfileBox->blockSignals( false ); 374 mProfileBox->blockSignals( false );
373 return; 375 return;
374 } 376 }
375 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 377 //qDebug("cur i %d ",mProfileBox-> currentItem () );
376 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 378 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
377 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 379 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
378 prof->setName( s ); 380 prof->setName( s );
379 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 381 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
380} 382}
381void KSyncPrefsDialog::profileChanged( int item ) 383void KSyncPrefsDialog::profileChanged( int item )
382{ 384{
383 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); 385 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
384 KSyncProfile* prof; 386 KSyncProfile* prof;
385 saveProfile(); 387 saveProfile();
386 currentSelection = item; 388 currentSelection = item;
387 prof = mSyncProfiles.at(item) ; 389 prof = mSyncProfiles.at(item) ;
388 390
389 mRemotePw->setText(prof->getRemotePw()); 391 mRemotePw->setText(prof->getRemotePw());
390 mRemoteIP->setText(prof->getRemoteIP()); 392 mRemoteIP->setText(prof->getRemoteIP());
391 mRemotePort->setText(prof->getRemotePort()); 393 mRemotePort->setText(prof->getRemotePort());
392 394
393 mRemotePwAB->setText(prof->getRemotePwAB()); 395 mRemotePwAB->setText(prof->getRemotePwAB());
394 mRemoteIPAB->setText(prof->getRemoteIPAB()); 396 mRemoteIPAB->setText(prof->getRemoteIPAB());
395 mRemotePortAB->setText(prof->getRemotePortAB()); 397 mRemotePortAB->setText(prof->getRemotePortAB());
396 398
397 mRemotePwPWM->setText(prof->getRemotePwPWM()); 399 mRemotePwPWM->setText(prof->getRemotePwPWM());
398 mRemoteIPPWM->setText(prof->getRemoteIPPWM()); 400 mRemoteIPPWM->setText(prof->getRemoteIPPWM());
399 mRemotePortPWM->setText(prof->getRemotePortPWM()); 401 mRemotePortPWM->setText(prof->getRemotePortPWM());
400 402
401 mRemotePrecommand->setText(prof->getPreSyncCommand()); 403 mRemotePrecommand->setText(prof->getPreSyncCommand());
402 mRemotePostcommand->setText(prof->getPostSyncCommand()); 404 mRemotePostcommand->setText(prof->getPostSyncCommand());
403 mLocalTempFile->setText(prof->getLocalTempFile()); 405 mLocalTempFile->setText(prof->getLocalTempFile());
404 mRemoteFile->setText(prof->getRemoteFileName()) ; 406 mRemoteFile->setText(prof->getRemoteFileName()) ;
405 407
406 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 408 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
407 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 409 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
408 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 410 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
409 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 411 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
410 412
411 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 413 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
412 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 414 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
413 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 415 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
414 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 416 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
415 417
416 if ( mWriteContactToSIM ) 418 if ( mWriteContactToSIM )
417 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 419 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
418 mPhoneDevice->setText(prof->getPhoneDevice()); 420 mPhoneDevice->setText(prof->getPhoneDevice());
419 mPhoneConnection->setText(prof->getPhoneConnection()); 421 mPhoneConnection->setText(prof->getPhoneConnection());
420 mPhoneModel->setText(prof->getPhoneModel()); 422 mPhoneModel->setText(prof->getPhoneModel());
421 423
422 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 424 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
423 mAskForPreferences->setChecked( prof->getAskForPreferences()); 425 mAskForPreferences->setChecked( prof->getAskForPreferences());
424 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 426 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
425 mWriteBackFile->setChecked( prof->getWriteBackFile()); 427 mWriteBackFile->setChecked( prof->getWriteBackFile());
426 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 428 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
427 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 429 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
428 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 430 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
429 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 431 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
430 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 432 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
431 433
432 switch ( prof->getSyncPrefs() ) { 434 switch ( prof->getSyncPrefs() ) {
433 case 0: 435 case 0:
434 loc->setChecked( true); 436 loc->setChecked( true);
435 break; 437 break;
436 case 1: 438 case 1:
437 rem->setChecked( true ); 439 rem->setChecked( true );
438 break; 440 break;
439 case 2: 441 case 2:
440 newest->setChecked( true); 442 newest->setChecked( true);
441 break; 443 break;
442 case 3: 444 case 3:
443 ask->setChecked( true); 445 ask->setChecked( true);
444 break; 446 break;
445 case 4: 447 case 4:
446 f_loc->setChecked( true); 448 f_loc->setChecked( true);
447 break; 449 break;
448 case 5: 450 case 5:
449 f_rem->setChecked( true); 451 f_rem->setChecked( true);
450 break; 452 break;
451 case 6: 453 case 6:
452 //both->setChecked( true); 454 //both->setChecked( true);
453 break; 455 break;
454 default: 456 default:
455 break; 457 break;
456 } 458 }
457 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 459 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
458 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 460 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
459 mIsPi->setChecked(prof->getIsPiSync()) ; 461 mIsPi->setChecked(prof->getIsPiSync()) ;
462 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
463 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
464
460 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); 465 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() );
461 proGr->setEnabled( item > 2 ); 466 proGr->setEnabled( item > 2 );
462 if ( item < 3 ) { 467 if ( item < 3 ) {
463 localFileWidget->hide(); 468 localFileWidget->hide();
464 remoteFileWidget->hide(); 469 remoteFileWidget->hide();
465 phoneWidget->hide(); 470 phoneWidget->hide();
466 piWidget->hide(); 471 piWidget->hide();
467 472
468 } else 473 } else
469 kindChanged( prof->getIsLocalFileSync() ); 474 kindChanged( prof->getIsLocalFileSync() );
470} 475}
471 476
472void KSyncPrefsDialog::fillSSH() 477void KSyncPrefsDialog::fillSSH()
473{ 478{
474 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 479 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
475 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 480 mLocalTempFile->setText("/tmp/mycalendar.ics" );
476 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 481 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" ); 482 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
478 mLocalTempFileAB->setText("/tmp/std.vcf" ); 483 mLocalTempFileAB->setText("/tmp/std.vcf" );
479 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 484 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" ); 485 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
481 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 486 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
482 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 487 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
483} 488}
484void KSyncPrefsDialog::fillFTP() 489void KSyncPrefsDialog::fillFTP()
485{ 490{
486 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 491 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
487 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 492 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" ); 493 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" ); 494 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
490 mLocalTempFileAB->setText("/tmp/std.vcf" ); 495 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" ); 496 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
492 497
493 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 498 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
494 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 499 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" ); 500 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
496 501
497} 502}
498void KSyncPrefsDialog::kindChanged( bool b ) 503void KSyncPrefsDialog::kindChanged( bool b )
499{ 504{
505
506 if ( mIsLocal->isChecked () ) {
507 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() );
508 } else {
509 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() );
510 }
500 511
501 if ( mIsLocal->isChecked () ) 512 if ( mIsLocal->isChecked () )
502 localFileWidget->show(); 513 localFileWidget->show();
503 else 514 else
504 localFileWidget->hide(); 515 localFileWidget->hide();
505 516
506 if ( mIsNotLocal->isChecked () ) 517 if ( mIsNotLocal->isChecked () )
507 remoteFileWidget->show(); 518 remoteFileWidget->show();
508 else 519 else
509 remoteFileWidget->hide(); 520 remoteFileWidget->hide();
510 521
511 if ( mIsPhone->isChecked () ) { 522 if ( mIsPhone->isChecked () ) {
512 phoneWidget->show(); 523 phoneWidget->show();
513 } 524 }
514 else { 525 else {
515 phoneWidget->hide(); 526 phoneWidget->hide();
516 } 527 }
517 if ( mIsPi->isChecked () ) { 528 if ( mIsPi->isChecked () ) {
518 piWidget->show(); 529 piWidget->show();
519 } 530 }
520 else { 531 else {
521 piWidget->hide(); 532 piWidget->hide();
522 } 533 }
523 534
524} 535}
525void KSyncPrefsDialog::deleteProfile() 536void KSyncPrefsDialog::deleteProfile()
526{ 537{
527 //qDebug("KSyncPrefsDialog::deleteProfile() "); 538 //qDebug("KSyncPrefsDialog::deleteProfile() ");
528 if ( currentSelection >= 0 ) { 539 if ( currentSelection >= 0 ) {
529 if ( currentSelection < 3 ) { 540 if ( currentSelection < 3 ) {
530 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 541 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
531 return; 542 return;
532 } 543 }
533 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 544 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
534 mSyncProfiles.remove( temp ); 545 mSyncProfiles.remove( temp );
535 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 546 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
536 insertProfiles(); 547 insertProfiles();
537 } 548 }
538} 549}
539 550
540void KSyncPrefsDialog::saveProfile() 551void KSyncPrefsDialog::saveProfile()
541{ 552{
542 KSyncProfile* prof; 553 KSyncProfile* prof;
543 if ( currentSelection >= 0 ) { 554 if ( currentSelection >= 0 ) {
544 prof = mSyncProfiles.at(currentSelection) ; 555 prof = mSyncProfiles.at(currentSelection) ;
545 556
546 prof->setRemotePw( mRemotePw->text()); 557 prof->setRemotePw( mRemotePw->text());
547 prof->setRemoteIP( mRemoteIP->text()); 558 prof->setRemoteIP( mRemoteIP->text());
548 prof->setRemotePort( mRemotePort->text()); 559 prof->setRemotePort( mRemotePort->text());
549 560
550 prof->setRemotePwAB( mRemotePwAB->text()); 561 prof->setRemotePwAB( mRemotePwAB->text());
551 prof->setRemoteIPAB( mRemoteIPAB->text()); 562 prof->setRemoteIPAB( mRemoteIPAB->text());
552 prof->setRemotePortAB( mRemotePortAB->text()); 563 prof->setRemotePortAB( mRemotePortAB->text());
553 564
554 prof->setRemotePwPWM( mRemotePwPWM->text()); 565 prof->setRemotePwPWM( mRemotePwPWM->text());
555 prof->setRemoteIPPWM( mRemoteIPPWM->text()); 566 prof->setRemoteIPPWM( mRemoteIPPWM->text());
556 prof->setRemotePortPWM( mRemotePortPWM->text()); 567 prof->setRemotePortPWM( mRemotePortPWM->text());
557 568
558 prof->setPreSyncCommand( mRemotePrecommand->text()); 569 prof->setPreSyncCommand( mRemotePrecommand->text());
559 prof->setPostSyncCommand( mRemotePostcommand->text() ); 570 prof->setPostSyncCommand( mRemotePostcommand->text() );
560 prof->setLocalTempFile( mLocalTempFile->text()); 571 prof->setLocalTempFile( mLocalTempFile->text());
561 prof->setRemoteFileName( mRemoteFile->text() ); 572 prof->setRemoteFileName( mRemoteFile->text() );
562 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 573 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
563 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 574 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
564 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 575 prof->setLocalTempFileAB( mLocalTempFileAB->text());
565 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 576 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
566 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); 577 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
567 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); 578 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
568 prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); 579 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
569 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); 580 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
570 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 581 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
571 prof->setAskForPreferences( mAskForPreferences->isChecked()); 582 prof->setAskForPreferences( mAskForPreferences->isChecked());
572 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 583 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
573 prof->setWriteBackFile( mWriteBackFile->isChecked()); 584 prof->setWriteBackFile( mWriteBackFile->isChecked());
574 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 585 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
575 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 586 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
576 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); 587 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 ; 588 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); 589 prof->setSyncPrefs( syncprefs);
579 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 590 prof->setIsLocalFileSync( mIsLocal->isChecked() );
580 prof->setIsPhoneSync( mIsPhone->isChecked() ); 591 prof->setIsPhoneSync( mIsPhone->isChecked() );
581 prof->setIsPiSync( mIsPi->isChecked() ); 592 prof->setIsPiSync( mIsPi->isChecked() );
593 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
582 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 594 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
583 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 595 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
584 if ( mWriteContactToSIM ) 596 if ( mWriteContactToSIM )
585 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 597 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
586 prof->setPhoneDevice( mPhoneDevice->text() ); 598 prof->setPhoneDevice( mPhoneDevice->text() );
587 prof->setPhoneConnection( mPhoneConnection->text() ); 599 prof->setPhoneConnection( mPhoneConnection->text() );
588 prof->setPhoneModel( mPhoneModel->text() ); 600 prof->setPhoneModel( mPhoneModel->text() );
589 601
590 } 602 }
591 603
592} 604}
593 605
594void KSyncPrefsDialog::insertProfiles() 606void KSyncPrefsDialog::insertProfiles()
595{ 607{
596 int curItem = mProfileBox->currentItem(); 608 int curItem = mProfileBox->currentItem();
597 mProfileBox->blockSignals( true ); 609 mProfileBox->blockSignals( true );
598 mProfileBox->clear(); 610 mProfileBox->clear();
599 mProfileBox->insertStringList (mSyncProfileNames ); 611 mProfileBox->insertStringList (mSyncProfileNames );
600 int item = mSyncProfileNames.count() -1; 612 int item = mSyncProfileNames.count() -1;
601 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 613 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
602 mProfileBox->setCurrentItem( curItem ); 614 mProfileBox->setCurrentItem( curItem );
603 else if ( item >= 0 ) { 615 else if ( item >= 0 ) {
604 mProfileBox->setCurrentItem( item ); 616 mProfileBox->setCurrentItem( item );
605 } 617 }
606 currentSelection = -1; 618 currentSelection = -1;
607 if ( mSyncProfileNames.count() > 0 ) { 619 if ( mSyncProfileNames.count() > 0 ) {
608 //qDebug(" profileChanged( mProfileBox->currentItem() "); 620 //qDebug(" profileChanged( mProfileBox->currentItem() ");
609 profileChanged( mProfileBox->currentItem() ); 621 profileChanged( mProfileBox->currentItem() );
610 currentSelection = mProfileBox->currentItem(); 622 currentSelection = mProfileBox->currentItem();
611 } 623 }
612 mProfileBox->blockSignals( false ); 624 mProfileBox->blockSignals( false );
613} 625}
614 626
615void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 627void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
616{ 628{
617 saveProfile(); 629 saveProfile();
618 mSyncProfiles.append( temp ); 630 mSyncProfiles.append( temp );
619 mSyncProfileNames << temp->getName(); 631 mSyncProfileNames << temp->getName();
620 insertProfiles(); 632 insertProfiles();
621 int last = mProfileBox->count() -1; 633 int last = mProfileBox->count() -1;
622 mProfileBox->blockSignals( true ); 634 mProfileBox->blockSignals( true );
623 mProfileBox->setCurrentItem( last ); 635 mProfileBox->setCurrentItem( last );
624 mProfileBox->blockSignals( false ); 636 mProfileBox->blockSignals( false );
625 profileChanged(last); 637 profileChanged(last);
626} 638}
627void KSyncPrefsDialog::newProfile() 639void KSyncPrefsDialog::newProfile()
628{ 640{
629 addProfile ( new KSyncProfile () ); 641 addProfile ( new KSyncProfile () );
630} 642}
631 643
632void KSyncPrefsDialog::cloneProfile() 644void KSyncPrefsDialog::cloneProfile()
633{ 645{
634 if ( currentSelection >= 0 ) 646 if ( currentSelection >= 0 )
635 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 647 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
636 else 648 else
637 newProfile(); 649 newProfile();
638} 650}
639 651
640void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) 652void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
641{ 653{
642 mMyMachineName->setText( name ); 654 mMyMachineName->setText( name );
643 655
644} 656}
645QString KSyncPrefsDialog::getLocalMachineName ( ) 657QString KSyncPrefsDialog::getLocalMachineName ( )
646{ 658{
647 return mMyMachineName->text(); 659 return mMyMachineName->text();
648} 660}
649 661
650QStringList KSyncPrefsDialog::getSyncProfileNames() 662QStringList KSyncPrefsDialog::getSyncProfileNames()
651{ 663{
652 return mSyncProfileNames; 664 return mSyncProfileNames;
653} 665}
654void KSyncPrefsDialog::usrReadConfig() 666void KSyncPrefsDialog::usrReadConfig()
655{ 667{
656 //KConfig *config = KOGlobals::config(); 668 //KConfig *config = KOGlobals::config();
657 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 669 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
658 config.setGroup("General"); 670 config.setGroup("General");
659 mSyncProfileNames =config.readListEntry("SyncProfileNames"); 671 mSyncProfileNames =config.readListEntry("SyncProfileNames");
660 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); 672 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
661 int i; 673 int i;
662 KSyncProfile* temp ; 674 KSyncProfile* temp ;
663 mSyncProfiles.clear(); 675 mSyncProfiles.clear();
664 for ( i = 0; i < mSyncProfileNames.count();++i ) { 676 for ( i = 0; i < mSyncProfileNames.count();++i ) {
665 temp = new KSyncProfile (); 677 temp = new KSyncProfile ();
666 temp->setName( mSyncProfileNames[i] ); 678 temp->setName( mSyncProfileNames[i] );
667 temp->readConfig( &config ); 679 temp->readConfig( &config );
668 mSyncProfiles.append( temp ); 680 mSyncProfiles.append( temp );
669 } 681 }
670 insertProfiles(); 682 insertProfiles();
671 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); 683 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
672} 684}
673 685
674 686
675void KSyncPrefsDialog::usrWriteConfig() 687void KSyncPrefsDialog::usrWriteConfig()
676{ 688{
677 saveProfile(); 689 saveProfile();
678 if ( currentSelection >= 0 ) 690 if ( currentSelection >= 0 )
679 profileChanged(currentSelection); 691 profileChanged(currentSelection);
680 //KConfig *config = KOGlobals::config(); 692 //KConfig *config = KOGlobals::config();
681 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 693 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
682 KSyncProfile* prof = mSyncProfiles.first(); 694 KSyncProfile* prof = mSyncProfiles.first();
683 QStringList externalSyncProfileNames; 695 QStringList externalSyncProfileNames;
684 externalSyncProfileNames.append("Sharp_DTM");; 696 externalSyncProfileNames.append("Sharp_DTM");;
685 while ( prof ) { 697 while ( prof ) {
686 prof->writeConfig(&config); 698 prof->writeConfig(&config);
687 if ( prof->getIsPhoneSync( ) ) 699 if ( prof->getIsPhoneSync( ) )
688 externalSyncProfileNames.append(prof->getName( ) ); 700 externalSyncProfileNames.append(prof->getName( ) );
689 prof = mSyncProfiles.next(); 701 prof = mSyncProfiles.next();
690 } 702 }
691 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; 703 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
692 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); 704 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
693 config.setGroup("General"); 705 config.setGroup("General");
694 config.writeEntry("SyncProfileNames",mSyncProfileNames); 706 config.writeEntry("SyncProfileNames",mSyncProfileNames);
695 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); 707 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames);
696 config.writeEntry("LocalMachineName",mMyMachineName->text()); 708 config.writeEntry("LocalMachineName",mMyMachineName->text());
697 config.sync(); 709 config.sync();
698} 710}
699 711
700void KSyncPrefsDialog::helpDevice() 712void KSyncPrefsDialog::helpDevice()
701{ 713{
702 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); 714 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n");
703#ifdef _WIN32_ 715#ifdef _WIN32_
704 hint += "Leave empty for Irda.\n" 716 hint += "Leave empty for Irda.\n"
705 "com1:\n(first serial port)\n" 717 "com1:\n(first serial port)\n"
706 "usb not supported\n" 718 "usb not supported\n"
707 "???\n(bluetooth device address)\n"; 719 "???\n(bluetooth device address)\n";
708 720
709#else 721#else
710 hint += "/dev/ircomm\n(Irda)\n" 722 hint += "/dev/ircomm\n(Irda)\n"
711 "/dev/ttyS0\n(first serial port)\n" 723 "/dev/ttyS0\n(first serial port)\n"
712 "/dev/ttyUSB0\n(first device usb port)\n" 724 "/dev/ttyUSB0\n(first device usb port)\n"
713 "???\n(bluetooth device address)\n"; 725 "???\n(bluetooth device address)\n";
714#endif 726#endif
715 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 727 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
716} 728}
717void KSyncPrefsDialog::helpModel() 729void KSyncPrefsDialog::helpModel()
718{ 730{
719 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n"); 731 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n");
720 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; 732 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection";
721 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 733 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
722 734
723} 735}
724void KSyncPrefsDialog::helpConnection() 736void KSyncPrefsDialog::helpConnection()
725{ 737{
726 QString hint = i18n("Insert kind of connection,e.g.:\n"); 738 QString hint = i18n("Insert kind of connection,e.g.:\n");
727 hint += "irda | Nokia FBUS over infrared\n" 739 hint += "irda | Nokia FBUS over infrared\n"
728 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" 740 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n"
729 "irdaobex | set also model as obex\n" 741 "irdaobex | set also model as obex\n"
730 "fbus | Nokia FBUS2 serial\n"; 742 "fbus | Nokia FBUS2 serial\n";
731 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 743 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
732} 744}