From fd8c3ec28d9f721e15ee89de412ad565f94e79d3 Mon Sep 17 00:00:00 2001
From: Fritz Elfert 
Date: Tue, 6 Mar 2001 17:13:01 +0000
Subject: KPsion: added format stuff.
---
 kde2/kpsion/kpsion.cpp  | 223 ++++++++++++++++++++++++++++++++--
 kde2/kpsion/kpsion.h    |   2 +
 kde2/kpsion/main.cpp    |  33 +++--
 kde2/kpsion/wizards.cpp |   9 +-
 kde2/po/de/kpsion.po    | 317 ++++++++++++++++++++++++++++--------------------
 kde2/po/kpsion.pot      | 301 ++++++++++++++++++++++++++-------------------
 ncpd/ncp.cc             |   2 +-
 ncpd/socketchan.cc      | 258 +++++++++++++++++++--------------------
 plpbackup/plpbackup.cc  |  10 +-
 plpftp/ftp.cc           |   4 +-
 plpnfsd/main.cc         |   5 +-
 11 files changed, 737 insertions(+), 427 deletions(-)
diff --git a/kde2/kpsion/kpsion.cpp b/kde2/kpsion/kpsion.cpp
index 2e605d9..fad18da 100644
--- a/kde2/kpsion/kpsion.cpp
+++ b/kde2/kpsion/kpsion.cpp
@@ -388,7 +388,7 @@ bool KPsionBackupListView::
 autoSelect(QString drive) {
     KPsionCheckListItem *latest = NULL;
     time_t stamp = 0;
-    
+
     drive += ":";
     // Find latest full backup for given drive
     KPsionCheckListItem *i = firstChild();
@@ -485,6 +485,8 @@ KPsionMainWindow::KPsionMainWindow()
 	    SLOT(iconClicked(QIconViewItem *)));
     connect(view, SIGNAL(onItem(QIconViewItem *)),
 	    SLOT(iconOver(QIconViewItem *)));
+    connect(this, SIGNAL(rearrangeIcons(bool)), view,
+	    SLOT(arrangeItemsInGrid(bool)));
     KConfig *config = kapp->config();
     config->setGroup("Psion");
     QStringList uids = config->readListEntry("MachineUIDs");
@@ -714,7 +716,7 @@ queryPsion() {
     for (int i = 0; i < 26; i++) {
 	if ((devbits & 1) != 0) {
 	    PlpDrive drive;
-	    if (plpRfsv->devinfo(i, drive) == rfsv::E_PSI_GEN_NONE)
+	    if (plpRfsv->devinfo('A' + i, drive) == rfsv::E_PSI_GEN_NONE)
 		insertDrive('A' + i, drive.getName().c_str());
 	}
 	devbits >>= 1;
@@ -738,6 +740,70 @@ queryPsion() {
     }
     statusBar()->changeItem(i18n("Connected to %1").arg(machineName),
 			    STID_CONNECTION);
+    if (args->isSet("backup")) {
+	bool any = false;
+
+	QCStringList argl = args->getOptionList("backup");
+	QCStringList::Iterator it;
+
+	for (it = argl.begin(); it != argl.end(); ++it) {
+	    QString drv((*it).upper());
+
+	    for (QIconViewItem *i = view->firstItem(); i; i = i->nextItem()) {
+		if (i->key() == drv) {
+		    i->setSelected(true);
+		    any = true;
+		}
+	    }
+	}
+	if (any) {
+	    fullBackup = true;
+	    doBackup();
+	}
+	return;
+    }
+    if (args->isSet("restore")) {
+	bool any = false;
+
+	QCStringList argl = args->getOptionList("restore");
+	QCStringList::Iterator it;
+
+	for (it = argl.begin(); it != argl.end(); ++it) {
+	    QString drv((*it).upper());
+	    if (drv == "Z") {
+		KMessageBox::sorry(this, i18n(
+		    "The selected drive Z: is "
+		    "a ROM drive and therefore cannot be restored."));
+		continue;
+	    }
+	    for (QIconViewItem *i = view->firstItem(); i; i = i->nextItem()) {
+		if (i->key() == drv) {
+		    i->setSelected(true);
+		    any = true;
+		}
+	    }
+	}
+	if (any)
+	    slotStartRestore();
+	return;
+    }
+    if (args->isSet("format")) {
+	bool any = false;
+	QCStringList argl = args->getOptionList("format");
+	QCStringList::Iterator it;
+
+	for (it = argl.begin(); it != argl.end(); ++it) {
+	    QString drv((*it).upper());
+	    for (QIconViewItem *i = view->firstItem(); i; i = i->nextItem()) {
+		if (i->key() == drv) {
+		    i->setSelected(true);
+		    any = true;
+		}
+	    }
+	}
+	KMessageBox::sorry(this, "Formatting is not yet implemented");
+	return;
+    }
 }
 
 QString KPsionMainWindow::
@@ -941,9 +1007,9 @@ doBackup() {
 	if (i->isSelected()) {
 	    QString drv = i->key();
 	    drv += ":";
-	    int drvNum = *(drv.data()) - 'A';
+	    int drvChar = drv[0].latin1();
 	    PlpDrive drive;
-	    if (plpRfsv->devinfo(drvNum, drive) != rfsv::E_PSI_GEN_NONE) {
+	    if (plpRfsv->devinfo(drvChar, drive) != rfsv::E_PSI_GEN_NONE) {
 		statusBar()->changeItem(i18n("Connected to %1").arg(machineName),
 					STID_CONNECTION);
 		emit enableProgressText(false);
@@ -1194,12 +1260,12 @@ askOverwrite(PlpDirent e) {
 		       KDialogBase::Cancel, KDialogBase::No,
 		       KDialogBase::Cancel, this, "overwriteDialog", true, true,
 		       QString::null, QString::null, i18n("Overwrite &All"));
-    
+
     QWidget *contents = new QWidget(&dialog);
     QHBoxLayout * lay = new QHBoxLayout(contents);
     lay->setSpacing(KDialog::spacingHint()*2);
     lay->setMargin(KDialog::marginHint()*2);
-    
+
     lay->addStretch(1);
     QLabel *label1 = new QLabel(contents);
     label1->setPixmap(QMessageBox::standardIcon(QMessageBox::Warning,
@@ -1218,10 +1284,10 @@ askOverwrite(PlpDirent e) {
 	"  Attributes: %7
"
 	"Do you want to overwrite it?").arg(fn).arg(os).arg(od).arg(oa).arg(ns).arg(nd).arg(na), contents));
     lay->addStretch(1);
- 
+
     dialog.setMainWidget(contents);
     dialog.enableButtonSeparator(false);
- 
+
     int result = dialog.exec();
     switch (result) {
 	case KDialogBase::Yes:
@@ -1234,7 +1300,7 @@ askOverwrite(PlpDirent e) {
 	default: // Huh?
 	    break;
     }
- 
+
     return false; // Default
 }
 
@@ -1431,6 +1497,126 @@ slotStartFormat() {
 	return;
     formatRunning = true;
     switchActions();
+
+    killSave();
+
+    for (QIconViewItem *i = view->firstItem(); i; i = i->nextItem()) {
+	if (i->isSelected() && (i->key() != "Z")) {
+	    int handle;
+	    int count;
+	    QString drive = i->key();
+	    const char dchar = drive[0].latin1();
+	    QString dname("");
+
+	    PlpDrive drv;
+	    if (plpRfsv->devinfo(dchar - 'A', drv) == rfsv::E_PSI_GEN_NONE)
+		dname = QString(drv.getName().c_str());
+
+	    statusBar()->changeItem(i18n("Formatting drive %1:").arg(dchar),
+				    STID_CONNECTION);
+	    update();
+
+	    emit setProgressText(QString(""));
+	    emit setProgress(0);
+	    emit enableProgressText(true);
+
+	    Enum res = plpRpcs->formatOpen(dchar, handle, count);
+	    if (res != rfsv::E_PSI_GEN_NONE) {
+		KMessageBox::error(this, i18n(
+		    "Could not format drive %1:
"
+		    "%2").arg(dchar).arg(KGlobal::locale()->translate(res)));
+		emit setProgress(0);
+		emit enableProgressText(false);
+		statusBar()->changeItem(i18n("Connected to %1").arg(machineName),
+					STID_CONNECTION);
+		continue;
+	    }
+	    progressTotal = 0;
+	    progressLocal = count;
+	    progressLocalCount = 0;
+	    progressLocalPercent = -1;
+	    updateProgress(0);
+	    for (int i = 0; i < count; i++) {
+		updateProgress(i);
+		res = plpRpcs->formatRead(handle);
+		if (res != rfsv::E_PSI_GEN_NONE) {
+		    KMessageBox::error(this, i18n(
+			"Error during format of drive %1:
"
+			"%2").arg(dchar).arg(KGlobal::locale()->translate(res)));
+		    emit setProgress(0);
+		    emit enableProgressText(false);
+		    statusBar()->changeItem(
+			i18n("Connected to %1").arg(machineName),
+			STID_CONNECTION);
+		    count = 0;
+		    continue;
+		}
+	    }
+	    setDriveName(dchar, dname);
+	}
+    }
+
+    runRestore();
+
+    formatRunning = false;
+    switchActions();
+
+    emit setProgress(0);
+    emit enableProgressText(false);
+    statusBar()->changeItem(i18n("Connected to %1").arg(machineName),
+			    STID_CONNECTION);
+    statusBar()->message(i18n("Format done"), 2000);
+}
+
+void KPsionMainWindow::
+setDriveName(const char dchar, QString dname) {
+    KDialogBase dialog(this, "drivenameDialog", true, i18n("Assign drive name"),
+		       KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
+		       true);
+
+    QWidget *w = new QWidget(&dialog);
+    QGridLayout *gl = new QGridLayout(w, 1, 1, KDialog::marginHint()*2,
+				      KDialog::spacingHint()*2);
+
+    QLabel *l = new QLabel(i18n(
+	"Formatting of drive %1: finished. Please assign a name for "
+	"that drive.").arg(dchar), w);
+    gl->addMultiCellWidget(l, 0, 0, 0, 1);
+
+    l = new QLabel(i18n("New name of drive %1:").arg(dchar), w);
+    gl->addWidget(l, 1, 0);
+
+    KLineEdit *e = new KLineEdit(dname, w, "nameEntry");
+    gl->addWidget(e, 1, 1);
+
+    gl->setColStretch(1, 1);
+    dialog.setMainWidget(w);
+
+    int result = dialog.exec();
+    QString newname = QString("%1:").arg(dchar);
+    QString dstr;
+    dstr = dchar;
+
+    switch (result) {
+	case QDialog::Accepted:
+	    if (!e->text().isEmpty()) {
+		Enum res;
+		res = plpRfsv->setVolumeName(dchar, e->text());
+		if (res == rfsv::E_PSI_GEN_NONE)
+		    newname = QString("%1 (%2:)").arg(e->text()).arg(dchar);
+	    }
+	    drives.replace(dchar, newname);
+	    for (QIconViewItem *i = view->firstItem(); i; i = i->nextItem()) {
+		if (i->key() == dstr) {
+		    i->setText(newname);
+		    break;
+		}
+	    }
+	    emit rearrangeIcons(true);
+	    break;
+	default: // Huh?
+	    break;
+    }
 }
 
 void KPsionMainWindow::
@@ -1546,6 +1732,25 @@ killSave() {
 	    plpRpcs->stopProgram(pbuf);
 	}
     }
+    time_t tstart = time(0) + 5;
+    while (true) {
+	kapp->processEvents();
+	usleep(100000);
+	kapp->processEvents();
+	if ((res = plpRpcs->queryDrive('C', tmp)) != rfsv::E_PSI_GEN_NONE) {
+	    cerr << "Could not get process list, Error: " << res << endl;
+	    return;
+	}
+	if (tmp.empty())
+	    break;
+	if (time(0) > tstart) {
+	    KMessageBox::error(this, i18n(
+		"Could not stop all processes.
"
+		"Please stop running programs manually on the Psion, "
+		"then klick Ok."));
+	    time_t tstart = time(0) + 5;
+	}
+    }
     return;
 }
 
diff --git a/kde2/kpsion/kpsion.h b/kde2/kpsion/kpsion.h
index 2543fa6..ce9430e 100644
--- a/kde2/kpsion/kpsion.h
+++ b/kde2/kpsion/kpsion.h
@@ -168,6 +168,7 @@ signals:
     void setProgress(int, int);
     void setProgressText(const QString &);
     void enableProgressText(bool);
+    void rearrangeIcons(bool);
 
 public slots:
     void slotStartRestore();
@@ -201,6 +202,7 @@ private:
     void runRestore();
     void createIndex();
     bool askOverwrite(PlpDirent e);
+    void setDriveName(const char dchar, QString dname);
 
     rfsv *plpRfsv;
     rpcs *plpRpcs;
diff --git a/kde2/kpsion/main.cpp b/kde2/kpsion/main.cpp
index c9c0a0f..5ccffc6 100644
--- a/kde2/kpsion/main.cpp
+++ b/kde2/kpsion/main.cpp
@@ -44,15 +44,14 @@ extern "C" {
 
 
 static KCmdLineOptions options[] = {
-    {"a", 0, 0},
+//    {"a", 0, 0},
     {"autobackup", I18N_NOOP("perform scheduled backup"), 0},
-    {"b ", 0, 0},
-    {"backup ", I18N_NOOP("perform backup"), 0},
-    {"r ", 0, 0},
-    {"restore ", I18N_NOOP("perform restore"), 0},
-    {"f ", 0, 0},
-    {"format ", I18N_NOOP("format drive"), 0},
-    {"+drive", I18N_NOOP("The drive letter to backup/restore or format."), 0},
+//    {"b ", 0, 0},
+    {"backup ", I18N_NOOP("perform backup"), 0},
+//    {"r ", 0, 0},
+    {"restore ", I18N_NOOP("perform restore"), 0},
+//    {"f ", 0, 0},
+    {"format ", I18N_NOOP("format drive"), 0},
     { 0, 0, 0},
 };
 
@@ -84,9 +83,25 @@ int main(int argc, char **argv) {
 	wiz->exec();
     }
 
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+    int acnt = 0;
+    if (args->isSet("backup"))
+	acnt++;
+    if (args->isSet("restore"))
+	acnt++;
+    if (args->isSet("format"))
+	acnt++;
+    if (args->isSet("autobackup"))
+	acnt++;
+
+    if (acnt > 1)
+	KCmdLineArgs::usage(i18n(
+	    "The options are mutually exclusive. "
+	    "I.e. You cannot specify more than one action at once."));
+
     KPsionMainWindow *w = new KPsionMainWindow();
 
-    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
     if (args->isSet("autobackup") && (!w->isConnected()))
 	return 0;
     w->resize(300, 170);
diff --git a/kde2/kpsion/wizards.cpp b/kde2/kpsion/wizards.cpp
index 24cd121..62734b5 100644
--- a/kde2/kpsion/wizards.cpp
+++ b/kde2/kpsion/wizards.cpp
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -53,13 +54,7 @@ FirstTimeWizard::FirstTimeWizard(QWidget *parent, const char *name)
 	QWhatsThis::add(cancelButton(),
 			i18n("If you click this button, the setup of KPSion will be aborted and next time you start KPsion, it will run this setup again."));
 
-	// 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";
+	bdirDefault = locateLocal("data", "kpsion/backups");
 	bdirCreated = "";
 
 	// Page 1
diff --git a/kde2/po/de/kpsion.po b/kde2/po/de/kpsion.po
index 7146209..e3c6219 100644
--- a/kde2/po/de/kpsion.po
+++ b/kde2/po/de/kpsion.po
@@ -5,8 +5,8 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: plptools 0.7\n"
-"POT-Creation-Date: 2001-03-05 09:37+0100\n"
-"PO-Revision-Date: 2001-03-05 09:39CET\n"
+"POT-Creation-Date: 2001-03-06 17:49+0100\n"
+"PO-Revision-Date: 2001-03-06 17:50CET\n"
 "Last-Translator: Fritz Elfert \n"
 "Language-Team: Deutsch \n"
 "MIME-Version: 1.0\n"
@@ -43,11 +43,11 @@ msgstr ""
 msgid "Idle"
 msgstr "Bereit"
 
-#: kpsion.cpp:499 wizards.cpp:232
+#: kpsion.cpp:501 wizards.cpp:227
 msgid "off"
 msgstr "aus"
 
-#: kpsion.cpp:503
+#: kpsion.cpp:505
 msgid ""
 "Here, you see your Psion's drives.
Every drive is represented by an "
 "Icon. If you click on it, it gets selected for the next operation. E.g.: "
@@ -61,65 +61,74 @@ msgstr ""
 "abzuwählen.
Wählen Sie beliebig viele Laufwerke und dann eine "
 "Operation."
 
-#: kpsion.cpp:566
+#: kpsion.cpp:573
 msgid "Start &Format"
 msgstr "Starte &Formatierung"
 
-#: kpsion.cpp:568
+#: kpsion.cpp:575
 msgid "Start Full &Backup"
 msgstr "Starte &Komplett-Sicherung"
 
-#: kpsion.cpp:571
+#: kpsion.cpp:578
 msgid "Start &Incremental Backup"
 msgstr "Starte &inkrementelle Sicherung"
 
-#: kpsion.cpp:573
+#: kpsion.cpp:580
 msgid "Start &Restore"
 msgstr "Starte &Rücksicherung"
 
-#: kpsion.cpp:587
+#: kpsion.cpp:594
 msgid "Full backup of selected drive(s)"
 msgstr "Komplett-Sicherung der ausgewählten Laufwerke"
 
-#: kpsion.cpp:589
+#: kpsion.cpp:596
 msgid "Incremental backup of selected drive(s)"
 msgstr "Inkrementelle Sicherung der ausgewählten Laufwerke"
 
-#: kpsion.cpp:591
+#: kpsion.cpp:598
 msgid "Restore selected drive(s)"
 msgstr "Sichere ausgewählte Laufwerke zurück"
 
-#: kpsion.cpp:593
+#: kpsion.cpp:600
 msgid "Format selected drive(s)"
 msgstr "Formatiere ausgewählte Laufwerke"
 
-#: kpsion.cpp:664
+#: kpsion.cpp:671
 msgid "Retrieving machine info ..."
 msgstr "Ermittle Geräte-Info ..."
 
-#: kpsion.cpp:675
+#: kpsion.cpp:682
 msgid "Could not get Psion machine info"
 msgstr "Konnte Psion Geräteinfo nicht ermitteln"
 
-#: kpsion.cpp:688
+#: kpsion.cpp:695
 msgid "an unknown machine"
 msgstr "einem unbekannten Gerät"
 
-#: kpsion.cpp:701
+#: kpsion.cpp:708
 msgid "Retrieving drive list ..."
 msgstr "Ermittle Laufwerks-Liste ..."
 
-#: kpsion.cpp:704
+#: kpsion.cpp:711
 msgid "Could not get list of drives"
 msgstr "Konnte Liste der Laufwerke nicht ermitteln"
 
-#: kpsion.cpp:722 kpsion.cpp:913 kpsion.cpp:935 kpsion.cpp:958 kpsion.cpp:1068
-#: kpsion.cpp:1245 kpsion.cpp:1376 kpsion.cpp:1385
+#: kpsion.cpp:741 kpsion.cpp:1013 kpsion.cpp:1035 kpsion.cpp:1058
+#: kpsion.cpp:1168 kpsion.cpp:1345 kpsion.cpp:1476 kpsion.cpp:1485
+#: kpsion.cpp:1530 kpsion.cpp:1549 kpsion.cpp:1566
 #, c-format
 msgid "Connected to %1"
 msgstr "Verbunden mit %1"
 
-#: kpsion.cpp:739
+#: kpsion.cpp:775
+msgid ""
+"The selected drive Z: is a ROM drive and therefore cannot "
+"be restored."
+msgstr ""
+"Das gewählte Laufwerk Z: ist ein ROM Laufwerk und kann "
+"deshalb nicht rückgesichert werden."
+
+#: kpsion.cpp:822
 msgid ""
 "A backup is running.\n"
 "Do you really want to quit?"
@@ -127,7 +136,7 @@ msgstr ""
 "Eine Sicherung läuft.\n"
 "Wollen Sie wirklich das Programm beenden?"
 
-#: kpsion.cpp:741
+#: kpsion.cpp:824
 msgid ""
 "A restore is running.\n"
 "Do you really want to quit?"
@@ -135,7 +144,7 @@ msgstr ""
 "Eine Rücksicherung läuft.\n"
 "Wollen Sie wirklich das Programm beenden?"
 
-#: kpsion.cpp:743
+#: kpsion.cpp:826
 msgid ""
 "A format is running.\n"
 "Do you really want to quit?"
@@ -143,88 +152,88 @@ msgstr ""
 "Eine Formatierung läuft.\n"
 "Wollen Sie wirklich das Programm beenden?"
 
-#: kpsion.cpp:769
+#: kpsion.cpp:852
 msgid "Connecting ..."
 msgstr "Verbindungsaufbau ..."
 
-#: kpsion.cpp:771
+#: kpsion.cpp:854
 msgid "RFSV could not connect to ncpd at %1:%2. "
 msgstr "RFSV konnte ncpd auf %1:%2 nicht erreichen. "
 
-#: kpsion.cpp:774 kpsion.cpp:791 kpsion.cpp:810 kpsion.cpp:831
+#: kpsion.cpp:857 kpsion.cpp:879 kpsion.cpp:902 kpsion.cpp:927
 msgid " (Retry in %1 seconds.)"
 msgstr " (Wiederholung in %1 Sekunden.)"
 
-#: kpsion.cpp:786
+#: kpsion.cpp:874
 #, c-format
 msgid "RFSV could not establish link: %1."
 msgstr "RFSV konnte keine Verbindung aufbauen: %1."
 
-#: kpsion.cpp:803
+#: kpsion.cpp:895
 msgid "RPCS could not connect to ncpd at %1:%2."
 msgstr "RPCS konnte ncpd auf %1:%2 nicht erreichen."
 
-#: kpsion.cpp:822
+#: kpsion.cpp:918
 #, c-format
 msgid "RPCS could not establish link: %1."
 msgstr "RPCS konnte keine Verbindung aufbauen: %1."
 
-#: kpsion.cpp:917
+#: kpsion.cpp:1017
 #, c-format
 msgid "Could not retrieve drive details for drive %1"
 msgstr "Konnte Details des Laufwerks %1 nicht ermitteln."
 
-#: kpsion.cpp:922
+#: kpsion.cpp:1022
 #, c-format
 msgid "Scanning drive %1"
 msgstr "Durchsuche Laufwerk %1"
 
-#: kpsion.cpp:931
+#: kpsion.cpp:1031
 msgid "%1 files need backup"
 msgstr "%1 Dateien müssen gesichert werden"
 
-#: kpsion.cpp:937
+#: kpsion.cpp:1037
 msgid "No files need backup"
 msgstr "Keine Dateien zu sichern"
 
-#: kpsion.cpp:960
+#: kpsion.cpp:1060
 #, c-format
 msgid "Could not create backup folder %1"
 msgstr "Konnte Sicherungs-Ordner %1 nicht anlegen."
 
-#: kpsion.cpp:984
+#: kpsion.cpp:1084
 msgid "Backup %1% done"
 msgstr "Sicherung %1% beendet"
 
-#: kpsion.cpp:1004
+#: kpsion.cpp:1104
 msgid "Could not open
%1"
 msgstr "Konnte
%1
nicht öffnen"
 
-#: kpsion.cpp:1024
+#: kpsion.cpp:1124
 msgid "Could not read
%1"
 msgstr "Konnte
%1
nicht lesen"
 
-#: kpsion.cpp:1037
+#: kpsion.cpp:1137
 msgid "Resetting archive attributes"
 msgstr "Setze Archiv-Attribute zurück"
 
-#: kpsion.cpp:1050
+#: kpsion.cpp:1150
 msgid "Could not set attributes of
%1"
 msgstr "Konnte Attribute der Datei
%1
nicht setzen"
 
-#: kpsion.cpp:1072
+#: kpsion.cpp:1172
 msgid "Backup done"
 msgstr "Sicherung beendet"
 
-#: kpsion.cpp:1076
+#: kpsion.cpp:1176
 msgid "Restore"
 msgstr "Rücksicherung"
 
-#: kpsion.cpp:1080
+#: kpsion.cpp:1180
 msgid "Start"
 msgstr "Start"
 
-#: kpsion.cpp:1083
+#: kpsion.cpp:1183
 msgid ""
 "Select items in the list of available backups, then click here to start "
 "restore of these items."
@@ -232,21 +241,21 @@ msgstr ""
 "Wählen Sie in der Liste der verfügbaren Sicherungen Dateien aus und "
 "klicken Sie dann hier um die gewählten Dateien zu restaurieren."
 
-#: kpsion.cpp:1130 kpsion.cpp:1343
+#: kpsion.cpp:1230 kpsion.cpp:1443
 msgid "Could not get attributes of
%1
Reason: %2"
 msgstr ""
 "Konnte Attribute der Datei
%1 nicht abfragen
Grund: "
 "%2"
 
-#: kpsion.cpp:1159
+#: kpsion.cpp:1259
 msgid "Overwrite"
 msgstr "Überschreiben"
 
-#: kpsion.cpp:1162
+#: kpsion.cpp:1262
 msgid "Overwrite &All"
 msgstr "Überschreibe &Alles"
 
-#: kpsion.cpp:1175
+#: kpsion.cpp:1275
 msgid ""
 "The file %1 exists already on the Psion with different size "
 "and/or attributes.On the Psion:
  Size: %2
  Date: %3
 "
@@ -254,50 +263,50 @@ msgid ""
 "Attributes: %7
Do you want to overwrite it?"
 msgstr ""
 "Die Datei %1 existiert bereits auf dem Psion mit abweichender "
-"Größe und/oder Attributen.Auf dem Psion:
  Größe: "
-"%2
  Datum: %3
  Attribute: "
-"%4
Sicherungsdatei:
  Größe:  %5
  Datum: "
-"%6
  Attribute: %7
Wollen Sie die Datei überschreiben?"
+"Größe und/oder Attributen.Auf dem Psion:
  Größe: %2
  "
+"Datum: %3
  Attribute: %4
Sicherungsdatei:
  Größe:  "
+"%5
  Datum: %6
  Attribute: %7
Wollen Sie die Datei "
+"überschreiben?"
 
-#: kpsion.cpp:1213
+#: kpsion.cpp:1313
 msgid "Reading backups ..."
 msgstr "Lese Sicherungsdaten ..."
 
-#: kpsion.cpp:1218
+#: kpsion.cpp:1318
 msgid "Selecting backups ..."
 msgstr "Wähle Sicherungsdaten ..."
 
-#: kpsion.cpp:1250
+#: kpsion.cpp:1350
 msgid "Restore %1% done"
 msgstr "Rücksicherung %1% abgeschlossen"
 
-#: kpsion.cpp:1298
+#: kpsion.cpp:1398
 msgid "Could not create directory
%1
Reason: %2"
 msgstr "Konnte den Ordner
%1 nicht anlegen.
Grund: %2"
 
-#: kpsion.cpp:1313
+#: kpsion.cpp:1413
 msgid "Could not create
%1
Reason: %2"
 msgstr "Konnte
%1 nicht anlegen
Grund: %2"
 
-#: kpsion.cpp:1335
+#: kpsion.cpp:1435
 msgid "Could not write to
%1
Reason: %2"
 msgstr "Konnte nicht auf 
%1 schreiben
Grund: %2"
 
-#: kpsion.cpp:1353
+#: kpsion.cpp:1453
 msgid "Could not set attributes of
%1
Reason: %2"
 msgstr "Konnte Attribute der Datei
%1nicht setzen.
Grund: %2"
 
-#: kpsion.cpp:1360
+#: kpsion.cpp:1460
 msgid "Could not set modification time of
%1
Reason: %2"
 msgstr ""
 "Konnte Änderungsdatum der Datei
%1 nicht setzen
Grund: "
 "%2"
 
-#: kpsion.cpp:1387
+#: kpsion.cpp:1487
 msgid "Restore done"
 msgstr "Rücksicherung abgeschlossen"
 
-#: kpsion.cpp:1393
+#: kpsion.cpp:1493
 msgid ""
 "This erases ALL data on the drive(s).
Do you really want to "
 "proceed?"
@@ -305,12 +314,50 @@ msgstr ""
 "Hierdurch werden ALLE Daten auf dem(den) Laufwerk(en) "
 "gelöscht.
Wollen Sie wirklich fortfahren?"
 
-#: kpsion.cpp:1510
+#: kpsion.cpp:1515
+msgid "Formatting drive %1:"
+msgstr "Formatiere Laufwerk %1:"
+
+#: kpsion.cpp:1526
+msgid "Could not format drive %1:
%2"
+msgstr "Konnte Laufwerk %1 nicht formatieren:
%2"
+
+#: kpsion.cpp:1544
+msgid "Error during format of drive %1:
%2"
+msgstr "Fehler beim Formatieren von Laufwerk %1:
%2"
+
+#: kpsion.cpp:1568
+msgid "Format done"
+msgstr "Formatierung beendet"
+
+#: kpsion.cpp:1573
+msgid "Assign drive name"
+msgstr "Weise Laufwerksnamen zu"
+
+#: kpsion.cpp:1582
+msgid ""
+"Formatting of drive %1: finished. Please assign a name for that "
+"drive."
+msgstr ""
+"Die Formatierung des Laufwerks %1 ist beendet. Bitte weisen Sie dem "
+"Laufwerk nun einen Namen zu."
+
+#: kpsion.cpp:1586
+msgid "New name of drive %1:"
+msgstr "Neuer Name für Laufwerk %1:"
+
+#: kpsion.cpp:1730
 #, c-format
 msgid "Stopping %1"
 msgstr "Stoppe %1"
 
-#: kpsion.cpp:1532
+#: kpsion.cpp:1748
+msgid ""
+"Could not stop all processes.
Please stop running programs manually "
+"on the Psion, then klick Ok."
+msgstr ""
+
+#: kpsion.cpp:1771
 #, c-format
 msgid "Starting %1"
 msgstr "Starte %1"
@@ -347,22 +394,26 @@ msgstr "Führe Rücksicherung durch"
 msgid "format drive"
 msgstr "Formatiere Laufwerk"
 
-#: main.cpp:55
-msgid "The drive letter to backup/restore or format."
-msgstr "Der Buchstabe des zu bearbeitenden Laufwerks."
-
-#: main.cpp:60
+#: main.cpp:59
 msgid "KPsion"
 msgstr "KPsion"
 
-#: main.cpp:61
+#: main.cpp:60
 msgid "Psion connectivity utility"
 msgstr "Werkzeug für Psion PDA"
 
-#: main.cpp:66
+#: main.cpp:65
 msgid "Original Developer/Maintainer"
 msgstr "Original Entwickler/Betreuer"
 
+#: main.cpp:100
+msgid ""
+"The options are mutually exclusive. I.e. You cannot specify more than one "
+"action at once."
+msgstr ""
+"Die Optionen schließen sich gegenseitig aus. D.h. sie können nicht mehrere "
+"unterschiedliche Aktionen gleichzeitig angeben."
+
 #: setupdialog.cpp:20
 msgid "&General"
 msgstr "&Allgemein"
@@ -371,11 +422,11 @@ msgstr "&Allgemein"
 msgid "Backup &directory"
 msgstr "&Ordner für Sicherungen"
 
-#: setupdialog.cpp:30 wizards.cpp:109
+#: setupdialog.cpp:30 wizards.cpp:104
 msgid "Browse"
 msgstr "Durchsuchen"
 
-#: setupdialog.cpp:33 wizards.cpp:182
+#: setupdialog.cpp:33 wizards.cpp:177
 msgid "Backup &generations"
 msgstr "Sicherungs-&Generationen"
 
@@ -401,19 +452,19 @@ msgstr "%1 %2 von %3"
 msgid "KPsionStatusBarProgress"
 msgstr "KPsionStatusBarProgress"
 
-#: wizards.cpp:48
+#: wizards.cpp:49
 msgid "KPsion Setup"
 msgstr "KPsion Einstellungen"
 
-#: wizards.cpp:50 wizards.cpp:433
+#: wizards.cpp:51 wizards.cpp:428
 msgid "Click this button to continue with the next page."
 msgstr "Betätigen Sie diese Schaltfläche um mit der nächsten Seite fortzufahren."
 
-#: wizards.cpp:52 wizards.cpp:435
+#: wizards.cpp:53 wizards.cpp:430
 msgid "Click this button, to go to a previous page."
 msgstr "Betätigen Sie diese Schaltfläche, um zur vorigen Seite zu kommen."
 
-#: wizards.cpp:54
+#: wizards.cpp:55
 msgid ""
 "If you click this button, the setup of KPSion will be aborted and "
 "next time you start KPsion, it will run this setup again."
@@ -422,7 +473,7 @@ msgstr ""
 "KPsion abgebrochen. Beim nächsten Start von KPsion wird dann "
 "die Konfiguration erneut gestartet."
 
-#: wizards.cpp:71
+#: wizards.cpp:66
 msgid ""
 "Welcome to KPsion!
It looks like you started KPsion the "
 "first time. At least, i could not find any valid configuration.On the "
@@ -435,11 +486,11 @@ msgstr ""
 "sammeln, die für die Arbeit mit KPsion nötig sind. Viel "
 "Spaß."
 
-#: wizards.cpp:88
+#: wizards.cpp:83
 msgid "Welcome"
 msgstr "Willkommen"
 
-#: wizards.cpp:96
+#: wizards.cpp:91
 msgid ""
 "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 "
@@ -453,11 +504,11 @@ msgstr ""
 "adäquate Stelle oder akzeptieren Sie einfach die unten angezeigte "
 "Vorgabe."
 
-#: wizards.cpp:112
+#: wizards.cpp:107
 msgid "This is the name of the backup folder."
 msgstr "Dies ist der Name des Sicherungs-Ordners."
 
-#: wizards.cpp:114
+#: wizards.cpp:109
 msgid ""
 "Click here, for opening a dialog which lets you easily select the backup "
 "folder."
@@ -465,11 +516,11 @@ msgstr ""
 "Aktivieren Sie diese Schaltfläche, um einen Dialog zu öffnen welcher es "
 "Ihnen auf einfache Weise erlaubt, den Sicherungs-Ordner zu wählen."
 
-#: wizards.cpp:129
+#: wizards.cpp:124
 msgid "Step 1 - Specify backup directory"
 msgstr "Schritt 1 - Angabe des Sicherungs-Ordners"
 
-#: wizards.cpp:136
+#: wizards.cpp:131
 msgid ""
 "Next, please specify some information regarding backup "
 "policy:- How many generations of backups do you want to "
@@ -481,63 +532,63 @@ msgstr ""
 "aufheben?
- Soll ich Sie an Sicherungen erinnern?
- Wenn ja, in "
 "welchen Intervallen?
"
 
-#: wizards.cpp:146
+#: wizards.cpp:141
 msgid "&Incremental backup reminder"
 msgstr "Erinnerung an &inkrementelle Sicherung"
 
-#: wizards.cpp:149 wizards.cpp:167
+#: wizards.cpp:144 wizards.cpp:162
 msgid "none"
 msgstr "keine"
 
-#: wizards.cpp:150 wizards.cpp:168
+#: wizards.cpp:145 wizards.cpp:163
 msgid "daily"
 msgstr "täglich"
 
-#: wizards.cpp:151 wizards.cpp:169
+#: wizards.cpp:146 wizards.cpp:164
 msgid "every 2 days"
 msgstr "alle 2 Tage"
 
-#: wizards.cpp:152 wizards.cpp:170
+#: wizards.cpp:147 wizards.cpp:165
 msgid "every 3 days"
 msgstr "alle 3 Tage"
 
-#: wizards.cpp:153 wizards.cpp:171
+#: wizards.cpp:148 wizards.cpp:166
 msgid "every 4 days"
 msgstr "alle 4 Tage"
 
-#: wizards.cpp:154 wizards.cpp:172
+#: wizards.cpp:149 wizards.cpp:167
 msgid "every 5 days"
 msgstr "alle 5 Tage"
 
-#: wizards.cpp:155 wizards.cpp:173
+#: wizards.cpp:150 wizards.cpp:168
 msgid "every 6 days"
 msgstr "alle 6 Tage"
 
-#: wizards.cpp:156 wizards.cpp:174
+#: wizards.cpp:151 wizards.cpp:169
 msgid "weekly"
 msgstr "wöchentlich"
 
-#: wizards.cpp:157 wizards.cpp:175
+#: wizards.cpp:152 wizards.cpp:170
 msgid "every 2 weeks"
 msgstr "alle 2 Wochen"
 
-#: wizards.cpp:158 wizards.cpp:176
+#: wizards.cpp:153 wizards.cpp:171
 msgid "every 3 weeks"
 msgstr "alle 3 Wochen"
 
-#: wizards.cpp:159 wizards.cpp:177
+#: wizards.cpp:154 wizards.cpp:172
 msgid "monthly"
 msgstr "monatlich"
 
-#: wizards.cpp:164
+#: wizards.cpp:159
 msgid "&Full backup reminder"
 msgstr "Erinnerung an &Komplett-Sicherung"
 
-#: wizards.cpp:200
+#: wizards.cpp:195
 msgid "Step 2 - Backup policy"
 msgstr "Schritt 2 - Sicherungs-Strategie"
 
-#: wizards.cpp:208
+#: wizards.cpp:203
 msgid ""
 "If no connection could be established on startup, KPsion will "
 "attempt to connect in regular intervals. Please specify the interval after "
@@ -558,55 +609,55 @@ msgstr ""
 "Schnittstellengeschwindigkeit angebendie Rechte zum Öffnen des "
 "angegebenen Ports besitzen"
 
-#: wizards.cpp:223
+#: wizards.cpp:218
 msgid "&Connection retry interval (sec.)"
 msgstr "&Verbindungsaufbau-Intervall (in sek.)"
 
-#: wizards.cpp:229
+#: wizards.cpp:224
 msgid "Serial &device"
 msgstr "&Serielle Schnittstelle"
 
-#: wizards.cpp:233
+#: wizards.cpp:228
 msgid "/dev/ttyS0"
 msgstr "/dev/ttyS0"
 
-#: wizards.cpp:234
+#: wizards.cpp:229
 msgid "/dev/ttyS1"
 msgstr "/dev/ttyS1"
 
-#: wizards.cpp:235
+#: wizards.cpp:230
 msgid "/dev/ttyS2"
 msgstr "/dev/ttyS2"
 
-#: wizards.cpp:236
+#: wizards.cpp:231
 msgid "/dev/ttyS3"
 msgstr "/dev/ttyS3"
 
-#: wizards.cpp:237
+#: wizards.cpp:232
 msgid "/dev/ircomm0"
 msgstr "/dev/ircomm0"
 
-#: wizards.cpp:238
+#: wizards.cpp:233
 msgid "/dev/ircomm1"
 msgstr "/dev/ircomm1"
 
-#: wizards.cpp:239
+#: wizards.cpp:234
 msgid "/dev/ircomm2"
 msgstr "/dev/ircomm2"
 
-#: wizards.cpp:240
+#: wizards.cpp:235
 msgid "/dev/ircomm3"
 msgstr "/dev/ircomm3"
 
-#: wizards.cpp:245
+#: wizards.cpp:240
 msgid "Serial &speed"
 msgstr "Schnittstellen-&Geschwindigkeit"
 
-#: wizards.cpp:269
+#: wizards.cpp:264
 msgid "Step 3 - Connection parameters"
 msgstr "Schritt 3 - Verbindungs-Parameter"
 
-#: wizards.cpp:277
+#: wizards.cpp:272
 msgid ""
 "That's it!
Next, i will start KPsion and if your Psion is "
 "already connected and it's communication turned on (use Ctrl-T at "
@@ -622,15 +673,15 @@ msgstr ""
 "durchzuführen.
Bitte betätigen Sie nun die Schaltfläche "
 "Abschließen."
 
-#: wizards.cpp:296
+#: wizards.cpp:291
 msgid "Finished"
 msgstr "Fertig"
 
-#: wizards.cpp:304
+#: wizards.cpp:299
 msgid "Backup folder"
 msgstr "Sicherungs-Ordner"
 
-#: wizards.cpp:314
+#: wizards.cpp:309
 msgid ""
 "You are about to abort the initial setup of KPsion. No "
 "configuration will be stored and you will have to repeat this procedure when "
@@ -641,17 +692,17 @@ msgstr ""
 "Vorgang wiederholen müssen, wenn Sie KPsion das nächste Mal "
 "starten.
Wollen Sie das Programm wirklich verlassen?"
 
-#: wizards.cpp:369
+#: wizards.cpp:364
 msgid "The folder %1 does not exist.
Shall it be created?"
 msgstr ""
 "Der Ordner %1 existiert nicht.
Soll er angelegt "
 "werden?"
 
-#: wizards.cpp:374
+#: wizards.cpp:369
 msgid "The specified folder
%1
could not be created"
 msgstr "Der angegebene Ordner
%1
konnte nicht angelegt werden"
 
-#: wizards.cpp:379
+#: wizards.cpp:374
 msgid ""
 ", because you either don't have sufficient rights to do that, or the "
 "filesystem is readonly."
@@ -659,15 +710,15 @@ msgstr ""
 ", weil Sie entweder nicht die nötigen Rechte besitzen, oder das Dateisystem "
 "nur lesbar ist."
 
-#: wizards.cpp:383
+#: wizards.cpp:378
 msgid ", because the filesystem has not enough space."
 msgstr ", weil auf dem Dateisystem kein Platz mehr ist."
 
-#: wizards.cpp:389
+#: wizards.cpp:384
 msgid ", because there already exists another object with the same name."
 msgstr ", weil schon ein anderes Objekt mit dem selben Namen existiert."
 
-#: wizards.cpp:399
+#: wizards.cpp:394
 msgid ""
 ", because you specified a path which probably contains a dangling symbolic "
 "link."
@@ -675,7 +726,7 @@ msgstr ""
 ", weil Sie eine Pfad angegeben haben, der eine nicht aufgelöste symbolische "
 "Verknüpfung enthält."
 
-#: wizards.cpp:402
+#: wizards.cpp:397
 msgid ""
 ", because you specified a path which contains an element which is not a "
 "folder."
@@ -683,21 +734,21 @@ msgstr ""
 ", weil Sie eine Pfad angegeben haben, der ein Element enthält, welches kein "
 "Ordner ist."
 
-#: wizards.cpp:406
+#: wizards.cpp:401
 msgid ", because you specified a path which contains too many symbolic links."
 msgstr ""
 ", weil Sie eine Pfad angegeben haben, der zu viele symbolische "
 "Verknüpfungen enthält."
 
-#: wizards.cpp:413
+#: wizards.cpp:408
 msgid "
Please select another folder."
 msgstr "
Bitte wählen Sie einen anderen Ordner."
 
-#: wizards.cpp:429
+#: wizards.cpp:424
 msgid "New Psion detected"
 msgstr "Neuer Psion erkannt"
 
-#: wizards.cpp:437
+#: wizards.cpp:432
 msgid ""
 "If you click this button, the setup for the new connected Psion will be "
 "aborted and next time you connect this Psion again, KPsion will run "
@@ -707,7 +758,7 @@ msgstr ""
 "den neuen Psion nicht gespeichert. Beim nächsten Verbindungsaufbau mit "
 "diesem Psion wird KPsion dann erneut diesen Dialog präsentieren."
 
-#: wizards.cpp:446
+#: wizards.cpp:441
 msgid ""
 "The Psion with the unique ID %1 is connected the first time. "
 "Please assign a name to it."
@@ -715,19 +766,19 @@ msgstr ""
 "Zum Psion mit der ID %1 wurde erstmalig Verbindung aufgenommen. "
 "Bitte weisen Sie diesem Gerät einen Namen zu."
 
-#: wizards.cpp:453
+#: wizards.cpp:448
 msgid "&Name of new Psion"
 msgstr "&Name des neuen Psion"
 
-#: wizards.cpp:455
+#: wizards.cpp:450
 msgid "My new Psion"
 msgstr "Mein neuer Psion"
 
-#: wizards.cpp:472
+#: wizards.cpp:467
 msgid "New Psion detected"
 msgstr "Neuer Psion erkannt"
 
-#: wizards.cpp:480
+#: wizards.cpp:475
 msgid ""
 "Please select the Drive(s), you want to be backed up when running in "
 "unattended backup mode."
@@ -735,19 +786,19 @@ msgstr ""
 "Bitte wählen sie die Laufwerke aus, die bei einer automatischen "
 "Sicherung gesichertwerden sollen."
 
-#: wizards.cpp:488
+#: wizards.cpp:483
 msgid "Available drives"
 msgstr "Verfügbare Laufwerke"
 
-#: wizards.cpp:512
+#: wizards.cpp:507
 msgid "Specify drives to backup"
 msgstr "Wahl der zu sichernden Laufwerke"
 
-#: wizards.cpp:536
+#: wizards.cpp:531
 msgid "The name cannot be empty."
 msgstr "Der Name darf nicht leer sein."
 
-#: wizards.cpp:543
+#: wizards.cpp:538
 msgid ""
 "The name %1 is already assigned to another machine.
Please "
 "choose a different name."
diff --git a/kde2/po/kpsion.pot b/kde2/po/kpsion.pot
index 7c0bd61..61591be 100644
--- a/kde2/po/kpsion.pot
+++ b/kde2/po/kpsion.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-03-05 09:37+0100\n"
+"POT-Creation-Date: 2001-03-06 17:49+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME \n"
 "Language-Team: LANGUAGE \n"
@@ -40,11 +40,11 @@ msgstr ""
 msgid "Idle"
 msgstr ""
 
-#: kpsion.cpp:499 wizards.cpp:232
+#: kpsion.cpp:501 wizards.cpp:227
 msgid "off"
 msgstr ""
 
-#: kpsion.cpp:503
+#: kpsion.cpp:505
 msgid ""
 "Here, you see your Psion's drives.
Every drive is represented by an "
 "Icon. If you click on it, it gets selected for the next operation. E.g.: "
@@ -52,182 +52,189 @@ msgid ""
 "again.
Select as many drives a you want, then choose an operation."
 msgstr ""
 
-#: kpsion.cpp:566
+#: kpsion.cpp:573
 msgid "Start &Format"
 msgstr ""
 
-#: kpsion.cpp:568
+#: kpsion.cpp:575
 msgid "Start Full &Backup"
 msgstr ""
 
-#: kpsion.cpp:571
+#: kpsion.cpp:578
 msgid "Start &Incremental Backup"
 msgstr ""
 
-#: kpsion.cpp:573
+#: kpsion.cpp:580
 msgid "Start &Restore"
 msgstr ""
 
-#: kpsion.cpp:587
+#: kpsion.cpp:594
 msgid "Full backup of selected drive(s)"
 msgstr ""
 
-#: kpsion.cpp:589
+#: kpsion.cpp:596
 msgid "Incremental backup of selected drive(s)"
 msgstr ""
 
-#: kpsion.cpp:591
+#: kpsion.cpp:598
 msgid "Restore selected drive(s)"
 msgstr ""
 
-#: kpsion.cpp:593
+#: kpsion.cpp:600
 msgid "Format selected drive(s)"
 msgstr ""
 
-#: kpsion.cpp:664
+#: kpsion.cpp:671
 msgid "Retrieving machine info ..."
 msgstr ""
 
-#: kpsion.cpp:675
+#: kpsion.cpp:682
 msgid "Could not get Psion machine info"
 msgstr ""
 
-#: kpsion.cpp:688
+#: kpsion.cpp:695
 msgid "an unknown machine"
 msgstr ""
 
-#: kpsion.cpp:701
+#: kpsion.cpp:708
 msgid "Retrieving drive list ..."
 msgstr ""
 
-#: kpsion.cpp:704
+#: kpsion.cpp:711
 msgid "Could not get list of drives"
 msgstr ""
 
-#: kpsion.cpp:722 kpsion.cpp:913 kpsion.cpp:935 kpsion.cpp:958 kpsion.cpp:1068
-#: kpsion.cpp:1245 kpsion.cpp:1376 kpsion.cpp:1385
+#: kpsion.cpp:741 kpsion.cpp:1013 kpsion.cpp:1035 kpsion.cpp:1058
+#: kpsion.cpp:1168 kpsion.cpp:1345 kpsion.cpp:1476 kpsion.cpp:1485
+#: kpsion.cpp:1530 kpsion.cpp:1549 kpsion.cpp:1566
 #, c-format
 msgid "Connected to %1"
 msgstr ""
 
-#: kpsion.cpp:739
+#: kpsion.cpp:775
+msgid ""
+"The selected drive Z: is a ROM drive and therefore cannot "
+"be restored."
+msgstr ""
+
+#: kpsion.cpp:822
 msgid ""
 "A backup is running.\n"
 "Do you really want to quit?"
 msgstr ""
 
-#: kpsion.cpp:741
+#: kpsion.cpp:824
 msgid ""
 "A restore is running.\n"
 "Do you really want to quit?"
 msgstr ""
 
-#: kpsion.cpp:743
+#: kpsion.cpp:826
 msgid ""
 "A format is running.\n"
 "Do you really want to quit?"
 msgstr ""
 
-#: kpsion.cpp:769
+#: kpsion.cpp:852
 msgid "Connecting ..."
 msgstr ""
 
-#: kpsion.cpp:771
+#: kpsion.cpp:854
 msgid "RFSV could not connect to ncpd at %1:%2. "
 msgstr ""
 
-#: kpsion.cpp:774 kpsion.cpp:791 kpsion.cpp:810 kpsion.cpp:831
+#: kpsion.cpp:857 kpsion.cpp:879 kpsion.cpp:902 kpsion.cpp:927
 msgid " (Retry in %1 seconds.)"
 msgstr ""
 
-#: kpsion.cpp:786
+#: kpsion.cpp:874
 #, c-format
 msgid "RFSV could not establish link: %1."
 msgstr ""
 
-#: kpsion.cpp:803
+#: kpsion.cpp:895
 msgid "RPCS could not connect to ncpd at %1:%2."
 msgstr ""
 
-#: kpsion.cpp:822
+#: kpsion.cpp:918
 #, c-format
 msgid "RPCS could not establish link: %1."
 msgstr ""
 
-#: kpsion.cpp:917
+#: kpsion.cpp:1017
 #, c-format
 msgid "Could not retrieve drive details for drive %1"
 msgstr ""
 
-#: kpsion.cpp:922
+#: kpsion.cpp:1022
 #, c-format
 msgid "Scanning drive %1"
 msgstr ""
 
-#: kpsion.cpp:931
+#: kpsion.cpp:1031
 msgid "%1 files need backup"
 msgstr ""
 
-#: kpsion.cpp:937
+#: kpsion.cpp:1037
 msgid "No files need backup"
 msgstr ""
 
-#: kpsion.cpp:960
+#: kpsion.cpp:1060
 #, c-format
 msgid "Could not create backup folder %1"
 msgstr ""
 
-#: kpsion.cpp:984
+#: kpsion.cpp:1084
 msgid "Backup %1% done"
 msgstr ""
 
-#: kpsion.cpp:1004
+#: kpsion.cpp:1104
 msgid "Could not open
%1"
 msgstr ""
 
-#: kpsion.cpp:1024
+#: kpsion.cpp:1124
 msgid "Could not read
%1"
 msgstr ""
 
-#: kpsion.cpp:1037
+#: kpsion.cpp:1137
 msgid "Resetting archive attributes"
 msgstr ""
 
-#: kpsion.cpp:1050
+#: kpsion.cpp:1150
 msgid "Could not set attributes of
%1"
 msgstr ""
 
-#: kpsion.cpp:1072
+#: kpsion.cpp:1172
 msgid "Backup done"
 msgstr ""
 
-#: kpsion.cpp:1076
+#: kpsion.cpp:1176
 msgid "Restore"
 msgstr ""
 
-#: kpsion.cpp:1080
+#: kpsion.cpp:1180
 msgid "Start"
 msgstr ""
 
-#: kpsion.cpp:1083
+#: kpsion.cpp:1183
 msgid ""
 "Select items in the list of available backups, then click here to start "
 "restore of these items."
 msgstr ""
 
-#: kpsion.cpp:1130 kpsion.cpp:1343
+#: kpsion.cpp:1230 kpsion.cpp:1443
 msgid "Could not get attributes of
%1
Reason: %2"
 msgstr ""
 
-#: kpsion.cpp:1159
+#: kpsion.cpp:1259
 msgid "Overwrite"
 msgstr ""
 
-#: kpsion.cpp:1162
+#: kpsion.cpp:1262
 msgid "Overwrite &All"
 msgstr ""
 
-#: kpsion.cpp:1175
+#: kpsion.cpp:1275
 msgid ""
 "The file %1 exists already on the Psion with different size "
 "and/or attributes.On the Psion:
  Size: %2
  Date: %3
 "
@@ -235,55 +242,91 @@ msgid ""
 "Attributes: %7
Do you want to overwrite it?"
 msgstr ""
 
-#: kpsion.cpp:1213
+#: kpsion.cpp:1313
 msgid "Reading backups ..."
 msgstr ""
 
-#: kpsion.cpp:1218
+#: kpsion.cpp:1318
 msgid "Selecting backups ..."
 msgstr ""
 
-#: kpsion.cpp:1250
+#: kpsion.cpp:1350
 msgid "Restore %1% done"
 msgstr ""
 
-#: kpsion.cpp:1298
+#: kpsion.cpp:1398
 msgid "Could not create directory
%1
Reason: %2"
 msgstr ""
 
-#: kpsion.cpp:1313
+#: kpsion.cpp:1413
 msgid "Could not create
%1
Reason: %2"
 msgstr ""
 
-#: kpsion.cpp:1335
+#: kpsion.cpp:1435
 msgid "Could not write to
%1
Reason: %2"
 msgstr ""
 
-#: kpsion.cpp:1353
+#: kpsion.cpp:1453
 msgid "Could not set attributes of
%1
Reason: %2"
 msgstr ""
 
-#: kpsion.cpp:1360
+#: kpsion.cpp:1460
 msgid ""
 "Could not set modification time of
%1
Reason: %2"
 msgstr ""
 
-#: kpsion.cpp:1387
+#: kpsion.cpp:1487
 msgid "Restore done"
 msgstr ""
 
-#: kpsion.cpp:1393
+#: kpsion.cpp:1493
 msgid ""
 "This erases ALL data on the drive(s).
Do you really want to "
 "proceed?"
 msgstr ""
 
-#: kpsion.cpp:1510
+#: kpsion.cpp:1515
+msgid "Formatting drive %1:"
+msgstr ""
+
+#: kpsion.cpp:1526
+msgid "Could not format drive %1:
%2"
+msgstr ""
+
+#: kpsion.cpp:1544
+msgid "Error during format of drive %1:
%2"
+msgstr ""
+
+#: kpsion.cpp:1568
+msgid "Format done"
+msgstr ""
+
+#: kpsion.cpp:1573
+msgid "Assign drive name"
+msgstr ""
+
+#: kpsion.cpp:1582
+msgid ""
+"Formatting of drive %1: finished. Please assign a name for that "
+"drive."
+msgstr ""
+
+#: kpsion.cpp:1586
+msgid "New name of drive %1:"
+msgstr ""
+
+#: kpsion.cpp:1730
 #, c-format
 msgid "Stopping %1"
 msgstr ""
 
-#: kpsion.cpp:1532
+#: kpsion.cpp:1748
+msgid ""
+"Could not stop all processes.
Please stop running programs manually "
+"on the Psion, then klick Ok."
+msgstr ""
+
+#: kpsion.cpp:1771
 #, c-format
 msgid "Starting %1"
 msgstr ""
@@ -320,22 +363,24 @@ msgstr ""
 msgid "format drive"
 msgstr ""
 
-#: main.cpp:55
-msgid "The drive letter to backup/restore or format."
-msgstr ""
-
-#: main.cpp:60
+#: main.cpp:59
 msgid "KPsion"
 msgstr ""
 
-#: main.cpp:61
+#: main.cpp:60
 msgid "Psion connectivity utility"
 msgstr ""
 
-#: main.cpp:66
+#: main.cpp:65
 msgid "Original Developer/Maintainer"
 msgstr ""
 
+#: main.cpp:100
+msgid ""
+"The options are mutually exclusive. I.e. You cannot specify more than one "
+"action at once."
+msgstr ""
+
 #: setupdialog.cpp:20
 msgid "&General"
 msgstr ""
@@ -344,11 +389,11 @@ msgstr ""
 msgid "Backup &directory"
 msgstr ""
 
-#: setupdialog.cpp:30 wizards.cpp:109
+#: setupdialog.cpp:30 wizards.cpp:104
 msgid "Browse"
 msgstr ""
 
-#: setupdialog.cpp:33 wizards.cpp:182
+#: setupdialog.cpp:33 wizards.cpp:177
 msgid "Backup &generations"
 msgstr ""
 
@@ -374,25 +419,25 @@ msgstr ""
 msgid "KPsionStatusBarProgress"
 msgstr ""
 
-#: wizards.cpp:48
+#: wizards.cpp:49
 msgid "KPsion Setup"
 msgstr ""
 
-#: wizards.cpp:50 wizards.cpp:433
+#: wizards.cpp:51 wizards.cpp:428
 msgid "Click this button to continue with the next page."
 msgstr ""
 
-#: wizards.cpp:52 wizards.cpp:435
+#: wizards.cpp:53 wizards.cpp:430
 msgid "Click this button, to go to a previous page."
 msgstr ""
 
-#: wizards.cpp:54
+#: wizards.cpp:55
 msgid ""
 "If you click this button, the setup of KPSion will be aborted and "
 "next time you start KPsion, it will run this setup again."
 msgstr ""
 
-#: wizards.cpp:71
+#: wizards.cpp:66
 msgid ""
 "Welcome to KPsion!
It looks like you started KPsion the "
 "first time. At least, i could not find any valid configuration.On the "
@@ -400,11 +445,11 @@ msgid ""
 "working with KPsion. Have fun."
 msgstr ""
 
-#: wizards.cpp:88
+#: wizards.cpp:83
 msgid "Welcome"
 msgstr ""
 
-#: wizards.cpp:96
+#: wizards.cpp:91
 msgid ""
 "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 "
@@ -412,21 +457,21 @@ msgid ""
 "select a suitable location or simply accept the default shown below."
 msgstr ""
 
-#: wizards.cpp:112
+#: wizards.cpp:107
 msgid "This is the name of the backup folder."
 msgstr ""
 
-#: wizards.cpp:114
+#: wizards.cpp:109
 msgid ""
 "Click here, for opening a dialog which lets you easily select the backup "
 "folder."
 msgstr ""
 
-#: wizards.cpp:129
+#: wizards.cpp:124
 msgid "Step 1 - Specify backup directory"
 msgstr ""
 
-#: wizards.cpp:136
+#: wizards.cpp:131
 msgid ""
 "Next, please specify some information regarding backup "
 "policy:- How many generations of backups do you want to "
@@ -434,63 +479,63 @@ msgid ""
 "intervals do you want to happen backups?
"
 msgstr ""
 
-#: wizards.cpp:146
+#: wizards.cpp:141
 msgid "&Incremental backup reminder"
 msgstr ""
 
-#: wizards.cpp:149 wizards.cpp:167
+#: wizards.cpp:144 wizards.cpp:162
 msgid "none"
 msgstr ""
 
-#: wizards.cpp:150 wizards.cpp:168
+#: wizards.cpp:145 wizards.cpp:163
 msgid "daily"
 msgstr ""
 
-#: wizards.cpp:151 wizards.cpp:169
+#: wizards.cpp:146 wizards.cpp:164
 msgid "every 2 days"
 msgstr ""
 
-#: wizards.cpp:152 wizards.cpp:170
+#: wizards.cpp:147 wizards.cpp:165
 msgid "every 3 days"
 msgstr ""
 
-#: wizards.cpp:153 wizards.cpp:171
+#: wizards.cpp:148 wizards.cpp:166
 msgid "every 4 days"
 msgstr ""
 
-#: wizards.cpp:154 wizards.cpp:172
+#: wizards.cpp:149 wizards.cpp:167
 msgid "every 5 days"
 msgstr ""
 
-#: wizards.cpp:155 wizards.cpp:173
+#: wizards.cpp:150 wizards.cpp:168
 msgid "every 6 days"
 msgstr ""
 
-#: wizards.cpp:156 wizards.cpp:174
+#: wizards.cpp:151 wizards.cpp:169
 msgid "weekly"
 msgstr ""
 
-#: wizards.cpp:157 wizards.cpp:175
+#: wizards.cpp:152 wizards.cpp:170
 msgid "every 2 weeks"
 msgstr ""
 
-#: wizards.cpp:158 wizards.cpp:176
+#: wizards.cpp:153 wizards.cpp:171
 msgid "every 3 weeks"
 msgstr ""
 
-#: wizards.cpp:159 wizards.cpp:177
+#: wizards.cpp:154 wizards.cpp:172
 msgid "monthly"
 msgstr ""
 
-#: wizards.cpp:164
+#: wizards.cpp:159
 msgid "&Full backup reminder"
 msgstr ""
 
-#: wizards.cpp:200
+#: wizards.cpp:195
 msgid "Step 2 - Backup policy"
 msgstr ""
 
-#: wizards.cpp:208
+#: wizards.cpp:203
 msgid ""
 "If no connection could be established on startup, KPsion will "
 "attempt to connect in regular intervals. Please specify the interval after "
@@ -501,55 +546,55 @@ msgid ""
 "ratehave permission to use the specified port"
 msgstr ""
 
-#: wizards.cpp:223
+#: wizards.cpp:218
 msgid "&Connection retry interval (sec.)"
 msgstr ""
 
-#: wizards.cpp:229
+#: wizards.cpp:224
 msgid "Serial &device"
 msgstr ""
 
-#: wizards.cpp:233
+#: wizards.cpp:228
 msgid "/dev/ttyS0"
 msgstr ""
 
-#: wizards.cpp:234
+#: wizards.cpp:229
 msgid "/dev/ttyS1"
 msgstr ""
 
-#: wizards.cpp:235
+#: wizards.cpp:230
 msgid "/dev/ttyS2"
 msgstr ""
 
-#: wizards.cpp:236
+#: wizards.cpp:231
 msgid "/dev/ttyS3"
 msgstr ""
 
-#: wizards.cpp:237
+#: wizards.cpp:232
 msgid "/dev/ircomm0"
 msgstr ""
 
-#: wizards.cpp:238
+#: wizards.cpp:233
 msgid "/dev/ircomm1"
 msgstr ""
 
-#: wizards.cpp:239
+#: wizards.cpp:234
 msgid "/dev/ircomm2"
 msgstr ""
 
-#: wizards.cpp:240
+#: wizards.cpp:235
 msgid "/dev/ircomm3"
 msgstr ""
 
-#: wizards.cpp:245
+#: wizards.cpp:240
 msgid "Serial &speed"
 msgstr ""
 
-#: wizards.cpp:269
+#: wizards.cpp:264
 msgid "Step 3 - Connection parameters"
 msgstr ""
 
-#: wizards.cpp:277
+#: wizards.cpp:272
 msgid ""
 "That's it!
Next, i will start KPsion and if your Psion is "
 "already connected and it's communication turned on (use Ctrl-T at "
@@ -558,112 +603,112 @@ msgid ""
 "Backup.
Please click Finish now."
 msgstr ""
 
-#: wizards.cpp:296
+#: wizards.cpp:291
 msgid "Finished"
 msgstr ""
 
-#: wizards.cpp:304
+#: wizards.cpp:299
 msgid "Backup folder"
 msgstr ""
 
-#: wizards.cpp:314
+#: wizards.cpp:309
 msgid ""
 "You are about to abort the initial setup of KPsion. No "
 "configuration will be stored and you will have to repeat this procedure when "
 "you start KPsion next time.
Do you really want to exit now?"
 msgstr ""
 
-#: wizards.cpp:369
+#: wizards.cpp:364
 msgid ""
 "The folder %1 does not exist.
Shall it be created?"
 msgstr ""
 
-#: wizards.cpp:374
+#: wizards.cpp:369
 msgid "The specified folder
%1
could not be created"
 msgstr ""
 
-#: wizards.cpp:379
+#: wizards.cpp:374
 msgid ""
 ", because you either don't have sufficient rights to do that, or the "
 "filesystem is readonly."
 msgstr ""
 
-#: wizards.cpp:383
+#: wizards.cpp:378
 msgid ", because the filesystem has not enough space."
 msgstr ""
 
-#: wizards.cpp:389
+#: wizards.cpp:384
 msgid ", because there already exists another object with the same name."
 msgstr ""
 
-#: wizards.cpp:399
+#: wizards.cpp:394
 msgid ""
 ", because you specified a path which probably contains a dangling symbolic "
 "link."
 msgstr ""
 
-#: wizards.cpp:402
+#: wizards.cpp:397
 msgid ""
 ", because you specified a path which contains an element which is not a "
 "folder."
 msgstr ""
 
-#: wizards.cpp:406
+#: wizards.cpp:401
 msgid ", because you specified a path which contains too many symbolic links."
 msgstr ""
 
-#: wizards.cpp:413
+#: wizards.cpp:408
 msgid "
Please select another folder."
 msgstr ""
 
-#: wizards.cpp:429
+#: wizards.cpp:424
 msgid "New Psion detected"
 msgstr ""
 
-#: wizards.cpp:437
+#: wizards.cpp:432
 msgid ""
 "If you click this button, the setup for the new connected Psion will be "
 "aborted and next time you connect this Psion again, KPsion will run "
 "this setup again."
 msgstr ""
 
-#: wizards.cpp:446
+#: wizards.cpp:441
 msgid ""
 "The Psion with the unique ID %1 is connected the first time. "
 "Please assign a name to it."
 msgstr ""
 
-#: wizards.cpp:453
+#: wizards.cpp:448
 msgid "&Name of new Psion"
 msgstr ""
 
-#: wizards.cpp:455
+#: wizards.cpp:450
 msgid "My new Psion"
 msgstr ""
 
-#: wizards.cpp:472
+#: wizards.cpp:467
 msgid "New Psion detected"
 msgstr ""
 
-#: wizards.cpp:480
+#: wizards.cpp:475
 msgid ""
 "Please select the Drive(s), you want to be backed up when running in "
 "unattended backup mode."
 msgstr ""
 
-#: wizards.cpp:488
+#: wizards.cpp:483
 msgid "Available drives"
 msgstr ""
 
-#: wizards.cpp:512
+#: wizards.cpp:507
 msgid "Specify drives to backup"
 msgstr ""
 
-#: wizards.cpp:536
+#: wizards.cpp:531
 msgid "The name cannot be empty."
 msgstr ""
 
-#: wizards.cpp:543
+#: wizards.cpp:538
 msgid ""
 "The name %1 is already assigned to another machine.
Please "
 "choose a different name."
diff --git a/ncpd/ncp.cc b/ncpd/ncp.cc
index b3cf009..bf99cac 100644
--- a/ncpd/ncp.cc
+++ b/ncpd/ncp.cc
@@ -247,7 +247,7 @@ decodeControlMessage(bufferStore & buff)
 			// sent, which is rather crude, but works for Series 3
 			// and probably 5. If Symbian have changed EPOC Connect
 			// for the Series 5mx/7, this may need to change.
-			// 
+			//
 			if (ver == PV_SERIES_5 || ver == PV_SERIES_3) {
 				bufferStore b;
 				protocolVersion = ver;
diff --git a/ncpd/socketchan.cc b/ncpd/socketchan.cc
index fa1a40f..36dd8b5 100644
--- a/ncpd/socketchan.cc
+++ b/ncpd/socketchan.cc
@@ -35,188 +35,186 @@
 #include "ppsocket.h"
 
 socketChan:: socketChan(ppsocket * _skt, ncp * _ncpController):
-	channel(_ncpController)
+    channel(_ncpController)
 {
-	skt = _skt;
-	connectName = 0;
-	connectTry = 0;
-	connected = false;
+    skt = _skt;
+    connectName = 0;
+    connectTry = 0;
+    connected = false;
 }
 
 socketChan::~socketChan()
 {
-	skt->closeSocket();
-	delete skt;
-	if (connectName)
-		free(connectName);
+    skt->closeSocket();
+    delete skt;
+    if (connectName)
+	free(connectName);
 }
 
 void socketChan::
 ncpDataCallback(bufferStore & a)
 {
-	if (connectName != 0) {
-		skt->sendBufferStore(a);
-	} else
-		cerr << "socketchan: Connect without name!!!\n";
+    if (connectName != 0) {
+	skt->sendBufferStore(a);
+    } else
+	cerr << "socketchan: Connect without name!!!\n";
 }
 
 char *socketChan::
 getNcpConnectName()
 {
-	return connectName;
+    return connectName;
 }
 
 // NCP Command processing
 bool socketChan::
 ncpCommand(bufferStore & a)
 {
-cerr << "socketChan:: received NCP command (" << a << ")" << endl;
-	// str is guaranteed to begin with NCP$, and all NCP commands are
-	// greater than or equal to 8 characters in length.
-	const char *str = a.getString();
-	// unsigned long len = a.getLen();
-	bool ok = false;
-
-	if (!strncmp(str+4, "INFO", 4)) {
-		// Send information discovered during the receipt of the
-		// NCON_MSG_NCP_INFO message.
-		a.init();
-		switch (ncpProtocolVersion()) {
-			case PV_SERIES_3:
-				a.addStringT("Series 3");
-				break;
-			case PV_SERIES_5:
-				a.addStringT("Series 5");
-				break;
-			default:
-				cerr << "ncpd: protocol version not known" << endl;
-				a.addStringT("Unknown!");
-				break;
-		}
-		skt->sendBufferStore(a);
-		ok = true;
-	} else if (!strncmp(str+4, "CONN", 4)) {
-		// Connect to a channel that was placed in 'pending' mode, by
-		// checking the channel table against the ID...
-		// DO ME LATER
-		ok = true;
-	} else if (!strncmp(str+4, "CHAL", 4)) {
-		// Challenge
-		// The idea is that the channel stays in 'secure' mode until a
-		// valid RESP is received
-		// DO ME LATER
-		ok = true;
-	} else if (!strncmp(str+4, "RESP", 4)) {
-		// Reponse - here is the plaintext as sent in the CHAL - the
-		// channel will only open up if this matches what ncpd has for
-		// the encrypted plaintext.
-		// DO ME LATER
-		ok = true;
+    cerr << "socketChan:: received NCP command (" << a << ")" << endl;
+    // str is guaranteed to begin with NCP$, and all NCP commands are
+    // greater than or equal to 8 characters in length.
+    const char *str = a.getString();
+    // unsigned long len = a.getLen();
+    bool ok = false;
+
+    if (!strncmp(str+4, "INFO", 4)) {
+	// Send information discovered during the receipt of the
+	// NCON_MSG_NCP_INFO message.
+	a.init();
+	switch (ncpProtocolVersion()) {
+	    case PV_SERIES_3:
+		a.addStringT("Series 3");
+		break;
+	    case PV_SERIES_5:
+		a.addStringT("Series 5");
+		break;
+	    default:
+		cerr << "ncpd: protocol version not known" << endl;
+		a.addStringT("Unknown!");
+		break;
 	}
-	return ok;
+	skt->sendBufferStore(a);
+	ok = true;
+    } else if (!strncmp(str+4, "CONN", 4)) {
+	// Connect to a channel that was placed in 'pending' mode, by
+	// checking the channel table against the ID...
+	// DO ME LATER
+	ok = true;
+    } else if (!strncmp(str+4, "CHAL", 4)) {
+	// Challenge
+	// The idea is that the channel stays in 'secure' mode until a
+	// valid RESP is received
+	// DO ME LATER
+	ok = true;
+    } else if (!strncmp(str+4, "RESP", 4)) {
+	// Reponse - here is the plaintext as sent in the CHAL - the
+	// channel will only open up if this matches what ncpd has for
+	// the encrypted plaintext.
+	// DO ME LATER
+	ok = true;
+    }
+    return ok;
 }
 
 
 void socketChan::
 ncpConnectAck()
 {
-	bufferStore a;
-	a.addStringT("Ok");
-	skt->sendBufferStore(a);
-	connected = true;
-	connectTry = 3;
+    bufferStore a;
+    a.addStringT("Ok");
+    skt->sendBufferStore(a);
+    connected = true;
+    connectTry = 3;
 }
 
 void socketChan::
 ncpConnectTerminate()
 {
-//	bufferStore a;
-	connectTry = 0;
-//	a.addStringT("Close");
-//	skt->sendBufferStore(a);
-	skt->closeSocket();
-	terminateWhenAsked();
+    connectTry = 0;
+    skt->closeSocket();
+    terminateWhenAsked();
 }
 
 void socketChan::
 ncpRegisterAck()
 {
-	connectTry++;
-	ncpConnect();
+    connectTry++;
+    ncpConnect();
 }
 
 void socketChan::
 ncpConnectNak()
 {
-	if (!connectName || (connectTry > 1))
-		ncpConnectTerminate();
-	else {
-		connectTry++;
-		ncpRegister();
-	}
+    if (!connectName || (connectTry > 1))
+	ncpConnectTerminate();
+    else {
+	connectTry++;
+	ncpRegister();
+    }
 }
 
 void socketChan::
 socketPoll()
 {
-	if (connectName == 0) {
-		bufferStore a;
-		if (skt->getBufferStore(a, false) == 1) {
-			// A client has connected, and is announcing who it
-			// is...  e.g.  "SYS$RFSV.*"
-			//
-			// An NCP Channel can be in 'Control' or 'Data' mode.
-			// Initially, it is in 'Control' mode, and can accept
-			// certain commands.
-			//
-			// When a command is received that ncpd does not
-			// understand, this is assumed to be a request to
-			// connect to the remote service of that name, and enter
-			// 'data' mode.
-			//
-			// Later, there might be an explicit command to enter
-			// 'data' mode, and also a challenge-response protocol
-			// before any connection can be made.
-			//
-			// All commands begin with "NCP$".
-
-			// There is a magic process name called "NCP$INFO.*"
-			// which is announced by the rfsvfactory. This causes a
-			// response to be issued containing the NCP version
-			// number. The rfsvfactory will create the correct type
-			// of RFSV protocol handler, which will then announce
-			// itself. So, first time in here, we might get the
-			// NCP$INFO.*
-			if (a.getLen() > 8 && !strncmp(a.getString(), "NCP$", 4)) {
-				if (!ncpCommand(a))
-					cerr << "ncpd: command " << a << " unrecognised." << endl;
-				return;
-			}
-
-			// This isn't a command, it's a remote process. Connect.
-			connectName = strdup(a.getString());
-			connectTry++;
-			ncpConnect();
-		}
-	} else if (connected) {
-		bufferStore a;
-		int res = skt->getBufferStore(a, false);
-		if (res == -1) {
-			ncpDisconnect();
-			skt->closeSocket();
-		} else if (res == 1) {
-//			if (a.getLen() > 4 &&
-//			    !strncmp(a.getString(), "Close", 5)) {
-//				ncpDisconnect();
-//			} else {
-				ncpSend(a);
-//			}
-		}
+    if (connectName == 0) {
+	bufferStore a;
+	if (skt->getBufferStore(a, false) == 1) {
+	    // A client has connected, and is announcing who it
+	    // is...  e.g.  "SYS$RFSV.*"
+	    //
+	    // An NCP Channel can be in 'Control' or 'Data' mode.
+	    // Initially, it is in 'Control' mode, and can accept
+	    // certain commands.
+	    //
+	    // When a command is received that ncpd does not
+	    // understand, this is assumed to be a request to
+	    // connect to the remote service of that name, and enter
+	    // 'data' mode.
+	    //
+	    // Later, there might be an explicit command to enter
+	    // 'data' mode, and also a challenge-response protocol
+	    // before any connection can be made.
+	    //
+	    // All commands begin with "NCP$".
+
+	    // There is a magic process name called "NCP$INFO.*"
+	    // which is announced by the rfsvfactory. This causes a
+	    // response to be issued containing the NCP version
+	    // number. The rfsvfactory will create the correct type
+	    // of RFSV protocol handler, which will then announce
+	    // itself. So, first time in here, we might get the
+	    // NCP$INFO.*
+	    if (a.getLen() > 8 && !strncmp(a.getString(), "NCP$", 4)) {
+		if (!ncpCommand(a))
+		    cerr << "ncpd: command " << a << " unrecognized." << endl;
+		return;
+	    }
+
+	    // This isn't a command, it's a remote process. Connect.
+	    connectName = strdup(a.getString());
+	    connectTry++;
+	    ncpConnect();
 	}
+    } else if (connected) {
+	bufferStore a;
+	int res = skt->getBufferStore(a, false);
+	if (res == -1) {
+	    ncpDisconnect();
+	    skt->closeSocket();
+	} else if (res == 1) {
+	    ncpSend(a);
+	}
+    }
 }
 
 bool socketChan::
 isConnected()
 const {
-	return connected;
+    return connected;
 }
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/plpbackup/plpbackup.cc b/plpbackup/plpbackup.cc
index adf8742..b10eff1 100644
--- a/plpbackup/plpbackup.cc
+++ b/plpbackup/plpbackup.cc
@@ -127,7 +127,7 @@ runrestore(rfsv *a, rpcs *r) {
 		return 1;
 	}
 	ip >> cmd >> arg;
-			
+
 	if (strcmp(cmd, "#plpbackup") || strcmp(arg, "processlist")) {
 		ip.close();
 		cerr << "Error: " << psfile <<
@@ -247,7 +247,7 @@ mkdirp(char *path) {
 		*p = '\0';
 		switch (mkdir(path, S_IRWXU|S_IRWXG)) {
 			struct stat stbuf;
-			
+
 			case 0:
 				break;
 			default:
@@ -346,7 +346,7 @@ main(int argc, char **argv)
 		cerr << "Could not get user's home directory from /etc/passwd" << endl;
 		exit(-1);
 	}
-	
+
 	skt = new ppsocket();
 	if (!skt->connect(NULL, sockNum)) {
 		cerr << "plpbackup: could not connect to ncpd" << endl;
@@ -395,7 +395,7 @@ main(int argc, char **argv)
 				}
 			} else
 				cout << "all drives";
-			
+
 			cout << " to " << dstPath << endl;
 		}
 		if (verbose > 0) {
@@ -415,7 +415,7 @@ main(int argc, char **argv)
 			if (a->devlist(devbits) == rfsv::E_PSI_GEN_NONE) {
 				for (i = 0; i < 26; i++) {
 					PlpDrive psidr;
-					if ((devbits & 1) && a->devinfo(i, psidr) == rfsv::E_PSI_GEN_NONE) {
+					if ((devbits & 1) && a->devinfo(i + 'A', psidr) == rfsv::E_PSI_GEN_NONE) {
 						if (psidr.getMediaType() != 7) {
 							sprintf(drive, "%c:\0", 'A' + i);
 							if (verbose > 0)
diff --git a/plpftp/ftp.cc b/plpftp/ftp.cc
index 013a063..8141f2b 100644
--- a/plpftp/ftp.cc
+++ b/plpftp/ftp.cc
@@ -249,7 +249,7 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv)
 
 	    for (i = 0; i < 26; i++) {
 		PlpDrive drive;
-		if ((devbits & 1) && a.devinfo(i, drive) == rfsv::E_PSI_GEN_NONE) {
+		if ((devbits & 1) && a.devinfo(i + 'A', drive) == rfsv::E_PSI_GEN_NONE) {
 		    defDrive[0] = 'A' + i;
 		    break;
 		}
@@ -419,7 +419,7 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv)
 		    PlpDrive drive;
 
 		    if ((devbits & 1) != 0) {
-			if (a.devinfo(i, drive) == rfsv::E_PSI_GEN_NONE)
+			if (a.devinfo(i + 'A', drive) == rfsv::E_PSI_GEN_NONE)
 			    cout << (char) ('A' + i) << "     " <<
 				hex << setw(4) << setfill('0') << drive.getMediaType() << " " <<
 				setw(12) << setfill(' ') << setiosflags(ios::left) <<
diff --git a/plpnfsd/main.cc b/plpnfsd/main.cc
index 89010fe..508649f 100644
--- a/plpnfsd/main.cc
+++ b/plpnfsd/main.cc
@@ -406,11 +406,10 @@ long rfsv_getattr(const char *name, long *attr, long *size, long *time) {
 
 long rfsv_statdev(char letter) {
 	PlpDrive drive;
-	u_int32_t devnum = letter - 'A';
 
 	if (!a)
 		return -1;
-	return (a->devinfo(devnum, drive) != rfsv::E_PSI_GEN_NONE);
+	return (a->devinfo(letter, drive) != rfsv::E_PSI_GEN_NONE);
 }
 
 long rfsv_rename(const char *oldname, const char *newname) {
@@ -433,7 +432,7 @@ long rfsv_drivelist(int *cnt, device **dlist) {
 			PlpDrive drive;
 
 			if ((devbits & 1) &&
-			    ((a->devinfo(i, drive) == rfsv::E_PSI_GEN_NONE))) {
+			    ((a->devinfo(i + 'A', drive) == rfsv::E_PSI_GEN_NONE))) {
 
 				device *next = *dlist;
 				*dlist = (device *)malloc(sizeof(device));
-- 
cgit v1.2.3