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