aboutsummaryrefslogtreecommitdiffstats
path: root/kde2/kpsion/wizards.cpp
blob: 24cd1213fc8681d91bd35441ae3447ab5d492c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
/*-*-c++-*-
 * $Id$
 *
 * This file is part of plptools.
 *
 *  Copyright (C) 2001 Fritz Elfert <felfert@to.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>

#include "wizards.h"

#include <kapp.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kmessagebox.h>

#include <qlayout.h>
#include <qwhatsthis.h>
#include <qheader.h>

FirstTimeWizard::FirstTimeWizard(QWidget *parent, const char *name)
    : KWizard(parent, name, true) {

	setCaption(i18n("KPsion Setup"));
	QWhatsThis::add(nextButton(),
			i18n("Click this button to continue with the next page."));
	QWhatsThis::add(backButton(),
			i18n("Click this button, to go to a previous page."));
	QWhatsThis::add(cancelButton(),
			i18n("<QT>If you click this button, the setup of <B>KPSion</B> will be aborted and next time you start <B>KPsion</B>, it will run this setup again.</QT>"));

	// Getting the users home directory from the passwd-entry is MUCH safer
	// than getting it from $HOME !!! (Environments can be tweaked)
	struct passwd *pw = getpwuid(getuid());
	bdirDefault = QString((pw) ? pw->pw_dir : 0L);
	if (bdirDefault.isEmpty())
	    bdirDefault = QDir::homeDirPath();
	bdirDefault += "/KPsionBackup";
	bdirCreated = "";

	// Page 1
	page1 = new QWidget(this, "welcome");
	QGridLayout *grid = new QGridLayout(page1);

	QLabel *l = new QLabel(page1, "welcome message");
	l->setText(i18n(
	    "<QT>"
	    "<H2>Welcome to KPsion!</H2>"
	    "It looks like you started <B>KPsion</B> the first time. "
	    "At least, i could not find any valid configuration.</BR>"
	    "On the following pages, we will gather some information, "
	    "which is needed for working with <B>KPsion</B>.</BR>"
	    " </BR>"
	    "Have fun."
	    "</QT>"
	    ));
	grid->addWidget(l, 1, 1, Qt::AlignTop);
	grid->setColStretch(1, 1);
	grid->setRowStretch(1, 1);
	grid->addRowSpacing(0, KDialog::marginHint());
	grid->addRowSpacing(2, KDialog::marginHint());
	grid->addColSpacing(0, KDialog::marginHint());
	grid->addColSpacing(2, KDialog::marginHint());
	addPage(page1, i18n("<QT><BIG><B>Welcome<B></BIG></QT>"));

	// Page 2
	page2 = new QWidget(this, "step1");
	grid = new QGridLayout(page2);

	l = new QLabel(page2, "step1");
	l->setText(i18n(
	    "<QT>"
	    "First, we need a folder for storing backups of "
	    "your Psion. You probably don't want others to "
	    "have access to it, so it's best to choose a "
	    "location somewhere in your home directory. "
	    "Please browse through existing folders and select a suitable "
	    "location or simply accept the default shown below."
	    "</QT>"
	    ));
	grid->addMultiCellWidget(l, 1, 1, 1, 2, Qt::AlignTop);

	bdirLabel = new QLabel(page2, "bdirLabel");
	bdirLabel->setText(bdirDefault);
	bdirButton = new QPushButton(i18n("Browse"), page2);

	QWhatsThis::add(bdirLabel,
			i18n("This is the name of the backup folder."));
	QWhatsThis::add(bdirButton,
			i18n("Click here, for opening a dialog which lets you easily select the backup folder."));
	grid->addWidget(bdirLabel, 3, 1);
	grid->addWidget(bdirButton, 3, 2);

	grid->setRowStretch(1, 1);
	grid->setColStretch(1, 1);

	grid->addRowSpacing(2, KDialog::spacingHint());

	grid->addRowSpacing(0, KDialog::marginHint());
	grid->addRowSpacing(4, KDialog::marginHint());
	grid->addColSpacing(0, KDialog::marginHint());
	grid->addColSpacing(3, KDialog::marginHint());

	connect(bdirButton, SIGNAL(clicked()), SLOT(slotBdirBrowse()));
	addPage(page2, i18n("<QT><BIG><B>Step 1</B></BIG> - Specify backup directory</QT>"));
	// Page 3
	page3 = new QWidget(this, "step2");
	grid = new QGridLayout(page3);

	l = new QLabel(page3, "step2");
	l->setText(i18n(
	    "<QT>"
	    "Next, please specify some information regarding "
	    "backup policy:<UL><LI>How many generations of backups "
	    "do you want to keep?</LI><LI>Shall i remind you about "
	    "backups?</LI><LI>If yes, in what intervals do you want "
	    "to happen backups?</LI></UL>"
	    "</QT>"
	    ));
	grid->addMultiCellWidget(l, 1, 1, 1, 2, Qt::AlignTop);

	l = new QLabel(i18n("&Incremental backup reminder"), page3, "iBackupIntLabel");
	grid->addWidget(l, 3, 1);
	iIntCombo = new KComboBox(false, page3, "iIntCombo");
	iIntCombo->insertItem(i18n("none"));
	iIntCombo->insertItem(i18n("daily"));
	iIntCombo->insertItem(i18n("every 2 days"));
	iIntCombo->insertItem(i18n("every 3 days"));
	iIntCombo->insertItem(i18n("every 4 days"));
	iIntCombo->insertItem(i18n("every 5 days"));
	iIntCombo->insertItem(i18n("every 6 days"));
	iIntCombo->insertItem(i18n("weekly"));
	iIntCombo->insertItem(i18n("every 2 weeks"));
	iIntCombo->insertItem(i18n("every 3 weeks"));
	iIntCombo->insertItem(i18n("monthly"));
	iIntCombo->setCurrentItem(1);
	grid->addWidget(iIntCombo, 3, 2);
	l->setBuddy(iIntCombo);

	l = new QLabel(i18n("&Full backup reminder"), page3, "fBackupIntLabel");
	grid->addWidget(l, 5, 1);
	fIntCombo = new KComboBox(false, page3, "fIntCombo");
	fIntCombo->insertItem(i18n("none"));
	fIntCombo->insertItem(i18n("daily"));
	fIntCombo->insertItem(i18n("every 2 days"));
	fIntCombo->insertItem(i18n("every 3 days"));
	fIntCombo->insertItem(i18n("every 4 days"));
	fIntCombo->insertItem(i18n("every 5 days"));
	fIntCombo->insertItem(i18n("every 6 days"));
	fIntCombo->insertItem(i18n("weekly"));
	fIntCombo->insertItem(i18n("every 2 weeks"));
	fIntCombo->insertItem(i18n("every 3 weeks"));
	fIntCombo->insertItem(i18n("monthly"));
	fIntCombo->setCurrentItem(7);
	grid->addWidget(fIntCombo, 5, 2);
	l->setBuddy(fIntCombo);

	l = new QLabel(i18n("Backup &generations"), page3, "backupGenLabel");
	grid->addWidget(l, 7, 1);
	genSpin = new KIntSpinBox(0, 10, 1, 3, 10, page3, "backupGenSpin");
	grid->addWidget(genSpin, 7, 2);
	l->setBuddy(genSpin);

	grid->setRowStretch(1, 1);
	grid->setColStretch(1, 1);

	grid->addRowSpacing(2, KDialog::spacingHint());
	grid->addRowSpacing(4, KDialog::spacingHint());
	grid->addRowSpacing(6, KDialog::spacingHint());

	grid->addRowSpacing(0, KDialog::marginHint());
	grid->addRowSpacing(8, KDialog::marginHint());
	grid->addColSpacing(0, KDialog::marginHint());
	grid->addColSpacing(3, KDialog::marginHint());

	addPage(page3, i18n("<QT><BIG><B>Step 2</B></BIG> - Backup policy</QT>"));

	// Page 4
	page4 = new QWidget(this, "step3");
	grid = new QGridLayout(page4);

	l = new QLabel(page4, "step2");
	l->setText(i18n(
	    "<QT>"
	    "If no connection could be established on startup, "
	    "<B>KPsion</B> will attempt to connect in regular "
	    "intervals. Please specify the interval after which "
	    "a connection attempt should happen. If you don't want "
	    "automatic retry, set the interval to zero. Furthermore, "
	    "<B>KPsion</B> can try to start ncpd if it is not already "
	    "running. For that to work correctly, you need to"
	    "<UL><LI>specify the serial port to use.</LI>"
	    "<LI>specify the baud rate</LI>"
	    "<LI>have permission to use the specified port</LI></UL>"
	    "</QT>"
	    ));
	grid->addMultiCellWidget(l, 1, 1, 1, 2, Qt::AlignTop);

	l = new QLabel(i18n("&Connection retry interval (sec.)"), page4, "rconLabel");
	grid->addWidget(l, 3, 1);
	rconSpin = new KIntSpinBox(0, 600, 1, 30, 10, page4, "rconSpin");
	grid->addWidget(rconSpin, 3, 2);
	l->setBuddy(rconSpin);

	l = new QLabel(i18n("Serial &device"), page4, "devLabel");
	grid->addWidget(l, 5, 1);
	devCombo = new KComboBox(false, page4, "devCombo");
	devCombo->insertItem(i18n("off"));
	devCombo->insertItem(i18n("/dev/ttyS0"));
	devCombo->insertItem(i18n("/dev/ttyS1"));
	devCombo->insertItem(i18n("/dev/ttyS2"));
	devCombo->insertItem(i18n("/dev/ttyS3"));
	devCombo->insertItem(i18n("/dev/ircomm0"));
	devCombo->insertItem(i18n("/dev/ircomm1"));
	devCombo->insertItem(i18n("/dev/ircomm2"));
	devCombo->insertItem(i18n("/dev/ircomm3"));
	devCombo->setCurrentItem(0);
	grid->addWidget(devCombo, 5, 2);
	l->setBuddy(devCombo);

	l = new QLabel(i18n("Serial &speed"), page4, "speedLabel");
	grid->addWidget(l, 7, 1);
	speedCombo = new KComboBox(false, page4, "speedCombo");
	speedCombo->insertItem("9600");
	speedCombo->insertItem("19200");
	speedCombo->insertItem("38400");
	speedCombo->insertItem("57600");
	speedCombo->insertItem("115200");
	speedCombo->setCurrentItem(4);
	grid->addWidget(speedCombo, 7, 2);
	l->setBuddy(speedCombo);

	grid->setRowStretch(1, 1);
	grid->setColStretch(1, 1);

	grid->addRowSpacing(2, KDialog::spacingHint());
	grid->addRowSpacing(4, KDialog::spacingHint());
	grid->addRowSpacing(6, KDialog::spacingHint());

	grid->addRowSpacing(0, KDialog::marginHint());
	grid->addRowSpacing(8, KDialog::marginHint());
	grid->addColSpacing(0, KDialog::marginHint());
	grid->addColSpacing(3, KDialog::marginHint());

	addPage(page4, i18n("<QT><BIG><B>Step 3</B></BIG> - Connection parameters</QT>"));

	// Page 5
	page5 = new QWidget(this, "step3");
	grid = new QGridLayout(page5);

	l = new QLabel(page5, "step2");
	l->setText(i18n(
	    "<QT>"
	    "That's it!<BR/>"
	    "Next, i will start <B>KPsion</B> and if your Psion is already "
	    "connected and it's communication turned on (use "
	    "<B>Ctrl-T</B> at system level), then <B>KPsion</B> will "
	    "bring up a similar Dialog like this which lets you assing a "
	    "Name for it. After that, i suggest performing a full "
	    "Backup.<BR/>Please click <B>Finish</B> now.</QT>"
	    ));
	grid->addWidget(l, 1, 1, Qt::AlignTop);

	grid->setRowStretch(1, 1);
	grid->setColStretch(1, 1);

	grid->addRowSpacing(0, KDialog::marginHint());
	grid->addRowSpacing(2, KDialog::marginHint());
	grid->addColSpacing(0, KDialog::marginHint());
	grid->addColSpacing(2, KDialog::marginHint());

	addPage(page5, i18n("<QT><BIG><B>Finished</B></BIG></QT>"));

	setFinishEnabled(page5, true);
}

void FirstTimeWizard::
slotBdirBrowse() {
    QString dir = KFileDialog::getExistingDirectory(bdirLabel->text(), this,
						    i18n("Backup folder"));
    checkBackupDir(dir);
}

void FirstTimeWizard::
reject() {
    // kapp->quit() and [QK]Application::exit(0) don't work here?!
    // probably because we didn't call kapp->exec() yet?
    // -> brute force
    if (KMessageBox::questionYesNo(this,
				   i18n("<QT>You are about to abort the initial setup of <B>KPsion</B>. No configuration will be stored and you will have to repeat this procedure when you start <B>KPsion</B> next time.<BR/>Do you really want to exit now?</QT>")) == KMessageBox::Yes) {
	if (!bdirCreated.isEmpty())
	    ::rmdir(bdirCreated.data());
	::exit(0);
    }
}

void FirstTimeWizard::
accept() {
    KConfig *config = kapp->config();
    config->setGroup("Settings");
    config->writeEntry("BackupDir", bdirLabel->text());
    config->writeEntry("BackupGenerations", genSpin->value());
    config->writeEntry("IncrementalInterval", iIntCombo->currentItem());
    config->writeEntry("FullInterval", fIntCombo->currentItem());
    config->setGroup("Connection");
    config->writeEntry("Retry", rconSpin->value());
    config->writeEntry("Device", devCombo->currentText());
    config->writeEntry("Speed", speedCombo->currentText());
    hide();
    setResult(Accepted);
}

void FirstTimeWizard::
next() {
    for (int i = 0; i < pageCount(); i++)
	if (currentPage() == page(i)) {
	    switch (i) {
		case 1:
		    QString dir(bdirLabel->text());
		    if (!checkBackupDir(dir))
			return;
	    }
	    break;
	}
    KWizard::next();
}

void FirstTimeWizard::
closeEvent(QCloseEvent *e) {
    reject();
}

bool FirstTimeWizard::
checkBackupDir(QString &dir) {
    if (!bdirCreated.isEmpty()) {
	if (bdirCreated != dir) {
	    ::rmdir(bdirCreated.data());
	    bdirCreated = "";
	}
    }
    if (!dir.isEmpty()) {
	QDir d(dir);
	if (!d.exists()) {
	    if (KMessageBox::questionYesNo(this,
					   i18n("<QT>The folder <B>%1</B> does <B>not</B> exist.<BR/>Shall it be created?</QT>").arg(dir)) == KMessageBox::No) {
		bdirLabel->setText(bdirDefault);
		return false;
	    }
	    if (mkdir(dir.data(), 0700) != 0) {
		QString msg = i18n("<QT>The specified folder<BR/><B>%1</B><BR/>could <B>not</B> be created");
		switch (errno) {
		    case EACCES:
		    case EPERM:
		    case EROFS:
			msg += i18n(", because you either don't have sufficient rights to do that, or the filesystem is readonly.");
			// Insufficient permissions/ readonly FS
			break;
		    case ENOSPC:
			msg += i18n(", because the filesystem has not enough space.");
			// No space
			break;
		    case EEXIST:
			// shouldn't happen, we checked already
			// for existence.
			msg += i18n(", because there already exists another object with the same name.");
			break;
		    case EFAULT:
		    case ENOMEM:
		    case ENAMETOOLONG:
			// shouldn't happen.
			msg += ".";
			break;
		    case ENOENT:
			// propably dangling symlink
			msg += i18n(", because you specified a path which probably contains a dangling symbolic link.");
			break;
		    case ENOTDIR:
			msg += i18n(", because you specified a path which contains an element which is not a folder.");
			// path element not dir.
			break;
		    case ELOOP:
			msg += i18n(", because you specified a path which contains too many symbolic links.");
			// Too many symlinks
			break;


		}
		bdirLabel->setText(bdirDefault);
		msg += i18n("<BR/>Please select another folder.</QT>");
		KMessageBox::error(this, msg.arg(dir));
		return false;
	    }
	    bdirCreated = dir;
	}
	bdirLabel->setText(dir);
	return true;
    }
    bdirLabel->setText(bdirDefault);
    return false;
}

NewPsionWizard::NewPsionWizard(QWidget *parent, const char *name)
    : KWizard(parent, name, true) {

	setCaption(i18n("New Psion detected"));
	psion = (KPsionMainWindow *)parent;

	QWhatsThis::add(nextButton(),
			i18n("Click this button to continue with the next page."));
	QWhatsThis::add(backButton(),
			i18n("Click this button, to go to a previous page."));
	QWhatsThis::add(cancelButton(),
			i18n("<QT>If you click this button, the setup for the new connected Psion will be aborted and next time you connect this Psion again, <B>KPsion</B> will run this setup again.</QT>"));

	// Page 1
	page1 = new QWidget(this, "newmachine");
	QGridLayout *grid = new QGridLayout(page1);

	QLabel *l = new QLabel(page1, "newmachmessage");
	uid = psion->getMachineUID();
	l->setText(i18n(
	    "<QT>"
	    "The Psion with the unique ID <B>%1</B> "
	    "is connected the first time. Please assign a name to it."
	    "</QT>").arg(uid));
	grid->addMultiCellWidget(l, 1, 1, 1, 2, Qt::AlignTop);

	l = new QLabel(page1, "nameLabel");
	l->setText(i18n("&Name of new Psion"));
	nameEdit = new KLineEdit(page1, "nameEdit");
	nameEdit->setText(i18n("My new Psion"));
	nameEdit->selectAll();
	nameEdit->setFocus();
	l->setBuddy(nameEdit);
	grid->addWidget(l, 3, 1);
	grid->addWidget(nameEdit, 3, 2);

	grid->setColStretch(1, 1);
	grid->setRowStretch(1, 1);

	grid->addRowSpacing(2, KDialog::spacingHint());

	grid->addRowSpacing(0, KDialog::marginHint());
	grid->addRowSpacing(4, KDialog::marginHint());
	grid->addColSpacing(0, KDialog::marginHint());
	grid->addColSpacing(2, KDialog::marginHint());

	addPage(page1, i18n("<QT><BIG><B>New Psion detected<B></BIG></QT>"));

	// Page 2
	page2 = new QWidget(this, "bdrives");
	grid = new QGridLayout(page2);

	l = new QLabel(page2, "bdrivemessage");
	l->setText(i18n(
	    "<QT>"
	    "Please select the Drive(s), you want to be backed up when "
	    "running in unattended backup mode."
	    "</QT>"
	    ));
	grid->addMultiCellWidget(l, 1, 1, 1, 3, Qt::AlignTop);

	backupListView = new KListView(page2, "bdriveListView");
	backupListView->addColumn(i18n("Available drives"));
	driveMap dlist = psion->getDrives();
	driveMap::Iterator it;
	int height = backupListView->header()->height();
	for (it = dlist.begin(); it != dlist.end(); it++) {
	    QCheckListItem *i = new QCheckListItem(backupListView, it.data(),
						   QCheckListItem::CheckBox);
	    height += i->height();
	    i->setSelectable(false);
	}
	backupListView->setMaximumSize(backupListView->columnWidth(0) + 5, height + 5);
	grid->addWidget(backupListView, 3, 2);

	grid->setColStretch(1, 1);
	grid->setRowStretch(1, 1);
	grid->setColStretch(3, 1);

	grid->addRowSpacing(2, KDialog::spacingHint());

	grid->addRowSpacing(0, KDialog::marginHint());
	grid->addRowSpacing(4, KDialog::marginHint());
	grid->addColSpacing(0, KDialog::marginHint());
	grid->addColSpacing(4, KDialog::marginHint());

	addPage(page2, i18n("<QT><BIG><B>Specify drives to backup<B></BIG></QT>"));

	setFinishEnabled(page2, true);
}

void NewPsionWizard::
next() {
    for (int i = 0; i < pageCount(); i++)
	if (currentPage() == page(i)) {
	    switch (i) {
		case 0:
		    QString tmp(nameEdit->text());
		    if (!checkPsionName(tmp))
			return;
	    }
	    break;
	}
    KWizard::next();
}

bool NewPsionWizard::
checkPsionName(QString &name) {
    KConfig *config = kapp->config();
    if (name.isEmpty()) {
	KMessageBox::sorry(this, i18n("The name cannot be empty."));
	return false;
    }
    psionMap l = psion->getMachines();
    psionMap::Iterator it;
    for (it = l.begin(); it != l.end(); it++) {
	if (name == it.data()) {
	    KMessageBox::sorry(this, i18n("<QT>The name <B>%1</B> is already assigned to another machine.<BR/>Please choose a different name.</QT>"));
	    return false;
	}
    }
    return true;
}

void NewPsionWizard::
accept() {
    KConfig *config = kapp->config();
    config->setGroup("Psion");
    QStringList machines = config->readListEntry("MachineUIDs");
    machines += uid;
    config->writeEntry("MachineUIDs", machines);
    QString tmp = QString::fromLatin1("Name_%1").arg(uid);
    config->writeEntry(tmp, nameEdit->text());
    tmp = nameEdit->text();
    psion->setMachineName(tmp);
    QListViewItemIterator li(backupListView);
    driveMap dlist = psion->getDrives();
    driveMap::Iterator di;
    QStringList bdrives;
    for (; li.current(); li++) {
	QCheckListItem *qcli = (QCheckListItem *)(li.current());
	if (qcli->isOn()) {
	    tmp = qcli->text();
	    for (di = dlist.begin(); di != dlist.end(); di++)
		if (di.data() == tmp) {
		    QString drv = "";
		    drv += di.key();
		    bdrives += drv;
		}
	}
    }
    config->writeEntry("BackupDrives", bdrives);
    hide();
    setResult(Accepted);
}

/*
 * Local variables:
 * c-basic-offset: 4
 * End:
 */