summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp55
1 files changed, 47 insertions, 8 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index b097277..6f46d19 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -32,874 +32,913 @@
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 QHGroupBox* gb3 = new QHGroupBox( 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 new QLabel( i18n("From ") , gb3 ); 226
227 mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); 227 new QLabel( i18n("From ") , gb3 );
228 new QLabel( i18n(" weeks in the past to ") , gb3 ); 228 QHBox * tf1 = new QHBox ( gb3 );
229 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); 229 mWriteBackPastWeeks= new QSpinBox(1,104, 1, tf1 );
230 new QLabel( i18n(" weeks in the future ") , gb3 ); 230 mWriteBackPastWeeks->setMaximumWidth( 100 );
231 new QLabel( i18n(" weeks in the past to ") ,tf1 );
232 QHBox * tf2 = new QHBox ( gb3 );
233 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, tf2);
234 mWriteBackFutureWeeks->setMaximumWidth( 100 );
235 new QLabel( i18n(" weeks in the future ") , tf2 );
231 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 236 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
232 //++iii; 237 //++iii;
233 gb3->setEnabled( false ); 238 gb3->setEnabled( false );
234 connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); 239 connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) );
235 } 240 }
236 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); 241 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
237 242
238 } 243 }
239 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 244 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
240 gr = proGr; 245 gr = proGr;
241 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 246 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
242 ++iii; 247 ++iii;
243 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 248 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
244 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 );
245 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 250 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
246 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 );
247 connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 252 connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
248 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 253 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
249 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 254 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
250 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 255 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
251 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 256 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
252 257
253 QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); 258 QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame);
254 topLayout->addMultiCellWidget(gb1, iii,iii,0,1); 259 topLayout->addMultiCellWidget(gb1, iii,iii,0,1);
255 ++iii; 260 ++iii;
256 261
257 // ****************************************** 262 // ******************************************
258 // Profile kind specific settings 263 // Profile kind specific settings
259 { 264 {
260 // *** phone ******************************* 265 // *** phone *******************************
261 QVGroupBox* topFrame = gb1; 266 QVGroupBox* topFrame = gb1;
262 phoneWidget = new QVBox( topFrame); 267 phoneWidget = new QVBox( topFrame);
263 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 268 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
264 //++iii; 269 //++iii;
265 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 );
266 QHBox* temphb = new QHBox( phoneWidget ); 271 QHBox* temphb = new QHBox( phoneWidget );
267 new QLabel( i18n("I/O device: "), temphb ); 272 new QLabel( i18n("I/O device: "), temphb );
268 mPhoneDevice = new QLineEdit( temphb); 273 mPhoneDevice = new QLineEdit( temphb);
269 button = new QPushButton( i18n("Help..."), temphb ); 274 button = new QPushButton( i18n("Help..."), temphb );
270 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 275 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
271 276
272 277
273 temphb = new QHBox( phoneWidget ); 278 temphb = new QHBox( phoneWidget );
274 new QLabel( i18n("Connection: "), temphb ); 279 new QLabel( i18n("Connection: "), temphb );
275 mPhoneConnection = new QLineEdit( temphb); 280 mPhoneConnection = new QLineEdit( temphb);
276 button = new QPushButton( i18n("Help..."), temphb ); 281 button = new QPushButton( i18n("Help..."), temphb );
277 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 282 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
278 283
279 284
280 temphb = new QHBox( phoneWidget ); 285 temphb = new QHBox( phoneWidget );
281 new QLabel( i18n("Model(opt.): "), temphb ); 286 new QLabel( i18n("Model(opt.): "), temphb );
282 mPhoneModel = new QLineEdit( temphb); 287 mPhoneModel = new QLineEdit( temphb);
283 button = new QPushButton( i18n("Help..."), temphb ); 288 button = new QPushButton( i18n("Help..."), temphb );
284 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 289 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
285 290
286 // *** local******************************* 291 // *** local*******************************
287 localFileWidget = new QVBox( topFrame); 292 localFileWidget = new QVBox( topFrame);
288 //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 293 //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
289 //++iii; 294 //++iii;
290 temphb = new QHBox( localFileWidget ); 295 temphb = new QHBox( localFileWidget );
291 296
292 lab = new QLabel( i18n("Local file Cal:"), temphb ); 297 lab = new QLabel( i18n("Local file Cal:"), temphb );
293 lab = new QLabel( i18n("Local file ABook:"), temphb ); 298 lab = new QLabel( i18n("Local file ABook:"), temphb );
294 lab = new QLabel( i18n("Local file PWMgr:"), temphb ); 299 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
295 temphb = new QHBox( localFileWidget ); 300 temphb = new QHBox( localFileWidget );
296 button = new QPushButton( i18n("Choose..."), temphb ); 301 button = new QPushButton( i18n("Choose..."), temphb );
297 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 302 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
298 button = new QPushButton( i18n("Choose..."), temphb ); 303 button = new QPushButton( i18n("Choose..."), temphb );
299 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); 304 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
300 button = new QPushButton( i18n("Choose..."), temphb ); 305 button = new QPushButton( i18n("Choose..."), temphb );
301 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); 306 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
302 temphb = new QHBox( localFileWidget ); 307 temphb = new QHBox( localFileWidget );
303 308
304 mRemoteFile = new QLineEdit( temphb); 309 mRemoteFile = new QLineEdit( temphb);
305 mRemoteFileAB = new QLineEdit( temphb); 310 mRemoteFileAB = new QLineEdit( temphb);
306 mRemoteFilePWM = new QLineEdit( temphb); 311 mRemoteFilePWM = new QLineEdit( temphb);
307 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 );
308 313
309 314
310 // *** remote******************************* 315 // *** remote*******************************
311 remoteFileWidget = new QVBox( topFrame); 316 remoteFileWidget = new QVBox( topFrame);
312 //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 317 //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
313 //++iii; 318 //++iii;
314 temphb = new QHBox( remoteFileWidget ); 319 temphb = new QHBox( remoteFileWidget );
315 new QLabel( i18n("Calendar:"), temphb); 320 new QLabel( i18n("Calendar:"), temphb);
316 new QLabel( i18n("AddressBook:"), temphb); 321 new QLabel( i18n("AddressBook:"), temphb);
317 new QLabel( i18n("PWManager:"), temphb); 322 new QLabel( i18n("PWManager:"), temphb);
318 323
319 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 324 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
320 temphb = new QHBox( remoteFileWidget ); 325 temphb = new QHBox( remoteFileWidget );
321 mRemotePrecommand = new QLineEdit(temphb); 326 mRemotePrecommand = new QLineEdit(temphb);
322 mRemotePrecommandAB = new QLineEdit(temphb); 327 mRemotePrecommandAB = new QLineEdit(temphb);
323 mRemotePrecommandPWM = new QLineEdit(temphb); 328 mRemotePrecommandPWM = new QLineEdit(temphb);
324 329
325 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 330 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
326 temphb = new QHBox( remoteFileWidget ); 331 temphb = new QHBox( remoteFileWidget );
327 mLocalTempFile = new QLineEdit(temphb); 332 mLocalTempFile = new QLineEdit(temphb);
328 mLocalTempFileAB = new QLineEdit(temphb); 333 mLocalTempFileAB = new QLineEdit(temphb);
329 mLocalTempFilePWM = new QLineEdit(temphb); 334 mLocalTempFilePWM = new QLineEdit(temphb);
330 335
331 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 336 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
332 temphb = new QHBox( remoteFileWidget ); 337 temphb = new QHBox( remoteFileWidget );
333 mRemotePostcommand = new QLineEdit(temphb ); 338 mRemotePostcommand = new QLineEdit(temphb );
334 mRemotePostcommandAB = new QLineEdit(temphb ); 339 mRemotePostcommandAB = new QLineEdit(temphb );
335 mRemotePostcommandPWM = new QLineEdit(temphb ); 340 mRemotePostcommandPWM = new QLineEdit(temphb );
336 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 );
337 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 342 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
338 temphb = new QHBox( remoteFileWidget ); 343 temphb = new QHBox( remoteFileWidget );
339 button = new QPushButton( i18n("ssh/scp"), temphb ); 344 button = new QPushButton( i18n("ssh/scp"), temphb );
340 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 345 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
341 button = new QPushButton( i18n("ftp"), temphb ); 346 button = new QPushButton( i18n("ftp"), temphb );
342 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 347 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
343 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);
344 349
345 // *** pi-sync******************************* 350 // *** pi-sync*******************************
346 piWidget = new QVBox( topFrame); 351 piWidget = new QVBox( topFrame);
347 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); 352 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
348 //++iii; 353 //++iii;
349 temphb = new QHBox( piWidget ); 354 temphb = new QHBox( piWidget );
350 new QLabel( i18n("Calendar:"), temphb); 355 new QLabel( i18n("Calendar:"), temphb);
351 new QLabel( i18n("AddressBook:"), temphb); 356 new QLabel( i18n("AddressBook:"), temphb);
352 new QLabel( i18n("PWManager:"), temphb); 357 new QLabel( i18n("PWManager:"), temphb);
353 358
354 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);
355 temphb = new QHBox( piWidget ); 360 temphb = new QHBox( piWidget );
356 mRemotePw = new QLineEdit(temphb); 361 mRemotePw = new QLineEdit(temphb);
357 mRemotePwAB = new QLineEdit(temphb); 362 mRemotePwAB = new QLineEdit(temphb);
358 mRemotePwPWM = new QLineEdit(temphb); 363 mRemotePwPWM = new QLineEdit(temphb);
359 364
360 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);
361 temphb = new QHBox( piWidget ); 366 temphb = new QHBox( piWidget );
362 mRemoteIP = new QLineEdit(temphb); 367 mRemoteIP = new QLineEdit(temphb);
363 mRemoteIPAB = new QLineEdit(temphb); 368 mRemoteIPAB = new QLineEdit(temphb);
364 mRemoteIPPWM = new QLineEdit(temphb); 369 mRemoteIPPWM = new QLineEdit(temphb);
365 370
366 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);
367 temphb = new QHBox( piWidget ); 372 temphb = new QHBox( piWidget );
368 mRemotePort = new QLineEdit(temphb); 373 mRemotePort = new QLineEdit(temphb);
369 mRemotePortAB = new QLineEdit(temphb); 374 mRemotePortAB = new QLineEdit(temphb);
370 mRemotePortPWM = new QLineEdit(temphb); 375 mRemotePortPWM = new QLineEdit(temphb);
371 376
372 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);
373 mTableBox = new QHBox( piWidget ); 378 mTableBox = new QHBox( piWidget );
374 mResTableKopi = new QTable( 1, 1, mTableBox ); 379 mResTableKopi = new QTable( 1, 1, mTableBox );
375 mResTableKapi = new QTable( 1, 1, mTableBox ); 380 mResTableKapi = new QTable( 1, 1, mTableBox );
376 mResTablePwmpi = new QTable( 1, 1, mTableBox ); 381 mResTablePwmpi = new QTable( 1, 1, mTableBox );
377 mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); 382 mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") );
378 mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); 383 mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") );
379 mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); 384 mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") );
380 mResTableKopi->setLeftMargin( 80 ); 385 mResTableKopi->setLeftMargin( 80 );
386 mResTableKapi->setLeftMargin( 80 );
381 } 387 }
382 // ****************************************** 388 // ******************************************
383 // Profile kind specific settings END 389 // Profile kind specific settings END
384 390
385} 391}
386 392
387void KSyncPrefsDialog::readResources() 393void KSyncPrefsDialog::readResources()
388{ 394{
389 mResourcesKopi.clear(); 395 mResourcesKopi.clear();
390 mResourcesKapi.clear();
391 KConfig fc(locateLocal("config","kopicalendarrc")); 396 KConfig fc(locateLocal("config","kopicalendarrc"));
392 fc.setGroup("CC"); 397 fc.setGroup("CC");
393 int numCals = fc.readNumEntry("NumberCalendars",0 ); 398 int numCals = fc.readNumEntry("NumberCalendars",0 );
394 int curCal = 1; 399 int curCal = 1;
395 while ( curCal <= numCals ) { 400 while ( curCal <= numCals ) {
396 QString prefix = "Cal_" +QString::number( curCal ); 401 QString prefix = "Cal_" +QString::number( curCal );
397 QString name = fc.readEntry( prefix+"_Name", "Calendar"); 402 QString name = fc.readEntry( prefix+"_Name", "Calendar");
398 mResourcesKopi.append( name ); 403 mResourcesKopi.append( name );
399 ++curCal; 404 ++curCal;
400 } 405 }
401 mResTableKopi->setNumRows( mResourcesKopi.count() ); 406 mResTableKopi->setNumRows( mResourcesKopi.count() );
402 int i; 407 int i;
403 for ( i = 0;i < mResourcesKopi.count(); ++i ) { 408 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
404 mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); 409 mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] );
405 } 410 }
411
412 mResourcesKapi.clear();
413
414 KConfig conf ( locateLocal("config", "kabcrc") );
415
416 conf.setGroup( "General" );
417
418 QStringList keys = conf.readListEntry( "ResourceKeys" );
419 //keys += conf->readListEntry( "PassiveResourceKeys" );
420
421 //QString standardKey = mConfig->readEntry( "Standard" );
422
423 for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) {
424 conf.setGroup("Resource_"+ (*it) );
425 QString name = conf.readEntry( "ResourceName" );
426 mResourcesKapi.append( name );
427 }
428 mResTableKapi->setNumRows( mResourcesKapi.count() );
429 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
430 mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] );
431 }
432
433
406} 434}
407void KSyncPrefsDialog::readFilter() 435void KSyncPrefsDialog::readFilter()
408{ 436{
409 mFilterKapi.clear(); 437 mFilterKapi.clear();
410 mFilterKopi.clear(); 438 mFilterKopi.clear();
411 KConfig cfgko(locateLocal("config","korganizerrc")); 439 KConfig cfgko(locateLocal("config","korganizerrc"));
412 KConfig cfgka(locateLocal("config","kaddressbookrc")); 440 KConfig cfgka(locateLocal("config","kaddressbookrc"));
413 cfgko.setGroup("General"); 441 cfgko.setGroup("General");
414 mFilterKopi = cfgko.readListEntry("CalendarFilters"); 442 mFilterKopi = cfgko.readListEntry("CalendarFilters");
415 cfgka.setGroup("Filter"); 443 cfgka.setGroup("Filter");
416 int count = cfgka.readNumEntry( "Count", 0 ); 444 int count = cfgka.readNumEntry( "Count", 0 );
417 for ( int i = 0; i < count; i++ ) { 445 for ( int i = 0; i < count; i++ ) {
418 cfgka.setGroup("Filter_"+QString::number( i ) ); 446 cfgka.setGroup("Filter_"+QString::number( i ) );
419 mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); 447 mFilterKapi.append( cfgka.readEntry("Name", "internal error") );
420 } 448 }
421 mFilterOutCal->clear(); 449 mFilterOutCal->clear();
422 mFilterInCal->clear(); 450 mFilterInCal->clear();
423 mFilterOutAB->clear(); 451 mFilterOutAB->clear();
424 mFilterInAB->clear(); 452 mFilterInAB->clear();
425 QStringList temp = mFilterKopi; 453 QStringList temp = mFilterKopi;
426 temp.prepend(i18n("No Filter") ); 454 temp.prepend(i18n("No Filter") );
427 mFilterOutCal->insertStringList( temp ); 455 mFilterOutCal->insertStringList( temp );
428 mFilterInCal->insertStringList( temp ); 456 mFilterInCal->insertStringList( temp );
429 temp = mFilterKapi; 457 temp = mFilterKapi;
430 temp.prepend(i18n("No Filter") ); 458 temp.prepend(i18n("No Filter") );
431 mFilterOutAB->insertStringList( temp ); 459 mFilterOutAB->insertStringList( temp );
432 mFilterInAB->insertStringList( temp ); 460 mFilterInAB->insertStringList( temp );
433} 461}
434 462
435void KSyncPrefsDialog::slotOK() 463void KSyncPrefsDialog::slotOK()
436{ 464{
437 if ( mMyMachineName->text() == "undefined" ) { 465 if ( mMyMachineName->text() == "undefined" ) {
438 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"));
439 return; 467 return;
440 } 468 }
441 int i; 469 int i;
442 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 470 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
443 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 471 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
444 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"));
445 return; 473 return;
446 } 474 }
447 } 475 }
448 usrWriteConfig(); 476 usrWriteConfig();
449 QDialog::accept(); 477 QDialog::accept();
450} 478}
451void KSyncPrefsDialog::accept() 479void KSyncPrefsDialog::accept()
452{ 480{
453 slotOK(); 481 slotOK();
454} 482}
455void KSyncPrefsDialog::chooseFile() 483void KSyncPrefsDialog::chooseFile()
456{ 484{
457 QString fn = QDir::homeDirPath(); 485 QString fn = QDir::homeDirPath();
458 486
459 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 487 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
460 if ( fn == "" ) 488 if ( fn == "" )
461 return; 489 return;
462 mRemoteFile->setText( fn ); 490 mRemoteFile->setText( fn );
463} 491}
464 492
465void KSyncPrefsDialog::chooseFileAB() 493void KSyncPrefsDialog::chooseFileAB()
466{ 494{
467 QString fn = QDir::homeDirPath(); 495 QString fn = QDir::homeDirPath();
468 496
469 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); 497 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
470 if ( fn == "" ) 498 if ( fn == "" )
471 return; 499 return;
472 mRemoteFileAB->setText( fn ); 500 mRemoteFileAB->setText( fn );
473} 501}
474 502
475void KSyncPrefsDialog::chooseFilePWM() 503void KSyncPrefsDialog::chooseFilePWM()
476{ 504{
477 QString fn = QDir::homeDirPath(); 505 QString fn = QDir::homeDirPath();
478 506
479 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 507 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
480 if ( fn == "" ) 508 if ( fn == "" )
481 return; 509 return;
482 mRemoteFilePWM->setText( fn ); 510 mRemoteFilePWM->setText( fn );
483} 511}
484 512void KSyncPrefsDialog::updateMyCaption()
513{
514 setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences"));
515}
485void KSyncPrefsDialog::textChanged( const QString & s ) 516void KSyncPrefsDialog::textChanged( const QString & s )
486{ 517{
487 if ( mProfileBox->count() == 0 ) 518 if ( mProfileBox->count() == 0 )
488 return; 519 return;
489 if ( currentSelection < 3 ) { 520 if ( currentSelection < 3 ) {
490 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 521 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
491 mProfileBox->blockSignals( true ); 522 mProfileBox->blockSignals( true );
492 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 523 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
493 mProfileBox->blockSignals( false ); 524 mProfileBox->blockSignals( false );
494 return; 525 return;
495 } 526 }
496 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 527 //qDebug("cur i %d ",mProfileBox-> currentItem () );
497 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 528 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
498 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 529 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
499 prof->setName( s ); 530 prof->setName( s );
500 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 531 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
532 updateMyCaption();
501} 533}
502void KSyncPrefsDialog::profileChanged( int item ) 534void KSyncPrefsDialog::profileChanged( int item )
503{ 535{
504 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); 536 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
505 KSyncProfile* prof; 537 KSyncProfile* prof;
506 saveProfile(); 538 saveProfile();
507 readFilter(); 539 readFilter();
508 readResources(); 540 readResources();
509 currentSelection = item; 541 currentSelection = item;
510 prof = mSyncProfiles.at(item) ; 542 prof = mSyncProfiles.at(item) ;
511 543
512 mRemotePw->setText(prof->getRemotePw()); 544 mRemotePw->setText(prof->getRemotePw());
513 mRemoteIP->setText(prof->getRemoteIP()); 545 mRemoteIP->setText(prof->getRemoteIP());
514 mRemotePort->setText(prof->getRemotePort()); 546 mRemotePort->setText(prof->getRemotePort());
515 547
516 mRemotePwAB->setText(prof->getRemotePwAB()); 548 mRemotePwAB->setText(prof->getRemotePwAB());
517 mRemoteIPAB->setText(prof->getRemoteIPAB()); 549 mRemoteIPAB->setText(prof->getRemoteIPAB());
518 mRemotePortAB->setText(prof->getRemotePortAB()); 550 mRemotePortAB->setText(prof->getRemotePortAB());
519 551
520 mRemotePwPWM->setText(prof->getRemotePwPWM()); 552 mRemotePwPWM->setText(prof->getRemotePwPWM());
521 mRemoteIPPWM->setText(prof->getRemoteIPPWM()); 553 mRemoteIPPWM->setText(prof->getRemoteIPPWM());
522 mRemotePortPWM->setText(prof->getRemotePortPWM()); 554 mRemotePortPWM->setText(prof->getRemotePortPWM());
523 555
524 mRemotePrecommand->setText(prof->getPreSyncCommand()); 556 mRemotePrecommand->setText(prof->getPreSyncCommand());
525 mRemotePostcommand->setText(prof->getPostSyncCommand()); 557 mRemotePostcommand->setText(prof->getPostSyncCommand());
526 mLocalTempFile->setText(prof->getLocalTempFile()); 558 mLocalTempFile->setText(prof->getLocalTempFile());
527 mRemoteFile->setText(prof->getRemoteFileName()) ; 559 mRemoteFile->setText(prof->getRemoteFileName()) ;
528 560
529 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 561 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
530 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 562 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
531 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 563 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
532 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 564 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
533 565
534 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 566 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
535 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 567 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
536 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 568 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
537 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 569 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
538 570
539 if ( mWriteContactToSIM ) 571 if ( mWriteContactToSIM )
540 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 572 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
541 mPhoneDevice->setText(prof->getPhoneDevice()); 573 mPhoneDevice->setText(prof->getPhoneDevice());
542 mPhoneConnection->setText(prof->getPhoneConnection()); 574 mPhoneConnection->setText(prof->getPhoneConnection());
543 mPhoneModel->setText(prof->getPhoneModel()); 575 mPhoneModel->setText(prof->getPhoneModel());
544 576
545 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 577 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
546 mAskForPreferences->setChecked( prof->getAskForPreferences()); 578 mAskForPreferences->setChecked( prof->getAskForPreferences());
547 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 579 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
548 mWriteBackFile->setChecked( prof->getWriteBackFile()); 580 mWriteBackFile->setChecked( prof->getWriteBackFile());
549 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 581 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
550 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 582 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
551 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 583 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
552 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 584 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
553 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 585 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
554 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); 586 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() );
555 587
556 mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); 588 mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 );
557 mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); 589 mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 );
558 mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); 590 mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 );
559 mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); 591 mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 );
560 592
561 switch ( prof->getSyncPrefs() ) { 593 switch ( prof->getSyncPrefs() ) {
562 case 0: 594 case 0:
563 loc->setChecked( true); 595 loc->setChecked( true);
564 break; 596 break;
565 case 1: 597 case 1:
566 rem->setChecked( true ); 598 rem->setChecked( true );
567 break; 599 break;
568 case 2: 600 case 2:
569 newest->setChecked( true); 601 newest->setChecked( true);
570 break; 602 break;
571 case 3: 603 case 3:
572 ask->setChecked( true); 604 ask->setChecked( true);
573 break; 605 break;
574 case 4: 606 case 4:
575 f_loc->setChecked( true); 607 f_loc->setChecked( true);
576 break; 608 break;
577 case 5: 609 case 5:
578 f_rem->setChecked( true); 610 f_rem->setChecked( true);
579 break; 611 break;
580 case 6: 612 case 6:
581 //both->setChecked( true); 613 //both->setChecked( true);
582 break; 614 break;
583 default: 615 default:
584 break; 616 break;
585 } 617 }
586 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 618 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
587 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 619 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
588 mIsPi->setChecked(prof->getIsPiSync()) ; 620 mIsPi->setChecked(prof->getIsPiSync()) ;
589 mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; 621 mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ;
590 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; 622 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
591 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; 623 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
592 624
593 625
594 QStringList res = QStringList::split( ":",prof->getResSpecKopi(), true ); 626 QStringList res = QStringList::split( ":",prof->getResSpecKopi(), true );
595 int add = res.count()/2; 627 int add = res.count()/2;
596 int i; 628 int i;
597 for ( i = 0;i < add ; ++i ) { 629 for ( i = 0;i < add ; ++i ) {
598 mResTableKopi->setText( i, 0, res[i+add] ); 630 mResTableKopi->setText( i, 0, res[i+add] );
599 } 631 }
600 res = QStringList::split( ":",prof->getResSpecKapi(), true); 632 res = QStringList::split( ":",prof->getResSpecKapi(), true);
601 add = res.count()/2; 633 add = res.count()/2;
602 for ( i = 0;i < add; ++i ) { 634 for ( i = 0;i < add; ++i ) {
603 mResTableKapi->setText( i, 0, res[i+add] ); 635 mResTableKapi->setText( i, 0, res[i+add] );
604 } 636 }
605 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); 637 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec());
606 proGr->setEnabled( item > 2 ); 638 proGr->setEnabled( item > 2 );
607 if ( item < 3 ) { 639 if ( item < 3 ) {
608 localFileWidget->hide(); 640 localFileWidget->hide();
609 remoteFileWidget->hide(); 641 remoteFileWidget->hide();
610 phoneWidget->hide(); 642 phoneWidget->hide();
611 piWidget->hide(); 643 piWidget->hide();
612 644
613 } else 645 } else
614 kindChanged( prof->getIsLocalFileSync() ); 646 kindChanged( prof->getIsLocalFileSync() );
647 updateMyCaption();
615} 648}
616 649
617void KSyncPrefsDialog::fillSSH() 650void KSyncPrefsDialog::fillSSH()
618{ 651{
619 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 652 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
620 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 653 mLocalTempFile->setText("/tmp/mycalendar.ics" );
621 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 654 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
622 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 655 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
623 mLocalTempFileAB->setText("/tmp/std.vcf" ); 656 mLocalTempFileAB->setText("/tmp/std.vcf" );
624 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 657 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
625 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 658 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
626 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 659 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
627 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 660 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
628} 661}
629void KSyncPrefsDialog::fillFTP() 662void KSyncPrefsDialog::fillFTP()
630{ 663{
631 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 664 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
632 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 665 mLocalTempFile->setText("/tmp/mycalendar.ics" );
633 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 666 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
634 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 667 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
635 mLocalTempFileAB->setText("/tmp/std.vcf" ); 668 mLocalTempFileAB->setText("/tmp/std.vcf" );
636 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 669 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
637 670
638 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 671 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
639 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 672 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
640 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 673 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
641 674
642} 675}
643void KSyncPrefsDialog::kindChanged( bool b ) 676void KSyncPrefsDialog::kindChanged( bool b )
644{ 677{
645 678
646 if ( mIsLocal->isChecked () ) { 679 if ( mIsLocal->isChecked () ) {
647 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() ); 680 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() );
648 } else { 681 } else {
649 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() ); 682 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() );
650 } 683 }
651 684
652 if ( mIsLocal->isChecked () ) 685 if ( mIsLocal->isChecked () )
653 localFileWidget->show(); 686 localFileWidget->show();
654 else 687 else
655 localFileWidget->hide(); 688 localFileWidget->hide();
656 689
657 if ( mIsNotLocal->isChecked () ) 690 if ( mIsNotLocal->isChecked () )
658 remoteFileWidget->show(); 691 remoteFileWidget->show();
659 else 692 else
660 remoteFileWidget->hide(); 693 remoteFileWidget->hide();
661 694
662 if ( mIsPhone->isChecked () ) { 695 if ( mIsPhone->isChecked () ) {
663 phoneWidget->show(); 696 phoneWidget->show();
664 } 697 }
665 else { 698 else {
666 phoneWidget->hide(); 699 phoneWidget->hide();
667 } 700 }
668 701
669 if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) { 702 if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) {
670 piWidget->show(); 703 piWidget->show();
671 if (mIsPiSpecific->isChecked () ) { 704 if (mIsPiSpecific->isChecked () ) {
672 mTableBox->show(); 705 mTableBox->show();
673 } 706 }
674 else { 707 else {
675 mTableBox->hide(); 708 mTableBox->hide();
676 } 709 }
677 } 710 }
678 else { 711 else {
679 piWidget->hide(); 712 piWidget->hide();
680 } 713 }
681 714
682 715
683} 716}
684void KSyncPrefsDialog::deleteProfile() 717void KSyncPrefsDialog::deleteProfile()
685{ 718{
686 //qDebug("KSyncPrefsDialog::deleteProfile() "); 719 //qDebug("KSyncPrefsDialog::deleteProfile() ");
687 if ( currentSelection >= 0 ) { 720 if ( currentSelection >= 0 ) {
688 if ( currentSelection < 3 ) { 721 if ( currentSelection < 3 ) {
689 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 722 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
690 return; 723 return;
691 } 724 }
692 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 725 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
693 mSyncProfiles.remove( temp ); 726 mSyncProfiles.remove( temp );
694 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 727 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
695 insertProfiles(); 728 insertProfiles();
696 } 729 }
697} 730}
698 731
699void KSyncPrefsDialog::saveProfile() 732void KSyncPrefsDialog::saveProfile()
700{ 733{
701 KSyncProfile* prof; 734 KSyncProfile* prof;
702 if ( currentSelection >= 0 ) { 735 if ( currentSelection >= 0 ) {
703 prof = mSyncProfiles.at(currentSelection) ; 736 prof = mSyncProfiles.at(currentSelection) ;
704 737
705 prof->setRemotePw( mRemotePw->text()); 738 prof->setRemotePw( mRemotePw->text());
706 prof->setRemoteIP( mRemoteIP->text()); 739 prof->setRemoteIP( mRemoteIP->text());
707 prof->setRemotePort( mRemotePort->text()); 740 prof->setRemotePort( mRemotePort->text());
708 741
709 prof->setRemotePwAB( mRemotePwAB->text()); 742 prof->setRemotePwAB( mRemotePwAB->text());
710 prof->setRemoteIPAB( mRemoteIPAB->text()); 743 prof->setRemoteIPAB( mRemoteIPAB->text());
711 prof->setRemotePortAB( mRemotePortAB->text()); 744 prof->setRemotePortAB( mRemotePortAB->text());
712 745
713 prof->setRemotePwPWM( mRemotePwPWM->text()); 746 prof->setRemotePwPWM( mRemotePwPWM->text());
714 prof->setRemoteIPPWM( mRemoteIPPWM->text()); 747 prof->setRemoteIPPWM( mRemoteIPPWM->text());
715 prof->setRemotePortPWM( mRemotePortPWM->text()); 748 prof->setRemotePortPWM( mRemotePortPWM->text());
716 749
717 prof->setPreSyncCommand( mRemotePrecommand->text()); 750 prof->setPreSyncCommand( mRemotePrecommand->text());
718 prof->setPostSyncCommand( mRemotePostcommand->text() ); 751 prof->setPostSyncCommand( mRemotePostcommand->text() );
719 prof->setLocalTempFile( mLocalTempFile->text()); 752 prof->setLocalTempFile( mLocalTempFile->text());
720 prof->setRemoteFileName( mRemoteFile->text() ); 753 prof->setRemoteFileName( mRemoteFile->text() );
721 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 754 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
722 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 755 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
723 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 756 prof->setLocalTempFileAB( mLocalTempFileAB->text());
724 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 757 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
725 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); 758 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
726 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); 759 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
727 prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); 760 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
728 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); 761 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
729 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 762 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
730 prof->setAskForPreferences( mAskForPreferences->isChecked()); 763 prof->setAskForPreferences( mAskForPreferences->isChecked());
731 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 764 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
732 prof->setWriteBackFile( mWriteBackFile->isChecked()); 765 prof->setWriteBackFile( mWriteBackFile->isChecked());
733 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 766 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
734 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 767 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
735 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); 768 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
736 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 769 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
737 prof->setSyncPrefs( syncprefs); 770 prof->setSyncPrefs( syncprefs);
738 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 771 prof->setIsLocalFileSync( mIsLocal->isChecked() );
739 prof->setIsPhoneSync( mIsPhone->isChecked() ); 772 prof->setIsPhoneSync( mIsPhone->isChecked() );
740 prof->setIsPiSync( mIsPi->isChecked() ); 773 prof->setIsPiSync( mIsPi->isChecked() );
741 prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); 774 prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() );
742 prof->setIsKapiFile( mIsKapiFileL->isChecked() ); 775 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
743 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 776 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
744 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 777 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
745 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); 778 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value());
746 if ( mWriteContactToSIM ) 779 if ( mWriteContactToSIM )
747 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 780 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
748 prof->setPhoneDevice( mPhoneDevice->text() ); 781 prof->setPhoneDevice( mPhoneDevice->text() );
749 prof->setPhoneConnection( mPhoneConnection->text() ); 782 prof->setPhoneConnection( mPhoneConnection->text() );
750 prof->setPhoneModel( mPhoneModel->text() ); 783 prof->setPhoneModel( mPhoneModel->text() );
751 prof->setFilterInCal ( mFilterInCal->currentText ()); 784 prof->setFilterInCal ( mFilterInCal->currentText ());
752 prof->setFilterOutCal ( mFilterOutCal ->currentText ()); 785 prof->setFilterOutCal ( mFilterOutCal ->currentText ());
753 prof->setFilterInAB ( mFilterInAB ->currentText ()); 786 prof->setFilterInAB ( mFilterInAB ->currentText ());
754 prof->setFilterOutAB ( mFilterOutAB ->currentText ()); 787 prof->setFilterOutAB ( mFilterOutAB ->currentText ());
788 mProfileBox->setFocus();
755 if ( mIsPiSpecific->isChecked() ) { 789 if ( mIsPiSpecific->isChecked() ) {
756 790
757 QStringList res = mResourcesKopi; 791 QStringList res = mResourcesKopi;
758 int i; 792 int i;
759 for ( i = 0;i < mResourcesKopi.count(); ++i ) { 793 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
760 res.append( mResTableKopi->text( i, 0 )); 794 res.append( mResTableKopi->text( i, 0 ));
761 } 795 }
762 prof->setResSpecKopi( res.join(":")); 796 prof->setResSpecKopi( res.join(":"));
797 res = mResourcesKapi;
798 for ( i = 0;i < mResourcesKapi.count(); ++i ) {
799 res.append( mResTableKapi->text( i, 0 ));
800 }
801 prof->setResSpecKapi( res.join(":"));
763 } 802 }
764 } 803 }
765} 804}
766 805
767void KSyncPrefsDialog::insertProfiles() 806void KSyncPrefsDialog::insertProfiles()
768{ 807{
769 int curItem = mProfileBox->currentItem(); 808 int curItem = mProfileBox->currentItem();
770 mProfileBox->blockSignals( true ); 809 mProfileBox->blockSignals( true );
771 mProfileBox->clear(); 810 mProfileBox->clear();
772 mProfileBox->insertStringList (mSyncProfileNames ); 811 mProfileBox->insertStringList (mSyncProfileNames );
773 int item = mSyncProfileNames.count() -1; 812 int item = mSyncProfileNames.count() -1;
774 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 813 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
775 mProfileBox->setCurrentItem( curItem ); 814 mProfileBox->setCurrentItem( curItem );
776 else if ( item >= 0 ) { 815 else if ( item >= 0 ) {
777 mProfileBox->setCurrentItem( item ); 816 mProfileBox->setCurrentItem( item );
778 } 817 }
779 currentSelection = -1; 818 currentSelection = -1;
780 if ( mSyncProfileNames.count() > 0 ) { 819 if ( mSyncProfileNames.count() > 0 ) {
781 //qDebug(" profileChanged( mProfileBox->currentItem() "); 820 //qDebug(" profileChanged( mProfileBox->currentItem() ");
782 profileChanged( mProfileBox->currentItem() ); 821 profileChanged( mProfileBox->currentItem() );
783 currentSelection = mProfileBox->currentItem(); 822 currentSelection = mProfileBox->currentItem();
784 } 823 }
785 mProfileBox->blockSignals( false ); 824 mProfileBox->blockSignals( false );
786} 825}
787 826
788void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 827void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
789{ 828{
790 saveProfile(); 829 saveProfile();
791 mSyncProfiles.append( temp ); 830 mSyncProfiles.append( temp );
792 mSyncProfileNames << temp->getName(); 831 mSyncProfileNames << temp->getName();
793 insertProfiles(); 832 insertProfiles();
794 int last = mProfileBox->count() -1; 833 int last = mProfileBox->count() -1;
795 mProfileBox->blockSignals( true ); 834 mProfileBox->blockSignals( true );
796 mProfileBox->setCurrentItem( last ); 835 mProfileBox->setCurrentItem( last );
797 mProfileBox->blockSignals( false ); 836 mProfileBox->blockSignals( false );
798 profileChanged(last); 837 profileChanged(last);
799} 838}
800void KSyncPrefsDialog::newProfile() 839void KSyncPrefsDialog::newProfile()
801{ 840{
802 addProfile ( new KSyncProfile () ); 841 addProfile ( new KSyncProfile () );
803} 842}
804 843
805void KSyncPrefsDialog::cloneProfile() 844void KSyncPrefsDialog::cloneProfile()
806{ 845{
807 if ( currentSelection >= 0 ) 846 if ( currentSelection >= 0 )
808 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 847 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
809 else 848 else
810 newProfile(); 849 newProfile();
811} 850}
812 851
813void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) 852void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
814{ 853{
815 mMyMachineName->setText( name ); 854 mMyMachineName->setText( name );
816 855
817} 856}
818QString KSyncPrefsDialog::getLocalMachineName ( ) 857QString KSyncPrefsDialog::getLocalMachineName ( )
819{ 858{
820 return mMyMachineName->text(); 859 return mMyMachineName->text();
821} 860}
822 861
823QStringList KSyncPrefsDialog::getSyncProfileNames() 862QStringList KSyncPrefsDialog::getSyncProfileNames()
824{ 863{
825 return mSyncProfileNames; 864 return mSyncProfileNames;
826} 865}
827void KSyncPrefsDialog::usrReadConfig() 866void KSyncPrefsDialog::usrReadConfig()
828{ 867{
829 //KConfig *config = KOGlobals::config(); 868 //KConfig *config = KOGlobals::config();
830 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 869 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
831 config.setGroup("General"); 870 config.setGroup("General");
832 mSyncProfileNames =config.readListEntry("SyncProfileNames"); 871 mSyncProfileNames =config.readListEntry("SyncProfileNames");
833 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); 872 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
834 int i; 873 int i;
835 KSyncProfile* temp ; 874 KSyncProfile* temp ;
836 mSyncProfiles.clear(); 875 mSyncProfiles.clear();
837 for ( i = 0; i < mSyncProfileNames.count();++i ) { 876 for ( i = 0; i < mSyncProfileNames.count();++i ) {
838 temp = new KSyncProfile (); 877 temp = new KSyncProfile ();
839 temp->setName( mSyncProfileNames[i] ); 878 temp->setName( mSyncProfileNames[i] );
840 temp->readConfig( &config ); 879 temp->readConfig( &config );
841 mSyncProfiles.append( temp ); 880 mSyncProfiles.append( temp );
842 } 881 }
843 insertProfiles(); 882 insertProfiles();
844 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); 883 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
845} 884}
846 885
847 886
848void KSyncPrefsDialog::usrWriteConfig() 887void KSyncPrefsDialog::usrWriteConfig()
849{ 888{
850 saveProfile(); 889 saveProfile();
851 if ( currentSelection >= 0 ) 890 if ( currentSelection >= 0 )
852 profileChanged(currentSelection); 891 profileChanged(currentSelection);
853 //KConfig *config = KOGlobals::config(); 892 //KConfig *config = KOGlobals::config();
854 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 893 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
855 KSyncProfile* prof = mSyncProfiles.first(); 894 KSyncProfile* prof = mSyncProfiles.first();
856 QStringList externalSyncProfileNames; 895 QStringList externalSyncProfileNames;
857 externalSyncProfileNames.append("Sharp_DTM");; 896 externalSyncProfileNames.append("Sharp_DTM");;
858 while ( prof ) { 897 while ( prof ) {
859 prof->writeConfig(&config); 898 prof->writeConfig(&config);
860 if ( prof->getIsPhoneSync( ) ) 899 if ( prof->getIsPhoneSync( ) )
861 externalSyncProfileNames.append(prof->getName( ) ); 900 externalSyncProfileNames.append(prof->getName( ) );
862 prof = mSyncProfiles.next(); 901 prof = mSyncProfiles.next();
863 } 902 }
864 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; 903 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
865 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); 904 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
866 config.setGroup("General"); 905 config.setGroup("General");
867 config.writeEntry("SyncProfileNames",mSyncProfileNames); 906 config.writeEntry("SyncProfileNames",mSyncProfileNames);
868 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); 907 config.writeEntry("ExternSyncProfiles",externalSyncProfileNames);
869 config.writeEntry("LocalMachineName",mMyMachineName->text()); 908 config.writeEntry("LocalMachineName",mMyMachineName->text());
870 config.sync(); 909 config.sync();
871} 910}
872 911
873void KSyncPrefsDialog::helpDevice() 912void KSyncPrefsDialog::helpDevice()
874{ 913{
875 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); 914 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n");
876#ifdef _WIN32_ 915#ifdef _WIN32_
877 hint += "Leave empty for Irda.\n" 916 hint += "Leave empty for Irda.\n"
878 "com1:\n(first serial port)\n" 917 "com1:\n(first serial port)\n"
879 "usb not supported\n" 918 "usb not supported\n"
880 "???\n(bluetooth device address)\n"; 919 "???\n(bluetooth device address)\n";
881 920
882#else 921#else
883 hint += "/dev/ircomm\n(Irda)\n" 922 hint += "/dev/ircomm\n(Irda)\n"
884 "/dev/ttyS0\n(first serial port)\n" 923 "/dev/ttyS0\n(first serial port)\n"
885 "/dev/ttyUSB0\n(first device usb port)\n" 924 "/dev/ttyUSB0\n(first device usb port)\n"
886 "???\n(bluetooth device address)\n"; 925 "???\n(bluetooth device address)\n";
887#endif 926#endif
888 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 927 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
889} 928}
890void KSyncPrefsDialog::helpModel() 929void KSyncPrefsDialog::helpModel()
891{ 930{
892 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n"); 931 QString hint = i18n("Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n");
893 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; 932 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection";
894 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 933 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
895 934
896} 935}
897void KSyncPrefsDialog::helpConnection() 936void KSyncPrefsDialog::helpConnection()
898{ 937{
899 QString hint = i18n("Insert kind of connection,e.g.:\n"); 938 QString hint = i18n("Insert kind of connection,e.g.:\n");
900 hint += "irda | Nokia FBUS over infrared\n" 939 hint += "irda | Nokia FBUS over infrared\n"
901 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" 940 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n"
902 "irdaobex | set also model as obex\n" 941 "irdaobex | set also model as obex\n"
903 "fbus | Nokia FBUS2 serial\n"; 942 "fbus | Nokia FBUS2 serial\n";
904 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 943 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
905} 944}