summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp130
1 files changed, 67 insertions, 63 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 2b87298..fd5bbca 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -1,943 +1,947 @@
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 <q3groupbox.h>
27#include <qbuttongroup.h> 27#include <q3buttongroup.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 <q3textstream.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qvbox.h> 35#include <q3vbox.h>
36#include <qhbox.h> 36#include <q3hbox.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 <q3strlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qscrollview.h> 45#include <q3scrollview.h>
46#include <qvgroupbox.h> 46#include <q3vgroupbox.h>
47#include <qhgroupbox.h> 47#include <q3hgroupbox.h>
48//Added by qt3to4:
49#include <Q3HBoxLayout>
50#include <Q3GridLayout>
51#include <Q3Frame>
48 52
49#include <kcolorbutton.h> 53#include <kcolorbutton.h>
50#include <kdebug.h> 54#include <kdebug.h>
51#include <klocale.h> 55#include <klocale.h>
52#include <kglobal.h> 56#include <kglobal.h>
53#include <kfontdialog.h> 57#include <kfontdialog.h>
54#include <kmessagebox.h> 58#include <kmessagebox.h>
55#include <kcolordialog.h> 59#include <kcolordialog.h>
56#include <kiconloader.h> 60#include <kiconloader.h>
57#include <kemailsettings.h> 61#include <kemailsettings.h>
58#include <kstandarddirs.h> 62#include <kstandarddirs.h>
59#include <kfiledialog.h> 63#include <kfiledialog.h>
60#include <kmessagebox.h> 64#include <kmessagebox.h>
61 65
62//#include <kurlrequester.h> 66//#include <kurlrequester.h>
63#include <klineedit.h> 67#include <klineedit.h>
64#include "ksyncprofile.h" 68#include "ksyncprofile.h"
65 69
66 70
67//#include "koprefs.h" 71//#include "koprefs.h"
68 72
69#include "ksyncprefsdialog.h" 73#include "ksyncprefsdialog.h"
70//#include "koglobals.h" 74//#include "koglobals.h"
71 75
72 76
73KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 77KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
74 KDialog(parent,name,true) 78 KDialog(parent,name,true)
75{ 79{
76 80
77 setCaption( i18n("Synchronization Preferences")); 81 setCaption( i18n("Synchronization Preferences"));
78 82
79 mSyncProfiles.setAutoDelete( true ); 83 mSyncProfiles.setAutoDelete( true );
80 setupSyncAlgTab(); 84 setupSyncAlgTab();
81} 85}
82 86
83 87
84KSyncPrefsDialog::~KSyncPrefsDialog() 88KSyncPrefsDialog::~KSyncPrefsDialog()
85{ 89{
86} 90}
87 91
88void KSyncPrefsDialog::setupSyncAlgTab() 92void KSyncPrefsDialog::setupSyncAlgTab()
89{ 93{
90 QLabel * lab; 94 QLabel * lab;
91 //QFrame *page = addPage(i18n("Sync Prefs"),0,0); 95 //QFrame *page = addPage(i18n("Sync Prefs"),0,0);
92 QVBox * mainbox = new QVBox( this ); 96 Q3VBox * mainbox = new Q3VBox( this );
93 QScrollView* sv = new QScrollView( mainbox ); 97 Q3ScrollView* sv = new Q3ScrollView( mainbox );
94 QHBoxLayout * lay = new QHBoxLayout( this ); 98 Q3HBoxLayout * lay = new Q3HBoxLayout( this );
95 lay->addWidget( mainbox ); 99 lay->addWidget( mainbox );
96 QHBox * b_box = new QHBox( mainbox ); 100 Q3HBox * b_box = new Q3HBox( mainbox );
97 101
98 QPushButton* button = new QPushButton( i18n("Ok"), b_box ); 102 QPushButton* button = new QPushButton( i18n("Ok"), b_box );
99 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); 103 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) );
100 button = new QPushButton( i18n("Cancel"), b_box ); 104 button = new QPushButton( i18n("Cancel"), b_box );
101 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); 105 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) );
102 //QBoxLayout * sl = new QVBoxLayout(this ); 106 //QBoxLayout * sl = new QVBoxLayout(this );
103 //sl->addWidget ( sv ); 107 //sl->addWidget ( sv );
104 sv->setResizePolicy ( QScrollView::AutoOneFit ); 108 sv->setResizePolicy ( Q3ScrollView::AutoOneFit );
105 QFrame *topFrame = new QFrame ( sv ); 109 Q3Frame *topFrame = new Q3Frame ( sv );
106 sv->addChild( topFrame ); 110 sv->addChild( topFrame );
107 mSetupSyncAlgTab = topFrame; 111 mSetupSyncAlgTab = topFrame;
108 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 112 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
109 topLayout->setSpacing(spacingHint()); 113 topLayout->setSpacing(spacingHint());
110 topLayout->setMargin(marginHint()); 114 topLayout->setMargin(marginHint());
111 115
112 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); 116 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame);
113 int iii = 0; 117 int iii = 0;
114 //topLayout->addMultiCellWidget(lab , iii,iii,0,1); 118 //topLayout->addMultiCellWidget(lab , iii,iii,0,1);
115 //++iii; 119 //++iii;
116 120
117 mMyMachineName = new QLineEdit(topFrame); 121 mMyMachineName = new QLineEdit(topFrame);
118 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); 122 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
119 topLayout->addWidget(lab ,iii,0); 123 topLayout->addWidget(lab ,iii,0);
120 topLayout->addWidget(mMyMachineName,iii,1); 124 topLayout->addWidget(mMyMachineName,iii,1);
121 ++iii; 125 ++iii;
122 126
123 QHBox* buttonbox = new QHBox( topFrame); 127 Q3HBox* buttonbox = new Q3HBox( topFrame);
124 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); 128 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
125 ++iii; 129 ++iii;
126 button = new QPushButton( i18n("New profile"), buttonbox ); 130 button = new QPushButton( i18n("New profile"), buttonbox );
127 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); 131 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
128 132
129 button = new QPushButton( i18n("Clone profile"), buttonbox ); 133 button = new QPushButton( i18n("Clone profile"), buttonbox );
130 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); 134 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
131 135
132 button = new QPushButton( i18n("Delete profile"), buttonbox ); 136 button = new QPushButton( i18n("Delete profile"), buttonbox );
133 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); 137 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
134 138
135 mProfileBox = new QComboBox(topFrame); 139 mProfileBox = new QComboBox(topFrame);
136 mProfileBox->setEditable ( true ); 140 mProfileBox->setEditable ( true );
137 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); 141 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion);
138 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 142 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
139 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 143 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
140 144
141 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 145 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
142 topLayout->addWidget(lab ,iii,0); 146 topLayout->addWidget(lab ,iii,0);
143 topLayout->addWidget(mProfileBox, iii,1); 147 topLayout->addWidget(mProfileBox, iii,1);
144 ++iii; 148 ++iii;
145 149
146 150
147 151
148 QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame); 152 Q3HGroupBox *iims = new Q3HGroupBox( i18n("Multiple Sync options"), topFrame);
149 new QLabel( i18n("Include in multiple "), iims ); 153 new QLabel( i18n("Include in multiple "), iims );
150 mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); 154 mIncludeInRing = new QCheckBox( i18n("calendar "), iims );
151 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); 155 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims );
152 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); 156 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims );
153 new QLabel( i18n(" sync"), iims ); 157 new QLabel( i18n(" sync"), iims );
154 topLayout->addMultiCellWidget(iims, iii,iii,0,1); 158 topLayout->addMultiCellWidget(iims, iii,iii,0,1);
155 ++iii; 159 ++iii;
156 QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); 160 Q3VGroupBox* gb0 = new Q3VGroupBox( i18n("Sync algo options"), topFrame);
157 topLayout->addMultiCellWidget(gb0, iii,iii,0,1); 161 topLayout->addMultiCellWidget(gb0, iii,iii,0,1);
158 ++iii; 162 ++iii;
159 QButtonGroup* gr; 163 Q3ButtonGroup* gr;
160 { 164 {
161 QVGroupBox* topFrame = gb0; 165 Q3VGroupBox* topFrame = gb0;
162 166
163 167
164 168
165 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 169 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
166 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 170 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
167 //++iii; 171 //++iii;
168 gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 172 gr = new Q3ButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
169 //topLayout->addMultiCellWidget(gr, iii,iii,0,1); 173 //topLayout->addMultiCellWidget(gr, iii,iii,0,1);
170 //++iii; 174 //++iii;
171 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 175 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
172 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 176 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
173 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 177 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
174 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 178 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
175 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 179 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
176 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 180 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
177 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 181 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
178 182
179 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 183 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
180 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 184 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
181 //++iii; 185 //++iii;
182 186
183#if 0 187#if 0
184 QHGroupBox* gb51 = new QHGroupBox( i18n("Local resources to sync with:"), topFrame); 188 Q3HGroupBox* gb51 = new Q3HGroupBox( i18n("Local resources to sync with:"), topFrame);
185 { 189 {
186 QVBox * fibo2 = new QVBox ( gb51 ); 190 Q3VBox * fibo2 = new Q3VBox ( gb51 );
187 new QLabel ( i18n("Calendar resources:"), fibo2 ); 191 new QLabel ( i18n("Calendar resources:"), fibo2 );
188 //mFilterInCal = new QComboBox( fibo2 ); 192 //mFilterInCal = new QComboBox( fibo2 );
189 fibo2 = new QVBox ( gb51 ); 193 fibo2 = new Q3VBox ( gb51 );
190 new QLabel ( i18n("Addressbook resources:"), fibo2 ); 194 new QLabel ( i18n("Addressbook resources:"), fibo2 );
191 //mFilterInAB = new QComboBox( fibo2 ); 195 //mFilterInAB = new QComboBox( fibo2 );
192 } 196 }
193#endif 197#endif
194 QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); 198 Q3HGroupBox* gb5 = new Q3HGroupBox( i18n("Apply filter when adding data to local:"), topFrame);
195 QVBox * fibo2 = new QVBox ( gb5 ); 199 Q3VBox * fibo2 = new Q3VBox ( gb5 );
196 new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); 200 new QLabel ( i18n("Incoming calendar filter:"), fibo2 );
197 mFilterInCal = new QComboBox( fibo2 ); 201 mFilterInCal = new QComboBox( fibo2 );
198 fibo2 = new QVBox ( gb5 ); 202 fibo2 = new Q3VBox ( gb5 );
199 new QLabel ( i18n("Incoming addressbook filter:"), fibo2 ); 203 new QLabel ( i18n("Incoming addressbook filter:"), fibo2 );
200 mFilterInAB = new QComboBox( fibo2 ); 204 mFilterInAB = new QComboBox( fibo2 );
201 205
202 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 206 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
203 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 207 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
204 // ++iii; 208 // ++iii;
205 209
206 QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); 210 Q3VGroupBox* gb2 = new Q3VGroupBox( i18n("Write back options"), topFrame);
207 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); 211 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1);
208 //++iii; 212 //++iii;
209 { 213 {
210 QVGroupBox*topFrame = gb2; 214 Q3VGroupBox*topFrame = gb2;
211 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); 215 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame );
212 QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); 216 Q3HGroupBox* gb4 = new Q3HGroupBox( i18n("Apply filter when adding data to remote:"), topFrame);
213 QVBox * fibo = new QVBox ( gb4 ); 217 Q3VBox * fibo = new Q3VBox ( gb4 );
214 new QLabel ( i18n("Outgoing calendar filter:"), fibo ); 218 new QLabel ( i18n("Outgoing calendar filter:"), fibo );
215 mFilterOutCal = new QComboBox( fibo ); 219 mFilterOutCal = new QComboBox( fibo );
216 fibo = new QVBox ( gb4 ); 220 fibo = new Q3VBox ( gb4 );
217 new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); 221 new QLabel ( i18n("Outgoing addressbook filter:"), fibo );
218 mFilterOutAB = new QComboBox( fibo ); 222 mFilterOutAB = new QComboBox( fibo );
219 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 223 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
220 //++iii; 224 //++iii;
221 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); 225 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame );
222 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 226 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
223 //++iii; 227 //++iii;
224 QVGroupBox* gb3 = new QVGroupBox( i18n("Time period"), topFrame); 228 Q3VGroupBox* gb3 = new Q3VGroupBox( i18n("Time period"), topFrame);
225 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); 229 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) );
226 230
227 new QLabel( i18n("From ") , gb3 ); 231 new QLabel( i18n("From ") , gb3 );
228 QHBox * tf1 = new QHBox ( gb3 ); 232 Q3HBox * tf1 = new Q3HBox ( gb3 );
229 mWriteBackPastWeeks= new QSpinBox(1,104, 1, tf1 ); 233 mWriteBackPastWeeks= new QSpinBox(1,104, 1, tf1 );
230 mWriteBackPastWeeks->setMaximumWidth( 100 ); 234 mWriteBackPastWeeks->setMaximumWidth( 100 );
231 new QLabel( i18n(" weeks in the past to ") ,tf1 ); 235 new QLabel( i18n(" weeks in the past to ") ,tf1 );
232 QHBox * tf2 = new QHBox ( gb3 ); 236 Q3HBox * tf2 = new Q3HBox ( gb3 );
233 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, tf2); 237 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, tf2);
234 mWriteBackFutureWeeks->setMaximumWidth( 100 ); 238 mWriteBackFutureWeeks->setMaximumWidth( 100 );
235 new QLabel( i18n(" weeks in the future ") , tf2 ); 239 new QLabel( i18n(" weeks in the future ") , tf2 );
236 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 240 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
237 //++iii; 241 //++iii;
238 gb3->setEnabled( false ); 242 gb3->setEnabled( false );
239 connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); 243 connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) );
240 } 244 }
241 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); 245 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
242 246
243 } 247 }
244 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 248 proGr = new Q3ButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
245 gr = proGr; 249 gr = proGr;
246 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 250 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
247 ++iii; 251 ++iii;
248 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 252 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
249 mIsPi = new QRadioButton ( i18n("Pi-Sync - all calendars ( direct Kx/Pi to Kx/Pi sync )"), gr ); 253 mIsPi = new QRadioButton ( i18n("Pi-Sync - all calendars ( direct Kx/Pi to Kx/Pi sync )"), gr );
250 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 254 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
251 mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected calendars ( direct Kx/Pi to Kx/Pi sync )"), gr ); 255 mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected calendars ( direct Kx/Pi to Kx/Pi sync )"), gr );
252 connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 256 connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
253 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 257 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
254 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 258 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
255 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 259 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
256 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 260 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
257 261
258 QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); 262 Q3VGroupBox* gb1 = new Q3VGroupBox( i18n("Profile kind specific settings"), topFrame);
259 topLayout->addMultiCellWidget(gb1, iii,iii,0,1); 263 topLayout->addMultiCellWidget(gb1, iii,iii,0,1);
260 ++iii; 264 ++iii;
261 265
262 // ****************************************** 266 // ******************************************
263 // Profile kind specific settings 267 // Profile kind specific settings
264 { 268 {
265 // *** phone ******************************* 269 // *** phone *******************************
266 QVGroupBox* topFrame = gb1; 270 Q3VGroupBox* topFrame = gb1;
267 phoneWidget = new QVBox( topFrame); 271 phoneWidget = new Q3VBox( topFrame);
268 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 272 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
269 //++iii; 273 //++iii;
270 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); 274 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
271 QHBox* temphb = new QHBox( phoneWidget ); 275 Q3HBox* temphb = new Q3HBox( phoneWidget );
272 new QLabel( i18n("I/O device: "), temphb ); 276 new QLabel( i18n("I/O device: "), temphb );
273 mPhoneDevice = new QLineEdit( temphb); 277 mPhoneDevice = new QLineEdit( temphb);
274 button = new QPushButton( i18n("Help..."), temphb ); 278 button = new QPushButton( i18n("Help..."), temphb );
275 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 279 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
276 280
277 281
278 temphb = new QHBox( phoneWidget ); 282 temphb = new Q3HBox( phoneWidget );
279 new QLabel( i18n("Connection: "), temphb ); 283 new QLabel( i18n("Connection: "), temphb );
280 mPhoneConnection = new QLineEdit( temphb); 284 mPhoneConnection = new QLineEdit( temphb);
281 button = new QPushButton( i18n("Help..."), temphb ); 285 button = new QPushButton( i18n("Help..."), temphb );
282 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 286 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
283 287
284 288
285 temphb = new QHBox( phoneWidget ); 289 temphb = new Q3HBox( phoneWidget );
286 new QLabel( i18n("Model(opt.): "), temphb ); 290 new QLabel( i18n("Model(opt.): "), temphb );
287 mPhoneModel = new QLineEdit( temphb); 291 mPhoneModel = new QLineEdit( temphb);
288 button = new QPushButton( i18n("Help..."), temphb ); 292 button = new QPushButton( i18n("Help..."), temphb );
289 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 293 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
290 294
291 // *** local******************************* 295 // *** local*******************************
292 localFileWidget = new QVBox( topFrame); 296 localFileWidget = new Q3VBox( topFrame);
293 //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 297 //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
294 //++iii; 298 //++iii;
295 temphb = new QHBox( localFileWidget ); 299 temphb = new Q3HBox( localFileWidget );
296 300
297 lab = new QLabel( i18n("Local file Cal:"), temphb ); 301 lab = new QLabel( i18n("Local file Cal:"), temphb );
298 lab = new QLabel( i18n("Local file ABook:"), temphb ); 302 lab = new QLabel( i18n("Local file ABook:"), temphb );
299 lab = new QLabel( i18n("Local file PWMgr:"), temphb ); 303 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
300 temphb = new QHBox( localFileWidget ); 304 temphb = new Q3HBox( localFileWidget );
301 button = new QPushButton( i18n("Choose..."), temphb ); 305 button = new QPushButton( i18n("Choose..."), temphb );
302 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 306 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
303 button = new QPushButton( i18n("Choose..."), temphb ); 307 button = new QPushButton( i18n("Choose..."), temphb );
304 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); 308 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
305 button = new QPushButton( i18n("Choose..."), temphb ); 309 button = new QPushButton( i18n("Choose..."), temphb );
306 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); 310 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
307 temphb = new QHBox( localFileWidget ); 311 temphb = new Q3HBox( localFileWidget );
308 312
309 mRemoteFile = new QLineEdit( temphb); 313 mRemoteFile = new QLineEdit( temphb);
310 mRemoteFileAB = new QLineEdit( temphb); 314 mRemoteFileAB = new QLineEdit( temphb);
311 mRemoteFilePWM = new QLineEdit( temphb); 315 mRemoteFilePWM = new QLineEdit( temphb);
312 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget ); 316 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
313 317
314 318
315 // *** remote******************************* 319 // *** remote*******************************
316 remoteFileWidget = new QVBox( topFrame); 320 remoteFileWidget = new Q3VBox( topFrame);
317 //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 321 //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
318 //++iii; 322 //++iii;
319 temphb = new QHBox( remoteFileWidget ); 323 temphb = new Q3HBox( remoteFileWidget );
320 new QLabel( i18n("Calendar:"), temphb); 324 new QLabel( i18n("Calendar:"), temphb);
321 new QLabel( i18n("AddressBook:"), temphb); 325 new QLabel( i18n("AddressBook:"), temphb);
322 new QLabel( i18n("PWManager:"), temphb); 326 new QLabel( i18n("PWManager:"), temphb);
323 327
324 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 328 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
325 temphb = new QHBox( remoteFileWidget ); 329 temphb = new Q3HBox( remoteFileWidget );
326 mRemotePrecommand = new QLineEdit(temphb); 330 mRemotePrecommand = new QLineEdit(temphb);
327 mRemotePrecommandAB = new QLineEdit(temphb); 331 mRemotePrecommandAB = new QLineEdit(temphb);
328 mRemotePrecommandPWM = new QLineEdit(temphb); 332 mRemotePrecommandPWM = new QLineEdit(temphb);
329 333
330 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 334 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
331 temphb = new QHBox( remoteFileWidget ); 335 temphb = new Q3HBox( remoteFileWidget );
332 mLocalTempFile = new QLineEdit(temphb); 336 mLocalTempFile = new QLineEdit(temphb);
333 mLocalTempFileAB = new QLineEdit(temphb); 337 mLocalTempFileAB = new QLineEdit(temphb);
334 mLocalTempFilePWM = new QLineEdit(temphb); 338 mLocalTempFilePWM = new QLineEdit(temphb);
335 339
336 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 340 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
337 temphb = new QHBox( remoteFileWidget ); 341 temphb = new Q3HBox( remoteFileWidget );
338 mRemotePostcommand = new QLineEdit(temphb ); 342 mRemotePostcommand = new QLineEdit(temphb );
339 mRemotePostcommandAB = new QLineEdit(temphb ); 343 mRemotePostcommandAB = new QLineEdit(temphb );
340 mRemotePostcommandPWM = new QLineEdit(temphb ); 344 mRemotePostcommandPWM = new QLineEdit(temphb );
341 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget ); 345 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
342 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 346 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
343 temphb = new QHBox( remoteFileWidget ); 347 temphb = new Q3HBox( remoteFileWidget );
344 button = new QPushButton( i18n("ssh/scp"), temphb ); 348 button = new QPushButton( i18n("ssh/scp"), temphb );
345 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 349 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
346 button = new QPushButton( i18n("ftp"), temphb ); 350 button = new QPushButton( i18n("ftp"), temphb );
347 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 351 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
348 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 352 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
349 353
350 // *** pi-sync******************************* 354 // *** pi-sync*******************************
351 piWidget = new QVBox( topFrame); 355 piWidget = new Q3VBox( topFrame);
352 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); 356 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
353 //++iii; 357 //++iii;
354 temphb = new QHBox( piWidget ); 358 temphb = new Q3HBox( piWidget );
355 new QLabel( i18n("Calendar:"), temphb); 359 new QLabel( i18n("Calendar:"), temphb);
356 new QLabel( i18n("AddressBook:"), temphb); 360 new QLabel( i18n("AddressBook:"), temphb);
357 new QLabel( i18n("PWManager:"), temphb); 361 new QLabel( i18n("PWManager:"), temphb);
358 362
359 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); 363 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
360 temphb = new QHBox( piWidget ); 364 temphb = new Q3HBox( piWidget );
361 mRemotePw = new QLineEdit(temphb); 365 mRemotePw = new QLineEdit(temphb);
362 mRemotePwAB = new QLineEdit(temphb); 366 mRemotePwAB = new QLineEdit(temphb);
363 mRemotePwPWM = new QLineEdit(temphb); 367 mRemotePwPWM = new QLineEdit(temphb);
364 368
365 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); 369 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
366 temphb = new QHBox( piWidget ); 370 temphb = new Q3HBox( piWidget );
367 mRemoteIP = new QLineEdit(temphb); 371 mRemoteIP = new QLineEdit(temphb);
368 mRemoteIPAB = new QLineEdit(temphb); 372 mRemoteIPAB = new QLineEdit(temphb);
369 mRemoteIPPWM = new QLineEdit(temphb); 373 mRemoteIPPWM = new QLineEdit(temphb);
370 374
371 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); 375 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
372 temphb = new QHBox( piWidget ); 376 temphb = new Q3HBox( piWidget );
373 mRemotePort = new QLineEdit(temphb); 377 mRemotePort = new QLineEdit(temphb);
374 mRemotePortAB = new QLineEdit(temphb); 378 mRemotePortAB = new QLineEdit(temphb);
375 mRemotePortPWM = new QLineEdit(temphb); 379 mRemotePortPWM = new QLineEdit(temphb);
376 380
377 lab = new QLabel( i18n("Local/remote Resource sync partners (Leave empty to not sync)"), piWidget); 381 lab = new QLabel( i18n("Local/remote Resource sync partners (Leave empty to not sync)"), piWidget);
378 mTableBox = new QHBox( piWidget ); 382 mTableBox = new Q3HBox( piWidget );
379 mResTableKopi = new QTable( 1, 1, mTableBox ); 383 mResTableKopi = new Q3Table( 1, 1, mTableBox );
380 mResTableKapi = new QTable( 1, 1, mTableBox ); 384 mResTableKapi = new Q3Table( 1, 1, mTableBox );
381 mResTablePwmpi = new QTable( 1, 1, mTableBox ); 385 mResTablePwmpi = new Q3Table( 1, 1, mTableBox );
382 mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); 386 mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") );
383 mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); 387 mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") );
384 mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); 388 mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") );
385 mResTableKopi->setLeftMargin( 80 ); 389 mResTableKopi->setLeftMargin( 80 );
386 mResTableKapi->setLeftMargin( 80 ); 390 mResTableKapi->setLeftMargin( 80 );
387 } 391 }
388 // ****************************************** 392 // ******************************************
389 // Profile kind specific settings END 393 // Profile kind specific settings END
390 394
391} 395}
392 396
393void KSyncPrefsDialog::readResources() 397void KSyncPrefsDialog::readResources()
394{ 398{
395 mResourcesKopi.clear(); 399 mResourcesKopi.clear();
396 KConfig fc(locateLocal("config","kopicalendarrc")); 400 KConfig fc(locateLocal("config","kopicalendarrc"));
397 fc.setGroup("CC"); 401 fc.setGroup("CC");
398 int numCals = fc.readNumEntry("NumberCalendars",0 ); 402 int numCals = fc.readNumEntry("NumberCalendars",0 );
399 int curCal = 1; 403 int curCal = 1;
400 while ( curCal <= numCals ) { 404 while ( curCal <= numCals ) {
401 QString prefix = "Cal_" +QString::number( curCal ); 405 QString prefix = "Cal_" +QString::number( curCal );
402 QString name = fc.readEntry( prefix+"_Name", "Calendar"); 406 QString name = fc.readEntry( prefix+"_Name", "Calendar");
403 mResourcesKopi.append( name ); 407 mResourcesKopi.append( name );
404 ++curCal; 408 ++curCal;
405 } 409 }
406 mResTableKopi->setNumRows( mResourcesKopi.count() ); 410 mResTableKopi->setNumRows( mResourcesKopi.count() );
407 int i; 411 int i;
408 for ( i = 0;i < mResourcesKopi.count(); ++i ) { 412 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
409 mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); 413 mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] );
410 } 414 }
411 415
412 mResourcesKapi.clear(); 416 mResourcesKapi.clear();
413 417
414 KConfig conf ( locateLocal("config", "kabcrc") ); 418 KConfig conf ( locateLocal("config", "kabcrc") );
415 419
416 conf.setGroup( "General" ); 420 conf.setGroup( "General" );
417 421
418 QStringList keys = conf.readListEntry( "ResourceKeys" ); 422 QStringList keys = conf.readListEntry( "ResourceKeys" );
419 //keys += conf->readListEntry( "PassiveResourceKeys" ); 423 //keys += conf->readListEntry( "PassiveResourceKeys" );
420 424
421 //QString standardKey = mConfig->readEntry( "Standard" ); 425 //QString standardKey = mConfig->readEntry( "Standard" );
422 426
423 for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { 427 for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) {
424 conf.setGroup("Resource_"+ (*it) ); 428 conf.setGroup("Resource_"+ (*it) );
425 QString name = conf.readEntry( "ResourceName" ); 429 QString name = conf.readEntry( "ResourceName" );
426 mResourcesKapi.append( name ); 430 mResourcesKapi.append( name );
427 } 431 }
428 mResTableKapi->setNumRows( mResourcesKapi.count() ); 432 mResTableKapi->setNumRows( mResourcesKapi.count() );
429 for ( i = 0;i < mResourcesKopi.count(); ++i ) { 433 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
430 mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] ); 434 mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] );
431 } 435 }
432 436
433 437
434} 438}
435void KSyncPrefsDialog::readFilter() 439void KSyncPrefsDialog::readFilter()
436{ 440{
437 mFilterKapi.clear(); 441 mFilterKapi.clear();
438 mFilterKopi.clear(); 442 mFilterKopi.clear();
439 KConfig cfgko(locateLocal("config","korganizerrc")); 443 KConfig cfgko(locateLocal("config","korganizerrc"));
440 KConfig cfgka(locateLocal("config","kaddressbookrc")); 444 KConfig cfgka(locateLocal("config","kaddressbookrc"));
441 cfgko.setGroup("General"); 445 cfgko.setGroup("General");
442 mFilterKopi = cfgko.readListEntry("CalendarFilters"); 446 mFilterKopi = cfgko.readListEntry("CalendarFilters");
443 cfgka.setGroup("Filter"); 447 cfgka.setGroup("Filter");
444 int count = cfgka.readNumEntry( "Count", 0 ); 448 int count = cfgka.readNumEntry( "Count", 0 );
445 for ( int i = 0; i < count; i++ ) { 449 for ( int i = 0; i < count; i++ ) {
446 cfgka.setGroup("Filter_"+QString::number( i ) ); 450 cfgka.setGroup("Filter_"+QString::number( i ) );
447 mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); 451 mFilterKapi.append( cfgka.readEntry("Name", "internal error") );
448 } 452 }
449 mFilterOutCal->clear(); 453 mFilterOutCal->clear();
450 mFilterInCal->clear(); 454 mFilterInCal->clear();
451 mFilterOutAB->clear(); 455 mFilterOutAB->clear();
452 mFilterInAB->clear(); 456 mFilterInAB->clear();
453 QStringList temp = mFilterKopi; 457 QStringList temp = mFilterKopi;
454 temp.prepend(i18n("No Filter") ); 458 temp.prepend(i18n("No Filter") );
455 mFilterOutCal->insertStringList( temp ); 459 mFilterOutCal->insertStringList( temp );
456 mFilterInCal->insertStringList( temp ); 460 mFilterInCal->insertStringList( temp );
457 temp = mFilterKapi; 461 temp = mFilterKapi;
458 temp.prepend(i18n("No Filter") ); 462 temp.prepend(i18n("No Filter") );
459 mFilterOutAB->insertStringList( temp ); 463 mFilterOutAB->insertStringList( temp );
460 mFilterInAB->insertStringList( temp ); 464 mFilterInAB->insertStringList( temp );
461} 465}
462 466
463void KSyncPrefsDialog::slotOK() 467void KSyncPrefsDialog::slotOK()
464{ 468{
465 if ( mMyMachineName->text() == "undefined" ) { 469 if ( mMyMachineName->text() == "undefined" ) {
466 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 470 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
467 return; 471 return;
468 } 472 }
469 int i; 473 int i;
470 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 474 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
471 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 475 if ( mSyncProfileNames.count( mSyncProfileNames[i]) > 1 ) {
472 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 476 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
473 return; 477 return;
474 } 478 }
475 } 479 }
476 usrWriteConfig(); 480 usrWriteConfig();
477 QDialog::accept(); 481 QDialog::accept();
478} 482}
479void KSyncPrefsDialog::accept() 483void KSyncPrefsDialog::accept()
480{ 484{
481 slotOK(); 485 slotOK();
482} 486}
483void KSyncPrefsDialog::chooseFile() 487void KSyncPrefsDialog::chooseFile()
484{ 488{
485 QString fn = QDir::homeDirPath(); 489 QString fn = QDir::homeDirPath();
486 490
487 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 491 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
488 if ( fn == "" ) 492 if ( fn == "" )
489 return; 493 return;
490 mRemoteFile->setText( fn ); 494 mRemoteFile->setText( fn );
491} 495}
492 496
493void KSyncPrefsDialog::chooseFileAB() 497void KSyncPrefsDialog::chooseFileAB()
494{ 498{
495 QString fn = QDir::homeDirPath(); 499 QString fn = QDir::homeDirPath();
496 500
497 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); 501 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
498 if ( fn == "" ) 502 if ( fn == "" )
499 return; 503 return;
500 mRemoteFileAB->setText( fn ); 504 mRemoteFileAB->setText( fn );
501} 505}
502 506
503void KSyncPrefsDialog::chooseFilePWM() 507void KSyncPrefsDialog::chooseFilePWM()
504{ 508{
505 QString fn = QDir::homeDirPath(); 509 QString fn = QDir::homeDirPath();
506 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 510 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
507 if ( fn == "" ) 511 if ( fn == "" )
508 return; 512 return;
509 mRemoteFilePWM->setText( fn ); 513 mRemoteFilePWM->setText( fn );
510} 514}
511void KSyncPrefsDialog::updateMyCaption() 515void KSyncPrefsDialog::updateMyCaption()
512{ 516{
513 setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences")); 517 setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences"));
514} 518}
515void KSyncPrefsDialog::textChanged( const QString & s ) 519void KSyncPrefsDialog::textChanged( const QString & s )
516{ 520{
517 if ( mProfileBox->count() == 0 ) 521 if ( mProfileBox->count() == 0 )
518 return; 522 return;
519 if ( currentSelection < 3 ) { 523 if ( currentSelection < 3 ) {
520 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 524 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
521 mProfileBox->blockSignals( true ); 525 mProfileBox->blockSignals( true );
522 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 526 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
523 mProfileBox->blockSignals( false ); 527 mProfileBox->blockSignals( false );
524 return; 528 return;
525 } 529 }
526 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 530 //qDebug("cur i %d ",mProfileBox-> currentItem () );
527 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 531 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
528 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 532 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
529 prof->setName( s ); 533 prof->setName( s );
530 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 534 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
531 updateMyCaption(); 535 updateMyCaption();
532} 536}
533void KSyncPrefsDialog::profileChanged( int item ) 537void KSyncPrefsDialog::profileChanged( int item )
534{ 538{
535 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); 539 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
536 KSyncProfile* prof; 540 KSyncProfile* prof;
537 saveProfile(); 541 saveProfile();
538 readFilter(); 542 readFilter();
539 readResources(); 543 readResources();
540 currentSelection = item; 544 currentSelection = item;
541 prof = mSyncProfiles.at(item) ; 545 prof = mSyncProfiles.at(item) ;
542 546
543 mRemotePw->setText(prof->getRemotePw()); 547 mRemotePw->setText(prof->getRemotePw());
544 mRemoteIP->setText(prof->getRemoteIP()); 548 mRemoteIP->setText(prof->getRemoteIP());
545 mRemotePort->setText(prof->getRemotePort()); 549 mRemotePort->setText(prof->getRemotePort());
546 550
547 mRemotePwAB->setText(prof->getRemotePwAB()); 551 mRemotePwAB->setText(prof->getRemotePwAB());
548 mRemoteIPAB->setText(prof->getRemoteIPAB()); 552 mRemoteIPAB->setText(prof->getRemoteIPAB());
549 mRemotePortAB->setText(prof->getRemotePortAB()); 553 mRemotePortAB->setText(prof->getRemotePortAB());
550 554
551 mRemotePwPWM->setText(prof->getRemotePwPWM()); 555 mRemotePwPWM->setText(prof->getRemotePwPWM());
552 mRemoteIPPWM->setText(prof->getRemoteIPPWM()); 556 mRemoteIPPWM->setText(prof->getRemoteIPPWM());
553 mRemotePortPWM->setText(prof->getRemotePortPWM()); 557 mRemotePortPWM->setText(prof->getRemotePortPWM());
554 558
555 mRemotePrecommand->setText(prof->getPreSyncCommand()); 559 mRemotePrecommand->setText(prof->getPreSyncCommand());
556 mRemotePostcommand->setText(prof->getPostSyncCommand()); 560 mRemotePostcommand->setText(prof->getPostSyncCommand());
557 mLocalTempFile->setText(prof->getLocalTempFile()); 561 mLocalTempFile->setText(prof->getLocalTempFile());
558 mRemoteFile->setText(prof->getRemoteFileName()) ; 562 mRemoteFile->setText(prof->getRemoteFileName()) ;
559 563
560 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 564 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
561 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 565 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
562 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 566 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
563 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 567 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
564 568
565 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 569 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
566 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 570 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
567 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 571 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
568 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 572 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
569 573
570 if ( mWriteContactToSIM ) 574 if ( mWriteContactToSIM )
571 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 575 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
572 mPhoneDevice->setText(prof->getPhoneDevice()); 576 mPhoneDevice->setText(prof->getPhoneDevice());
573 mPhoneConnection->setText(prof->getPhoneConnection()); 577 mPhoneConnection->setText(prof->getPhoneConnection());
574 mPhoneModel->setText(prof->getPhoneModel()); 578 mPhoneModel->setText(prof->getPhoneModel());
575 579
576 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 580 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
577 mAskForPreferences->setChecked( prof->getAskForPreferences()); 581 mAskForPreferences->setChecked( prof->getAskForPreferences());
578 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 582 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
579 mWriteBackFile->setChecked( prof->getWriteBackFile()); 583 mWriteBackFile->setChecked( prof->getWriteBackFile());
580 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 584 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
581 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 585 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
582 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 586 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
583 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 587 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
584 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 588 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
585 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); 589 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() );
586 590
587 mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); 591 mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 );
588 mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); 592 mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 );
589 mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); 593 mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 );
590 mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); 594 mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 );
591 595
592 switch ( prof->getSyncPrefs() ) { 596 switch ( prof->getSyncPrefs() ) {
593 case 0: 597 case 0:
594 loc->setChecked( true); 598 loc->setChecked( true);
595 break; 599 break;
596 case 1: 600 case 1:
597 rem->setChecked( true ); 601 rem->setChecked( true );
598 break; 602 break;
599 case 2: 603 case 2:
600 newest->setChecked( true); 604 newest->setChecked( true);
601 break; 605 break;
602 case 3: 606 case 3:
603 ask->setChecked( true); 607 ask->setChecked( true);
604 break; 608 break;
605 case 4: 609 case 4:
606 f_loc->setChecked( true); 610 f_loc->setChecked( true);
607 break; 611 break;
608 case 5: 612 case 5:
609 f_rem->setChecked( true); 613 f_rem->setChecked( true);
610 break; 614 break;
611 case 6: 615 case 6:
612 //both->setChecked( true); 616 //both->setChecked( true);
613 break; 617 break;
614 default: 618 default:
615 break; 619 break;
616 } 620 }
617 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 621 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
618 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 622 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
619 mIsPi->setChecked(prof->getIsPiSync()) ; 623 mIsPi->setChecked(prof->getIsPiSync()) ;
620 mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; 624 mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ;
621 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; 625 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
622 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; 626 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
623 627
624 628
625 QStringList res = QStringList::split( ":",prof->getResSpecKopi(), true ); 629 QStringList res = QStringList::split( ":",prof->getResSpecKopi(), true );
626 int add = res.count()/2; 630 int add = res.count()/2;
627 int i; 631 int i;
628 for ( i = 0;i < add ; ++i ) { 632 for ( i = 0;i < add ; ++i ) {
629 mResTableKopi->setText( i, 0, res[i+add] ); 633 mResTableKopi->setText( i, 0, res[i+add] );
630 } 634 }
631 res = QStringList::split( ":",prof->getResSpecKapi(), true); 635 res = QStringList::split( ":",prof->getResSpecKapi(), true);
632 add = res.count()/2; 636 add = res.count()/2;
633 for ( i = 0;i < add; ++i ) { 637 for ( i = 0;i < add; ++i ) {
634 mResTableKapi->setText( i, 0, res[i+add] ); 638 mResTableKapi->setText( i, 0, res[i+add] );
635 } 639 }
636 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); 640 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec());
637 proGr->setEnabled( item > 2 ); 641 proGr->setEnabled( item > 2 );
638 if ( item < 3 ) { 642 if ( item < 3 ) {
639 localFileWidget->hide(); 643 localFileWidget->hide();
640 remoteFileWidget->hide(); 644 remoteFileWidget->hide();
641 phoneWidget->hide(); 645 phoneWidget->hide();
642 piWidget->hide(); 646 piWidget->hide();
643 647
644 } else 648 } else
645 kindChanged( prof->getIsLocalFileSync() ); 649 kindChanged( prof->getIsLocalFileSync() );
646 updateMyCaption(); 650 updateMyCaption();
647} 651}
648 652
649void KSyncPrefsDialog::fillSSH() 653void KSyncPrefsDialog::fillSSH()
650{ 654{
651 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 655 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
652 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 656 mLocalTempFile->setText("/tmp/mycalendar.ics" );
653 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 657 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
654 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 658 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
655 mLocalTempFileAB->setText("/tmp/std.vcf" ); 659 mLocalTempFileAB->setText("/tmp/std.vcf" );
656 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 660 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
657 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 661 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
658 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 662 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
659 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 663 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
660} 664}
661void KSyncPrefsDialog::fillFTP() 665void KSyncPrefsDialog::fillFTP()
662{ 666{
663 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 667 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
664 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 668 mLocalTempFile->setText("/tmp/mycalendar.ics" );
665 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 669 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
666 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 670 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
667 mLocalTempFileAB->setText("/tmp/std.vcf" ); 671 mLocalTempFileAB->setText("/tmp/std.vcf" );
668 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 672 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
669 673
670 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 674 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
671 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 675 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
672 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 676 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
673 677
674} 678}
675void KSyncPrefsDialog::kindChanged( bool b ) 679void KSyncPrefsDialog::kindChanged( bool b )
676{ 680{
677 681
678 if ( mIsLocal->isChecked () ) { 682 if ( mIsLocal->isChecked () ) {
679 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() ); 683 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() );
680 } else { 684 } else {
681 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() ); 685 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() );
682 } 686 }
683 687
684 if ( mIsLocal->isChecked () ) 688 if ( mIsLocal->isChecked () )
685 localFileWidget->show(); 689 localFileWidget->show();
686 else 690 else
687 localFileWidget->hide(); 691 localFileWidget->hide();
688 692
689 if ( mIsNotLocal->isChecked () ) 693 if ( mIsNotLocal->isChecked () )
690 remoteFileWidget->show(); 694 remoteFileWidget->show();
691 else 695 else
692 remoteFileWidget->hide(); 696 remoteFileWidget->hide();
693 697
694 if ( mIsPhone->isChecked () ) { 698 if ( mIsPhone->isChecked () ) {
695 phoneWidget->show(); 699 phoneWidget->show();
696 } 700 }
697 else { 701 else {
698 phoneWidget->hide(); 702 phoneWidget->hide();
699 } 703 }
700 704
701 if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) { 705 if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) {
702 piWidget->show(); 706 piWidget->show();
703 if (mIsPiSpecific->isChecked () ) { 707 if (mIsPiSpecific->isChecked () ) {
704 mTableBox->show(); 708 mTableBox->show();
705 } 709 }
706 else { 710 else {
707 mTableBox->hide(); 711 mTableBox->hide();
708 } 712 }
709 } 713 }
710 else { 714 else {
711 piWidget->hide(); 715 piWidget->hide();
712 } 716 }
713 717
714 718
715} 719}
716void KSyncPrefsDialog::deleteProfile() 720void KSyncPrefsDialog::deleteProfile()
717{ 721{
718 //qDebug("KSyncPrefsDialog::deleteProfile() "); 722 //qDebug("KSyncPrefsDialog::deleteProfile() ");
719 if ( currentSelection >= 0 ) { 723 if ( currentSelection >= 0 ) {
720 if ( currentSelection < 3 ) { 724 if ( currentSelection < 3 ) {
721 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 725 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
722 return; 726 return;
723 } 727 }
724 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 728 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
725 mSyncProfiles.remove( temp ); 729 mSyncProfiles.remove( temp );
726 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 730 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
727 insertProfiles(); 731 insertProfiles();
728 } 732 }
729} 733}
730 734
731void KSyncPrefsDialog::saveProfile() 735void KSyncPrefsDialog::saveProfile()
732{ 736{
733 KSyncProfile* prof; 737 KSyncProfile* prof;
734 if ( currentSelection >= 0 ) { 738 if ( currentSelection >= 0 ) {
735 prof = mSyncProfiles.at(currentSelection) ; 739 prof = mSyncProfiles.at(currentSelection) ;
736 740
737 prof->setRemotePw( mRemotePw->text()); 741 prof->setRemotePw( mRemotePw->text());
738 prof->setRemoteIP( mRemoteIP->text()); 742 prof->setRemoteIP( mRemoteIP->text());
739 prof->setRemotePort( mRemotePort->text()); 743 prof->setRemotePort( mRemotePort->text());
740 744
741 prof->setRemotePwAB( mRemotePwAB->text()); 745 prof->setRemotePwAB( mRemotePwAB->text());
742 prof->setRemoteIPAB( mRemoteIPAB->text()); 746 prof->setRemoteIPAB( mRemoteIPAB->text());
743 prof->setRemotePortAB( mRemotePortAB->text()); 747 prof->setRemotePortAB( mRemotePortAB->text());
744 748
745 prof->setRemotePwPWM( mRemotePwPWM->text()); 749 prof->setRemotePwPWM( mRemotePwPWM->text());
746 prof->setRemoteIPPWM( mRemoteIPPWM->text()); 750 prof->setRemoteIPPWM( mRemoteIPPWM->text());
747 prof->setRemotePortPWM( mRemotePortPWM->text()); 751 prof->setRemotePortPWM( mRemotePortPWM->text());
748 752
749 prof->setPreSyncCommand( mRemotePrecommand->text()); 753 prof->setPreSyncCommand( mRemotePrecommand->text());
750 prof->setPostSyncCommand( mRemotePostcommand->text() ); 754 prof->setPostSyncCommand( mRemotePostcommand->text() );
751 prof->setLocalTempFile( mLocalTempFile->text()); 755 prof->setLocalTempFile( mLocalTempFile->text());
752 prof->setRemoteFileName( mRemoteFile->text() ); 756 prof->setRemoteFileName( mRemoteFile->text() );
753 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 757 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
754 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 758 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
755 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 759 prof->setLocalTempFileAB( mLocalTempFileAB->text());
756 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 760 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
757 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); 761 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
758 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); 762 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
759 prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); 763 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
760 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); 764 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
761 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 765 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
762 prof->setAskForPreferences( mAskForPreferences->isChecked()); 766 prof->setAskForPreferences( mAskForPreferences->isChecked());
763 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 767 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
764 prof->setWriteBackFile( mWriteBackFile->isChecked()); 768 prof->setWriteBackFile( mWriteBackFile->isChecked());
765 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 769 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
766 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 770 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
767 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); 771 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
768 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 772 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
769 prof->setSyncPrefs( syncprefs); 773 prof->setSyncPrefs( syncprefs);
770 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 774 prof->setIsLocalFileSync( mIsLocal->isChecked() );
771 prof->setIsPhoneSync( mIsPhone->isChecked() ); 775 prof->setIsPhoneSync( mIsPhone->isChecked() );
772 prof->setIsPiSync( mIsPi->isChecked() ); 776 prof->setIsPiSync( mIsPi->isChecked() );
773 prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); 777 prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() );
774 prof->setIsKapiFile( mIsKapiFileL->isChecked() ); 778 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
775 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 779 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
776 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 780 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
777 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); 781 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value());
778 if ( mWriteContactToSIM ) 782 if ( mWriteContactToSIM )
779 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 783 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
780 prof->setPhoneDevice( mPhoneDevice->text() ); 784 prof->setPhoneDevice( mPhoneDevice->text() );
781 prof->setPhoneConnection( mPhoneConnection->text() ); 785 prof->setPhoneConnection( mPhoneConnection->text() );
782 prof->setPhoneModel( mPhoneModel->text() ); 786 prof->setPhoneModel( mPhoneModel->text() );
783 prof->setFilterInCal ( mFilterInCal->currentText ()); 787 prof->setFilterInCal ( mFilterInCal->currentText ());
784 prof->setFilterOutCal ( mFilterOutCal ->currentText ()); 788 prof->setFilterOutCal ( mFilterOutCal ->currentText ());
785 prof->setFilterInAB ( mFilterInAB ->currentText ()); 789 prof->setFilterInAB ( mFilterInAB ->currentText ());
786 prof->setFilterOutAB ( mFilterOutAB ->currentText ()); 790 prof->setFilterOutAB ( mFilterOutAB ->currentText ());
787 mProfileBox->setFocus(); 791 mProfileBox->setFocus();
788 if ( mIsPiSpecific->isChecked() ) { 792 if ( mIsPiSpecific->isChecked() ) {
789 793
790 QStringList res = mResourcesKopi; 794 QStringList res = mResourcesKopi;
791 int i; 795 int i;
792 for ( i = 0;i < mResourcesKopi.count(); ++i ) { 796 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
793 res.append( mResTableKopi->text( i, 0 )); 797 res.append( mResTableKopi->text( i, 0 ));
794 } 798 }
795 prof->setResSpecKopi( res.join(":")); 799 prof->setResSpecKopi( res.join(":"));
796 res = mResourcesKapi; 800 res = mResourcesKapi;
797 for ( i = 0;i < mResourcesKapi.count(); ++i ) { 801 for ( i = 0;i < mResourcesKapi.count(); ++i ) {
798 res.append( mResTableKapi->text( i, 0 )); 802 res.append( mResTableKapi->text( i, 0 ));
799 } 803 }
800 prof->setResSpecKapi( res.join(":")); 804 prof->setResSpecKapi( res.join(":"));
801 } 805 }
802 } 806 }
803} 807}
804 808
805void KSyncPrefsDialog::insertProfiles() 809void KSyncPrefsDialog::insertProfiles()
806{ 810{
807 int curItem = mProfileBox->currentItem(); 811 int curItem = mProfileBox->currentItem();
808 mProfileBox->blockSignals( true ); 812 mProfileBox->blockSignals( true );
809 mProfileBox->clear(); 813 mProfileBox->clear();
810 mProfileBox->insertStringList (mSyncProfileNames ); 814 mProfileBox->insertStringList (mSyncProfileNames );
811 int item = mSyncProfileNames.count() -1; 815 int item = mSyncProfileNames.count() -1;
812 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 816 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
813 mProfileBox->setCurrentItem( curItem ); 817 mProfileBox->setCurrentItem( curItem );
814 else if ( item >= 0 ) { 818 else if ( item >= 0 ) {
815 mProfileBox->setCurrentItem( item ); 819 mProfileBox->setCurrentItem( item );
816 } 820 }
817 currentSelection = -1; 821 currentSelection = -1;
818 if ( mSyncProfileNames.count() > 0 ) { 822 if ( mSyncProfileNames.count() > 0 ) {
819 //qDebug(" profileChanged( mProfileBox->currentItem() "); 823 //qDebug(" profileChanged( mProfileBox->currentItem() ");
820 profileChanged( mProfileBox->currentItem() ); 824 profileChanged( mProfileBox->currentItem() );
821 currentSelection = mProfileBox->currentItem(); 825 currentSelection = mProfileBox->currentItem();
822 } 826 }
823 mProfileBox->blockSignals( false ); 827 mProfileBox->blockSignals( false );
824} 828}
825 829
826void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 830void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
827{ 831{
828 saveProfile(); 832 saveProfile();
829 mSyncProfiles.append( temp ); 833 mSyncProfiles.append( temp );
830 mSyncProfileNames << temp->getName(); 834 mSyncProfileNames << temp->getName();
831 insertProfiles(); 835 insertProfiles();
832 int last = mProfileBox->count() -1; 836 int last = mProfileBox->count() -1;
833 mProfileBox->blockSignals( true ); 837 mProfileBox->blockSignals( true );
834 mProfileBox->setCurrentItem( last ); 838 mProfileBox->setCurrentItem( last );
835 mProfileBox->blockSignals( false ); 839 mProfileBox->blockSignals( false );
836 profileChanged(last); 840 profileChanged(last);
837} 841}
838void KSyncPrefsDialog::newProfile() 842void KSyncPrefsDialog::newProfile()
839{ 843{
840 addProfile ( new KSyncProfile () ); 844 addProfile ( new KSyncProfile () );
841} 845}
842 846
843void KSyncPrefsDialog::cloneProfile() 847void KSyncPrefsDialog::cloneProfile()
844{ 848{
845 if ( currentSelection >= 0 ) 849 if ( currentSelection >= 0 )
846 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 850 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
847 else 851 else
848 newProfile(); 852 newProfile();
849} 853}
850 854
851void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) 855void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
852{ 856{
853 mMyMachineName->setText( name ); 857 mMyMachineName->setText( name );
854 858
855} 859}
856QString KSyncPrefsDialog::getLocalMachineName ( ) 860QString KSyncPrefsDialog::getLocalMachineName ( )
857{ 861{
858 return mMyMachineName->text(); 862 return mMyMachineName->text();
859} 863}
860 864
861QStringList KSyncPrefsDialog::getSyncProfileNames() 865QStringList KSyncPrefsDialog::getSyncProfileNames()
862{ 866{
863 return mSyncProfileNames; 867 return mSyncProfileNames;
864} 868}
865void KSyncPrefsDialog::usrReadConfig() 869void KSyncPrefsDialog::usrReadConfig()
866{ 870{
867 //KConfig *config = KOGlobals::config(); 871 //KConfig *config = KOGlobals::config();
868 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 872 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
869 config.setGroup("General"); 873 config.setGroup("General");
870 mSyncProfileNames =config.readListEntry("SyncProfileNames"); 874 mSyncProfileNames =config.readListEntry("SyncProfileNames");
871 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); 875 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
872 int i; 876 int i;
873 KSyncProfile* temp ; 877 KSyncProfile* temp ;
874 mSyncProfiles.clear(); 878 mSyncProfiles.clear();
875 for ( i = 0; i < mSyncProfileNames.count();++i ) { 879 for ( i = 0; i < mSyncProfileNames.count();++i ) {
876 temp = new KSyncProfile (); 880 temp = new KSyncProfile ();
877 temp->setName( mSyncProfileNames[i] ); 881 temp->setName( mSyncProfileNames[i] );
878 temp->readConfig( &config ); 882 temp->readConfig( &config );
879 mSyncProfiles.append( temp ); 883 mSyncProfiles.append( temp );
880 } 884 }
881 insertProfiles(); 885 insertProfiles();
882 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); 886 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
883} 887}
884 888
885 889
886void KSyncPrefsDialog::usrWriteConfig() 890void KSyncPrefsDialog::usrWriteConfig()
887{ 891{
888 saveProfile(); 892 saveProfile();
889 if ( currentSelection >= 0 ) 893 if ( currentSelection >= 0 )
890 profileChanged(currentSelection); 894 profileChanged(currentSelection);
891 //KConfig *config = KOGlobals::config(); 895 //KConfig *config = KOGlobals::config();
892 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 896 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
893 KSyncProfile* prof = mSyncProfiles.first(); 897 KSyncProfile* prof = mSyncProfiles.first();
894 QStringList externalSyncProfileNames; 898 QStringList externalSyncProfileNames;
895 externalSyncProfileNames.append("Sharp_DTM");; 899 externalSyncProfileNames.append("Sharp_DTM");;
896 while ( prof ) { 900 while ( prof ) {
897 prof->writeConfig(&config); 901 prof->writeConfig(&config);
898 if ( prof->getIsPhoneSync( ) ) 902 if ( prof->getIsPhoneSync( ) )
899 externalSyncProfileNames.append(prof->getName( ) ); 903 externalSyncProfileNames.append(prof->getName( ) );
900 prof = mSyncProfiles.next(); 904 prof = mSyncProfiles.next();
901 } 905 }
902 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; 906 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
903 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); 907 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
904 config.setGroup("General"); 908 config.setGroup("General");
905 config.writeEntry("SyncProfileNames",mSyncProfileNames); 909 config.writeEntry("SyncProfileNames",mSyncProfileNames);
906 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); 910 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames);
907 config.writeEntry("LocalMachineName",mMyMachineName->text()); 911 config.writeEntry("LocalMachineName",mMyMachineName->text());
908 config.sync(); 912 config.sync();
909} 913}
910 914
911void KSyncPrefsDialog::helpDevice() 915void KSyncPrefsDialog::helpDevice()
912{ 916{
913 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); 917 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n");
914#ifdef _WIN32_ 918#ifdef _WIN32_
915 hint += "Leave empty for Irda.\n" 919 hint += "Leave empty for Irda.\n"
916 "com1:\n(first serial port)\n" 920 "com1:\n(first serial port)\n"
917 "usb not supported\n" 921 "usb not supported\n"
918 "???\n(bluetooth device address)\n"; 922 "???\n(bluetooth device address)\n";
919 923
920#else 924#else
921 hint += "/dev/ircomm\n(Irda)\n" 925 hint += "/dev/ircomm\n(Irda)\n"
922 "/dev/ttyS0\n(first serial port)\n" 926 "/dev/ttyS0\n(first serial port)\n"
923 "/dev/ttyUSB0\n(first device usb port)\n" 927 "/dev/ttyUSB0\n(first device usb port)\n"
924 "???\n(bluetooth device address)\n"; 928 "???\n(bluetooth device address)\n";
925#endif 929#endif
926 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 930 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
927} 931}
928void KSyncPrefsDialog::helpModel() 932void KSyncPrefsDialog::helpModel()
929{ 933{
930 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n"); 934 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n");
931 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; 935 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection";
932 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 936 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
933 937
934} 938}
935void KSyncPrefsDialog::helpConnection() 939void KSyncPrefsDialog::helpConnection()
936{ 940{
937 QString hint = i18n("Insert kind of connection,e.g.:\n"); 941 QString hint = i18n("Insert kind of connection,e.g.:\n");
938 hint += "irda | Nokia FBUS over infrared\n" 942 hint += "irda | Nokia FBUS over infrared\n"
939 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" 943 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n"
940 "irdaobex | set also model as obex\n" 944 "irdaobex | set also model as obex\n"
941 "fbus | Nokia FBUS2 serial\n"; 945 "fbus | Nokia FBUS2 serial\n";
942 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 946 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
943} 947}