summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
authorulf69 <ulf69>2004-10-02 00:19:45 (UTC)
committer ulf69 <ulf69>2004-10-02 00:19:45 (UTC)
commitba1176743a536e19bb8b9d68b1c0c0023a0f3101 (patch) (unidiff)
tree352e97763d1b90eca9884651ab5533ef8ae8affc /libkdepim/ksyncprefsdialog.cpp
parent7810fe355bd75c83bcdaed646cd1dde8d3c94fcb (diff)
downloadkdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.zip
kdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.tar.gz
kdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.tar.bz2
fixed a crash when pressing return(enter) in the syncprofilenames combobox
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 6e6e631..28aac45 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -7,472 +7,473 @@
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 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 136 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
136 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 137 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
137 138
138 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 139 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
139 topLayout->addWidget(lab ,iii,0); 140 topLayout->addWidget(lab ,iii,0);
140 topLayout->addWidget(mProfileBox, iii,1); 141 topLayout->addWidget(mProfileBox, iii,1);
141 ++iii; 142 ++iii;
142 143
143 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); 144 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame );
144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); 145 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1);
145 ++iii; 146 ++iii;
146 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); 147 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame );
147 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); 148 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1);
148 ++iii; 149 ++iii;
149 mIncludeInRingPWM = new QCheckBox( i18n("Include in multiple pwmanager sync"), topFrame ); 150 mIncludeInRingPWM = new QCheckBox( i18n("Include in multiple pwmanager sync"), topFrame );
150 topLayout->addMultiCellWidget(mIncludeInRingPWM, iii,iii,0,1); 151 topLayout->addMultiCellWidget(mIncludeInRingPWM, iii,iii,0,1);
151 ++iii; 152 ++iii;
152 153
153 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 154 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
154 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 155 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
155 ++iii; 156 ++iii;
156 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 157 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
157 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 158 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
158 ++iii; 159 ++iii;
159 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 160 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
160 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 161 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
161 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 162 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
162 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 163 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
163 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 164 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
164 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 165 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
165 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 166 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
166 167
167 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 168 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
168 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 169 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
169 ++iii; 170 ++iii;
170 171
171 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 172 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
172 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 173 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
173 ++iii; 174 ++iii;
174 175
175 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 176 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame );
176 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 177 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
177 ++iii; 178 ++iii;
178 179
179 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 180 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
180 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 181 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
181 ++iii; 182 ++iii;
182 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 183 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
183 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 184 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
184 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 185 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
185 ++iii; 186 ++iii;
186 187
187 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 188 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
188 gr = proGr; 189 gr = proGr;
189 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 190 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
190 ++iii; 191 ++iii;
191 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 192 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
192 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 193 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
193 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 194 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
194 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 195 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
195 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 196 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
196 197
197 198
198 phoneWidget = new QVBox( topFrame); 199 phoneWidget = new QVBox( topFrame);
199 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 200 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
200 ++iii; 201 ++iii;
201 mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); 202 mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
202 QHBox* temphb = new QHBox( phoneWidget ); 203 QHBox* temphb = new QHBox( phoneWidget );
203 new QLabel( i18n("I/O device: "), temphb ); 204 new QLabel( i18n("I/O device: "), temphb );
204 mPhoneDevice = new QLineEdit( temphb); 205 mPhoneDevice = new QLineEdit( temphb);
205 button = new QPushButton( i18n("Help..."), temphb ); 206 button = new QPushButton( i18n("Help..."), temphb );
206 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 207 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
207 208
208 209
209 temphb = new QHBox( phoneWidget ); 210 temphb = new QHBox( phoneWidget );
210 new QLabel( i18n("Connection: "), temphb ); 211 new QLabel( i18n("Connection: "), temphb );
211 mPhoneConnection = new QLineEdit( temphb); 212 mPhoneConnection = new QLineEdit( temphb);
212 button = new QPushButton( i18n("Help..."), temphb ); 213 button = new QPushButton( i18n("Help..."), temphb );
213 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 214 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
214 215
215 216
216 temphb = new QHBox( phoneWidget ); 217 temphb = new QHBox( phoneWidget );
217 new QLabel( i18n("Model(opt.): "), temphb ); 218 new QLabel( i18n("Model(opt.): "), temphb );
218 mPhoneModel = new QLineEdit( temphb); 219 mPhoneModel = new QLineEdit( temphb);
219 button = new QPushButton( i18n("Help..."), temphb ); 220 button = new QPushButton( i18n("Help..."), temphb );
220 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 221 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
221 222
222 // *** local 223 // *** local
223 localFileWidget = new QVBox( topFrame); 224 localFileWidget = new QVBox( topFrame);
224 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 225 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
225 ++iii; 226 ++iii;
226 temphb = new QHBox( localFileWidget ); 227 temphb = new QHBox( localFileWidget );
227 228
228 lab = new QLabel( i18n("Local file Cal:"), temphb ); 229 lab = new QLabel( i18n("Local file Cal:"), temphb );
229 lab = new QLabel( i18n("Local file ABook:"), temphb ); 230 lab = new QLabel( i18n("Local file ABook:"), temphb );
230 lab = new QLabel( i18n("Local file PWMgr:"), temphb ); 231 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
231 temphb = new QHBox( localFileWidget ); 232 temphb = new QHBox( localFileWidget );
232 button = new QPushButton( i18n("Choose..."), temphb ); 233 button = new QPushButton( i18n("Choose..."), temphb );
233 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 234 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
234 button = new QPushButton( i18n("Choose..."), temphb ); 235 button = new QPushButton( i18n("Choose..."), temphb );
235 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); 236 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
236 button = new QPushButton( i18n("Choose..."), temphb ); 237 button = new QPushButton( i18n("Choose..."), temphb );
237 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); 238 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
238 temphb = new QHBox( localFileWidget ); 239 temphb = new QHBox( localFileWidget );
239 240
240 mRemoteFile = new QLineEdit( temphb); 241 mRemoteFile = new QLineEdit( temphb);
241 mRemoteFileAB = new QLineEdit( temphb); 242 mRemoteFileAB = new QLineEdit( temphb);
242 mRemoteFilePWM = new QLineEdit( temphb); 243 mRemoteFilePWM = new QLineEdit( temphb);
243 244
244 // *** remote 245 // *** remote
245 remoteFileWidget = new QVBox( topFrame); 246 remoteFileWidget = new QVBox( topFrame);
246 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 247 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
247 ++iii; 248 ++iii;
248 temphb = new QHBox( remoteFileWidget ); 249 temphb = new QHBox( remoteFileWidget );
249 new QLabel( i18n("Calendar:"), temphb); 250 new QLabel( i18n("Calendar:"), temphb);
250 new QLabel( i18n("AddressBook:"), temphb); 251 new QLabel( i18n("AddressBook:"), temphb);
251 new QLabel( i18n("PWManager:"), temphb); 252 new QLabel( i18n("PWManager:"), temphb);
252 253
253 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 254 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
254 temphb = new QHBox( remoteFileWidget ); 255 temphb = new QHBox( remoteFileWidget );
255 mRemotePrecommand = new QLineEdit(temphb); 256 mRemotePrecommand = new QLineEdit(temphb);
256 mRemotePrecommandAB = new QLineEdit(temphb); 257 mRemotePrecommandAB = new QLineEdit(temphb);
257 mRemotePrecommandPWM = new QLineEdit(temphb); 258 mRemotePrecommandPWM = new QLineEdit(temphb);
258 259
259 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 260 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
260 temphb = new QHBox( remoteFileWidget ); 261 temphb = new QHBox( remoteFileWidget );
261 mLocalTempFile = new QLineEdit(temphb); 262 mLocalTempFile = new QLineEdit(temphb);
262 mLocalTempFileAB = new QLineEdit(temphb); 263 mLocalTempFileAB = new QLineEdit(temphb);
263 mLocalTempFilePWM = new QLineEdit(temphb); 264 mLocalTempFilePWM = new QLineEdit(temphb);
264 265
265 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 266 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
266 temphb = new QHBox( remoteFileWidget ); 267 temphb = new QHBox( remoteFileWidget );
267 mRemotePostcommand = new QLineEdit(temphb ); 268 mRemotePostcommand = new QLineEdit(temphb );
268 mRemotePostcommandAB = new QLineEdit(temphb ); 269 mRemotePostcommandAB = new QLineEdit(temphb );
269 mRemotePostcommandPWM = new QLineEdit(temphb ); 270 mRemotePostcommandPWM = new QLineEdit(temphb );
270 271
271 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 272 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
272 temphb = new QHBox( remoteFileWidget ); 273 temphb = new QHBox( remoteFileWidget );
273 button = new QPushButton( i18n("ssh/scp"), temphb ); 274 button = new QPushButton( i18n("ssh/scp"), temphb );
274 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 275 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
275 button = new QPushButton( i18n("ftp"), temphb ); 276 button = new QPushButton( i18n("ftp"), temphb );
276 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 277 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
277 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 278 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
278 279
279 280
280} 281}
281void KSyncPrefsDialog::slotOK() 282void KSyncPrefsDialog::slotOK()
282{ 283{
283 if ( mMyMachineName->text() == "undefined" ) { 284 if ( mMyMachineName->text() == "undefined" ) {
284 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 285 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
285 return; 286 return;
286 } 287 }
287 int i; 288 int i;
288 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 289 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
289 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 290 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
290 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 291 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
291 return; 292 return;
292 } 293 }
293 } 294 }
294 usrWriteConfig(); 295 usrWriteConfig();
295 QDialog::accept(); 296 QDialog::accept();
296} 297}
297void KSyncPrefsDialog::accept() 298void KSyncPrefsDialog::accept()
298{ 299{
299 slotOK(); 300 slotOK();
300} 301}
301void KSyncPrefsDialog::chooseFile() 302void KSyncPrefsDialog::chooseFile()
302{ 303{
303 QString fn = QDir::homeDirPath(); 304 QString fn = QDir::homeDirPath();
304 305
305 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 306 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
306 if ( fn == "" ) 307 if ( fn == "" )
307 return; 308 return;
308 mRemoteFile->setText( fn ); 309 mRemoteFile->setText( fn );
309} 310}
310 311
311void KSyncPrefsDialog::chooseFileAB() 312void KSyncPrefsDialog::chooseFileAB()
312{ 313{
313 QString fn = QDir::homeDirPath(); 314 QString fn = QDir::homeDirPath();
314 315
315 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); 316 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
316 if ( fn == "" ) 317 if ( fn == "" )
317 return; 318 return;
318 mRemoteFileAB->setText( fn ); 319 mRemoteFileAB->setText( fn );
319} 320}
320 321
321void KSyncPrefsDialog::chooseFilePWM() 322void KSyncPrefsDialog::chooseFilePWM()
322{ 323{
323 QString fn = QDir::homeDirPath(); 324 QString fn = QDir::homeDirPath();
324 325
325 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 326 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
326 if ( fn == "" ) 327 if ( fn == "" )
327 return; 328 return;
328 mRemoteFilePWM->setText( fn ); 329 mRemoteFilePWM->setText( fn );
329} 330}
330 331
331void KSyncPrefsDialog::textChanged( const QString & s ) 332void KSyncPrefsDialog::textChanged( const QString & s )
332{ 333{
333 if ( mProfileBox->count() == 0 ) 334 if ( mProfileBox->count() == 0 )
334 return; 335 return;
335 if ( currentSelection < 3 ) { 336 if ( currentSelection < 3 ) {
336 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 337 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
337 mProfileBox->blockSignals( true ); 338 mProfileBox->blockSignals( true );
338 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 339 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
339 mProfileBox->blockSignals( false ); 340 mProfileBox->blockSignals( false );
340 return; 341 return;
341 } 342 }
342 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 343 //qDebug("cur i %d ",mProfileBox-> currentItem () );
343 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 344 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
344 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 345 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
345 prof->setName( s ); 346 prof->setName( s );
346 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 347 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
347} 348}
348void KSyncPrefsDialog::profileChanged( int item ) 349void KSyncPrefsDialog::profileChanged( int item )
349{ 350{
350 //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); 351 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
351 KSyncProfile* prof; 352 KSyncProfile* prof;
352 saveProfile(); 353 saveProfile();
353 currentSelection = item; 354 currentSelection = item;
354 prof = mSyncProfiles.at(item) ; 355 prof = mSyncProfiles.at(item) ;
355 mRemotePrecommand->setText(prof->getPreSyncCommand()); 356 mRemotePrecommand->setText(prof->getPreSyncCommand());
356 mRemotePostcommand->setText(prof->getPostSyncCommand()); 357 mRemotePostcommand->setText(prof->getPostSyncCommand());
357 mLocalTempFile->setText(prof->getLocalTempFile()); 358 mLocalTempFile->setText(prof->getLocalTempFile());
358 mRemoteFile->setText(prof->getRemoteFileName()) ; 359 mRemoteFile->setText(prof->getRemoteFileName()) ;
359 360
360 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 361 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
361 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 362 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
362 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 363 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
363 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 364 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
364 365
365 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 366 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
366 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 367 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
367 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 368 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
368 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 369 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
369 370
370 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 371 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
371 mPhoneDevice->setText(prof->getPhoneDevice()); 372 mPhoneDevice->setText(prof->getPhoneDevice());
372 mPhoneConnection->setText(prof->getPhoneConnection()); 373 mPhoneConnection->setText(prof->getPhoneConnection());
373 mPhoneModel->setText(prof->getPhoneModel()); 374 mPhoneModel->setText(prof->getPhoneModel());
374 375
375 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 376 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
376 mAskForPreferences->setChecked( prof->getAskForPreferences()); 377 mAskForPreferences->setChecked( prof->getAskForPreferences());
377 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 378 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
378 mWriteBackFile->setChecked( prof->getWriteBackFile()); 379 mWriteBackFile->setChecked( prof->getWriteBackFile());
379 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 380 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
380 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 381 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
381 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 382 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
382 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 383 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
383 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 384 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
384 385
385 switch ( prof->getSyncPrefs() ) { 386 switch ( prof->getSyncPrefs() ) {
386 case 0: 387 case 0:
387 loc->setChecked( true); 388 loc->setChecked( true);
388 break; 389 break;
389 case 1: 390 case 1:
390 rem->setChecked( true ); 391 rem->setChecked( true );
391 break; 392 break;
392 case 2: 393 case 2:
393 newest->setChecked( true); 394 newest->setChecked( true);
394 break; 395 break;
395 case 3: 396 case 3:
396 ask->setChecked( true); 397 ask->setChecked( true);
397 break; 398 break;
398 case 4: 399 case 4:
399 f_loc->setChecked( true); 400 f_loc->setChecked( true);
400 break; 401 break;
401 case 5: 402 case 5:
402 f_rem->setChecked( true); 403 f_rem->setChecked( true);
403 break; 404 break;
404 case 6: 405 case 6:
405 //both->setChecked( true); 406 //both->setChecked( true);
406 break; 407 break;
407 default: 408 default:
408 break; 409 break;
409 } 410 }
410 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 411 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
411 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 412 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
412 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); 413 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() );
413 proGr->setEnabled( item > 2 ); 414 proGr->setEnabled( item > 2 );
414 if ( item < 3 ) { 415 if ( item < 3 ) {
415 localFileWidget->hide(); 416 localFileWidget->hide();
416 remoteFileWidget->hide(); 417 remoteFileWidget->hide();
417 phoneWidget->hide(); 418 phoneWidget->hide();
418 419
419 } else 420 } else
420 kindChanged( prof->getIsLocalFileSync() ); 421 kindChanged( prof->getIsLocalFileSync() );
421} 422}
422 423
423void KSyncPrefsDialog::fillSSH() 424void KSyncPrefsDialog::fillSSH()
424{ 425{
425 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 426 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
426 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 427 mLocalTempFile->setText("/tmp/mycalendar.ics" );
427 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 428 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
428 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 429 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
429 mLocalTempFileAB->setText("/tmp/std.vcf" ); 430 mLocalTempFileAB->setText("/tmp/std.vcf" );
430 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 431 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
431 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 432 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
432 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 433 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
433 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 434 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
434} 435}
435void KSyncPrefsDialog::fillFTP() 436void KSyncPrefsDialog::fillFTP()
436{ 437{
437 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 438 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
438 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 439 mLocalTempFile->setText("/tmp/mycalendar.ics" );
439 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 440 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
440 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 441 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
441 mLocalTempFileAB->setText("/tmp/std.vcf" ); 442 mLocalTempFileAB->setText("/tmp/std.vcf" );
442 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 443 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
443 444
444 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 445 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
445 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 446 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
446 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 447 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
447 448
448} 449}
449void KSyncPrefsDialog::kindChanged( bool b ) 450void KSyncPrefsDialog::kindChanged( bool b )
450{ 451{
451 452
452 if ( mIsLocal->isChecked () ) 453 if ( mIsLocal->isChecked () )
453 localFileWidget->show(); 454 localFileWidget->show();
454 else 455 else
455 localFileWidget->hide(); 456 localFileWidget->hide();
456 457
457 if ( mIsNotLocal->isChecked () ) 458 if ( mIsNotLocal->isChecked () )
458 remoteFileWidget->show(); 459 remoteFileWidget->show();
459 else 460 else
460 remoteFileWidget->hide(); 461 remoteFileWidget->hide();
461 462
462 if ( mIsPhone->isChecked () ) { 463 if ( mIsPhone->isChecked () ) {
463 phoneWidget->show(); 464 phoneWidget->show();
464 } 465 }
465 else { 466 else {
466 phoneWidget->hide(); 467 phoneWidget->hide();
467 } 468 }
468 469
469} 470}
470void KSyncPrefsDialog::deleteProfile() 471void KSyncPrefsDialog::deleteProfile()
471{ 472{
472 //qDebug("KSyncPrefsDialog::deleteProfile() "); 473 //qDebug("KSyncPrefsDialog::deleteProfile() ");
473 if ( currentSelection >= 0 ) { 474 if ( currentSelection >= 0 ) {
474 if ( currentSelection < 3 ) { 475 if ( currentSelection < 3 ) {
475 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 476 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
476 return; 477 return;
477 } 478 }
478 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 479 KSyncProfile* temp = mSyncProfiles.at(currentSelection);