summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkdepim/ksyncprefsdialog.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-p1.zip
kdepimpi-p1.tar.gz
kdepimpi-p1.tar.bz2
initial public commit of qt4 portp1
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,663 +1,667 @@
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" );