aboutsummaryrefslogtreecommitdiffstats
path: root/kde2
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2001-03-01 00:22:23 +0000
committerFritz Elfert <felfert@to.com>2001-03-01 00:22:23 +0000
commit75007da068aac10fed90fc5234ab2d50deed3e61 (patch)
treebe0a8ebba9bad4ccab4600c60d9e7fcc21dc7837 /kde2
parentd8ae774198cf180fcaa4a2512dd94b4dbfdfd72d (diff)
downloadplptools-75007da068aac10fed90fc5234ab2d50deed3e61.tar.gz
plptools-75007da068aac10fed90fc5234ab2d50deed3e61.tar.bz2
plptools-75007da068aac10fed90fc5234ab2d50deed3e61.zip
Modified icons.
Started NLS support. Added kpsion KDE2 application. Unified file-headers.
Diffstat (limited to 'kde2')
-rw-r--r--kde2/Makefile.am5
-rw-r--r--kde2/kioslave/kio_plp.cpp1881
-rw-r--r--kde2/kioslave/kio_plp.h138
-rw-r--r--kde2/kioslave/psion.protocol2
-rw-r--r--kde2/kpsion/Makefile.am31
-rw-r--r--kde2/kpsion/kpsion.cpp1046
-rw-r--r--kde2/kpsion/kpsion.desktop10
-rw-r--r--kde2/kpsion/kpsion.h165
-rw-r--r--kde2/kpsion/kpsionui.rc15
-rw-r--r--kde2/kpsion/lo16-action-psion_backup.pngbin0 -> 268 bytes
-rw-r--r--kde2/kpsion/lo16-action-psion_restore.pngbin0 -> 274 bytes
-rw-r--r--kde2/kpsion/lo16-app-kpsion.pngbin0 -> 250 bytes
-rw-r--r--kde2/kpsion/lo22-action-psion_backup.pngbin0 -> 318 bytes
-rw-r--r--kde2/kpsion/lo22-action-psion_restore.pngbin0 -> 318 bytes
-rw-r--r--kde2/kpsion/lo32-action-psion_backup.pngbin0 -> 366 bytes
-rw-r--r--kde2/kpsion/lo32-action-psion_restore.pngbin0 -> 368 bytes
-rw-r--r--kde2/kpsion/lo32-app-kpsion.pngbin0 -> 309 bytes
-rw-r--r--kde2/kpsion/main.cpp55
-rw-r--r--kde2/kpsion/setupdialog.cpp62
-rw-r--r--kde2/kpsion/setupdialog.h17
-rw-r--r--kde2/kpsion/wizards.cpp586
-rw-r--r--kde2/kpsion/wizards.h78
-rw-r--r--kde2/mime/icons/lo32-app-psion_backup.pngbin366 -> 366 bytes
-rw-r--r--kde2/mime/icons/lo32-app-psion_desktop.pngbin309 -> 309 bytes
-rw-r--r--kde2/mime/icons/lo32-app-psion_owner.pngbin392 -> 392 bytes
-rw-r--r--kde2/mime/icons/lo32-app-psion_restore.pngbin368 -> 368 bytes
-rw-r--r--kde2/mime/icons/lo32-app-psion_setup.pngbin413 -> 413 bytes
-rw-r--r--kde2/mime/icons/lo32-device-psion_drive.pngbin488 -> 475 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_agenda.pngbin570 -> 505 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_backup.pngbin499 -> 469 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_data.pngbin539 -> 536 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_encryptit.pngbin419 -> 416 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_opl.pngbin456 -> 445 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_opo.pngbin458 -> 445 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_opx.pngbin458 -> 446 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_recorder.pngbin435 -> 430 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_sheet.pngbin699 -> 568 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_sis.pngbin534 -> 485 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_unknown.pngbin430 -> 425 bytes
-rw-r--r--kde2/mime/icons/lo32-mime-x_psion_word.pngbin512 -> 474 bytes
-rw-r--r--kde2/mime/psion-drive-actions.desktop16
-rw-r--r--kde2/mime/x-psion-backup.desktop7
-rw-r--r--kde2/mime/x-psion-machine.desktop7
-rw-r--r--kde2/mime/x-psion-owner.desktop7
-rw-r--r--kde2/mime/x-psion-restore.desktop7
-rw-r--r--kde2/mime/x-psion-setup.desktop7
-rw-r--r--kde2/plugins/Makefile.am2
-rw-r--r--kde2/plugins/plpprops.cc1139
-rw-r--r--kde2/plugins/plpprops.h263
-rw-r--r--kde2/plugins/plppropsFactory.cc14
-rw-r--r--kde2/po/Makefile.am24
-rw-r--r--kde2/po/de/Makefile.am3
-rw-r--r--kde2/po/de/kpsion.po631
-rw-r--r--kde2/po/kpsion.pot559
54 files changed, 5426 insertions, 1351 deletions
diff --git a/kde2/Makefile.am b/kde2/Makefile.am
index c1186d6..7e40266 100644
--- a/kde2/Makefile.am
+++ b/kde2/Makefile.am
@@ -1,8 +1,9 @@
# $Id$
#
-SUBDIRS = kioslave plugins mime
+SUBDIRS = kioslave plugins mime kpsion po
+POFILES =
#
# remove all intermediate files that can be recreated using
# Makefile.cvs
@@ -11,4 +12,4 @@ maintainer-clean-local:
rm -f Makefile.in
am_edit:
- perl ../conf/am_edit
+ perl ../conf/am_edit -v
diff --git a/kde2/kioslave/kio_plp.cpp b/kde2/kioslave/kio_plp.cpp
index ffa5c8a..ef9fe54 100644
--- a/kde2/kioslave/kio_plp.cpp
+++ b/kde2/kioslave/kio_plp.cpp
@@ -1,24 +1,26 @@
-/*
- A KIOslave for KDE2
-
- Copyright (C) 2001 Fritz Elfert <felfert@to.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
+/*-*-c++-*-
+ * $Id$
+ *
+ * This file is part of plptools.
+ *
+ * Copyright (C) 1999 Philip Proudman <philip.proudman@btinternet.com>
+ * Copyright (C) 2000, 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
@@ -27,6 +29,8 @@
#include <iomanip>
#include <stdio.h>
+#include <pwd.h>
+#include <grp.h>
#include <sys/stat.h>
#include <qfile.h>
@@ -62,1031 +66,1168 @@ extern "C" {
int
kdemain( int argc, char **argv ) {
- KInstance instance( "kio_nfs" );
+ KInstance instance( "kio_nfs" );
- if (argc != 4) {
- fprintf(stderr, "Usage: kio_nfs protocol domain-socket1 domain-socket2\n");
- exit(-1);
- }
- kdDebug(PLP_DEBUGAREA) << "PLP: kdemain: starting" << endl;
+ if (argc != 4) {
+ fprintf(stderr, "Usage: kio_plp protocol domain-socket1 domain-socket2\n");
+ exit(-1);
+ }
+ kdDebug(PLP_DEBUGAREA) << "PLP: kdemain: starting" << endl;
- PLPProtocol slave(argv[2], argv[3]);
- slave.dispatchLoop();
- return 0;
+ PLPProtocol slave(argv[2], argv[3]);
+ slave.dispatchLoop();
+ return 0;
}
static void
stripTrailingSlash(QString& path) {
- if (path=="/")
- path="";
- else
- if (path[path.length()-1]=='/')
- path.truncate(path.length()-1);
+ if (path=="/")
+ path="";
+ else
+ if (path[path.length()-1]=='/')
+ path.truncate(path.length()-1);
}
static QString
baseName(const QString& path) {
- return path.mid(path.findRev("/") + 1);
+ return path.mid(path.findRev("/") + 1);
}
static QString
removeFirstPart(const QString& path, QString &removed) {
- QString result("");
- if (path.isEmpty()) {
- removed = "";
- return result;
- }
- result = path.mid(1);
- int slashPos = result.find("/");
- if (slashPos == -1) {
- removed = result;
- result = "";
- } else {
- removed = result.left(slashPos);
- result = result.mid(slashPos);
- }
+ QString result("");
+ if (path.isEmpty()) {
+ removed = "";
return result;
+ }
+ result = path.mid(1);
+ int slashPos = result.find("/");
+ if (slashPos == -1) {
+ removed = result;
+ result = "";
+ } else {
+ removed = result.left(slashPos);
+ result = result.mid(slashPos);
+ }
+ return result;
}
PLPProtocol::PLPProtocol (const QCString &pool, const QCString &app)
- :SlaveBase("psion", pool, app), plpRfsv(0), plpRfsvSocket(0) {
-
- kdDebug(PLP_DEBUGAREA) << "PLPProtocol::PLPProtocol(" << pool << ","
- << app << ")" << endl;
-
- currentHost = "";
- struct servent *se = getservbyname("psion", "tcp");
- endservent();
- if (se != 0L)
- currentPort = ntohs(se->s_port);
- else
- currentPort = DPORT;
-
- typedef QMap<QString,QString> UIDMap;
- KConfig *cfg = new KConfig("kioslaverc");
-
- UIDMap uids = cfg->entryMap("Psion/UIDmapping");
- if (uids.isEmpty()) {
- cfg->setGroup("Psion/UIDmapping");
- // Builtin application types.
- cfg->writeEntry("uid-10000037-1000006D-1000007F",
- "application/x-psion-word");
- cfg->writeEntry("uid-10000037-1000006D-10000088",
- "application/x-psion-sheet");
- cfg->writeEntry("uid-10000037-1000006D-1000006d",
- "application/x-psion-record");
- cfg->writeEntry("uid-10000037-1000006D-1000007d",
- "application/x-psion-sketch");
- cfg->writeEntry("uid-10000037-1000006D-10000085",
- "application/x-psion-opl");
- cfg->writeEntry("uid-10000050-1000006D-10000084",
- "application/x-psion-agenda");
- cfg->writeEntry("uid-10000050-1000006D-10000086",
- "application/x-psion-data");
- cfg->sync();
- uids = cfg->entryMap("Psion/UIDmapping");
- }
- for (UIDMap::Iterator uit = uids.begin(); uit != uids.end(); ++uit) {
- long u1, u2, u3;
-
- sscanf(uit.key().data(), "uid-%08X-%08X-%08X", &u1, &u2, &u3);
- puids.insert(PlpUID(u1, u2, u3), uit.data());
- }
+ :SlaveBase("psion", pool, app), plpRfsv(0), plpRfsvSocket(0) {
+
+ kdDebug(PLP_DEBUGAREA) << "PLPProtocol::PLPProtocol(" << pool << ","
+ << app << ")" << endl;
+
+ currentHost = "";
+ struct servent *se = getservbyname("psion", "tcp");
+ endservent();
+ if (se != 0L)
+ currentPort = ntohs(se->s_port);
+ else
+ currentPort = DPORT;
+
+ typedef QMap<QString,QString> UIDMap;
+ KConfig *cfg = new KConfig("kioslaverc");
+
+ UIDMap uids = cfg->entryMap("Psion/UIDmapping");
+ if (uids.isEmpty()) {
+ cfg->setGroup("Psion/UIDmapping");
+ // Builtin application types.
+ cfg->writeEntry("uid-10000037-1000006D-1000007F",
+ "application/x-psion-word");
+ cfg->writeEntry("uid-10000037-1000006D-10000088",
+ "application/x-psion-sheet");
+ cfg->writeEntry("uid-10000037-1000006D-1000006d",
+ "application/x-psion-record");
+ cfg->writeEntry("uid-10000037-1000006D-1000007d",
+ "application/x-psion-sketch");
+ cfg->writeEntry("uid-10000037-1000006D-10000085",
+ "application/x-psion-opl");
+ cfg->writeEntry("uid-10000050-1000006D-10000084",
+ "application/x-psion-agenda");
+ cfg->writeEntry("uid-10000050-1000006D-10000086",
+ "application/x-psion-data");
+ cfg->sync();
+ uids = cfg->entryMap("Psion/UIDmapping");
+ }
+ for (UIDMap::Iterator uit = uids.begin(); uit != uids.end(); ++uit) {
+ long u1, u2, u3;
+
+ sscanf(uit.key().data(), "uid-%08X-%08X-%08X", &u1, &u2, &u3);
+ puids.insert(PlpUID(u1, u2, u3), uit.data());
+ }
}
PLPProtocol::~PLPProtocol() {
- closeConnection();
+ closeConnection();
}
void PLPProtocol::
closeConnection() {
- if (plpRfsv)
- delete(plpRfsv);
- if (plpRfsvSocket)
- delete(plpRfsvSocket);
- plpRfsv = 0;
- plpRfsvSocket = 0;
+ if (plpRfsv)
+ delete(plpRfsv);
+ if (plpRfsvSocket)
+ delete(plpRfsvSocket);
+ plpRfsv = 0;
+ plpRfsvSocket = 0;
}
bool PLPProtocol::
isRoot(const QString& path) {
- return (path.isEmpty() || (path=="/"));
+ return (path.isEmpty() || (path=="/"));
}
bool PLPProtocol::
isDrive(const QString& path) {
- QString tmp = path;
- stripTrailingSlash(tmp);
- for (QStringList::Iterator it = drives.begin(); it != drives.end(); it++) {
- QString cmp = "/" + *it;
- if (cmp == tmp)
- return true;
- }
- return false;
+ QString tmp = path;
+ stripTrailingSlash(tmp);
+ for (QStringList::Iterator it = drives.begin(); it != drives.end(); it++) {
+ QString cmp = "/" + *it;
+ if (cmp == tmp)
+ return true;
+ }
+ return false;
}
bool PLPProtocol::
isRomDrive(const QString& path) {
- return (driveChar(path) == 'Z');
+ return (driveChar(path) == 'Z');
}
char PLPProtocol::
driveChar(const QString& path) {
- QString vname;
- QString dummy = removeFirstPart(path, vname);
- if (drivechars.find(vname) != drivechars.end())
- return drivechars[vname];
- return '\0';
+ QString vname;
+ QString dummy = removeFirstPart(path, vname);
+ if (drivechars.find(vname) != drivechars.end())
+ return drivechars[vname];
+ return '\0';
}
int PLPProtocol::
checkSpecial(const QString& path) {
- QString tmp = path.mid(1);
- if (tmp == i18n("Owner"))
- return PLP_FTYPE_OWNER;
- if (tmp == i18n("Machine"))
- return PLP_FTYPE_MACHINE;
- if (tmp == i18n("Settings"))
- return PLP_FTYPE_SETUP;
- if (tmp == i18n("Backup"))
- return PLP_FTYPE_BACKUP;
- if (tmp == i18n("Restore"))
- return PLP_FTYPE_RESTORE;
- return 0;
+ QString tmp = path.mid(1);
+ if (tmp == i18n("Owner"))
+ return PLP_FTYPE_OWNER;
+ if (tmp == i18n("Machine"))
+ return PLP_FTYPE_MACHINE;
+ if (tmp == i18n("Settings"))
+ return PLP_FTYPE_SETUP;
+ if (tmp == i18n("Backup"))
+ return PLP_FTYPE_BACKUP;
+ if (tmp == i18n("Restore"))
+ return PLP_FTYPE_RESTORE;
+ return 0;
}
void PLPProtocol::
convertName(QString &path) {
- kdDebug(PLP_DEBUGAREA) << "convert: in='" << path << "' out='";
- QString dummy;
- QString drive;
-
- drive.sprintf("%c:", driveChar(path));
- path = drive + removeFirstPart(path, dummy);
- path.replace(QRegExp("/"), "\\");
- kdDebug(PLP_DEBUGAREA) << path << "'" << endl;
+ kdDebug(PLP_DEBUGAREA) << "convert: in='" << path << "' out='";
+ QString dummy;
+ QString drive;
+
+ drive.sprintf("%c:", driveChar(path));
+ path = drive + removeFirstPart(path, dummy);
+ path.replace(QRegExp("/"), "\\");
+ kdDebug(PLP_DEBUGAREA) << path << "'" << endl;
}
void PLPProtocol::
openConnection() {
- kdDebug(PLP_DEBUGAREA) << "PLP::openConnection" << endl;
- closeConnection();
-
- plpRfsvSocket = new ppsocket();
- QString estr = i18n("Could not connect to ncpd at %1:%2").arg(currentHost).arg(currentPort);
- if (!plpRfsvSocket->connect((char *)(currentHost.data()), currentPort)) {
- error(ERR_COULD_NOT_CONNECT, estr);
- return;
- }
- rfsvfactory factory(plpRfsvSocket);
- plpRfsv = factory.create(false);
- if (plpRfsv == 0L) {
- error(ERR_COULD_NOT_CONNECT, estr);
- return;
- }
-
- /* If we have a S5, get the Psion's Owner- and Mach- info.
- * This implicitely sets the Timezone info of the Psion also.
- */
- ppsocket rpcsSocket;
- if (rpcsSocket.connect((char *)(currentHost.data()), currentPort)) {
- rpcsfactory factory(&rpcsSocket);
- rpcs *Rpcs = factory.create(false);
- if (Rpcs != 0L) {
- bufferArray b;
- Enum <rfsv::errs> res;
- if ((res = Rpcs->getOwnerInfo(b)) == rfsv::E_PSI_GEN_NONE) {
- Rpcs->getMachineType(machType);
- if (machType == rpcs::PSI_MACH_S5)
- Rpcs->getMachineInfo(mi);
- }
+ kdDebug(PLP_DEBUGAREA) << "PLP::openConnection" << endl;
+ closeConnection();
+
+ plpRfsvSocket = new ppsocket();
+ QString estr = i18n("Could not connect to ncpd at %1:%2").arg(currentHost).arg(currentPort);
+ if (!plpRfsvSocket->connect((char *)(currentHost.data()), currentPort)) {
+ error(ERR_COULD_NOT_CONNECT, estr);
+ return;
+ }
+ rfsvfactory factory(plpRfsvSocket);
+ plpRfsv = factory.create(false);
+ if (plpRfsv == 0L) {
+ error(ERR_COULD_NOT_CONNECT, estr);
+ return;
+ }
+
+ plpRpcsSocket = new ppsocket();
+ if (!plpRpcsSocket->connect((char *)(currentHost.data()), currentPort)) {
+ error(ERR_COULD_NOT_CONNECT, estr);
+ return;
+ }
+ rpcsfactory factory2(plpRpcsSocket);
+ plpRpcs = factory2.create(false);
+ if (plpRpcs == 0L) {
+ error(ERR_COULD_NOT_CONNECT, estr);
+ return;
+ }
+
+ /* If we have a S5, get the Psion's Owner- and Mach- info.
+ * This implicitely sets the Timezone info of the Psion also.
+ */
+ bufferArray b;
+ Enum <rfsv::errs> res;
+ if ((res = plpRpcs->getOwnerInfo(b)) == rfsv::E_PSI_GEN_NONE) {
+ plpRpcs->getMachineType(machType);
+ if (machType == rpcs::PSI_MACH_S5)
+ plpRpcs->getMachineInfo(machInfo);
+ }
+
+ u_int32_t devbits;
+
+ if ((res = plpRfsv->devlist(devbits)) == rfsv::E_PSI_GEN_NONE) {
+ for (int i = 0; i < 26; i++) {
+ if ((devbits & 1) != 0) {
+ PlpDrive drive;
+ if (plpRfsv->devinfo(i, drive) == rfsv::E_PSI_GEN_NONE) {
+ string vname = drive.getName();
+ QString name;
+
+ if (!vname.empty())
+ name = QString(vname.c_str());
+ else
+ name.sprintf("%c", 'A' + i);
+ drives.append(name);
+ drivechars.insert(name, 'A' + i);
}
+ }
+ devbits >>= 1;
}
-
- u_int32_t devbits;
- Enum<rfsv::errs> res;
-
- if ((res = plpRfsv->devlist(devbits)) == rfsv::E_PSI_GEN_NONE) {
- for (int i = 0; i < 26; i++) {
- if ((devbits & 1) != 0) {
- PlpDrive drive;
- if (plpRfsv->devinfo(i, drive) == rfsv::E_PSI_GEN_NONE) {
- string vname = drive.getName();
- QString name;
-
- if (!vname.empty())
- name = QString(vname.c_str());
- else
- name.sprintf("%c", 'A' + i);
- drives.append(name);
- drivechars.insert(name, 'A' + i);
- }
- }
- devbits >>= 1;
- }
- } else {
- error(ERR_COULD_NOT_CONNECT, i18n("Could not get drive list"));
- return;
- }
- connected();
- kdDebug(PLP_DEBUGAREA) << "openConnection succeeded" << endl;
+ } else {
+ error(ERR_COULD_NOT_CONNECT, i18n("Could not get drive list"));
+ return;
+ }
+ connected();
+ kdDebug(PLP_DEBUGAREA) << "openConnection succeeded" << endl;
}
bool PLPProtocol::
checkConnection() {
- kdDebug(PLP_DEBUGAREA) << "PLP::checkConnection" << endl;
- if (plpRfsv == 0)
- openConnection();
- return (plpRfsv == 0);
+ kdDebug(PLP_DEBUGAREA) << "PLP::checkConnection" << endl;
+ if (plpRfsv == 0)
+ openConnection();
+ return (plpRfsv == 0);
}
QString PLPProtocol::
uid2mime(PlpDirent &e) {
- QString tmp;
- PlpUID u = e.getUID();
- UidMap::Iterator it = puids.find(u);
-
- if (it != puids.end())
- tmp = it.data();
- else
- tmp.sprintf("application/x-psion-uid-%08X-%08X-%08X", u[0], u[1], u[2]);
- return tmp;
+ QString tmp;
+ PlpUID u = e.getUID();
+ UidMap::Iterator it = puids.find(u);
+
+ if (it != puids.end())
+ tmp = it.data();
+ else
+ tmp.sprintf("application/x-psion-uid-%08X-%08X-%08X", u[0], u[1], u[2]);
+ return tmp;
}
void PLPProtocol::
listDir(const KURL& _url) {
- KURL url(_url);
- QString path(QFile::encodeName(url.path()));
+ KURL url(_url);
+ QString path(QFile::encodeName(url.path(-1)));
- if (path.isEmpty()) {
- url.setPath("/");
- redirection(url);
- finished();
- return;
- }
+ if (path.isEmpty()) {
+ url.setPath("/");
+ redirection(url);
+ finished();
+ return;
+ }
- if (checkConnection())
- return;
+ if (checkConnection())
+ return;
- if (isRoot(path)) {
- kdDebug(PLP_DEBUGAREA) << "listing root" << endl;
- totalSize(drives.count()/* + 5*/);
- //in this case we don't need to do a real listdir
- UDSEntry entry;
- UDSAtom atom;
- for (QStringList::Iterator it = drives.begin(); it != drives.end(); it++) {
- entry.clear();
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = (*it);
- kdDebug(PLP_DEBUGAREA) << "listing " << (*it) << endl;
- entry.append(atom);
- createVirtualDirEntry(entry, drivechars[*it] == 'Z', PLP_FTYPE_DRIVE);
- listEntry(entry, false);
- }
+ if (isRoot(path)) {
+ kdDebug(PLP_DEBUGAREA) << "listing root" << endl;
+ totalSize(drives.count()/* + 5*/);
+ //in this case we don't need to do a real listdir
+ UDSEntry entry;
+ UDSAtom atom;
+ for (QStringList::Iterator it = drives.begin(); it != drives.end(); it++) {
+ entry.clear();
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = (*it);
+ kdDebug(PLP_DEBUGAREA) << "listing " << (*it) << endl;
+ entry.append(atom);
+ createVirtualDirEntry(entry, drivechars[*it] == 'Z', PLP_FTYPE_DRIVE);
+ listEntry(entry, false);
+ }
#if 0
- entry.clear();
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = i18n("Owner");
- entry.append(atom);
- createVirtualDirEntry(entry, false, PLP_FTYPE_OWNER);
- listEntry(entry, false);
-
- entry.clear();
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = i18n("Machine");
- entry.append(atom);
- createVirtualDirEntry(entry, false, PLP_FTYPE_MACHINE);
- listEntry(entry, false);
-
- entry.clear();
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = i18n("Settings");
- entry.append(atom);
- createVirtualDirEntry(entry, false, PLP_FTYPE_SETUP);
- listEntry(entry, false);
-
- entry.clear();
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = i18n("Backup");
- entry.append(atom);
- createVirtualDirEntry(entry, false, PLP_FTYPE_BACKUP);
- listEntry(entry, false);
-
- entry.clear();
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = i18n("Restore");
- entry.append(atom);
- createVirtualDirEntry(entry, false, PLP_FTYPE_RESTORE);
- listEntry(entry, false);
-#endif
+ entry.clear();
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = i18n("Owner");
+ entry.append(atom);
+ createVirtualDirEntry(entry, false, PLP_FTYPE_OWNER);
+ listEntry(entry, false);
- listEntry(entry, true);
- finished();
- return;
- }
+ entry.clear();
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = i18n("Machine");
+ entry.append(atom);
+ createVirtualDirEntry(entry, false, PLP_FTYPE_MACHINE);
+ listEntry(entry, false);
- kdDebug(PLP_DEBUGAREA) << "getting subdir -" << path << "-" << endl;
- bool rom = isRomDrive(path);
- convertName(path);
- path += "\\";
+ entry.clear();
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = i18n("Settings");
+ entry.append(atom);
+ createVirtualDirEntry(entry, false, PLP_FTYPE_SETUP);
+ listEntry(entry, false);
- PlpDir files;
- Enum<rfsv::errs> res = plpRfsv->dir(path, files);
- if (checkForError(res, url.path()))
- return;
- totalSize(files.size());
- UDSEntry entry;
- for (int i = 0; i < files.size(); i++) {
- UDSAtom atom;
+ entry.clear();
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = i18n("Backup");
+ entry.append(atom);
+ createVirtualDirEntry(entry, false, PLP_FTYPE_BACKUP);
+ listEntry(entry, false);
- PlpDirent e = files[i];
- long attr = e.getAttr();
+ entry.clear();
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = i18n("Restore");
+ entry.append(atom);
+ createVirtualDirEntry(entry, false, PLP_FTYPE_RESTORE);
+ listEntry(entry, false);
+#endif
- entry.clear();
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = e.getName();
- entry.append(atom);
+ listEntry(entry, true);
+ finished();
+ return;
+ }
+
+ kdDebug(PLP_DEBUGAREA) << "getting subdir -" << path << "-" << endl;
+ bool rom = isRomDrive(path);
+ convertName(path);
+ path += "\\";
+
+ PlpDir files;
+ Enum<rfsv::errs> res = plpRfsv->dir(path.latin1(), files);
+ if (checkForError(res, url.path()))
+ return;
+ totalSize(files.size());
+ UDSEntry entry;
+ for (int i = 0; i < files.size(); i++) {
+ UDSAtom atom;
- if ((attr & rfsv::PSI_A_DIR) == 0) {
- atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = uid2mime(e);
- entry.append(atom);
- }
+ PlpDirent e = files[i];
+ long attr = e.getAttr();
- completeUDSEntry(entry, e, rom);
- listEntry(entry, false);
+ entry.clear();
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = e.getName();
+ entry.append(atom);
+
+ if ((attr & rfsv::PSI_A_DIR) == 0) {
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = uid2mime(e);
+ entry.append(atom);
}
- listEntry(entry, true); // ready
- finished();
+
+ completeUDSEntry(entry, e, rom);
+ listEntry(entry, false);
+ }
+ listEntry(entry, true); // ready
+ finished();
}
void PLPProtocol::
-createVirtualDirEntry(UDSEntry & entry, bool rdonly, int type) {
- UDSAtom atom;
+setOwner(UDSEntry & entry) {
+ UDSAtom atom;
+ struct passwd *pw = getpwuid(getuid());
+ struct group *gr = getgrgid(getgid());
- atom.m_uds = KIO::UDS_ACCESS;
- atom.m_long = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
- if (!rdonly)
- atom.m_long |= (S_IWUSR | S_IWGRP | S_IWOTH);
- entry.append(atom);
+ atom.m_uds = KIO::UDS_USER;
+ atom.m_str = pw ? pw->pw_name : "root";
+ entry.append(atom);
- atom.m_uds = KIO::UDS_SIZE;
- atom.m_long = 0;
- entry.append(atom);
+ atom.m_uds = KIO::UDS_GROUP;
+ atom.m_str = gr ? gr->gr_name : "root";
+ entry.append(atom);
- switch (type) {
- case PLP_FTYPE_ROOT:
- //atom.m_uds = KIO::UDS_FILE_TYPE;
- //atom.m_long = S_IFBLK;
- //entry.append(atom);
- // atom.m_uds = KIO::UDS_GUESSED_MIME_TYPE;
- atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = QString("inode/x-psion-drive");
- entry.append(atom);
- break;
- case PLP_FTYPE_DRIVE:
- atom.m_uds = KIO::UDS_FILE_TYPE;
- atom.m_long = S_IFDIR;
- entry.append(atom);
- atom.m_uds = KIO::UDS_GUESSED_MIME_TYPE;
- // atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = QString("inode/x-psion-drive");
- entry.append(atom);
- break;
- case PLP_FTYPE_OWNER:
- atom.m_uds = KIO::UDS_FILE_TYPE;
- atom.m_long = S_IFREG;
- entry.append(atom);
- atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = QString("application/x-psion-owner");
- entry.append(atom);
- break;
- case PLP_FTYPE_MACHINE:
- atom.m_uds = KIO::UDS_FILE_TYPE;
- atom.m_long = S_IFREG;
- entry.append(atom);
- atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = QString("application/x-psion-machine");
- entry.append(atom);
- break;
- case PLP_FTYPE_SETUP:
- atom.m_uds = KIO::UDS_FILE_TYPE;
- atom.m_long = S_IFREG;
- entry.append(atom);
- atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = QString("application/x-psion-setup");
- entry.append(atom);
- break;
- case PLP_FTYPE_BACKUP:
- atom.m_uds = KIO::UDS_FILE_TYPE;
- atom.m_long = S_IFREG;
- entry.append(atom);
- atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = QString("application/x-psion-backup");
- entry.append(atom);
- break;
- case PLP_FTYPE_RESTORE:
- atom.m_uds = KIO::UDS_FILE_TYPE;
- atom.m_long = S_IFREG;
- entry.append(atom);
- atom.m_uds = KIO::UDS_MIME_TYPE;
- atom.m_str = QString("application/x-psion-restore");
- entry.append(atom);
- break;
- }
+ endgrent();
+ endpwent();
+}
+
+void PLPProtocol::
+createVirtualDirEntry(UDSEntry & entry, bool rdonly, int type) {
+ UDSAtom atom;
+
+ atom.m_uds = KIO::UDS_ACCESS;
+ atom.m_long = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
+ if (!rdonly)
+ atom.m_long |= (S_IWUSR | S_IWGRP | S_IWOTH);
+ entry.append(atom);
+
+ atom.m_uds = KIO::UDS_SIZE;
+ atom.m_long = 0;
+ entry.append(atom);
+
+ setOwner(entry);
+
+ switch (type) {
+ case PLP_FTYPE_ROOT:
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = S_IFDIR;
+ entry.append(atom);
+ atom.m_uds = KIO::UDS_GUESSED_MIME_TYPE;
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = QString("inode/x-psion-drive");
+ entry.append(atom);
+ break;
+ case PLP_FTYPE_DRIVE:
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = S_IFDIR;
+ entry.append(atom);
+ atom.m_uds = KIO::UDS_GUESSED_MIME_TYPE;
+ atom.m_str = QString("inode/x-psion-drive");
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = QString("inode/x-psion-drive");
+ entry.append(atom);
+ break;
+ case PLP_FTYPE_OWNER:
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = S_IFREG;
+ entry.append(atom);
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = QString("application/x-psion-owner");
+ entry.append(atom);
+ break;
+ case PLP_FTYPE_MACHINE:
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = S_IFREG;
+ entry.append(atom);
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = QString("application/x-psion-machine");
+ entry.append(atom);
+ break;
+ case PLP_FTYPE_SETUP:
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = S_IFREG;
+ entry.append(atom);
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = QString("application/x-psion-setup");
+ entry.append(atom);
+ break;
+ case PLP_FTYPE_BACKUP:
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = S_IFREG;
+ entry.append(atom);
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = QString("application/x-psion-backup");
+ entry.append(atom);
+ break;
+ case PLP_FTYPE_RESTORE:
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = S_IFREG;
+ entry.append(atom);
+ atom.m_uds = KIO::UDS_MIME_TYPE;
+ atom.m_str = QString("application/x-psion-restore");
+ entry.append(atom);
+ break;
+ }
}
bool PLPProtocol::
emitTotalSize(QString &name) {
- PlpDirent e;
+ PlpDirent e;
- Enum<rfsv::errs> res = plpRfsv->fgeteattr(name, e);
- if (checkForError(res), &name)
- return true;
- totalSize(e.getSize());
- return false;
+ Enum<rfsv::errs> res = plpRfsv->fgeteattr(name.latin1(), e);
+ if (checkForError(res, name))
+ return true;
+ totalSize(e.getSize());
+ return false;
}
void PLPProtocol::
stat(const KURL & url) {
- QString path(QFile::encodeName(url.path()));
- UDSEntry entry;
- UDSAtom atom;
+ QString path(QFile::encodeName(url.path(-1)));
+ UDSEntry entry;
+ UDSAtom atom;
- if (checkConnection())
- return;
-
- kdDebug(PLP_DEBUGAREA) << "stat(" << path << ")" << endl;
- stripTrailingSlash(path);
-
- if (isRoot(path) || isDrive(path)) {
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = path;
- entry.append(atom);
- if (isRoot(path))
- createVirtualDirEntry(entry, true, PLP_FTYPE_ROOT);
- else
- createVirtualDirEntry(entry, isRomDrive(path), PLP_FTYPE_DRIVE);
- statEntry(entry);
- finished();
- kdDebug(PLP_DEBUGAREA) << "succeeded" << endl;
- return;
- }
- int ftype = checkSpecial(path);
- if (ftype != 0) {
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = path;
- entry.append(atom);
- createVirtualDirEntry(entry, false, ftype);
- statEntry(entry);
- finished();
- kdDebug(PLP_DEBUGAREA) << "succeeded" << endl;
- return;
- }
+ if (checkConnection())
+ return;
- bool rom = isRomDrive(path);
- QString fileName = baseName(path);
- convertName(path);
-
- if (path.isEmpty()) {
- error(ERR_DOES_NOT_EXIST, url.path());
- return;
- }
-
- PlpDirent e;
-
- Enum<rfsv::errs> res = plpRfsv->fgeteattr(path, e);
- if (checkForError(res, url.path()))
- return;
+ kdDebug(PLP_DEBUGAREA) << "stat(" << path << ")" << endl;
+ stripTrailingSlash(path);
+ if (isRoot(path) || isDrive(path)) {
atom.m_uds = KIO::UDS_NAME;
- atom.m_str = fileName;
+ atom.m_str = path;
entry.append(atom);
- completeUDSEntry(entry, e, rom);
+ if (isRoot(path))
+ createVirtualDirEntry(entry, true, PLP_FTYPE_ROOT);
+ else
+ createVirtualDirEntry(entry, isRomDrive(path), PLP_FTYPE_DRIVE);
statEntry(entry);
-
finished();
-}
+ kdDebug(PLP_DEBUGAREA) << "succeeded" << endl;
+ return;
+ }
+ int ftype = checkSpecial(path);
+ if (ftype != 0) {
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = path;
+ entry.append(atom);
+ createVirtualDirEntry(entry, false, ftype);
+ statEntry(entry);
+ finished();
+ kdDebug(PLP_DEBUGAREA) << "succeeded" << endl;
+ return;
+ }
-void PLPProtocol::
-mimetype(const KURL & url) {
- QString path(QFile::encodeName(url.path()));
- UDSEntry entry;
- UDSAtom atom;
+ bool rom = isRomDrive(path);
+ QString fileName = baseName(path);
+ convertName(path);
- if (checkConnection())
- return;
+ if (path.isEmpty()) {
+ error(ERR_DOES_NOT_EXIST, url.path());
+ return;
+ }
- kdDebug(PLP_DEBUGAREA) << "mimetype(" << path << ")" << endl;
- stripTrailingSlash(path);
+ PlpDirent e;
- if (isRoot(path) || isDrive(path)) {
- mimeType("inode/directory");
- finished();
- return;
- }
- convertName(path);
+ Enum<rfsv::errs> res = plpRfsv->fgeteattr(path.latin1(), e);
+ if (checkForError(res, url.path()))
+ return;
- if (path.isEmpty()) {
- error(ERR_DOES_NOT_EXIST, url.path());
- return;
- }
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = fileName;
+ entry.append(atom);
+ completeUDSEntry(entry, e, rom);
+ statEntry(entry);
- PlpDirent e;
- Enum<rfsv::errs> res = plpRfsv->fgeteattr(path, e);
- if (checkForError(res, url.path()))
- return;
- mimeType(uid2mime(e));
- finished();
+ finished();
}
void PLPProtocol::
-completeUDSEntry(UDSEntry& entry, PlpDirent &e, bool rom) {
- UDSAtom atom;
- long attr = e.getAttr();
-
- if (rom)
- attr |= rfsv::PSI_A_RDONLY;
-
- atom.m_uds = KIO::UDS_SIZE;
- atom.m_long = e.getSize();
- entry.append(atom);
-
- if (attr & rfsv::PSI_A_DIR)
- atom.m_uds = KIO::UDS_CREATION_TIME;
- else
- atom.m_uds = KIO::UDS_MODIFICATION_TIME;
- atom.m_long = e.getPsiTime().getTime();
- entry.append(atom);
+mimetype(const KURL & url) {
+ QString path(QFile::encodeName(url.path(-1)));
+ UDSEntry entry;
+ UDSAtom atom;
- atom.m_uds = KIO::UDS_ACCESS;
- atom.m_long = S_IRUSR | S_IRGRP | S_IROTH;
- if (attr & rfsv::PSI_A_DIR)
- atom.m_long |= S_IXUSR | S_IXGRP | S_IXOTH;
- if (!(attr & rfsv::PSI_A_RDONLY))
- atom.m_long |= S_IWUSR | S_IWGRP | S_IWOTH;
- entry.append(atom);
+ kdDebug(PLP_DEBUGAREA) << "mimetype(" << path << ")" << endl;
+ stripTrailingSlash(path);
- atom.m_uds = KIO::UDS_FILE_TYPE;
- atom.m_long = (attr & rfsv::PSI_A_DIR) ? S_IFDIR : S_IFREG;
- entry.append(atom);
+ if (isRoot(path) || isDrive(path)) {
+ mimeType("inode/directory");
+ finished();
+ return;
+ }
+ convertName(path);
+
+ if (path.isEmpty()) {
+ error(ERR_DOES_NOT_EXIST, url.path());
+ return;
+ }
+
+ PlpDirent e;
+ Enum<rfsv::errs> res = plpRfsv->fgeteattr(path.latin1(), e);
+ if (checkForError(res, url.path()))
+ return;
+ mimeType(uid2mime(e));
+ finished();
+}
-#if 0
- KIO::UDSEntry::ConstIterator it = entry.begin();
- for( ; it != entry.end(); it++ ) {
- switch ((*it).m_uds) {
- case KIO::UDS_FILE_TYPE:
- kdDebug(PLP_DEBUGAREA) << "File Type : " <<
- (mode_t)((*it).m_long) << endl;
- break;
- case KIO::UDS_SIZE:
- kdDebug(PLP_DEBUGAREA) << "File Size : " <<
- (long)((*it).m_long) << endl;
- break;
- case KIO::UDS_ACCESS:
- kdDebug(PLP_DEBUGAREA) << "Access permissions : " <<
- (mode_t)((*it).m_long) << endl;
- break;
- case KIO::UDS_USER:
- kdDebug(PLP_DEBUGAREA) << "User : " <<
- ((*it).m_str.ascii() ) << endl;
- break;
- case KIO::UDS_GROUP:
- kdDebug(PLP_DEBUGAREA) << "Group : " <<
- ((*it).m_str.ascii() ) << endl;
- break;
- case KIO::UDS_NAME:
- kdDebug(PLP_DEBUGAREA) << "Name : " <<
- ((*it).m_str.ascii() ) << endl;
- //m_strText = decodeFileName( (*it).m_str );
- break;
- case KIO::UDS_URL:
- kdDebug(PLP_DEBUGAREA) << "URL : " <<
- ((*it).m_str.ascii() ) << endl;
- break;
- case KIO::UDS_MIME_TYPE:
- kdDebug(PLP_DEBUGAREA) << "MimeType : " <<
- ((*it).m_str.ascii() ) << endl;
- break;
- case KIO::UDS_LINK_DEST:
- kdDebug(PLP_DEBUGAREA) << "LinkDest : " <<
- ((*it).m_str.ascii() ) << endl;
- break;
- }
- }
+void PLPProtocol::
+completeUDSEntry(UDSEntry& entry, PlpDirent &e, bool rom) {
+ UDSAtom atom;
+ long attr = e.getAttr();
+
+ if (rom)
+ attr |= rfsv::PSI_A_RDONLY;
+
+ atom.m_uds = KIO::UDS_SIZE;
+ atom.m_long = e.getSize();
+ entry.append(atom);
+
+ if (attr & rfsv::PSI_A_DIR)
+ atom.m_uds = KIO::UDS_CREATION_TIME;
+ else
+ atom.m_uds = KIO::UDS_MODIFICATION_TIME;
+ atom.m_long = e.getPsiTime().getTime();
+ entry.append(atom);
+
+ atom.m_uds = KIO::UDS_ACCESS;
+ atom.m_long = S_IRUSR | S_IRGRP | S_IROTH;
+ if (attr & rfsv::PSI_A_DIR)
+ atom.m_long |= S_IXUSR | S_IXGRP | S_IXOTH;
+ if (!(attr & rfsv::PSI_A_RDONLY))
+ atom.m_long |= S_IWUSR | S_IWGRP | S_IWOTH;
+ entry.append(atom);
+
+ atom.m_uds = KIO::UDS_FILE_TYPE;
+ atom.m_long = (attr & rfsv::PSI_A_DIR) ? S_IFDIR : S_IFREG;
+ entry.append(atom);
+
+ setOwner(entry);
+
+#if 1
+ KIO::UDSEntry::ConstIterator it = entry.begin();
+ for( ; it != entry.end(); it++ ) {
+ switch ((*it).m_uds) {
+ case KIO::UDS_FILE_TYPE:
+ kdDebug(PLP_DEBUGAREA) << "File Type : " <<
+ (mode_t)((*it).m_long) << endl;
+ break;
+ case KIO::UDS_SIZE:
+ kdDebug(PLP_DEBUGAREA) << "File Size : " <<
+ (long)((*it).m_long) << endl;
+ break;
+ case KIO::UDS_ACCESS:
+ kdDebug(PLP_DEBUGAREA) << "Access permissions : " <<
+ (mode_t)((*it).m_long) << endl;
+ break;
+ case KIO::UDS_USER:
+ kdDebug(PLP_DEBUGAREA) << "User : " <<
+ ((*it).m_str.ascii() ) << endl;
+ break;
+ case KIO::UDS_GROUP:
+ kdDebug(PLP_DEBUGAREA) << "Group : " <<
+ ((*it).m_str.ascii() ) << endl;
+ break;
+ case KIO::UDS_NAME:
+ kdDebug(PLP_DEBUGAREA) << "Name : " <<
+ ((*it).m_str.ascii() ) << endl;
+ //m_strText = decodeFileName( (*it).m_str );
+ break;
+ case KIO::UDS_URL:
+ kdDebug(PLP_DEBUGAREA) << "URL : " <<
+ ((*it).m_str.ascii() ) << endl;
+ break;
+ case KIO::UDS_MIME_TYPE:
+ kdDebug(PLP_DEBUGAREA) << "MimeType : " <<
+ ((*it).m_str.ascii() ) << endl;
+ break;
+ case KIO::UDS_LINK_DEST:
+ kdDebug(PLP_DEBUGAREA) << "LinkDest : " <<
+ ((*it).m_str.ascii() ) << endl;
+ break;
+ }
+ }
#endif
}
void PLPProtocol::
setHost(const QString& host, int port, const QString&, const QString&) {
- kdDebug(PLP_DEBUGAREA) << "setHost(" << host << "," << port << ")" << endl;
- QString tmphost = host;
- if (host.isEmpty())
- tmphost = "localhost";
- if (port == 0) {
- struct servent *se = getservbyname("psion", "tcp");
- endservent();
- if (se != 0L)
- port = ntohs(se->s_port);
- else
- port = DPORT;
- }
- if ((tmphost == currentHost) && (port == currentPort))
- return;
- currentHost = tmphost;
- currentPort = port;
- closeConnection();
+ kdDebug(PLP_DEBUGAREA) << "setHost(" << host << "," << port << ")" << endl;
+ QString tmphost = host;
+ if (host.isEmpty())
+ tmphost = "localhost";
+ if (port == 0) {
+ struct servent *se = getservbyname("psion", "tcp");
+ endservent();
+ if (se != 0L)
+ port = ntohs(se->s_port);
+ else
+ port = DPORT;
+ }
+ if ((tmphost == currentHost) && (port == currentPort))
+ return;
+ currentHost = tmphost;
+ currentPort = port;
+ closeConnection();
}
void PLPProtocol::
mkdir(const KURL& url, int) {
- kdDebug(PLP_DEBUGAREA) << "mkdir" << endl;
- QString name(QFile::encodeName(url.path()));
-
- if (checkConnection())
- return;
- kdDebug(PLP_DEBUGAREA) << "mkdir(" << name << ")" << endl;
- if (isRomDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
- return;
- }
- if (isRoot(name) || isDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
- return;
- }
- convertName(name);
- Enum<rfsv::errs> res = plpRfsv->mkdir(name);
- if (checkForError(res), url.path())
- return;
- finished();
+ kdDebug(PLP_DEBUGAREA) << "mkdir" << endl;
+ QString name(QFile::encodeName(url.path(-1)));
+
+ if (checkConnection())
+ return;
+ kdDebug(PLP_DEBUGAREA) << "mkdir(" << name << ")" << endl;
+ if (isRomDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
+ return;
+ }
+ if (isRoot(name) || isDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
+ return;
+ }
+ convertName(name);
+ Enum<rfsv::errs> res = plpRfsv->mkdir(name.latin1());
+ if (checkForError(res, url.path()))
+ return;
+ finished();
}
bool PLPProtocol::
checkForError(Enum<rfsv::errs> res, QString n1, QString n2) {
- if (res != rfsv::E_PSI_GEN_NONE) {
- kdDebug(PLP_DEBUGAREA) << "plp error: " << res << endl;
- QString reason(res.toString().data());
- QString text;
- if (!!n1 && !!n2)
- text = i18n("%1 or %2: %3").arg(n1).arg(n2).arg(reason);
- else {
- if (!!n1 || !!n2)
- text = QString("%1: %2").arg(n1 ? n1 : n2).arg(reason);
- else
- text = reason;
- }
- switch (res) {
- case rfsv::E_PSI_FILE_ACCESS:
- error(ERR_ACCESS_DENIED, text);
- break;
- case rfsv::E_PSI_FILE_EXIST:
- error(ERR_FILE_ALREADY_EXIST, text);
- break;
- case rfsv::E_PSI_FILE_NXIST:
- error(ERR_DOES_NOT_EXIST, text);
- break;
- case rfsv::E_PSI_FILE_DIR:
- error(ERR_IS_DIRECTORY, text);
- break;
- default:
- error(ERR_UNKNOWN, text);
- break;
- }
- return true;
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ kdDebug(PLP_DEBUGAREA) << "plp error: " << res << endl;
+ QString reason(res);
+ QString text;
+ if (!!n1 && !!n2)
+ text = i18n("%1 or %2: %3").arg(n1).arg(n2).arg(reason);
+ else {
+ if (!!n1 || !!n2)
+ text = QString("%1: %2").arg(n1 ? n1 : n2).arg(reason);
+ else
+ text = reason;
+ }
+ switch (res) {
+ case rfsv::E_PSI_FILE_ACCESS:
+ error(ERR_ACCESS_DENIED, text);
+ break;
+ case rfsv::E_PSI_FILE_EXIST:
+ error(ERR_FILE_ALREADY_EXIST, text);
+ break;
+ case rfsv::E_PSI_FILE_NXIST:
+ error(ERR_DOES_NOT_EXIST, text);
+ break;
+ case rfsv::E_PSI_FILE_DIR:
+ error(ERR_IS_DIRECTORY, text);
+ break;
+ default:
+ error(ERR_UNKNOWN, text);
+ break;
}
- return false;
+ return true;
+ }
+ return false;
}
void PLPProtocol::
del( const KURL& url, bool isfile) {
- kdDebug(PLP_DEBUGAREA) << "del" << endl;
- QString name(QFile::encodeName(url.path()));
-
- if (checkConnection())
- return;
- kdDebug(PLP_DEBUGAREA) << "del(" << name << ")" << endl;
- if (isRomDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
- return;
- }
- if (isRoot(name) || isDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
- return;
- }
- convertName(name);
-
- Enum<rfsv::errs> res =
- (isfile) ? plpRfsv->remove(name) : plpRfsv->rmdir(name);
- if (checkForError(res, url.path()))
- return;
- finished();
+ kdDebug(PLP_DEBUGAREA) << "del" << endl;
+ QString name(QFile::encodeName(url.path(-1)));
+
+ if (checkConnection())
+ return;
+ kdDebug(PLP_DEBUGAREA) << "del(" << name << ")" << endl;
+ if (isRomDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
+ return;
+ }
+ if (isRoot(name) || isDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
+ return;
+ }
+ convertName(name);
+
+ Enum<rfsv::errs> res =
+ (isfile) ? plpRfsv->remove(name.latin1()) : plpRfsv->rmdir(name.latin1());
+ if (checkForError(res, url.path()))
+ return;
+ finished();
}
void PLPProtocol::
chmod( const KURL& url, int permissions ) {
- kdDebug(PLP_DEBUGAREA) << "del" << endl;
- QString name(QFile::encodeName(url.path()));
-
- if (checkConnection())
- return;
- kdDebug(PLP_DEBUGAREA) << "chmod(" << name << ")" << endl;
- if (isRomDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
- return;
- }
- if (isRoot(name) || isDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
- return;
- }
- convertName(name);
- long attr[2];
- attr[0] = attr[1] = 0;
- Enum <rfsv::errs> res = plpRfsv->fsetattr(name, attr[0], attr[1]);
- if (checkForError(res, url.path()))
- return;
- finished();
+ kdDebug(PLP_DEBUGAREA) << "del" << endl;
+ QString name(QFile::encodeName(url.path(-1)));
+
+ if (checkConnection())
+ return;
+ kdDebug(PLP_DEBUGAREA) << "chmod(" << name << ")" << endl;
+ if (isRomDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
+ return;
+ }
+ if (isRoot(name) || isDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
+ return;
+ }
+ convertName(name);
+ long attr[2];
+ attr[0] = attr[1] = 0;
+ Enum <rfsv::errs> res = plpRfsv->fsetattr(name.latin1(), attr[0], attr[1]);
+ if (checkForError(res, url.path()))
+ return;
+ finished();
}
void PLPProtocol::
get( const KURL& url ) {
- kdDebug(PLP_DEBUGAREA) << "get" << endl;
- QString name(QFile::encodeName(url.path()));
-
- if (checkConnection())
- return;
- kdDebug(PLP_DEBUGAREA) << "get(" << name << ")" << endl;
- if (isRoot(name) || isDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
- return;
+ kdDebug(PLP_DEBUGAREA) << "get" << endl;
+ QString name(QFile::encodeName(url.path(-1)));
+
+ if (checkConnection())
+ return;
+ kdDebug(PLP_DEBUGAREA) << "get(" << name << ")" << endl;
+ if (isRoot(name) || isDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
+ return;
+ }
+ convertName(name);
+
+ Enum<rfsv::errs> res;
+ u_int32_t handle;
+ u_int32_t len;
+ u_int32_t size;
+ u_int32_t total = 0;
+
+ if (emitTotalSize(name))
+ return;
+ res = plpRfsv->fopen(plpRfsv->opMode(rfsv::PSI_O_RDONLY), name.latin1(), handle);
+ if (checkForError(res, url.path()))
+ return;
+
+ QByteArray a(RFSV_SENDLEN);
+ do {
+ if ((res = plpRfsv->fread(handle, (unsigned char *)(a.data()),
+ RFSV_SENDLEN, len)) == rfsv::E_PSI_GEN_NONE) {
+ if (len < RFSV_SENDLEN)
+ a.resize(len);
+ data(a);
+ total += len;
+ calcprogress(total);
}
- convertName(name);
-
- Enum<rfsv::errs> res;
- u_int32_t handle;
- u_int32_t len;
- u_int32_t size;
- u_int32_t total = 0;
+ } while ((len > 0) && (res == rfsv::E_PSI_GEN_NONE));
+ plpRfsv->fclose(handle);
+ if (checkForError(res, url.path()))
+ return;
+ data(QByteArray());
- if (emitTotalSize(name))
- return;
- res = plpRfsv->fopen(plpRfsv->opMode(rfsv::PSI_O_RDONLY), name, handle);
- if (checkForError(res, url.path()))
- return;
-
- QByteArray a(RFSV_SENDLEN);
- do {
- if ((res = plpRfsv->fread(handle, (unsigned char *)(a.data()),
- RFSV_SENDLEN, len)) == rfsv::E_PSI_GEN_NONE) {
- if (len < RFSV_SENDLEN)
- a.resize(len);
- data(a);
- total += len;
- calcprogress(total);
- }
- } while ((len > 0) && (res == rfsv::E_PSI_GEN_NONE));
- plpRfsv->fclose(handle);
- if (checkForError(res, url.path()))
- return;
- data(QByteArray());
-
- finished();
+ finished();
}
//TODO the partial putting thing is not yet implemented
void PLPProtocol::
put( const KURL& url, int _mode, bool _overwrite, bool /*_resume*/ ) {
- kdDebug(PLP_DEBUGAREA) << "get" << endl;
- QString name(QFile::encodeName(url.path()));
-
- if (checkConnection())
- return;
- kdDebug(PLP_DEBUGAREA) << "put(" << name << ")" << endl;
- if (isRomDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
- return;
- }
- if (isRoot(name) || isDrive(name)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
- return;
- }
- convertName(name);
-
- Enum<rfsv::errs> res;
- u_int32_t handle;
- int result;
-
- res = plpRfsv->fcreatefile(plpRfsv->opMode(rfsv::PSI_O_RDWR), name, handle);
- if ((res == rfsv::E_PSI_FILE_EXIST) && _overwrite)
- res = plpRfsv->freplacefile(plpRfsv->opMode(rfsv::PSI_O_RDWR), name, handle);
- if (checkForError(res, url.path()))
- return;
-
- do {
- QByteArray a;
- dataReq();
- result = readData(a);
- const unsigned char *data = (const unsigned char *)(a.data());
- long len = a.size();
-
- if (result > 0)
- do {
- u_int32_t written;
- u_int32_t count = (len > RFSV_SENDLEN) ? RFSV_SENDLEN : len;
- res = plpRfsv->fwrite(handle, data, count, written);
- if (checkForError(res, url.path())) {
- plpRfsv->fclose(handle);
- return;
- }
- len -= written;
- data += written;
- } while (len > 0);
- } while (result > 0);
- plpRfsv->fclose(handle);
- finished();
+ kdDebug(PLP_DEBUGAREA) << "get" << endl;
+ QString name(QFile::encodeName(url.path(-1)));
+
+ if (checkConnection())
+ return;
+ kdDebug(PLP_DEBUGAREA) << "put(" << name << ")" << endl;
+ if (isRomDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path()));
+ return;
+ }
+ if (isRoot(name) || isDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path()));
+ return;
+ }
+ convertName(name);
+
+ Enum<rfsv::errs> res;
+ u_int32_t handle;
+ int result;
+
+ res = plpRfsv->fcreatefile(plpRfsv->opMode(rfsv::PSI_O_RDWR), name.latin1(), handle);
+ if ((res == rfsv::E_PSI_FILE_EXIST) && _overwrite)
+ res = plpRfsv->freplacefile(plpRfsv->opMode(rfsv::PSI_O_RDWR), name.latin1(), handle);
+ if (checkForError(res, url.path()))
+ return;
+
+ do {
+ QByteArray a;
+ dataReq();
+ result = readData(a);
+ const unsigned char *data = (const unsigned char *)(a.data());
+ long len = a.size();
+
+ if (result > 0)
+ do {
+ u_int32_t written;
+ u_int32_t count = (len > RFSV_SENDLEN) ? RFSV_SENDLEN : len;
+ res = plpRfsv->fwrite(handle, data, count, written);
+ if (checkForError(res, url.path())) {
+ plpRfsv->fclose(handle);
+ return;
+ }
+ len -= written;
+ data += written;
+ } while (len > 0);
+ } while (result > 0);
+ plpRfsv->fclose(handle);
+ finished();
}
void PLPProtocol::
rename(const KURL &src, const KURL &dest, bool _overwrite) {
- QString from(QFile::encodeName(src.path()));
- QString to(QFile::encodeName(dest.path()));
-
- if (checkConnection())
- return;
- kdDebug(PLP_DEBUGAREA) << "rename(" << from << "," << to << ")" << endl;
- if ((driveChar(from) != driveChar(to)) && (driveChar(to) != '\0')) {
- error(ERR_ACCESS_DENIED, i18n("%1 or %2: virtual directory").arg(src.path()).arg(dest.path()));
- kdDebug(PLP_DEBUGAREA) << "from FS != to FS" << endl;
- return;
- }
- if (isRomDrive(from)) {
- error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(src.path()));
- kdDebug(PLP_DEBUGAREA) << "from ROFS" << endl;
- return;
- }
- if (isRoot(from)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(src.path()));
- kdDebug(PLP_DEBUGAREA) << "from VFS" << endl;
- return;
- }
- bool volRename = isDrive(from);
- if (isRomDrive(to)) {
- error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(dest.path()));
- kdDebug(PLP_DEBUGAREA) << "to ROFS" << endl;
- return;
- }
- if (isRoot(to)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(dest.path()));
- kdDebug(PLP_DEBUGAREA) << "to VFS" << endl;
- return;
+ QString from(QFile::encodeName(src.path(-1)));
+ QString to(QFile::encodeName(dest.path(-1)));
+
+ if (checkConnection())
+ return;
+ kdDebug(PLP_DEBUGAREA) << "rename(" << from << "," << to << ")" << endl;
+ if ((driveChar(from) != driveChar(to)) && (driveChar(to) != '\0')) {
+ error(ERR_ACCESS_DENIED, i18n("%1 or %2: virtual directory").arg(src.path()).arg(dest.path()));
+ kdDebug(PLP_DEBUGAREA) << "from FS != to FS" << endl;
+ return;
+ }
+ if (isRomDrive(from)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(src.path()));
+ kdDebug(PLP_DEBUGAREA) << "from ROFS" << endl;
+ return;
+ }
+ if (isRoot(from)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(src.path()));
+ kdDebug(PLP_DEBUGAREA) << "from VFS" << endl;
+ return;
+ }
+ bool volRename = isDrive(from);
+ if (isRomDrive(to)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(dest.path()));
+ kdDebug(PLP_DEBUGAREA) << "to ROFS" << endl;
+ return;
+ }
+ if (isRoot(to)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(dest.path()));
+ kdDebug(PLP_DEBUGAREA) << "to VFS" << endl;
+ return;
+ }
+
+ Enum <rfsv::errs> res;
+ kdDebug(PLP_DEBUGAREA) << "ren: from=" << from << " to=" << to << endl;
+ if (volRename) {
+ to = to.mid(1);
+ res = plpRfsv->setVolumeName(driveChar(from), to);
+ if (res == rfsv::E_PSI_GEN_NONE) {
+ char drvc = driveChar(from);
+ drivechars.remove(from);
+ drivechars.insert(to, drvc);
}
+ } else {
+ convertName(from);
+ convertName(to);
+ if (!_overwrite) {
+ u_int32_t attr;
+ if ((res = plpRfsv->fgetattr(to.latin1(), attr)) == rfsv::E_PSI_GEN_NONE) {
- Enum <rfsv::errs> res;
- kdDebug(PLP_DEBUGAREA) << "ren: from=" << from << " to=" << to << endl;
- if (volRename) {
- to = to.mid(1);
- res = plpRfsv->setVolumeName(driveChar(from), to);
- if (res == rfsv::E_PSI_GEN_NONE) {
- char drvc = driveChar(from);
- drivechars.remove(from);
- drivechars.insert(to, drvc);
- }
- } else {
- convertName(from);
- convertName(to);
- if (!_overwrite) {
- u_int32_t attr;
- if ((res = plpRfsv->fgetattr(to, attr)) == rfsv::E_PSI_GEN_NONE) {
-
- error(ERR_FILE_ALREADY_EXIST, to);
- return;
- }
- }
- res = plpRfsv->rename(from, to);
- }
- if (checkForError(res, src.path(), dest.path()))
+ error(ERR_FILE_ALREADY_EXIST, to);
return;
- finished();
+ }
+ }
+ res = plpRfsv->rename(from.latin1(), to.latin1());
+ }
+ if (checkForError(res, src.path(), dest.path()))
+ return;
+ finished();
}
extern "C" {
-static int
-progresswrapper(void *ptr, u_int32_t total) {
-
+ static int
+ progresswrapper(void *ptr, u_int32_t total) {
+
((PLPProtocol *)ptr)->calcprogress(total);
return 1;
-}
+ }
}
void PLPProtocol::
calcprogress(long total) {
- time_t t = time(0);
- if (t - t_last) {
- processedSize(total);
- speed(total / (t - t_start));
- t_last = t;
- }
+ time_t t = time(0);
+ if (t - t_last) {
+ processedSize(total);
+ speed(total / (t - t_start));
+ t_last = t;
+ }
}
void PLPProtocol::
copy( const KURL &src, const KURL &dest, int _mode, bool _overwrite ) {
- QString from( QFile::encodeName(src.path()));
- QString to( QFile::encodeName(dest.path()));
+ QString from( QFile::encodeName(src.path(-1)));
+ QString to( QFile::encodeName(dest.path(-1)));
+
+ if (checkConnection())
+ return;
+ kdDebug(PLP_DEBUGAREA) << "copy(" << from << "," << to << ")" << endl;
+ if (isRoot(from) || isDrive(from)) {
+ error(ERR_ACCESS_DENIED, i18n("%1 or %2: virtual directory").arg(src.path()).arg(dest.path()));
+ return;
+ }
+ convertName(from);
+ if (isRomDrive(to)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(dest.path()));
+ return;
+ }
+ if (isRoot(to) || isDrive(to)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(dest.path()));
+ return;
+ }
+ convertName(to);
+ Enum <rfsv::errs> res;
+ if (!_overwrite) {
+ u_int32_t attr;
+ if ((res = plpRfsv->fgetattr(to.latin1(), attr)) == rfsv::E_PSI_GEN_NONE) {
+ error(ERR_FILE_ALREADY_EXIST, to);
+ return;
+ }
+ }
+ if (emitTotalSize(from))
+ return;
+ t_last = t_start = time(0);
+ res = plpRfsv->copyOnPsion(from.latin1(), to.latin1(), (void *)this, progresswrapper);
+ if (checkForError(res, src.path(), dest.path()))
+ return;
+ finished();
+}
+
+void PLPProtocol::
+special(const QByteArray &a) {
+ kdDebug(PLP_DEBUGAREA) << "special()" << endl;
+
+ QDataStream stream(a, IO_ReadOnly);
+ int cmd;
+ UDSEntry entry;
+ UDSAtom atom;
+
+ if (checkConnection())
+ return;
+
+ stream >> cmd;
- if (checkConnection())
+ switch (cmd) {
+ case 1: {
+ kdDebug(PLP_DEBUGAREA) << "get DriveDetails" << endl;
+ QString param;
+ PlpDrive drive;
+
+ Enum<rfsv::errs> res;
+ int drv;
+
+ stream >> param;
+ cout << "p='" << param << "'" << endl;
+ if (param.isEmpty()) {
+ error(ERR_MALFORMED_URL, i18n("(empty)"));
return;
- kdDebug(PLP_DEBUGAREA) << "copy(" << from << "," << to << ")" << endl;
- if (isRoot(from) || isDrive(from)) {
- error(ERR_ACCESS_DENIED, i18n("%1 or %2: virtual directory").arg(src.path()).arg(dest.path()));
+ }
+ if (!isDrive(param)) {
+ error(ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, param);
return;
- }
- convertName(from);
- if (isRomDrive(to)) {
- error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(dest.path()));
+ }
+ param = param.mid(1);
+ drv = drivechars[param] - 'A';
+ res = plpRfsv->devinfo(drv, drive);
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ error(ERR_COULD_NOT_STAT, param);
return;
+ }
+
+ string mtype;
+ drive.getMediaType(mtype);
+
+ // DriveLetter
+ atom.m_uds = KIO::UDS_USER;
+ atom.m_str = QString("%1").arg(drivechars[param]);
+ entry.append(atom);
+ // TypeName
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = QString(mtype.c_str());
+ entry.append(atom);
+ // Total capacity
+ atom.m_uds = KIO::UDS_SIZE;
+ atom.m_long = drive.getSize();
+ entry.append(atom);
+ // Free capacity
+ atom.m_uds = KIO::UDS_MODIFICATION_TIME;
+ atom.m_long = drive.getSpace();
+ entry.append(atom);
+ // UID
+ atom.m_uds = KIO::UDS_CREATION_TIME;
+ atom.m_long = drive.getUID();
+ entry.append(atom);
+
+ statEntry(entry);
}
- if (isRoot(to) || isDrive(to)) {
- error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(dest.path()));
+ break;
+ case 2: {
+ kdDebug(PLP_DEBUGAREA) << "get Ownerinfo" << endl;
+ bufferArray b;
+
+ Enum<rfsv::errs> res = plpRpcs->getOwnerInfo(b);
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ error(ERR_COULD_NOT_STAT, "Owner");
return;
+ }
+ QString param = "";
+ while (!b.empty()) {
+ param += b.pop().getString();
+ param += "\n";
+ }
+ // Owner-String
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = param;
+ entry.append(atom);
+ statEntry(entry);
}
- convertName(to);
- Enum <rfsv::errs> res;
- if (!_overwrite) {
- u_int32_t attr;
- if ((res = plpRfsv->fgetattr(to, attr)) == rfsv::E_PSI_GEN_NONE) {
- error(ERR_FILE_ALREADY_EXIST, to);
- return;
- }
- }
- if (emitTotalSize(from))
- return;
- t_last = t_start = time(0);
- res = plpRfsv->copyOnPsion(from, to, (void *)this, progresswrapper);
- if (checkForError(res, src.path(), dest.path()))
+ break;
+ case 3: {
+ kdDebug(PLP_DEBUGAREA) << "get Fileattribs" << endl;
+
+ QString name;
+ PlpDirent e;
+ bool isRoFS;
+
+ stream >> name;
+
+ if (name.isEmpty()) {
+ error(ERR_MALFORMED_URL, i18n("(empty)"));
return;
- finished();
-}
+ }
+ if (isRoot(name) || isDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(name));
+ return;
+ }
+ isRoFS = isRomDrive(name);
+ convertName(name);
+ Enum<rfsv::errs> res = plpRfsv->fgeteattr(name.latin1(), e);
+ if (checkForError(res, name))
+ return;
+ // Attributes
+ atom.m_uds = KIO::UDS_SIZE;
+ atom.m_long = e.getAttr();
+ entry.append(atom);
+ // bool ReadonlyFS (for disabling checkboxes in attr dialog)
+ atom.m_uds = KIO::UDS_CREATION_TIME;
+ u_int32_t flags = (machType == rpcs::PSI_MACH_S5) ? 1 : 0;
+ flags |= (isRoFS) ? 2 : 0;
+ atom.m_long = flags;
+ entry.append(atom);
+ // Psion Path
+ atom.m_uds = KIO::UDS_NAME;
+ atom.m_str = name;
+ entry.append(atom);
+
+ statEntry(entry);
+ kdDebug(PLP_DEBUGAREA) << "get Fileattribs done OK" << endl;
+ }
+ break;
+ case 4: {
+ kdDebug(PLP_DEBUGAREA) << "set Fileattribs" << endl;
-void PLPProtocol::
-special(const QByteArray &a) {
- kdDebug(PLP_DEBUGAREA) << "special()" << endl;
+ QString name;
+ u_int32_t seta, unseta;
- QDataStream stream(a, IO_ReadOnly);
- int tmp;
- UDSEntry entry;
- UDSAtom atom;
+ stream >> seta >> unseta >> name;
- stream >> tmp;
-
- switch (tmp) {
- case 1: {
- QString param;
- PlpDrive drive;
-
- Enum<rfsv::errs> res;
- int drv;
-
- stream >> param;
-
- if (!isDrive(QString("/") + param)) {
- error(ERR_PROTOCOL_IS_NOT_A_FILESYSTEM, param);
- return;
- }
- drv = drivechars[param] - 'A';
- res = plpRfsv->devinfo(drv, drive);
- if (res != rfsv::E_PSI_GEN_NONE) {
- error(ERR_COULD_NOT_STAT, param);
- return;
- }
-
- string mtype;
- drive.getMediaType(mtype);
-
- // DriveLetter
- atom.m_uds = KIO::UDS_USER;
- atom.m_str = QString("%1").arg(drivechars[param]);
- entry.append(atom);
- // TypeName
- atom.m_uds = KIO::UDS_NAME;
- atom.m_str = QString(mtype.c_str());
- entry.append(atom);
- // Total capacity
- atom.m_uds = KIO::UDS_SIZE;
- atom.m_long = drive.getSize();
- entry.append(atom);
- // Free capacity
- atom.m_uds = KIO::UDS_MODIFICATION_TIME;
- atom.m_long = drive.getSpace();
- entry.append(atom);
- // UID
- atom.m_uds = KIO::UDS_CREATION_TIME;
- atom.m_long = drive.getUID();
- entry.append(atom);
- statEntry(entry);
- }
- break;
- default:
- error(ERR_UNSUPPORTED_PROTOCOL, QString(i18n("Code: %1")).arg(tmp));
- return;
+ if (name.isEmpty()) {
+ error(ERR_MALFORMED_URL, i18n("(empty)"));
+ return;
+ }
+ if (isRoot(name) || isDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(name));
+ return;
+ }
+ if (isRomDrive(name)) {
+ error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(name));
+ return;
+ }
+ convertName(name);
+ Enum<rfsv::errs> res = plpRfsv->fsetattr(name.latin1(), seta,
+ unseta);
+ if (checkForError(res, name))
+ return;
}
- finished();
+ break;
+ case 5: {
+ kdDebug(PLP_DEBUGAREA) << "get machineInfo" << endl;
+ QByteArray a(sizeof(machInfo));
+ a.duplicate((const char *)&machInfo, sizeof(machInfo));
+ data(a);
+ data(QByteArray());
+ }
+ break;
+ default:
+ error(ERR_UNSUPPORTED_PROTOCOL, QString(i18n("Code: %1")).arg(cmd));
+ return;
+ }
+ finished();
}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/kde2/kioslave/kio_plp.h b/kde2/kioslave/kio_plp.h
index d5841bb..9119e6d 100644
--- a/kde2/kioslave/kio_plp.h
+++ b/kde2/kioslave/kio_plp.h
@@ -1,24 +1,27 @@
-/* This file is part of the KDE project
- Copyright (C) 2000 Alexander Neundorf <neundorf@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#ifndef KIO_PLP_H
-#define KIO_PLP_H
+/*-*-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
+ *
+ */
+#ifndef _KIO_PLP_H_
+#define _KIO_PLP_H_
#include <kio/slavebase.h>
#include <kio/global.h>
@@ -31,57 +34,66 @@
typedef QMap<PlpUID,QString> UidMap;
-class PLPProtocol : public KIO::SlaveBase
-{
+class PLPProtocol : public KIO::SlaveBase {
public:
- PLPProtocol (const QCString &pool, const QCString &app);
- virtual ~PLPProtocol();
+ PLPProtocol (const QCString &pool, const QCString &app);
+ virtual ~PLPProtocol();
- virtual void openConnection();
- virtual void closeConnection();
+ virtual void openConnection();
+ virtual void closeConnection();
+
+ virtual void setHost(const QString& host, int port, const QString&, const QString&);
- virtual void setHost(const QString& host, int port, const QString&, const QString&);
+ virtual void put(const KURL& url, int _mode,bool _overwrite, bool _resume);
+ virtual void get(const KURL& url);
+ virtual void listDir(const KURL& url);
+ virtual void stat(const KURL & url);
+ virtual void mimetype(const KURL & url);
+ virtual void mkdir(const KURL& url, int permissions);
+ virtual void del(const KURL& url, bool isfile);
+ virtual void chmod(const KURL& url, int permissions);
+ virtual void rename(const KURL &src, const KURL &dest, bool overwrite);
+ virtual void copy(const KURL& src, const KURL &dest, int mode, bool overwrite );
+ virtual void special(const QByteArray &a);
- virtual void put(const KURL& url, int _mode,bool _overwrite, bool _resume);
- virtual void get(const KURL& url);
- virtual void listDir(const KURL& url);
- virtual void stat(const KURL & url);
- virtual void mimetype(const KURL & url);
- virtual void mkdir(const KURL& url, int permissions);
- virtual void del(const KURL& url, bool isfile);
- virtual void chmod(const KURL& url, int permissions);
- virtual void rename(const KURL &src, const KURL &dest, bool overwrite);
- virtual void copy(const KURL& src, const KURL &dest, int mode, bool overwrite );
- virtual void special(const QByteArray &a);
+ void calcprogress(long total);
- void calcprogress(long total);
private:
- bool checkConnection();
+ bool checkConnection();
- char driveChar(const QString& path);
+ char driveChar(const QString& path);
- void createVirtualDirEntry(KIO::UDSEntry & entry, bool rdonly, int type);
- void completeUDSEntry(KIO::UDSEntry& entry, PlpDirent &e, bool rom);
- bool checkForError(Enum<rfsv::errs> res, QString name1 = QString(0), QString name2 = QString(0));
- bool isRomDrive(const QString& path);
- bool isDrive(const QString& path);
- bool isRoot(const QString& path);
- void convertName(QString &path);
- bool emitTotalSize(QString &name);
- QString uid2mime(PlpDirent &e);
- int checkSpecial(const QString& path);
+ void createVirtualDirEntry(KIO::UDSEntry & entry, bool rdonly, int type);
+ void completeUDSEntry(KIO::UDSEntry& entry, PlpDirent &e, bool rom);
+ bool checkForError(Enum<rfsv::errs> res, QString name1 = QString(0), QString name2 = QString(0));
+ bool isRomDrive(const QString& path);
+ bool isDrive(const QString& path);
+ bool isRoot(const QString& path);
+ void convertName(QString &path);
+ bool emitTotalSize(QString &name);
+ QString uid2mime(PlpDirent &e);
+ int checkSpecial(const QString& path);
+ void setOwner(KIO::UDSEntry & entry);
- rfsv *plpRfsv;
- ppsocket *plpRfsvSocket;
- QStringList drives;
- QMap<QString,char> drivechars;
- UidMap puids;
- QString currentHost;
- int currentPort;
- time_t t_last;
- time_t t_start;
- Enum<rpcs::machs> machType;
- rpcs::machineInfo mi;
+ rfsv *plpRfsv;
+ rpcs *plpRpcs;
+ ppsocket *plpRfsvSocket;
+ ppsocket *plpRpcsSocket;
+ QStringList drives;
+ QMap<QString,char> drivechars;
+ UidMap puids;
+ QString currentHost;
+ int currentPort;
+ time_t t_last;
+ time_t t_start;
+ Enum<rpcs::machs> machType;
+ rpcs::machineInfo machInfo;
};
#endif
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/kde2/kioslave/psion.protocol b/kde2/kioslave/psion.protocol
index c77c486..5281723 100644
--- a/kde2/kioslave/psion.protocol
+++ b/kde2/kioslave/psion.protocol
@@ -4,7 +4,7 @@ protocol=psion
input=none
output=filesystem
defaultMimetype=inode/directory
-listing=Name,Type,Size,Date,Access
+listing=Name,Type,Size,Date,Access,MimeType
reading=true
writing=true
makedir=true
diff --git a/kde2/kpsion/Makefile.am b/kde2/kpsion/Makefile.am
new file mode 100644
index 0000000..85f70fa
--- /dev/null
+++ b/kde2/kpsion/Makefile.am
@@ -0,0 +1,31 @@
+# $Id$
+
+METASOURCES = AUTO
+
+KDE_ICON = AUTO
+
+INCLUDES = $(all_includes) -I$(top_srcdir)/lib
+
+DISTCLEANFILES = $(kpsion_METASOURCES) ./.deps/* ./.deps/.P
+
+lib_LTLIBRARIES = libkpsion.la
+bin_PROGRAMS = kpsion
+
+libkpsion_la_LDFLAGS = $(LIBDEBUG) $(all_libraries) -module -version-info $(LIBVERSION)
+libkpsion_la_SOURCES = kpsion.cpp setupdialog.cpp wizards.cpp
+libkpsion_la_LIBADD = -L$(top_srcdir)/lib -lplp $(LIB_KFILE)
+
+kpsion_SOURCES = main.cpp
+kpsion_LDFLAGS = $(KDE_RPATH)
+kpsion_LDADD = libkpsion.la $(top_srcdir)/lib/libplp.la
+
+applnk_DATA = kpsion.desktop
+applnkdir = $(kde_appsdir)/Utilities
+
+rcdir = $(kde_datadir)/kpsion
+rc_DATA = kpsionui.rc
+
+noinst_HEADERS = kpsion.h setupdialog.h wizards.h
+
+messages:
+ $(XGETTEXT) -C -ki18n -kI18N_NOOP -ktranslate -kaliasLocale *.cpp *.h && mv messages.po ../po/kpsion.pot
diff --git a/kde2/kpsion/kpsion.cpp b/kde2/kpsion/kpsion.cpp
new file mode 100644
index 0000000..808ed1a
--- /dev/null
+++ b/kde2/kpsion/kpsion.cpp
@@ -0,0 +1,1046 @@
+/*-*-c++-*-
+ * $Id$
+ *
+ * This file is part of plptools.
+ *
+ * Copyright (C) 1999 Philip Proudman <philip.proudman@btinternet.com>
+ * Copyright (C) 2000, 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 "kpsion.h"
+#include "wizards.h"
+
+#include <kapp.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kstdaction.h>
+#include <kconfig.h>
+#include <kiconview.h>
+#include <kmessagebox.h>
+#include <kfileitem.h>
+
+#include <qwhatsthis.h>
+#include <qtimer.h>
+#include <qlayout.h>
+#include <qiodevice.h>
+#include <qdir.h>
+
+#include <ppsocket.h>
+#include <rfsvfactory.h>
+#include <rpcsfactory.h>
+#include <bufferarray.h>
+
+#include <iomanip>
+#include <strstream>
+
+// internal use for developing offline without
+// having a Psion connected.
+// !!!!! set to 0 for production code !!!!!
+#define OFFLINE 0
+
+#define STID_CONNECTION 1
+
+void KPsionCheckListItem::
+init(bool myparent) {
+ setSelectable(false);
+ dontPropagate = false;
+ parentIsKPsionCheckListItem = myparent;
+}
+
+void KPsionCheckListItem::
+setMetaData(int bType, time_t bWhen) {
+ backupType = bType;
+ when = bWhen;
+}
+
+void KPsionCheckListItem::
+stateChange(bool state) {
+ QCheckListItem::stateChange(state);
+
+ if (dontPropagate)
+ return;
+ if (parentIsKPsionCheckListItem)
+ ((KPsionCheckListItem *)parent())->propagateUp(state);
+ propagateDown(state);
+}
+
+void KPsionCheckListItem::
+propagateDown(bool state) {
+ setOn(state);
+ KPsionCheckListItem *child = (KPsionCheckListItem *)firstChild();
+ while (child) {
+ child->propagateDown(state);
+ child = (KPsionCheckListItem *)child->nextSibling();
+ }
+}
+
+void KPsionCheckListItem::
+propagateUp(bool state) {
+ bool deactivateThis = false;
+
+ KPsionCheckListItem *child = (KPsionCheckListItem *)firstChild();
+ while (child) {
+ if ((child->isOn() != state) || (!child->isEnabled())) {
+ deactivateThis = true;
+ break;
+ }
+ child = (KPsionCheckListItem *)child->nextSibling();
+ }
+ dontPropagate = true;
+ if (deactivateThis) {
+ setOn(true);
+ setEnabled(false);
+ } else {
+ setEnabled(true);
+ setOn(state);
+ }
+ // Bug in QListView? It doesn't update, when
+ // enabled/disabled without activating.
+ // -> force it.
+ listView()->repaintItem(this);
+ dontPropagate = false;
+ if (parentIsKPsionCheckListItem)
+ ((KPsionCheckListItem *)parent())->propagateUp(state);
+}
+
+KPsionBackupListView::KPsionBackupListView(QWidget *parent, const char *name)
+ : KListView(parent, name) {
+
+ toRestore.clear();
+ uid = QString::null;
+ KConfig *config = kapp->config();
+ config->setGroup("Settings");
+ backupDir = config->readEntry("BackupDir");
+ addColumn(i18n("Available backups"));
+ setRootIsDecorated(true);
+}
+
+void KPsionBackupListView::
+readBackups(QString uid) {
+ QString bdir(backupDir);
+ bdir += "/";
+ bdir += uid;
+ QDir d(bdir);
+ const QFileInfoList *fil =
+ d.entryInfoList("*.tar.gz", QDir::Files|QDir::Readable, QDir::Name);
+ QFileInfoListIterator it(*fil);
+ QFileInfo *fi;
+ while ((fi = it.current())) {
+ bool isValid = false;
+ KTarGz tgz(fi->absFilePath());
+ const KTarEntry *te;
+ QString bTypeName;
+ int bType;
+ QDateTime date;
+
+ tgz.open(IO_ReadOnly);
+ te = tgz.directory()->entry("KPsionFullIndex");
+ if (te && (!te->isDirectory())) {
+ date.setTime_t(te->date());
+ bTypeName = i18n("Full");
+ bType = FULL;
+ isValid = true;
+ } else {
+ te = tgz.directory()->entry("KPsionIncrementalIndex");
+ if (te && (!te->isDirectory())) {
+ date.setTime_t(te->date());
+ bTypeName = i18n("Incremental");
+ bType = INCREMENTAL;
+ isValid = true;
+ }
+ }
+
+ if (isValid) {
+ QString n = i18n("%1 backup, created at %2").arg(bTypeName).arg(date.toString());
+
+ KPsionCheckListItem *i =
+ new KPsionCheckListItem(this, n,
+ KPsionCheckListItem::CheckBox);
+ i->setMetaData(bType, te->date());
+ i->setPixmap(0, KGlobal::iconLoader()->loadIcon("mime_empty", KIcon::Small));
+ QStringList files = tgz.directory()->entries();
+ for (QStringList::Iterator f = files.begin();
+ f != files.end(); f++)
+ if ((*f != "KPsionFullIndex") &&
+ (*f != "KPsionIncrementalIndex"))
+ listTree(i, tgz.directory()->entry(*f), 0);
+ }
+ tgz.close();
+ ++it;
+ }
+}
+
+void KPsionBackupListView::
+listTree(KPsionCheckListItem *cli, const KTarEntry *te, int level) {
+ KPsionCheckListItem *i =
+ new KPsionCheckListItem(cli, te->name(),
+ KPsionCheckListItem::CheckBox);
+ if (te->isDirectory()) {
+ if (level)
+ i->setPixmap(0, KGlobal::iconLoader()->loadIcon("folder",
+ KIcon::Small));
+ else
+ i->setPixmap(0, KGlobal::iconLoader()->loadIcon("hdd_unmount",
+ KIcon::Small));
+ KTarDirectory *td = (KTarDirectory *)te;
+ QStringList files = td->entries();
+ for (QStringList::Iterator f = files.begin(); f != files.end(); f++)
+ listTree(i, td->entry(*f), level + 1);
+ } else
+ i->setPixmap(0, KGlobal::iconLoader()->loadIcon("mime_empty",
+ KIcon::Small));
+}
+
+PlpDir &KPsionBackupListView::
+getRestoreList() {
+ return toRestore;
+}
+
+KPsionMainWindow::KPsionMainWindow()
+ : KMainWindow() {
+ setupActions();
+
+ statusBar()->insertItem(i18n("Idle"), STID_CONNECTION, 1);
+ statusBar()->setItemAlignment(STID_CONNECTION,
+ QLabel::AlignLeft|QLabel::AlignVCenter);
+
+ backupRunning = false;
+ restoreRunning = false;
+ formatRunning = false;
+
+ view = new KIconView(this, "iconview");
+ view->setSelectionMode(KIconView::Multi);
+ view->setResizeMode(KIconView::Adjust);
+ view->setItemsMovable(false);
+ connect(view, SIGNAL(clicked(QIconViewItem *)),
+ SLOT(iconClicked(QIconViewItem *)));
+ connect(view, SIGNAL(onItem(QIconViewItem *)),
+ SLOT(iconOver(QIconViewItem *)));
+ KConfig *config = kapp->config();
+ config->setGroup("Psion");
+ QStringList uids = config->readListEntry("MachineUIDs");
+ for (QStringList::Iterator it = uids.begin(); it != uids.end(); it++) {
+ QString tmp = QString::fromLatin1("Name_%1").arg(*it);
+ machines.insert(*it, config->readEntry(tmp));
+ }
+ config->setGroup("Settings");
+ backupDir = config->readEntry("BackupDir");
+ config->setGroup("Connection");
+ reconnectTime = config->readNumEntry("Retry");
+ ncpdDevice = config->readEntry("Device", i18n("off"));
+ ncpdSpeed = config->readNumEntry("Speed", 115200);
+
+ QWhatsThis::add(view, i18n(
+ "<qt>Here, you see your Psion's drives.<br/>"
+ "Every drive is represented by an Icon. If you "
+ "click on it, it gets selected for the next "
+ "operation. E.g.: backup, restore or format.<br/>"
+ "To unselect it, simply click on it again.<br/>"
+ "Select as many drives a you want, then choose "
+ "an operation.</qt>"));
+ setCentralWidget(view);
+
+ rfsvSocket = 0L;
+ rpcsSocket = 0L;
+ plpRfsv = 0L;
+ plpRpcs = 0L;
+
+ firstTry = true;
+ connected = false;
+ shuttingDown = false;
+
+ tryConnect();
+}
+
+KPsionMainWindow::~KPsionMainWindow() {
+ shuttingDown = true;
+ if (plpRfsv)
+ delete plpRfsv;
+ if (plpRpcs)
+ delete plpRpcs;
+ if (rfsvSocket)
+ delete rfsvSocket;
+ if (rfsvSocket)
+ delete rpcsSocket;
+}
+
+void KPsionMainWindow::
+setupActions() {
+
+ KStdAction::quit(this, SLOT(close()), actionCollection());
+ KStdAction::showToolbar(this, SLOT(slotToggleToolbar()),
+ actionCollection());
+ KStdAction::showStatusbar(this, SLOT(slotToggleStatusbar()),
+ actionCollection());
+ KStdAction::saveOptions(this, SLOT(slotSaveOptions()),
+ actionCollection());
+ KStdAction::preferences(this, SLOT(slotPreferences()),
+ actionCollection());
+ new KAction(i18n("Start &Format"), 0L, 0, this,
+ SLOT(slotStartFormat()), actionCollection(), "format");
+ new KAction(i18n("Start Full &Backup"), "psion_backup", 0, this,
+ SLOT(slotStartFullBackup()), actionCollection(),
+ "fullbackup");
+ new KAction(i18n("Start &Incremental Backup"), "psion_backup", 0, this,
+ SLOT(slotStartIncBackup()), actionCollection(), "incbackup");
+ new KAction(i18n("Start &Restore"), "psion_restore", 0, this,
+ SLOT(slotStartRestore()), actionCollection(), "restore");
+ createGUI();
+
+ actionCollection()->action("fullbackup")->setEnabled(false);
+ actionCollection()->action("incbackup")->setEnabled(false);
+#if OFFLINE
+ actionCollection()->action("restore")->setEnabled(true);
+#else
+ actionCollection()->action("restore")->setEnabled(false);
+#endif
+ actionCollection()->action("format")->setEnabled(false);
+
+ actionCollection()->action("fullbackup")->
+ setToolTip(i18n("Full backup of selected drive(s)"));
+ actionCollection()->action("incbackup")->
+ setToolTip(i18n("Incremental backup of selected drive(s)"));
+ actionCollection()->action("restore")->
+ setToolTip(i18n("Restore selected drive(s)"));
+ actionCollection()->action("format")->
+ setToolTip(i18n("Format selected drive(s)"));
+}
+
+void KPsionMainWindow::
+iconOver(QIconViewItem *i) {
+ lastSelected = i->isSelected();
+}
+
+void KPsionMainWindow::
+switchActions() {
+ QIconViewItem *i;
+ bool rwSelected = false;
+ bool anySelected = false;
+
+ if (backupRunning | restoreRunning | formatRunning)
+ view->setEnabled(false);
+ else {
+ for (i = view->firstItem(); i; i = i->nextItem()) {
+ if (i->isSelected()) {
+ anySelected = true;
+ if (i->key() != "Z") {
+ rwSelected = true;
+ break;
+ }
+ }
+ }
+ view->setEnabled(true);
+ }
+#if OFFLINE
+ actionCollection()->action("restore")->setEnabled(true);
+#else
+ actionCollection()->action("restore")->setEnabled(rwSelected);
+#endif
+ actionCollection()->action("format")->setEnabled(rwSelected);
+ actionCollection()->action("fullbackup")->setEnabled(anySelected);
+ actionCollection()->action("incbackup")->setEnabled(anySelected);
+}
+
+void KPsionMainWindow::
+iconClicked(QIconViewItem *i) {
+ if (i == 0L)
+ return;
+ lastSelected = !lastSelected;
+ i->setSelected(lastSelected);
+ switchActions();
+}
+
+void KPsionMainWindow::
+insertDrive(char letter, const char * const name) {
+ QString tmp;
+
+ if (name && strlen(name))
+ tmp = QString::fromLatin1("%1 (%2:)").arg(name).arg(letter);
+ else
+ tmp = QString::fromLatin1("%1:").arg(letter);
+ drives.insert(letter,tmp);
+ QIconViewItem *it =
+ new QIconViewItem(view, tmp,
+ KFileItem(KURL(), "inode/x-psion-drive", 0).pixmap(0));
+ tmp = QString::fromLatin1("%1").arg(letter);
+ it->setKey(tmp);
+ it->setDropEnabled(false);
+ it->setDragEnabled(false);
+ it->setRenameEnabled(false);
+}
+
+void KPsionMainWindow::
+queryPsion() {
+ u_int32_t devbits;
+ Enum <rfsv::errs> res;
+
+ statusBar()->changeItem(i18n("Retrieving machine info ..."),
+ STID_CONNECTION);
+#if OFFLINE
+ machineUID = 0x1000118a0c428fa3ULL;
+ S5mx = true;
+ insertDrive('C', "Intern");
+ insertDrive('D', "Flash");
+ insertDrive('Z', "RomDrive");
+#else
+ rpcs::machineInfo mi;
+ if ((res = plpRpcs->getMachineInfo(mi)) != rfsv::E_PSI_GEN_NONE) {
+ QString msg = i18n("Could not get Psion machine info");
+ statusBar()->changeItem(msg, STID_CONNECTION);
+ KMessageBox::error(this, msg);
+ return;
+ }
+ machineUID = mi.machineUID;
+ S5mx = (strcmp(mi.machineName, "SERIES5mx") == 0);
+#endif
+
+ QString uid = getMachineUID();
+ bool machineFound = false;
+ KConfig *config = kapp->config();
+ config->setGroup("Psion");
+ machineName = i18n("an unknown machine");
+ psionMap::Iterator it;
+ for (it = machines.begin(); it != machines.end(); it++) {
+ if (uid == it.key()) {
+ machineName = it.data();
+ QString tmp =
+ QString::fromLatin1("BackupDrives_%1").arg(it.key());
+ backupDrives = config->readListEntry(tmp);
+ machineFound = true;
+ }
+ }
+#if (!(OFFLINE))
+ drives.clear();
+ statusBar()->changeItem(i18n("Retrieving drive list ..."),
+ STID_CONNECTION);
+ if ((res = plpRfsv->devlist(devbits)) != rfsv::E_PSI_GEN_NONE) {
+ QString msg = i18n("Could not get list of drives");
+ statusBar()->changeItem(msg, STID_CONNECTION);
+ KMessageBox::error(this, msg);
+ return;
+ }
+ for (int i = 0; i < 26; i++) {
+ if ((devbits & 1) != 0) {
+ PlpDrive drive;
+ if (plpRfsv->devinfo(i, drive) == rfsv::E_PSI_GEN_NONE)
+ insertDrive('A' + i, drive.getName().c_str());
+ }
+ devbits >>= 1;
+ }
+#endif
+ if (!machineFound) {
+ NewPsionWizard *wiz = new NewPsionWizard(this, "newpsionwiz");
+ wiz->exec();
+ }
+ statusBar()->changeItem(i18n("Connected to %1").arg(machineName),
+ STID_CONNECTION);
+}
+
+QString KPsionMainWindow::
+getMachineUID() {
+ // ??! None of QString's formatting methods knows about long long.
+ ostrstream s;
+ s << hex << setw(16) << machineUID;
+ QString ret = s.str();
+ ret = ret.left(16);
+ return ret;
+}
+
+bool KPsionMainWindow::
+queryClose() {
+ QString msg = 0L;
+
+ if (backupRunning)
+ msg = i18n("A backup is running.\nDo you really want to quit?");
+ if (restoreRunning)
+ msg = i18n("A restore is running.\nDo you really want to quit?");
+ if (formatRunning)
+ msg = i18n("A format is running.\nDo you really want to quit?");
+
+ if ((!msg.isNull()) &&
+ (KMessageBox::warningYesNo(this, msg) == KMessageBox::No))
+ return false;
+ return true;
+}
+
+void KPsionMainWindow::
+tryConnect() {
+#if (!(OFFLINE))
+ if (shuttingDown || connected)
+ return;
+ bool showMB = firstTry;
+ firstTry = false;
+
+ if (plpRfsv)
+ delete plpRfsv;
+ if (plpRpcs)
+ delete plpRpcs;
+ if (rfsvSocket)
+ delete rfsvSocket;
+ if (rfsvSocket)
+ delete rpcsSocket;
+
+ rfsvSocket = new ppsocket();
+ statusBar()->changeItem(i18n("Connecting ..."), STID_CONNECTION);
+ if (!rfsvSocket->connect(NULL, 7501)) {
+ statusMsg = i18n("RFSV could not connect to ncpd at %1:%2. ").arg("localhost").arg(7501);
+ if (reconnectTime) {
+ nextTry = reconnectTime;
+ statusMsg += i18n(" (Retry in %1 seconds.)");
+ QTimer::singleShot(1000, this, SLOT(slotUpdateTimer()));
+ }
+ statusBar()->changeItem(statusMsg.arg(reconnectTime),
+ STID_CONNECTION);
+ if (showMB)
+ KMessageBox::error(this, statusMsg.arg(reconnectTime));
+ return;
+ }
+ rfsvfactory factory(rfsvSocket);
+ plpRfsv = factory.create(false);
+ if (plpRfsv == 0L) {
+ statusMsg = i18n("RFSV could not establish link: %1.").arg(factory.getError());
+ delete rfsvSocket;
+ rfsvSocket = 0L;
+ if (reconnectTime) {
+ nextTry = reconnectTime;
+ statusMsg += i18n(" (Retry in %1 seconds.)");
+ QTimer::singleShot(1000, this, SLOT(slotUpdateTimer()));
+ }
+ statusBar()->changeItem(statusMsg.arg(reconnectTime),
+ STID_CONNECTION);
+ if (showMB)
+ KMessageBox::error(this, statusMsg.arg(reconnectTime));
+ return;
+ }
+
+ rpcsSocket = new ppsocket();
+ if (!rpcsSocket->connect(NULL, 7501)) {
+ statusMsg = i18n("RPCS could not connect to ncpd at %1:%2.").arg("localhost").arg(7501);
+ delete plpRfsv;
+ plpRfsv = 0L;
+ delete rfsvSocket;
+ rfsvSocket = 0L;
+ if (reconnectTime) {
+ nextTry = reconnectTime;
+ statusMsg += i18n(" (Retry in %1 seconds.)");
+ QTimer::singleShot(1000, this, SLOT(slotUpdateTimer()));
+ }
+ statusBar()->changeItem(statusMsg.arg(reconnectTime),
+ STID_CONNECTION);
+ if (showMB)
+ KMessageBox::error(this, statusMsg.arg(reconnectTime));
+ return;
+ }
+ rpcsfactory factory2(rpcsSocket);
+ plpRpcs = factory2.create(false);
+ if (plpRpcs == 0L) {
+ statusMsg = i18n("RPCS could not establish link: %1.").arg(factory.getError());
+ delete plpRfsv;
+ plpRfsv = 0L;
+ delete rfsvSocket;
+ rfsvSocket = 0L;
+ delete rpcsSocket;
+ rpcsSocket = 0L;
+ if (reconnectTime) {
+ nextTry = reconnectTime;
+ statusMsg += i18n(" (Retry in %1 seconds.)");
+ QTimer::singleShot(1000, this, SLOT(slotUpdateTimer()));
+ }
+ statusBar()->changeItem(statusMsg.arg(reconnectTime),
+ STID_CONNECTION);
+ if (showMB)
+ KMessageBox::error(this, statusMsg.arg(reconnectTime));
+ return;
+ }
+#endif
+ connected = true;
+ queryPsion();
+}
+
+void KPsionMainWindow::
+slotUpdateTimer() {
+ nextTry--;
+ if (nextTry <= 0)
+ tryConnect();
+ else {
+ statusBar()->changeItem(statusMsg.arg(nextTry), STID_CONNECTION);
+ QTimer::singleShot(1000, this, SLOT(slotUpdateTimer()));
+ }
+}
+
+void KPsionMainWindow::
+slotStartFullBackup() {
+ fullBackup = true;
+ doBackup();
+}
+
+void KPsionMainWindow::
+slotStartIncBackup() {
+ fullBackup = false;
+ doBackup();
+}
+
+void KPsionMainWindow::
+doBackup() {
+ backupRunning = true;
+ switchActions();
+ toBackup.clear();
+ KDialog *d = new KDialog(this, "backupDialog", false);
+ d->setCaption(i18n("Backup"));
+ QGridLayout *gl = new QGridLayout(d);
+ progressLabel = new KSqueezedTextLabel(d);
+ gl->addWidget(progressLabel, 1, 1);
+ progress = new KProgress(0, 100, 0, KProgress::Horizontal, d,
+ "backupProgress");
+
+ gl->addWidget(progress, 2, 1);
+ gl->addRowSpacing(0, KDialog::marginHint());
+ gl->addRowSpacing(3, KDialog::marginHint());
+ gl->addColSpacing(0, KDialog::marginHint());
+ gl->addColSpacing(2, KDialog::marginHint());
+ gl->setColStretch(1, 1);
+ gl->setRowStretch(1, 1);
+ d->setMinimumSize(250, 80);
+ d->show();
+
+ // Collect list of files to backup
+ backupSize = 0;
+ backupCount = 0;
+ progressTotal = 0;
+ for (QIconViewItem *i = view->firstItem(); i; i = i->nextItem()) {
+ if (i->isSelected()) {
+ QString drv = i->key();
+ drv += ":";
+ int drvNum = *(drv.data()) - 'A';
+ PlpDrive drive;
+ if (plpRfsv->devinfo(drvNum, drive) != rfsv::E_PSI_GEN_NONE) {
+ KMessageBox::error(this, i18n("Could not retrieve drive details for drive %1").arg(drv));
+ d->hide();
+ delete d;
+ backupRunning = false;
+ switchActions();
+ return;
+ }
+ progressLabel->setText(i18n("Scanning drive %1").arg(drv));
+
+ progressLocal = drive.getSize() - drive.getSpace();
+ progressLocalCount = 0;
+ progressLocalPercent = -1;
+ progress->setValue(0);
+ collectFiles(drv);
+ }
+ }
+ progressLabel->setText(i18n("%1 files need backup").arg(backupSize));
+ if (backupCount == 0) {
+ KMessageBox::information(this, i18n("No files need backup"));
+ d->hide();
+ delete d;
+ backupRunning = false;
+ switchActions();
+ return;
+ }
+
+ statusBar()->message(i18n("Backup"));
+ progressCount = 0;
+ progressTotal = backupSize;
+ progressPercent = -1;
+
+ // Create tgz with index file.
+ QString archiveName = backupDir;
+ if (archiveName.right(1) != "/")
+ archiveName += "/";
+ archiveName += getMachineUID();
+ QDir archiveDir(archiveName);
+ if (!archiveDir.exists())
+ if (!archiveDir.mkdir(archiveName)) {
+ KMessageBox::error(this, i18n("Could not create backup folder %1").arg(archiveName));
+ d->hide();
+ delete d;
+ statusBar()->clear();
+ backupRunning = false;
+ switchActions();
+ return;
+ }
+
+ archiveName += (fullBackup) ? "/F-" : "/I-";
+ time_t now = time(0);
+ char tstr[30];
+ strftime(tstr, sizeof(tstr), "%Y-%m-%d-%H-%M-%S.tar.gz",
+ localtime(&now));
+ archiveName += tstr;
+ backupTgz = new KTarGz(archiveName);
+ backupTgz->open(IO_WriteOnly);
+ createIndex();
+
+ // Kill all running applications on the Psion
+ // and save their state.
+ killSave();
+
+ bool badBackup = false;
+ Enum<rfsv::errs> res;
+ // Now the real backup
+ for (int i = 0; i < toBackup.size(); i++) {
+ PlpDirent e = toBackup[i];
+ const char *fn = e.getName();
+ const char *p;
+ char *q;
+ char unixname[1024];
+
+ for (p = fn, q = unixname; *p; p++, q++)
+ switch (*p) {
+ case '%':
+ *q++ = '%';
+ *q++ = '2';
+ *q = '5';
+ break;
+ case '/':
+ *q++ = '%';
+ *q++ = '2';
+ *q= 'f';
+ break;
+ case '\\':
+ *q = '/';
+ break;
+ default:
+ *q = *p;
+ }
+ *q = '\0';
+
+ ostrstream os;
+
+ progressLabel->setText(i18n("Backing up %1").arg(fn));
+ progressLocal = e.getSize();
+ progressLocalCount = 0;
+ progressLocalPercent = -1;
+ progress->setValue(0);
+
+ u_int32_t handle;
+
+ kapp->processEvents();
+ res = plpRfsv->fopen(plpRfsv->opMode(rfsv::PSI_O_RDONLY), fn,
+ handle);
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ if (KMessageBox::warningYesNo(this, i18n("<QT>Could not open<BR/><B>%1</B></QT>").arg(fn)) == KMessageBox::No) {
+ badBackup = true;
+ break;
+ } else {
+ e.setName("!");
+ continue;
+ }
+ }
+ unsigned char *buff = new unsigned char[RFSV_SENDLEN];
+ u_int32_t len;
+ do {
+ if ((res = plpRfsv->fread(handle, buff, RFSV_SENDLEN, len)) ==
+ rfsv::E_PSI_GEN_NONE) {
+ os.write(buff, len);
+ updateProgress(len);
+ }
+ kapp->processEvents();
+ } while ((len > 0) && (res == rfsv::E_PSI_GEN_NONE));
+ delete[]buff;
+ plpRfsv->fclose(handle);
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ if (KMessageBox::warningYesNo(this, i18n("<QT>Could not read<BR/><B>%1</B></QT>").arg(fn)) == KMessageBox::No) {
+ badBackup = true;
+ break;
+ } else {
+ e.setName("!");
+ continue;
+ }
+ }
+ backupTgz->writeFile(unixname, "root", "root", os.pcount(),
+ os.str());
+ }
+
+ if (!badBackup) {
+ // Reset archive attributes of all backuped files.
+ progressLabel->setText(i18n("Resetting archive attributes ..."));
+ progressLocal = backupSize;
+ progressLocalCount = 0;
+ progressLocalPercent = -1;
+ progress->setValue(0);
+ for (int i = 0; i < toBackup.size(); i++) {
+ PlpDirent e = toBackup[i];
+ const char *fn = e.getName();
+ if ((e.getAttr() & rfsv::PSI_A_ARCHIVE) &&
+ (strcmp(fn, "!") != 0)) {
+ kapp->processEvents();
+ res = plpRfsv->fsetattr(fn, 0, rfsv::PSI_A_ARCHIVE);
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ if (KMessageBox::warningYesNo(this, i18n("<QT>Could not set attributes of<BR/><B>%1</B></QT>").arg(fn)) == KMessageBox::No) {
+ break;
+ }
+ }
+ }
+ updateProgress(e.getSize());
+ }
+ }
+ // Restart previously running applications on the Psion
+ // from saved state info.
+ runRestore();
+
+ backupTgz->close();
+ delete backupTgz;
+ if (badBackup)
+ unlink(archiveName.data());
+ d->hide();
+ delete d;
+ backupRunning = false;
+ switchActions();
+ statusBar()->message(i18n("Backup done"), 2000);
+}
+
+void KPsionMainWindow::
+slotStartRestore() {
+ restoreRunning = true;
+ switchActions();
+
+ KDialog *d = new KDialog(this, "restoreDialog", true);
+ d->setCaption(i18n("Restore"));
+ QGridLayout *gl = new QGridLayout(d);
+ //progressLabel = new KSqueezedTextLabel(d);
+ KPsionBackupListView *v = new KPsionBackupListView(d, "restoreSelector");
+ gl->addWidget(v, 1, 1);
+ //progress = new KProgress(0, 100, 0, KProgress::Horizontal, d, "restoreProgress");
+
+ //gl->addWidget(progress, 2, 1);
+ gl->addRowSpacing(0, KDialog::marginHint());
+ gl->addRowSpacing(3, KDialog::marginHint());
+ gl->addColSpacing(0, KDialog::marginHint());
+ gl->addColSpacing(2, KDialog::marginHint());
+ gl->setColStretch(1, 1);
+ gl->setRowStretch(1, 1);
+ d->setMinimumSize(250, 80);
+ v->readBackups(getMachineUID());
+ d->exec();
+
+ d->hide();
+ delete d;
+ restoreRunning = false;
+ switchActions();
+ statusBar()->message(i18n("Restore done"), 2000);
+}
+
+void KPsionMainWindow::
+slotStartFormat() {
+ if (KMessageBox::warningYesNo(this, i18n(
+ "<QT>This erases <B>ALL</B> data "
+ "on the drive(s).<BR/>Do you really "
+ "want to proceed?"
+ )) == KMessageBox::No)
+ return;
+ formatRunning = true;
+ switchActions();
+}
+
+void KPsionMainWindow::
+slotToggleToolbar() {
+ if (toolBar()->isVisible())
+ toolBar()->hide();
+ else
+ toolBar()->show();
+}
+
+void KPsionMainWindow::
+slotToggleStatusbar() {
+ if (statusBar()->isVisible())
+ statusBar()->hide();
+ else
+ statusBar()->show();
+}
+
+void KPsionMainWindow::
+slotSaveOptions() {
+}
+
+void KPsionMainWindow::
+slotPreferences() {
+}
+
+void KPsionMainWindow::
+updateProgress(unsigned long amount) {
+ progressLocalCount += amount;
+ int lastPercent = progressLocalPercent;
+ if (progressLocal)
+ progressLocalPercent = progressLocalCount * 100 / progressLocal;
+ else
+ progressLocalPercent = 100;
+ if (progressLocalPercent != lastPercent)
+ progress->setValue(progressLocalPercent);
+ if (progressTotal > 0) {
+ progressCount += amount;
+ lastPercent = progressPercent;
+ if (progressTotal)
+ progressPercent = progressCount * 100 / progressTotal;
+ else
+ progressPercent = 100;
+ if (progressPercent != lastPercent)
+ statusBar()->message(i18n("Backup %1% complete").arg(progressPercent));
+ }
+}
+
+void KPsionMainWindow::
+collectFiles(QString dir) {
+ Enum<rfsv::errs> res;
+ PlpDir files;
+ QString tmp = dir;
+
+ kapp->processEvents();
+ tmp += "\\";
+ if ((res = plpRfsv->dir(tmp.data(), files)) != rfsv::E_PSI_GEN_NONE) {
+ // messagebox "Couldn't get directory ...."
+ } else
+ for (int i = 0; i < files.size(); i++) {
+ PlpDirent e = files[i];
+
+
+ long attr = e.getAttr();
+ tmp = dir;
+ tmp += "\\";
+ tmp += e.getName();
+ if (attr & rfsv::PSI_A_DIR) {
+ collectFiles(tmp);
+ } else {
+ kapp->processEvents();
+ updateProgress(e.getSize());
+ if ((attr & rfsv::PSI_A_ARCHIVE) || fullBackup) {
+ backupCount++;
+ backupSize += e.getSize();
+ e.setName(tmp.data());
+ toBackup.push_back(e);
+ }
+ }
+ }
+}
+
+void KPsionMainWindow::
+killSave() {
+ Enum<rfsv::errs> res;
+ bufferArray tmp;
+
+ savedCommands.clear();
+ if ((res = plpRpcs->queryDrive('C', tmp)) != rfsv::E_PSI_GEN_NONE) {
+ cerr << "Could not get process list, Error: " << res << endl;
+ return;
+ } else {
+ while (!tmp.empty()) {
+ QString pbuf;
+ bufferStore cmdargs;
+ bufferStore bs = tmp.pop();
+ int pid = bs.getWord(0);
+ const char *proc = bs.getString(2);
+ if (S5mx)
+ pbuf.sprintf("%s.$%02d", proc, pid);
+ else
+ pbuf.sprintf("%s.$%d", proc, pid);
+ bs = tmp.pop();
+ if (plpRpcs->getCmdLine(pbuf.data(), cmdargs) == 0) {
+ QString cmdline(cmdargs.getString(0));
+ cmdline += " ";
+ cmdline += bs.getString(0);
+ savedCommands += cmdline;
+ }
+ progressLabel->setText(i18n("Stopping %1").arg(cmdargs.getString(0)));
+ kapp->processEvents();
+ plpRpcs->stopProgram(pbuf);
+ }
+ }
+ return;
+}
+
+void KPsionMainWindow::
+runRestore() {
+ Enum<rfsv::errs> res;
+
+ for (QStringList::Iterator it = savedCommands.begin(); it != savedCommands.end(); it++) {
+ int firstBlank = (*it).find(' ');
+ QString cmd = (*it).left(firstBlank);
+ QString arg = (*it).mid(firstBlank + 1);
+
+ if (!cmd.isEmpty()) {
+ // Workaround for broken programs like Backlite.
+ // These do not storethe full program path.
+ // In that case we try running the arg1 which
+ // results in starting the program via recog. facility.
+ progressLabel->setText(i18n("Starting %1").arg(cmd));
+ kapp->processEvents();
+ if ((arg.length() > 2) && (arg[1] == ':') && (arg[0] >= 'A') &&
+ (arg[0] <= 'Z'))
+ res = plpRpcs->execProgram(arg.data(), "");
+ else
+ res = plpRpcs->execProgram(cmd.data(), arg.data());
+ if (res != rfsv::E_PSI_GEN_NONE) {
+ // If we got an error here, that happened probably because
+ // we have no path at all (e.g. Macro5) and the program is
+ // not registered in the Psion's path properly. Now try
+ // the ususal \System\Apps\<AppName>\<AppName>.app
+ // on all drives.
+ if (cmd.find('\\') == -1) {
+ driveMap::Iterator it;
+ for (it = drives.begin(); it != drives.end(); it++) {
+ QString newcmd = QString::fromLatin1("%1:\\System\\Apps\\%2\\%3").arg(it.key()).arg(cmd).arg(cmd);
+ res = plpRpcs->execProgram(newcmd.data(), "");
+ if (res == rfsv::E_PSI_GEN_NONE)
+ break;
+ newcmd += ".app";
+ res = plpRpcs->execProgram(newcmd.data(), "");
+ if (res == rfsv::E_PSI_GEN_NONE)
+ break;
+
+ }
+ }
+ }
+ }
+ }
+ return;
+}
+
+void KPsionMainWindow::
+createIndex() {
+ ostrstream os;
+ os << "#plpbackup index " <<
+ (fullBackup ? "F" : "I") << endl;
+ for (int i = 0; i < toBackup.size(); i++) {
+ PlpDirent e = toBackup[i];
+ PsiTime t = e.getPsiTime();
+ long attr = e.getAttr() &
+ ~rfsv::PSI_A_ARCHIVE;
+ os << hex
+ << setw(8) << setfill('0') <<
+ t.getPsiTimeHi() << " "
+ << setw(8) << setfill('0') <<
+ t.getPsiTimeLo() << " "
+ << setw(8) << setfill('0') <<
+ e.getSize() << " "
+ << setw(8) << setfill('0') <<
+ attr << " "
+ << setw(0) << e.getName() << endl;
+ kapp->processEvents();
+ }
+ backupTgz->writeFile("Index", "root", "root", os.pcount(), os.str());
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/kde2/kpsion/kpsion.desktop b/kde2/kpsion/kpsion.desktop
new file mode 100644
index 0000000..e29bb73
--- /dev/null
+++ b/kde2/kpsion/kpsion.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+DocPath=kpsion/index.html
+Exec=kpsion
+Terminal=0
+Type=Application
+Icon=psion_desktop
+Comment=My Psion PDA
+Comment[de]=Mein Psion
+Name=KPsion
+Name[de]=KPsion
diff --git a/kde2/kpsion/kpsion.h b/kde2/kpsion/kpsion.h
new file mode 100644
index 0000000..86aeff4
--- /dev/null
+++ b/kde2/kpsion/kpsion.h
@@ -0,0 +1,165 @@
+#ifndef _KPSION_H_
+#define _KPSION_H_
+
+#include "setupdialog.h"
+
+#include <kmainwindow.h>
+#include <kiconview.h>
+#include <kprogress.h>
+#include <ksqueezedtextlabel.h>
+#include <klistview.h>
+#include <ktar.h>
+
+#include <rfsv.h>
+#include <rpcs.h>
+#include <ppsocket.h>
+
+typedef QMap<char,QString> driveMap;
+typedef QMap<QString,QString> psionMap;
+
+class KPsionCheckListItem : public QCheckListItem {
+ public:
+ KPsionCheckListItem(KPsionCheckListItem *parent, const QString &text,
+ Type tt)
+ : QCheckListItem(parent, text, tt) { init(true); }
+ KPsionCheckListItem(QCheckListItem *parent, const QString &text, Type tt)
+ : QCheckListItem(parent, text, tt) { init(false); }
+ KPsionCheckListItem(QListViewItem *parent, const QString &text, Type tt)
+ : QCheckListItem(parent, text, tt) { init(false); }
+ KPsionCheckListItem(QListView *parent, const QString &text, Type tt)
+ : QCheckListItem(parent, text, tt) { init(false); }
+ KPsionCheckListItem(QListViewItem *parent, const QString &text,
+ const QPixmap &p)
+ : QCheckListItem(parent, text, p) { init(false); }
+ KPsionCheckListItem(QListView *parent, const QString &text,
+ const QPixmap &p)
+ : QCheckListItem(parent, text, p) { init(false); }
+ void setMetaData(int, time_t);
+
+ protected:
+ virtual void stateChange(bool);
+ void propagateUp(bool);
+ void propagateDown(bool);
+
+ private:
+ void init(bool);
+
+ bool parentIsKPsionCheckListItem;
+ bool dontPropagate;
+ int backupType;
+ time_t when;
+};
+
+class KPsionBackupListView : public KListView {
+ Q_OBJECT
+ public:
+ enum backupTypes {
+ UNKNOWN = 0,
+ FULL = 1,
+ INCREMENTAL = 2,
+ };
+
+ KPsionBackupListView(QWidget *parent = 0, const char *name = 0);
+ void readBackups(QString uid);
+ PlpDir &getRestoreList();
+
+ private:
+ void listTree(KPsionCheckListItem *cli, const KTarEntry *te, int level);
+
+ QString uid;
+ QString backupDir;
+ PlpDir toRestore;
+};
+
+class KPsionMainWindow : public KMainWindow {
+ Q_OBJECT
+
+ public:
+ KPsionMainWindow();
+ ~KPsionMainWindow();
+ void setMachineName(QString &_name) { machineName = _name; }
+ QString getMachineUID();
+ driveMap &getDrives() { return drives; }
+ psionMap &getMachines() { return machines; }
+ QString &getMachineName() { return machineName; }
+ QString &getBackupDir() { return backupDir; }
+
+ public slots:
+ void slotStartRestore();
+ void slotStartFullBackup();
+ void slotStartIncBackup();
+ void slotStartFormat();
+ void slotToggleToolbar();
+ void slotToggleStatusbar();
+ void slotSaveOptions();
+ void slotPreferences();
+
+ protected:
+ virtual bool queryClose();
+ void setupActions();
+ void switchActions();
+ void queryPsion();
+ void insertDrive(char letter, const char * const name);
+
+ private slots:
+ void iconClicked(QIconViewItem *i);
+ void iconOver(QIconViewItem *i);
+ void slotUpdateTimer();
+
+ private:
+ void doBackup();
+ void tryConnect();
+ void updateProgress(unsigned long);
+ void collectFiles(QString dir);
+ void killSave();
+ void runRestore();
+ void createIndex();
+
+ rfsv *plpRfsv;
+ rpcs *plpRpcs;
+ ppsocket *rfsvSocket;
+ ppsocket *rpcsSocket;
+ SetupDialog *setupDialog;
+ KIconView *view;
+ KProgress *progress;
+ KSqueezedTextLabel *progressLabel;
+ KTarGz *backupTgz;
+
+ driveMap drives;
+ psionMap machines;
+ QStringList backupDrives;
+ QStringList savedCommands;
+ QString backupDir;
+ QString machineName;
+ QString statusMsg;
+ QString ncpdDevice;
+ bool S5mx;
+ bool backupRunning;
+ bool restoreRunning;
+ bool formatRunning;
+ bool lastSelected;
+ bool connected;
+ bool firstTry;
+ bool shuttingDown;
+ bool fullBackup;
+ int reconnectTime;
+ int nextTry;
+ int ncpdSpeed;
+ unsigned long long machineUID;
+ PlpDir toBackup;
+ unsigned long backupSize;
+ unsigned long backupCount;
+ unsigned long progressTotal;
+ unsigned long progressLocal;
+ unsigned long progressCount;
+ unsigned long progressLocalCount;
+ int progressPercent;
+ int progressLocalPercent;
+};
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/kde2/kpsion/kpsionui.rc b/kde2/kpsion/kpsionui.rc
new file mode 100644
index 0000000..17302c5
--- /dev/null
+++ b/kde2/kpsion/kpsionui.rc
@@ -0,0 +1,15 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="kpsion">
+ <MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ <Action name="fullbackup"/>
+ <Action name="incbackup"/>
+ <Action name="restore"/>
+ <Action name="format"/>
+ </Menu>
+ </MenuBar>
+ <ToolBar fullWidth="true" name="mainToolBar">
+ <Action name="fullbackup"/>
+ <Action name="restore"/>
+ </ToolBar>
+</kpartgui>
diff --git a/kde2/kpsion/lo16-action-psion_backup.png b/kde2/kpsion/lo16-action-psion_backup.png
new file mode 100644
index 0000000..4d0f815
--- /dev/null
+++ b/kde2/kpsion/lo16-action-psion_backup.png
Binary files differ
diff --git a/kde2/kpsion/lo16-action-psion_restore.png b/kde2/kpsion/lo16-action-psion_restore.png
new file mode 100644
index 0000000..8f3103b
--- /dev/null
+++ b/kde2/kpsion/lo16-action-psion_restore.png
Binary files differ
diff --git a/kde2/kpsion/lo16-app-kpsion.png b/kde2/kpsion/lo16-app-kpsion.png
new file mode 100644
index 0000000..2382c76
--- /dev/null
+++ b/kde2/kpsion/lo16-app-kpsion.png
Binary files differ
diff --git a/kde2/kpsion/lo22-action-psion_backup.png b/kde2/kpsion/lo22-action-psion_backup.png
new file mode 100644
index 0000000..b5ebd45
--- /dev/null
+++ b/kde2/kpsion/lo22-action-psion_backup.png
Binary files differ
diff --git a/kde2/kpsion/lo22-action-psion_restore.png b/kde2/kpsion/lo22-action-psion_restore.png
new file mode 100644
index 0000000..47780b8
--- /dev/null
+++ b/kde2/kpsion/lo22-action-psion_restore.png
Binary files differ
diff --git a/kde2/kpsion/lo32-action-psion_backup.png b/kde2/kpsion/lo32-action-psion_backup.png
new file mode 100644
index 0000000..4a99260
--- /dev/null
+++ b/kde2/kpsion/lo32-action-psion_backup.png
Binary files differ
diff --git a/kde2/kpsion/lo32-action-psion_restore.png b/kde2/kpsion/lo32-action-psion_restore.png
new file mode 100644
index 0000000..782e2d9
--- /dev/null
+++ b/kde2/kpsion/lo32-action-psion_restore.png
Binary files differ
diff --git a/kde2/kpsion/lo32-app-kpsion.png b/kde2/kpsion/lo32-app-kpsion.png
new file mode 100644
index 0000000..7285992
--- /dev/null
+++ b/kde2/kpsion/lo32-app-kpsion.png
Binary files differ
diff --git a/kde2/kpsion/main.cpp b/kde2/kpsion/main.cpp
new file mode 100644
index 0000000..df909ef
--- /dev/null
+++ b/kde2/kpsion/main.cpp
@@ -0,0 +1,55 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "kpsion.h"
+#include "wizards.h"
+#include <kapp.h>
+#include <klocale.h>
+#include <kconfig.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+
+static KCmdLineOptions options[] = {
+ {"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},
+ {"+[DriveLetter]", I18N_NOOP("The drive letter to backup/restore or format."), 0},
+ { 0, 0, 0},
+};
+
+int main(int argc, char **argv) {
+ KAboutData *about = new KAboutData("kpsion", I18N_NOOP("KPsion"),
+ VERSION, I18N_NOOP("Psion connectivity utility"),
+ KAboutData::License_GPL,
+ "(C) 2001, Fritz Elfert", 0L,
+ "http://plptools.sourceforge.net",
+ "plptools-developers@sourceforge.net");
+ about->addAuthor("Fritz Elfert", I18N_NOOP("Original Developer/Maintainer"),
+ "felfert@users.sourceforge.net",
+ "http://plptools.sourceforge.net");
+ KCmdLineArgs::init(argc, argv, about);
+ KCmdLineArgs::addCmdLineOptions(options);
+
+ KApplication a;
+
+ KConfig *config = kapp->config();
+ config->setGroup("Settings");
+ QString backupDir = config->readEntry("BackupDir");
+
+ if (backupDir.isEmpty()) {
+ FirstTimeWizard *wiz = new FirstTimeWizard(0L, "firsttimewizard");
+ wiz->exec();
+ }
+
+ KPsionMainWindow *w = new KPsionMainWindow();
+ w->resize(300, 150);
+ a.setMainWidget(w);
+ w->show();
+ return a.exec();
+}
+
+
diff --git a/kde2/kpsion/setupdialog.cpp b/kde2/kpsion/setupdialog.cpp
new file mode 100644
index 0000000..370bb30
--- /dev/null
+++ b/kde2/kpsion/setupdialog.cpp
@@ -0,0 +1,62 @@
+#include "setupdialog.h"
+
+#include <kapp.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <knuminput.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+
+SetupDialog::SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs)
+ : KDialogBase(Tabbed, "Settings", Ok|Apply|Default|Cancel, Ok, parent,
+ "settingsDialog", true, true) {
+
+ enableLinkedHelp(true);
+
+ KConfig *config = kapp->config();
+ QFrame *page = addPage(i18n("&General"));
+ QGridLayout *gl = new QGridLayout(page, 4, 2, 15);
+ gl->addRowSpacing(0, 10);
+ QLabel *l;
+
+ l = new QLabel(i18n("Backup &directory"), page, "backupDirLabel");
+ gl->addWidget(l, 1, 0);
+ KLineEdit *bdiredit = new KLineEdit(page, "backupDirEdit");
+ gl->addWidget(bdiredit, 1 , 1);
+ l->setBuddy(bdiredit);
+ QPushButton *bdirbutton = new QPushButton(i18n("Browse"), page, "backupDirButton");
+ gl->addWidget(bdirbutton, 1 , 2);
+
+ l = new QLabel(i18n("Backup &generations"), page, "backupGenLabel");
+ gl->addMultiCellWidget(l, 2, 2, 0, 1);
+ KIntSpinBox *genspin = new KIntSpinBox(0, 10, 1, 3, 10, page, "backupGenSpin");
+ gl->addWidget(genspin, 2, 2);
+ l->setBuddy(genspin);
+
+ page = addPage(i18n("&Machines"));
+ gl = new QGridLayout(page, 4, 2, 15);
+ gl->addRowSpacing(0, 10);
+
+ l = new QLabel(i18n("Machine &Name"), page, "NameLabel");
+ gl->addWidget(l, 1, 0);
+ KLineEdit *nedit = new KLineEdit(page, "NameEdit");
+ gl->addWidget(nedit, 1, 1);
+ l->setBuddy(nedit);
+ l = new QLabel(i18n("Machine &UID"), page, "UIDLabel");
+ gl->addWidget(l, 2, 0);
+ KComboBox *uidcombo = new KComboBox(true, page, "UIDCombo");
+ config->setGroup("Psion");
+ uidcombo->insertStringList(config->readListEntry("MachineUIDs"));
+ gl->addWidget(uidcombo, 1, 1);
+ l->setBuddy(uidcombo);
+
+ connect(this, SIGNAL(defaultClicked()), SLOT(slotDefaultClicked()));
+}
+
+void SetupDialog::
+slotDefaultClicked() {
+ enableLinkedHelp(false);
+}
diff --git a/kde2/kpsion/setupdialog.h b/kde2/kpsion/setupdialog.h
new file mode 100644
index 0000000..b385dce
--- /dev/null
+++ b/kde2/kpsion/setupdialog.h
@@ -0,0 +1,17 @@
+#ifndef _SETUPDIALOGS_H_
+#define _SETUPDIALOGS_H_
+
+#include <rfsv.h>
+#include <rpcs.h>
+
+#include <kdialogbase.h>
+
+class SetupDialog : public KDialogBase {
+ public:
+ SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs);
+
+ private slots:
+ void slotDefaultClicked();
+};
+
+#endif
diff --git a/kde2/kpsion/wizards.cpp b/kde2/kpsion/wizards.cpp
new file mode 100644
index 0000000..24cd121
--- /dev/null
+++ b/kde2/kpsion/wizards.cpp
@@ -0,0 +1,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:
+ */
diff --git a/kde2/kpsion/wizards.h b/kde2/kpsion/wizards.h
new file mode 100644
index 0000000..6edd8d9
--- /dev/null
+++ b/kde2/kpsion/wizards.h
@@ -0,0 +1,78 @@
+#ifndef _WIZARDS_H_
+#define _WIZARDS_H_
+
+#include "kpsion.h"
+
+#include <kwizard.h>
+#include <knuminput.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <klistview.h>
+
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+class FirstTimeWizard : public KWizard {
+ Q_OBJECT
+ public:
+ FirstTimeWizard(QWidget *parent = 0, const char *name = 0);
+
+ protected:
+ virtual void closeEvent(QCloseEvent *e);
+ virtual void reject();
+ virtual void accept();
+
+ protected slots:
+ virtual void next();
+
+ private slots:
+ void slotBdirBrowse();
+
+ private:
+ bool checkBackupDir(QString &);
+
+ QWidget *page1;
+ QWidget *page2;
+ QWidget *page3;
+ QWidget *page4;
+ QWidget *page5;
+ QLabel *bdirLabel;
+ KIntSpinBox *genSpin;
+ KIntSpinBox *rconSpin;
+ QPushButton *bdirButton;
+ QCheckBox *remCheck;
+ KComboBox *iIntCombo;
+ KComboBox *fIntCombo;
+ KComboBox *devCombo;
+ KComboBox *speedCombo;
+
+ QString bdirDefault;
+ QString bdirCreated;
+};
+
+class NewPsionWizard : public KWizard {
+ Q_OBJECT
+
+ public:
+ NewPsionWizard(QWidget *parent = 0, const char *name = 0);
+
+ protected:
+ virtual void accept();
+
+ protected slots:
+ virtual void next();
+
+ private:
+ bool checkPsionName(QString &);
+
+ QWidget *page1;
+ QWidget *page2;
+ KPsionMainWindow *psion;
+ KLineEdit *nameEdit;
+ KListView *backupListView;
+
+ QString uid;
+ QString machineName;
+};
+#endif
diff --git a/kde2/mime/icons/lo32-app-psion_backup.png b/kde2/mime/icons/lo32-app-psion_backup.png
index 4a99260..1e98401 100644
--- a/kde2/mime/icons/lo32-app-psion_backup.png
+++ b/kde2/mime/icons/lo32-app-psion_backup.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-app-psion_desktop.png b/kde2/mime/icons/lo32-app-psion_desktop.png
index 7285992..b3e1db4 100644
--- a/kde2/mime/icons/lo32-app-psion_desktop.png
+++ b/kde2/mime/icons/lo32-app-psion_desktop.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-app-psion_owner.png b/kde2/mime/icons/lo32-app-psion_owner.png
index 515b105..00e44c6 100644
--- a/kde2/mime/icons/lo32-app-psion_owner.png
+++ b/kde2/mime/icons/lo32-app-psion_owner.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-app-psion_restore.png b/kde2/mime/icons/lo32-app-psion_restore.png
index 782e2d9..2b0f5ee 100644
--- a/kde2/mime/icons/lo32-app-psion_restore.png
+++ b/kde2/mime/icons/lo32-app-psion_restore.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-app-psion_setup.png b/kde2/mime/icons/lo32-app-psion_setup.png
index 7282e39..28203be 100644
--- a/kde2/mime/icons/lo32-app-psion_setup.png
+++ b/kde2/mime/icons/lo32-app-psion_setup.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-device-psion_drive.png b/kde2/mime/icons/lo32-device-psion_drive.png
index e1494bf..48637fc 100644
--- a/kde2/mime/icons/lo32-device-psion_drive.png
+++ b/kde2/mime/icons/lo32-device-psion_drive.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_agenda.png b/kde2/mime/icons/lo32-mime-x_psion_agenda.png
index 333ee4c..6eed655 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_agenda.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_agenda.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_backup.png b/kde2/mime/icons/lo32-mime-x_psion_backup.png
index 420c112..13c0e5c 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_backup.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_backup.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_data.png b/kde2/mime/icons/lo32-mime-x_psion_data.png
index b365f45..4f19555 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_data.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_data.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_encryptit.png b/kde2/mime/icons/lo32-mime-x_psion_encryptit.png
index 105f784..d4ca041 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_encryptit.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_encryptit.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_opl.png b/kde2/mime/icons/lo32-mime-x_psion_opl.png
index 064df0a..078cad6 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_opl.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_opl.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_opo.png b/kde2/mime/icons/lo32-mime-x_psion_opo.png
index 916fa19..4850d33 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_opo.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_opo.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_opx.png b/kde2/mime/icons/lo32-mime-x_psion_opx.png
index de90515..4741851 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_opx.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_opx.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_recorder.png b/kde2/mime/icons/lo32-mime-x_psion_recorder.png
index b935808..174068c 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_recorder.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_recorder.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_sheet.png b/kde2/mime/icons/lo32-mime-x_psion_sheet.png
index 336cb04..63626f7 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_sheet.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_sheet.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_sis.png b/kde2/mime/icons/lo32-mime-x_psion_sis.png
index 1af15bb..649f258 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_sis.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_sis.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_unknown.png b/kde2/mime/icons/lo32-mime-x_psion_unknown.png
index b70ac35..7b77048 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_unknown.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_unknown.png
Binary files differ
diff --git a/kde2/mime/icons/lo32-mime-x_psion_word.png b/kde2/mime/icons/lo32-mime-x_psion_word.png
index c677b70..808c17d 100644
--- a/kde2/mime/icons/lo32-mime-x_psion_word.png
+++ b/kde2/mime/icons/lo32-mime-x_psion_word.png
Binary files differ
diff --git a/kde2/mime/psion-drive-actions.desktop b/kde2/mime/psion-drive-actions.desktop
new file mode 100644
index 0000000..c9a1e39
--- /dev/null
+++ b/kde2/mime/psion-drive-actions.desktop
@@ -0,0 +1,16 @@
+[Desktop Entry]
+ServiceTypes=inode/x-psion-drive
+Actions=Backup;Restore;Format
+Patterns=
+[Desktop Action Backup]
+Exec=kpsion backup %u
+Name=backup this drive
+Name[de]=Laufwerk sichern
+[Desktop Action Format]
+Exec=kpsion format %u
+Name=format this drive
+Name[de]=Laufwerk formatieren
+[Desktop Action Restore]
+Exec=kpsion restore %u
+Name=restore this drive
+Name[de]=Laufwerk rücksichern
diff --git a/kde2/mime/x-psion-backup.desktop b/kde2/mime/x-psion-backup.desktop
new file mode 100644
index 0000000..7d46250
--- /dev/null
+++ b/kde2/mime/x-psion-backup.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Comment=Psion Backup
+Hidden=false
+Icon=psion_backup
+MimeType=application/x-psion-backup
+Patterns=
+Type=MimeType
diff --git a/kde2/mime/x-psion-machine.desktop b/kde2/mime/x-psion-machine.desktop
new file mode 100644
index 0000000..cc0310f
--- /dev/null
+++ b/kde2/mime/x-psion-machine.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Comment=Psion Machine
+Hidden=false
+Icon=psion_desktop
+MimeType=application/x-psion-machine
+Patterns=
+Type=MimeType
diff --git a/kde2/mime/x-psion-owner.desktop b/kde2/mime/x-psion-owner.desktop
new file mode 100644
index 0000000..9d1fe06
--- /dev/null
+++ b/kde2/mime/x-psion-owner.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Comment=Psion Owner
+Hidden=false
+Icon=psion_owner
+MimeType=application/x-psion-owner
+Patterns=
+Type=MimeType
diff --git a/kde2/mime/x-psion-restore.desktop b/kde2/mime/x-psion-restore.desktop
new file mode 100644
index 0000000..c79c5dc
--- /dev/null
+++ b/kde2/mime/x-psion-restore.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Comment=Psion Restore
+Hidden=false
+Icon=psion_restore
+MimeType=application/x-psion-restore
+Patterns=
+Type=MimeType
diff --git a/kde2/mime/x-psion-setup.desktop b/kde2/mime/x-psion-setup.desktop
new file mode 100644
index 0000000..20d0f7c
--- /dev/null
+++ b/kde2/mime/x-psion-setup.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Comment=Psion Settings
+Hidden=false
+Icon=psion_setup
+MimeType=application/x-psion-setup
+Patterns=
+Type=MimeType
diff --git a/kde2/plugins/Makefile.am b/kde2/plugins/Makefile.am
index 9ef736d..35d3f27 100644
--- a/kde2/plugins/Makefile.am
+++ b/kde2/plugins/Makefile.am
@@ -2,7 +2,7 @@
AM_CPPFLAGS = -DQT_NO_CAST_ASCII
INCLUDES = $(all_includes) -I$(top_srcdir)/lib
-LDFLAGS = $(all_libraries) $(KDE_RPATH)
+LDFLAGS = $(all_libraries)
libplpprops_la_LDFLAGS = $(LIBDEBUG) $(all_libraries) -module -no-undefined -version-info $(LIBVERSION)
diff --git a/kde2/plugins/plpprops.cc b/kde2/plugins/plpprops.cc
index 1992e33..6db2c5b 100644
--- a/kde2/plugins/plpprops.cc
+++ b/kde2/plugins/plpprops.cc
@@ -1,65 +1,65 @@
+/*-*-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 <stream.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <qfile.h>
-#include <qapplication.h>
-#include <qdir.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcheckbox.h>
-#include <qstrlist.h>
-#include <qstringlist.h>
-#include <qtextstream.h>
-#include <qpainter.h>
-#include <qlayout.h>
-#include <qcombobox.h>
-#include <qgroupbox.h>
+#include "plpprops.h"
+#include "pie3dwidget.h"
-#include <kdialog.h>
-#include <kdirsize.h>
-#include <kdirwatch.h>
#include <kdebug.h>
-#include <kdesktopfile.h>
-#include <kicondialog.h>
-#include <kurl.h>
-#include <kurlrequester.h>
#include <klocale.h>
-#include <kglobal.h>
-#include <kglobalsettings.h>
-#include <kstddirs.h>
-#include <kio/job.h>
-#include <kio/renamedlg.h>
-#include <kfiledialog.h>
-#include <kmimetype.h>
-#include <kmessagebox.h>
-#include <kservice.h>
-#include <kglobal.h>
-#include <kcompletion.h>
-#include <klineedit.h>
-//#include <klibloader.h>
-//#include <ktrader.h>
#include <kio/slaveinterface.h>
+#include <krun.h>
-#include "plpprops.h"
-#include "pie3dwidget.h"
-
+#include <qlayout.h>
+#include <qlabel.h>
#include <qobjectlist.h>
#include <qtabwidget.h>
+#include <qcheckbox.h>
+#include <qwhatsthis.h>
+
+#include <rfsv.h>
+#include <rpcs.h>
+
+#include <strstream>
+#include <iomanip>
+
+#define PLP_CMD_DRIVEINFO 1
+#define PLP_CMD_OWNERINFO 2
+#define PLP_CMD_GETATTR 3
+#define PLP_CMD_SETATTR 4
+#define PLP_CMD_MACHINFO 5
#define KIO_ARGS QByteArray packedArgs; \
QDataStream stream( packedArgs, IO_WriteOnly ); stream
class PlpPropsPlugin::PlpPropsPluginPrivate {
public:
- PlpPropsPluginPrivate() { }
- ~PlpPropsPluginPrivate() { }
+ PlpPropsPluginPrivate() { }
+ ~PlpPropsPluginPrivate() { }
- QFrame *m_frame;
+ QFrame *frame;
};
/*
@@ -67,375 +67,908 @@ public:
* the Properties dialog.
*/
static void
-removePermsPage(QWidget *theDialog) {
- QObject *qtabwidget = 0L;
- QFrame *permframe = 0L;
-
- //
- // First, find the QTabWidget in the dialog.
- // This is easy, cause there's only one.
- //
- QObjectList *l = theDialog->queryList("QTabWidget");
+removeDialogPage(QWidget *theDialog, QString theLabel) {
+ QObject *qtabwidget = 0L;
+ QFrame *permframe = 0L;
+
+ //
+ // First, find the QTabWidget in the dialog.
+ // Easy, cause there's only one.
+ //
+ QObjectList *l = theDialog->queryList("QTabWidget");
+ QObjectListIt it(*l);
+ QObject * obj;
+ while ((obj=it.current()) != 0) {
+ ++it;
+ qtabwidget = obj;
+ }
+ delete l;
+
+ // Now, walk thru all Childs of the QTabWidget which are
+ // inherited from class QFrame. For every found frame,
+ // compare the tabLabel against the required label (&Permissions).
+ //
+ if (qtabwidget != 0L) {
+ l = qtabwidget->queryList("QFrame");
QObjectListIt it(*l);
- QObject * obj;
- while ((obj=it.current()) != 0) {
- ++it;
- qtabwidget = obj;
+
+ while ((obj = it.current()) != 0) {
+ if (theLabel ==
+ ((QTabWidget *)qtabwidget)->tabLabel((QWidget*)obj)) {
+ permframe = (QFrame *)obj;
+ break;
+ }
+ ++it;
}
delete l;
- // Now, walk thru all Childs of the QTabWidget which are
- // inherited from class QFrame.
- //
- if (qtabwidget != 0L) {
- l = qtabwidget->queryList("QFrame");
- QObjectListIt it(*l);
-
- while ((obj = it.current()) != 0) {
- QObjectList *l2 = obj->queryList();
- QObjectListIt it2(*l2);
- QObject *o2;
- int qvbl, qgb, qgl, ql, qcb;
- qvbl = qgb = qgl = ql = qcb = 0;
-
- // If we found a QFrame, count it's children
- // by className. We must rely on the numbers,
- // because not a single child has been given
- // a name.
- while ((o2 = it2.current()) != 0) {
- if (o2->isA("QVBoxLayout"))
- qvbl++;
- if (o2->isA("QGroupBox"))
- qgb++;
- if (o2->isA("QGridLayout"))
- qgl++;
- if (o2->isA("QLabel"))
- ql++;
- if (o2->isA("QCheckBox"))
- qcb++;
- ++it2;
- }
- delete l2;
-
- // The PermissionsPage is build out of:
- //
- // 1 QVBoxLayout, 2 QGroupboxes, 2 QGridLayouts,
- // 15 QLabels and 12 QCheckBoxes
- //
- if ((qvbl == 1) &&
- (qgb == 2) &&
- (qgl == 2) &&
- (ql == 15) &&
- (qcb == 12)) {
- permframe = (QFrame *)obj;
- break;
- }
- ++it;
- }
- delete l;
-
- // If we found it, remove it.
- if (permframe != 0)
- ((QTabWidget *)qtabwidget)->removePage(permframe);
- }
+ // If we found it, remove it.
+ if (permframe != 0)
+ ((QTabWidget *)qtabwidget)->removePage(permframe);
+ }
}
PlpPropsPlugin::PlpPropsPlugin(KPropertiesDialog *_props)
- : KPropsDlgPlugin( _props )
+ : KPropsDlgPlugin( _props )
{
- d = new PlpPropsPluginPrivate;
- bool removePerms = false;
-
- if (!supports(properties->items()))
- return;
-
- if (PlpFileAttrPage::supports(properties->items())) {
- PlpFileAttrPage *p = new PlpFileAttrPage(_props);
- removePerms = true;
- }
- if (PlpDriveAttrPage::supports(properties->items())) {
- PlpDriveAttrPage *p = new PlpDriveAttrPage(_props);
- removePerms = true;
- }
- if (PlpMachinePage::supports(properties->items())) {
- PlpMachinePage *p = new PlpMachinePage(_props);
- }
- if (PlpOwnerPage::supports(properties->items())) {
- PlpOwnerPage *p = new PlpOwnerPage(_props);
- }
- if (removePerms)
- removePermsPage(properties->dialog());
+ d = new PlpPropsPluginPrivate;
+ bool removePerms = false;
+ bool removeGeneral = false;
+
+ if (!supports(properties->items()))
+ return;
+
+ if (PlpFileAttrPage::supports(properties->items())) {
+ PlpFileAttrPage *p = new PlpFileAttrPage(_props);
+ connect(p, SIGNAL(changed()), SLOT(doChange()));
+ connect(this, SIGNAL(save()), p, SLOT(applyChanges()));
+ removePerms = true;
+ }
+ if (PlpDriveAttrPage::supports(properties->items())) {
+ PlpDriveAttrPage *p = new PlpDriveAttrPage(_props);
+ removePerms = true;
+ }
+ if (PlpMachinePage::supports(properties->items())) {
+ PlpMachinePage *p = new PlpMachinePage(_props);
+ removePerms = true;
+ removeGeneral = true;
+ }
+ if (PlpOwnerPage::supports(properties->items())) {
+ PlpOwnerPage *p = new PlpOwnerPage(_props);
+ removePerms = true;
+ removeGeneral = true;
+ }
+ if (removePerms)
+ removeDialogPage(properties->dialog(), i18n("&Permissions"));
+ if (removeGeneral)
+ removeDialogPage(properties->dialog(), i18n("&General"));
}
PlpPropsPlugin::~PlpPropsPlugin() {
- delete d;
+ delete d;
}
bool PlpPropsPlugin::supports(KFileItemList _items) {
- for (KFileItemListIterator it(_items); it.current(); ++it) {
- KFileItem *fi = it.current();
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
- if (fi->url().protocol() != QString::fromLatin1("psion"))
- return false;
- }
- return true;
+ if (fi->url().protocol() != QString::fromLatin1("psion"))
+ return false;
+ }
+ return true;
}
void PlpPropsPlugin::applyChanges() {
- kdDebug(250) << "PlpFileAttrPlugin::applyChanges" << endl;
+ emit save();
}
-void PlpPropsPlugin::postApplyChanges() {
+void PlpPropsPlugin::doChange() {
+ emit changed();
}
class PlpFileAttrPage::PlpFileAttrPagePrivate {
+
+ typedef struct {
+ const char * const lbl;
+ const u_int32_t mask;
+ bool inverted;
+ bool direnabled;
+ bool s5enabled;
+ } UIelem;
+
public:
- PlpFileAttrPagePrivate() { }
- ~PlpFileAttrPagePrivate() { }
- QFrame *m_frame;
+ PlpFileAttrPagePrivate();
+ ~PlpFileAttrPagePrivate() {}
+
+ KPropertiesDialog *props;
+
+ bool jobReturned;
+ u_int32_t flags;
+ u_int32_t attr;
+
+ const UIelem *generic;
+ const UIelem *s3;
+ const UIelem *s5;
+
+ QFrame *frame;
+ QLabel *psiPath;
+ QCheckBox *genCb[5]; // MUST match initializers below!!!
+ QCheckBox *specCb[3]; // MUST match initializers below!!!
};
-PlpFileAttrPage::PlpFileAttrPage(KPropertiesDialog *_props)
- : KPropsDlgPlugin( _props ) {
- d = new PlpFileAttrPagePrivate;
- d->m_frame = properties->dialog()->addPage(i18n("Psion &Attributes"));
+PlpFileAttrPage::PlpFileAttrPagePrivate::PlpFileAttrPagePrivate() {
+ int i;
+
+ static const UIelem _generic[] = {
+ { "Readable", rfsv::PSI_A_READ, false, false, false }, // Fake for S5
+ { "Writeable", rfsv::PSI_A_RDONLY, true, true, true },
+ { "Hidden", rfsv::PSI_A_HIDDEN, false, true, true },
+ { "System", rfsv::PSI_A_SYSTEM, false, false, true },
+ { "Archive", rfsv::PSI_A_ARCHIVE, false, true, true },
+ { 0L, 0L, false, false, true },
+ };
+ static const UIelem _s3[] = {
+ { "Executable", rfsv::PSI_A_EXEC, false, false, true },
+ { "Stream", rfsv::PSI_A_STREAM, false, false, true },
+ { "Text", rfsv::PSI_A_TEXT, false, false, true },
+ { 0L, 0L, false, false, true },
+ };
+ static const UIelem _s5[] = {
+ { "Normal", rfsv::PSI_A_NORMAL, false, false, true },
+ { "Temporary", rfsv::PSI_A_TEMP, false, false, true },
+ { "Compressed", rfsv::PSI_A_COMPRESSED, false, false, true },
+ { 0L, 0L, false, false, true },
+ };
+ generic = _generic;
+ s3 = _s3;
+ s5 = _s5;
+}
+
+PlpFileAttrPage::PlpFileAttrPage(KPropertiesDialog *_props) {
+ QGridLayout *mgl;
+ QGridLayout *gl;
+ QGroupBox *gb;
+ QLabel *l;
+ int i;
+
+ d = new PlpFileAttrPagePrivate;
+ d->props = _props;
+ d->frame = _props->dialog()->addPage(i18n("Psion &Attributes"));
+
+ mgl = new QGridLayout(d->frame, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint(), "mainLayout");
+
+ l = new QLabel(i18n("Path on Psion:"), d->frame, "psiPathLabel");
+ mgl->addWidget(l, 0, 0);
+
+ d->psiPath = new QLabel(QString::fromLatin1("?"), d->frame, "psiPath");
+ mgl->addWidget(d->psiPath, 0, 1);
+ mgl->setColStretch(1, 1);
+
+ gb = new QGroupBox(i18n("Generic attributes"), d->frame, "genattrBox");
+ mgl->addMultiCellWidget(gb, 1, 1, 0, 1);
+ gl = new QGridLayout (gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint(), "genattrLayout");
+ for (i = 0; d->generic[i].lbl; i++) {
+ QString lbl = KGlobal::locale()->translate(d->generic[i].lbl);
+ d->genCb[i] = new QCheckBox(lbl, gb, d->generic[i].lbl);
+ d->genCb[i]->setEnabled(false);
+ connect(d->genCb[i], SIGNAL(toggled(bool)), SLOT(slotCbToggled(bool)));
+ gl->addWidget(d->genCb[i], 0, i);
+ }
+
+ gb = new QGroupBox(i18n("Machine specific attributes"), d->frame,
+ "specattrBox");
+ mgl->addMultiCellWidget(gb, 2, 2, 0, 1);
+ gl = new QGridLayout (gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint(), "specattrLayout");
+ for (i = 0; d->s5[i].lbl; i++) {
+ QString lbl = KGlobal::locale()->translate(d->s5[i].lbl);
+ d->specCb[i] = new QCheckBox(lbl, gb, d->s5[i].lbl);
+ d->specCb[i]->setEnabled(false);
+ connect(d->specCb[i], SIGNAL(toggled(bool)), SLOT(slotCbToggled(bool)));
+ gl->addWidget(d->specCb[i], 0, i);
+ }
+ mgl->addRowSpacing(3, KDialog::marginHint());
+
+ d->jobReturned = false;
+ KIO_ARGS << int(PLP_CMD_GETATTR) << _props->item()->url().path();
+ KIO::StatJob *job = new KIO::StatJob(KURL("psion:/"), KIO::CMD_SPECIAL,
+ packedArgs, false);
+ connect(job, SIGNAL(result(KIO::Job *)),
+ SLOT(slotGetSpecialFinished(KIO::Job *)));
}
PlpFileAttrPage::~PlpFileAttrPage() {
- delete d;
+ delete d;
}
bool PlpFileAttrPage::supports(KFileItemList _items) {
- for (KFileItemListIterator it(_items); it.current(); ++it) {
- KFileItem *fi = it.current();
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ QString path = fi->url().path(-1);
+ if (path.contains('/') == 1)
+ return false;
+ }
+ return true;
+}
- QString path = fi->url().path(-1);
- if (path.contains('/') == 1)
- return false;
+void PlpFileAttrPage::applyChanges() {
+ u_int32_t attr = 0;
+ bool isS5 = ((d->flags & 1) != 0);
+ bool val;
+ int i;
+
+ for (i = 0; d->generic[i].lbl; i++) {
+ val = d->genCb[i]->isChecked();
+ if (d->generic[i].inverted)
+ val = !val;
+ if (val)
+ attr |= d->generic[i].mask;
+ }
+ if (isS5)
+ for (i = 0; d->s5[i].lbl; i++) {
+ val = d->specCb[i]->isChecked();
+ if (d->s5[i].inverted)
+ val = !val;
+ if (val)
+ attr |= d->s5[i].mask;
+ }
+ else
+ for (i = 0; d->s3[i].lbl; i++) {
+ val = d->specCb[i]->isChecked();
+ if (d->s3[i].inverted)
+ val = !val;
+ if (val)
+ attr |= d->s3[i].mask;
}
- return true;
+ if (d->attr != attr) {
+ u_int32_t mask = d->attr ^ attr;
+ u_int32_t sattr = attr & mask;
+ u_int32_t dattr = ~sattr & mask;
+ cout << "apply: old=" << hex << d->attr << " new=" << attr << endl;
+ cout << "apply: m=" << hex << mask << " s=" << sattr << " d=" << dattr << endl;
+
+ KIO_ARGS << int(PLP_CMD_SETATTR) << sattr << dattr
+ << d->props->item()->url().path();
+ KIO::SimpleJob *sjob = new KIO::SimpleJob(KURL("psion:/"),
+ KIO::CMD_SPECIAL, packedArgs,
+ false);
+ connect(sjob, SIGNAL(result(KIO::Job *)),
+ SLOT(slotSetSpecialFinished(KIO::Job *)));
+ }
}
-void PlpFileAttrPage::applyChanges() {
+void PlpFileAttrPage::slotCbToggled(bool) {
+ if (d->jobReturned)
+ emit changed();
+}
+
+void PlpFileAttrPage::slotSetSpecialFinished(KIO::Job *job) {
+ KIO::SimpleJob *sJob = static_cast<KIO::SimpleJob *>(job);
+
+ if (sJob->error())
+ job->showErrorDialog(d->props->dialog());
+}
+
+void PlpFileAttrPage::slotGetSpecialFinished(KIO::Job *job) {
+ KIO::StatJob *sJob = static_cast<KIO::StatJob *>(job);
+
+ if (sJob->error())
+ job->showErrorDialog(d->props->dialog());
+ else {
+ KIO::UDSEntry e = sJob->statResult();
+ bool attr_found = false;
+ bool flags_found = false;
+ u_int32_t flags;
+ u_int32_t attr;
+
+ for (KIO::UDSEntry::ConstIterator it = e.begin(); it != e.end(); ++it) {
+ if ((*it).m_uds == KIO::UDS_SIZE) {
+ attr_found = true;
+ attr = (unsigned long)((*it).m_long);
+ }
+ if ((*it).m_uds == KIO::UDS_CREATION_TIME) {
+ flags_found = true;
+ flags = (unsigned long)((*it).m_long);
+ }
+ if ((*it).m_uds == KIO::UDS_NAME)
+ d->psiPath->setText((*it).m_str);
+ }
+ if (attr_found && flags_found) {
+ bool isS5 = ((flags & 1) != 0);
+ bool isRom = ((flags & 2) != 0);
+ bool noDir = ((attr & rfsv::PSI_A_DIR) == 0);
+ int i;
+
+ d->attr = attr;
+ d->flags = flags;
+ for (i = 0; d->generic[i].lbl; i++) {
+ bool val = ((attr & d->generic[i].mask) != 0);
+ if (d->generic[i].inverted)
+ val = !val;
+ d->genCb[i]->setChecked(val);
+ if ((!isRom) && (d->generic[i].s5enabled) &&
+ (noDir || d->generic[i].direnabled)) {
+ d->genCb[i]->setEnabled(true);
+ }
+ }
+ if (isS5)
+ for (i = 0; d->s5[i].lbl; i++) {
+ bool val = ((attr & d->s5[i].mask) != 0);
+ d->specCb[i]->setChecked(val);
+ if ((!isRom) && (noDir || d->s5[i].direnabled))
+ d->specCb[i]->setEnabled(true);
+ }
+ else
+ for (i = 0; d->s3[i].lbl; i++) {
+ bool val = ((attr & d->s3[i].mask) != 0);
+ QString lbl = KGlobal::locale()->translate(d->s3[i].lbl);
+ d->specCb[i]->setText(lbl);
+ d->specCb[i]->setChecked(val);
+ if ((!isRom) && (noDir || d->s3[i].direnabled))
+ d->specCb[i]->setEnabled(true);
+ }
+ }
+ }
+ d->jobReturned = true;
}
class PlpDriveAttrPage::PlpDriveAttrPagePrivate {
public:
- PlpDriveAttrPagePrivate() { }
- ~PlpDriveAttrPagePrivate() { }
-
- QFrame *m_frame;
+ PlpDriveAttrPagePrivate() { }
+ ~PlpDriveAttrPagePrivate() { }
+
+ QColor usedColor;
+ QColor freeColor;
+ QString driveLetter;
+
+ KPropertiesDialog *props;
+ QFrame *frame;
+ QGroupBox *gb;
+ Pie3DWidget *pie;
+ QLabel *typeLabel;
+ QLabel *totalLabel;
+ QLabel *freeLabel;
+ QLabel *uidLabel;
+ QPushButton *restoreButton;
+ QPushButton *formatButton;
};
-PlpDriveAttrPage::PlpDriveAttrPage(KPropertiesDialog *_props)
- : KPropsDlgPlugin( _props ) {
+PlpDriveAttrPage::PlpDriveAttrPage(KPropertiesDialog *_props) {
+ d = new PlpDriveAttrPagePrivate;
+ d->props = _props;
+ d->frame = _props->dialog()->addPage(i18n("Psion &Drive"));
- d = new PlpDriveAttrPagePrivate;
- d->m_frame = properties->dialog()->addPage(i18n("Psion &Drive"));
+ QBoxLayout *box = new QVBoxLayout(d->frame, KDialog::spacingHint());
+ QLabel *l;
+ QGridLayout *gl;
+ QPushButton *b;
+ d->usedColor = QColor(219, 58, 197);
+ d->freeColor = QColor(39, 56, 167);
+ d->driveLetter = "";
- QBoxLayout *box = new QVBoxLayout( d->m_frame, KDialog::spacingHint() );
- QLabel *l;
- QGridLayout *gl;
- usedColor = QColor(219, 58, 197);
- freeColor = QColor(39, 56, 167);
+ d->gb = new QGroupBox(i18n("Information"), d->frame, "driveinfo");
+ box->addWidget(d->gb);
- KIO_ARGS << int(1) << properties->item()->name();
- KIO::StatJob *job = new KIO::StatJob(KURL("psion:/"), KIO::CMD_SPECIAL, packedArgs, false);
- connect(job, SIGNAL(result(KIO::Job *)), SLOT(slotSpecialFinished(KIO::Job *)));
+ gl = new QGridLayout(d->gb, 7, 4, 15);
+ gl->addRowSpacing(0, 10);
- gb = new QGroupBox(i18n("Information"), d->m_frame);
- box->addWidget(gb);
+ l = new QLabel(i18n("Type"), d->gb, "typeLabel");
+ gl->addWidget(l, 1, 0);
- gl = new QGridLayout(gb, 7, 4, 15);
- gl->addRowSpacing(0, 10);
+ d->typeLabel = new QLabel(d->gb);
+ gl->addWidget(d->typeLabel, 2, 0);
+ QWhatsThis::add(d->typeLabel,
+ i18n("The type of the drive is shown here."));
- l = new QLabel(i18n("Type"), gb, "typeLabel");
- gl->addWidget(l, 1, 0);
+ l = new QLabel(i18n("Total capacity"), d->gb, "capacityLabel");
+ gl->addWidget (l, 1, 1);
- typeLabel = new QLabel(gb);
- gl->addWidget(typeLabel, 2, 0);
+ d->totalLabel = new QLabel(i18n(" "), d->gb, "capacityValue");
+ gl->addWidget(d->totalLabel, 2, 1);
+ QWhatsThis::add(d->totalLabel,
+ i18n("This shows the total capacity of the drive."));
- l = new QLabel(i18n("Total capacity"), gb, "capacityLabel");
- gl->addWidget (l, 1, 1);
+ l = new QLabel(i18n("Free space"), d->gb, "spaceLabel");
+ gl->addWidget (l, 1, 2);
- totalLabel = new QLabel(i18n(" "), gb, "capacityValue");
- gl->addWidget(totalLabel, 2, 1);
+ d->freeLabel = new QLabel(i18n(" "), d->gb, "spaceValue");
+ gl->addWidget(d->freeLabel, 2, 2);
+ QWhatsThis::add(d->freeLabel,
+ i18n("This shows the available space of the drive."));
- l = new QLabel(i18n("Free space"), gb, "spaceLabel");
- gl->addWidget (l, 1, 2);
+ l = new QLabel(i18n("Unique ID"), d->gb, "uidLabel");
+ gl->addWidget (l, 1, 3);
- freeLabel = new QLabel(i18n(" "), gb, "spaceValue");
- gl->addWidget(freeLabel, 2, 2);
+ d->uidLabel = new QLabel(i18n(" "), d->gb, "uidValue");
+ gl->addWidget(d->uidLabel, 2, 3);
+ QWhatsThis::add(d->freeLabel,
+ i18n("This shows unique ID of the drive. For ROM drives, this is always 0."));
- l = new QLabel(i18n("Unique ID"), gb, "uidLabel");
- gl->addWidget (l, 1, 3);
+ d->pie = new Pie3DWidget(d->gb, "pie");
- uidLabel = new QLabel(i18n(" "), gb, "uidValue");
- gl->addWidget(uidLabel, 2, 3);
+ gl->addMultiCellWidget(d->pie, 3, 4, 1, 2);
- pie = new Pie3DWidget(gb, "pie");
+ QHBoxLayout *blay = new QHBoxLayout(KDialog::spacingHint(), "buttons");
+ gl->addMultiCellLayout(blay, 5, 6, 1, 3);
+ blay->setAlignment(AlignRight | AlignVCenter);
- gl->addMultiCellWidget(pie, 3, 4, 1, 2);
+ b = new QPushButton(i18n("Backup"), d->gb, "backupButton");
+ connect(b, SIGNAL(clicked()), SLOT(slotBackupClicked()));
+ blay->addWidget(b, 0);
+ QWhatsThis::add(b,
+ i18n("Click here, to do a backup of this drive. This launches KPsion to perform that task."));
- l = new QLabel(i18n("Used space:"), gb, "usedLgend");
- l->setAlignment(AlignRight | AlignVCenter);
- gl->addWidget (l, 5, 2);
-
- l = new QLabel(i18n(" "), gb, "usedLegendColor");
- l->setBackgroundColor(usedColor);
- gl->addWidget (l, 5, 3);
+ b = new QPushButton(i18n("Restore"), d->gb, "restoreButton");
+ connect(b, SIGNAL(clicked()), SLOT(slotRestoreClicked()));
+ blay->addWidget(b, 0);
+ d->restoreButton = b;
+ QWhatsThis::add(b,
+ i18n("Click here, to do a restore of this drive. This launches KPsion to perform that task."));
- l = new QLabel(i18n("Free space:"), gb, "spaceLegend");
- l->setAlignment(AlignRight | AlignVCenter);
- gl->addWidget (l, 6, 2);
+ b = new QPushButton(i18n("Format"), d->gb, "formatButton");
+ connect(b, SIGNAL(clicked()), SLOT(slotFormatClicked()));
+ blay->addWidget(b, 0);
+ d->formatButton = b;
+ QWhatsThis::add(b,
+ i18n("Click here, to format this drive. This launches KPsion to perform that task."));
- l = new QLabel(i18n(" "), gb, "spaceLegendColor");
- l->setBackgroundColor(freeColor);
+ blay->addStretch(10);
- gl->addWidget (l, 6, 3);
+ box->addStretch(10);
+
+ KIO_ARGS << int(PLP_CMD_DRIVEINFO) << _props->item()->url().path();
+ KIO::StatJob *job = new KIO::StatJob(KURL("psion:/"), KIO::CMD_SPECIAL,
+ packedArgs, false);
+ connect(job, SIGNAL(result(KIO::Job *)),
+ SLOT(slotSpecialFinished(KIO::Job *)));
- box->addStretch(10);
}
PlpDriveAttrPage::~PlpDriveAttrPage() {
- delete d;
+ delete d;
}
bool PlpDriveAttrPage::supports(KFileItemList _items) {
- for (KFileItemListIterator it(_items); it.current(); ++it) {
- KFileItem *fi = it.current();
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ QString path = fi->url().path(-1);
+ if (path.contains('/') != 1)
+ return false;
+ if (fi->url().path() == QString::fromLatin1("/"))
+ return false;
+ }
+ return true;
+}
- QString path = fi->url().path(-1);
- if (path.contains('/') != 1)
- return false;
- }
- return true;
+void PlpDriveAttrPage::slotBackupClicked() {
+ if (!d->driveLetter.isEmpty())
+ KRun::runCommand(
+ QString::fromLatin1("kpsion --backup %1").arg(d->driveLetter));
+}
+
+void PlpDriveAttrPage::slotRestoreClicked() {
+ if (!d->driveLetter.isEmpty())
+ KRun::runCommand(
+ QString::fromLatin1("kpsion --restore %1").arg(d->driveLetter));
}
-void PlpDriveAttrPage::applyChanges() {
+void PlpDriveAttrPage::slotFormatClicked() {
+ if (!d->driveLetter.isEmpty())
+ KRun::runCommand(
+ QString::fromLatin1("kpsion --format %1").arg(d->driveLetter));
}
void PlpDriveAttrPage::slotSpecialFinished(KIO::Job *job) {
- KIO::StatJob *sJob = static_cast<KIO::StatJob *>(job);
-
- if (sJob->error())
- job->showErrorDialog(properties->dialog());
- else {
- KIO::UDSEntry e = sJob->statResult();
- bool total_found = false;
- bool free_found = false;
-
- for (KIO::UDSEntry::ConstIterator it = e.begin(); it != e.end(); ++it) {
- if ((*it).m_uds == KIO::UDS_SIZE) {
- total_found = true;
- total = (unsigned long)((*it).m_long);
- }
- if ((*it).m_uds == KIO::UDS_MODIFICATION_TIME) {
- free_found = true;
- unused = (unsigned long)((*it).m_long);
- }
- if ((*it).m_uds == KIO::UDS_CREATION_TIME) {
- unsigned long uid = (unsigned long)((*it).m_long);
- uidLabel->setText(QString::fromLatin1("%1").arg(uid, 8, 16));
- }
- if ((*it).m_uds == KIO::UDS_NAME) {
- QString name = ((*it).m_str);
- typeLabel->setText(name);
- }
- if ((*it).m_uds == KIO::UDS_USER) {
- QString name = ((*it).m_str);
- gb->setTitle(QString(i18n("Information for Psion drive %1: (%2)")).arg(name).arg(properties->item()->name()));
- }
- }
- if (total_found && free_found) {
- totalLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(total)).arg(KGlobal::locale()->formatNumber(total, 0)));
- freeLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(unused)).arg(KGlobal::locale()->formatNumber(unused, 0)));
- pie->addPiece(total - unused, usedColor);
- pie->addPiece(unused, freeColor);
+ KIO::StatJob *sJob = static_cast<KIO::StatJob *>(job);
+
+ if (sJob->error())
+ job->showErrorDialog(d->props->dialog());
+ else {
+ KIO::UDSEntry e = sJob->statResult();
+ bool total_found = false;
+ bool free_found = false;
+ u_int32_t total;
+ u_int32_t unused;
+
+ for (KIO::UDSEntry::ConstIterator it = e.begin(); it != e.end(); ++it) {
+ if ((*it).m_uds == KIO::UDS_SIZE) {
+ total_found = true;
+ total = (unsigned long)((*it).m_long);
+ }
+ if ((*it).m_uds == KIO::UDS_MODIFICATION_TIME) {
+ free_found = true;
+ unused = (unsigned long)((*it).m_long);
+ }
+ if ((*it).m_uds == KIO::UDS_CREATION_TIME) {
+ unsigned long uid = (unsigned long)((*it).m_long);
+ d->uidLabel->setText(QString::fromLatin1("%1").arg(uid, 8, 16));
+ }
+ if ((*it).m_uds == KIO::UDS_NAME) {
+ QString name = ((*it).m_str);
+ d->typeLabel->setText(name);
+ if (name == QString::fromLatin1("ROM")) {
+ d->restoreButton->setEnabled(false);
+ d->formatButton->setEnabled(false);
+ // Can't change anything
+ removeDialogPage(d->props->dialog(), i18n("&General"));
}
+ }
+ if ((*it).m_uds == KIO::UDS_USER) {
+ d->driveLetter = ((*it).m_str);
+ d->gb->setTitle(QString(i18n("Information for Psion drive %1: (%2)")).arg(d->driveLetter).arg(d->props->item()->name()));
+ }
}
+ if (total_found && free_found) {
+ d->totalLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(total)).arg(KGlobal::locale()->formatNumber(total, 0)));
+ d->freeLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(unused)).arg(KGlobal::locale()->formatNumber(unused, 0)));
+ d->pie->addPiece(total - unused, d->usedColor);
+ d->pie->addPiece(unused, d->freeColor);
+ }
+ }
}
class PlpMachinePage::PlpMachinePagePrivate {
public:
- PlpMachinePagePrivate() { }
- ~PlpMachinePagePrivate() { }
-
- QFrame *m_frame;
+ PlpMachinePagePrivate() { }
+ ~PlpMachinePagePrivate() { }
+
+ KPropertiesDialog *props;
+
+ QFrame *f;
+ QGridLayout *g;
+
+ QLabel *machType;
+ QLabel *machName;
+ QLabel *machUID;
+ QLabel *machLang;
+
+ QLabel *romVersion;
+ QLabel *romSize;
+ QLabel *romProg;
+
+ QLabel *ramSize;
+ QLabel *ramFree;
+ QLabel *ramMaxFree;
+ QLabel *ramDiskSz;
+
+ QLabel *regSize;
+ QLabel *dispGeo;
+ QLabel *machTime;
+ QLabel *machUTCo;
+ QLabel *machDST;
+
+ QLabel *mbattChanged;
+ QLabel *mbattUsage;
+ QLabel *mbattStatus;
+ QLabel *mbattPower;
+ QLabel *mbattCurrent;
+ QLabel *mbattVoltage;
+ QLabel *mbattMaxVoltage;
+
+ QLabel *bbattStatus;
+ QLabel *bbattUsage;
+ QLabel *bbattVoltage;
+ QLabel *bbattMaxVoltage;
+
+ rpcs::machineInfo mi;
};
-PlpMachinePage::PlpMachinePage( KPropertiesDialog *_props )
- : KPropsDlgPlugin( _props ) {
-
- d = new PlpMachinePagePrivate;
- d->m_frame = properties->dialog()->addPage(i18n("Psion &Machine"));
-
- QVBoxLayout * mainlayout = new QVBoxLayout( d->m_frame, KDialog::spacingHint());
-
- // Now the widgets in the top layout
-
- QLabel* l;
- l = new QLabel(d->m_frame, "Label_1" );
- l->setText( i18n("Machine UID:") );
- mainlayout->addWidget(l, 1);
+QLabel *PlpMachinePage::
+makeEntry(QString text, QWidget *w, int y) {
+ QLabel *l = new QLabel(w);
+ d->g->addWidget(new QLabel(text, w), y, 0);
+ d->g->addWidget(l, y, 1);
+ return l;
+}
- mainlayout->addStretch(2);
+PlpMachinePage::PlpMachinePage( KPropertiesDialog *_props ) {
+ d = new PlpMachinePagePrivate;
+ d->props = _props;
+
+ QGroupBox *gb;
+ QBoxLayout *box;
+
+ d->f = _props->dialog()->addPage(i18n("Psion &Machine"));
+
+ box = new QVBoxLayout(d->f, KDialog::spacingHint());
+ gb = new QGroupBox(i18n("General"), d->f, "genInfBox");
+ box->addWidget(gb);
+ d->g = new QGridLayout(gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint());
+
+ d->machType = makeEntry(i18n("Machine type:"), gb, 1);
+ QWhatsThis::add(d->machType,
+ i18n("Here, the type of the connected device is shown."));
+ d->machName = makeEntry(i18n("Model name:"), gb, 2);
+ QWhatsThis::add(d->machName,
+ i18n("Here, the model name of the connected device is shown."));
+ d->machUID = makeEntry(i18n("Machine UID:"), gb, 3);
+ QWhatsThis::add(d->machUID,
+ i18n("Here, the unique ID of the connected device is shown."));
+ d->machLang = makeEntry(i18n("UI language:"), gb, 4);
+ QWhatsThis::add(d->machLang,
+ i18n("Here, the user interface language of the connected device is shown."));
+ d->dispGeo = makeEntry(i18n("Display geometry:"), gb, 5);
+ QWhatsThis::add(d->dispGeo,
+ i18n("Here, the display geometry of the connected device is shown."));
+ d->regSize = makeEntry(i18n("Registry size:"), gb, 6);
+ QWhatsThis::add(d->regSize,
+ i18n("Here, the size of the registry data is shown."));
+ d->g->addRowSpacing(0, KDialog::marginHint());
+ d->g->setColStretch(1, 1);
+
+ gb = new QGroupBox(i18n("Time"), d->f, "timeInfBox");
+ box->addWidget(gb);
+ d->g = new QGridLayout(gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint());
+ d->machTime = makeEntry(i18n("Date/Time:"), gb, 1);
+ QWhatsThis::add(d->machTime,
+ i18n("Here, the current time setting of the connected device is shown."));
+ d->machUTCo = makeEntry(i18n("UTC offset"), gb, 2);
+ QWhatsThis::add(d->machUTCo,
+ i18n("Here, the offset of the connected device's time zone relative to GMT is shown."));
+ d->machDST = makeEntry(i18n("Daylight saving"), gb, 3);
+ QWhatsThis::add(d->machDST,
+ i18n("Here, you can see, if daylight saving time is currently active on the connected device."));
+ d->g->addRowSpacing(0, KDialog::marginHint());
+ d->g->setColStretch(1, 1);
+ box->addStretch(10);
+
+ d->f = _props->dialog()->addPage(i18n("Psion &Battery"));
+ box = new QVBoxLayout(d->f, KDialog::spacingHint());
+ gb = new QGroupBox(i18n("Main battery"), d->f, "mbatInfBox");
+ box->addWidget(gb);
+ d->g = new QGridLayout(gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint());
+ d->mbattChanged = makeEntry(i18n("Changed at:"), gb, 1);
+ QWhatsThis::add(d->mbattChanged,
+ i18n("This shows the time of last battery change."));
+ d->mbattUsage = makeEntry(i18n("Usage time:"), gb, 2);
+ QWhatsThis::add(d->mbattUsage,
+ i18n("This shows the accumulated time of running on battery power."));
+ d->mbattStatus = makeEntry(i18n("Status:"), gb, 3);
+ QWhatsThis::add(d->mbattStatus,
+ i18n("This shows current status of the battery."));
+ d->mbattPower = makeEntry(i18n("Total consumed power:"), gb, 4);
+ QWhatsThis::add(d->mbattPower,
+ i18n("This shows accumulated power consumtion of the device."));
+ d->mbattCurrent = makeEntry(i18n("Current:"), gb, 5);
+ QWhatsThis::add(d->mbattCurrent,
+ i18n("This shows the current, drawn from power supply (battery or mains)."));
+ d->mbattVoltage = makeEntry(i18n("Voltage:"), gb, 6);
+ QWhatsThis::add(d->mbattVoltage,
+ i18n("This shows the current battery voltage."));
+ d->mbattMaxVoltage = makeEntry(i18n("Max. voltage:"), gb, 7);
+ QWhatsThis::add(d->mbattMaxVoltage,
+ i18n("This shows the maximum battery voltage."));
+ d->g->addRowSpacing(0, KDialog::marginHint());
+ d->g->setColStretch(1, 1);
+
+ gb = new QGroupBox(i18n("Backup battery"), d->f, "bbatInfBox");
+ box->addWidget(gb);
+ d->g = new QGridLayout(gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint());
+ d->bbattUsage = makeEntry(i18n("Usage time:"), gb, 1);
+ QWhatsThis::add(d->bbattUsage,
+ i18n("This shows the accumulated time of running on backup battery power."));
+ d->bbattStatus = makeEntry(i18n("Status:"), gb, 2);
+ QWhatsThis::add(d->bbattStatus,
+ i18n("This shows current status of the backup battery."));
+ d->bbattVoltage = makeEntry(i18n("Voltage:"), gb, 3);
+ QWhatsThis::add(d->bbattVoltage,
+ i18n("This shows the current backup battery voltage."));
+ d->bbattMaxVoltage = makeEntry(i18n("Max. voltage:"), gb, 4);
+ QWhatsThis::add(d->bbattMaxVoltage,
+ i18n("This shows the maximum backup battery voltage."));
+ d->g->addRowSpacing(0, KDialog::marginHint());
+ d->g->setColStretch(1, 1);
+ box->addStretch(10);
+
+ d->f = _props->dialog()->addPage(i18n("Psion M&emory"));
+
+ box = new QVBoxLayout(d->f, KDialog::spacingHint());
+ gb = new QGroupBox(i18n("ROM"), d->f, "romInfBox");
+ box->addWidget(gb);
+ d->g = new QGridLayout(gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint());
+ d->romVersion = makeEntry(i18n("Version:"), gb, 1);
+ QWhatsThis::add(d->romVersion,
+ i18n("This shows the firmware version."));
+ d->romSize = makeEntry(i18n("Size:"), gb, 2);
+ QWhatsThis::add(d->romSize,
+ i18n("This shows the size of the ROM."));
+ d->romProg = makeEntry(i18n("Programmable:"), gb, 3);
+ QWhatsThis::add(d->romProg,
+ i18n("This shows, whether the ROM is flashable or not."));
+ d->g->addRowSpacing(0, KDialog::marginHint());
+ d->g->setColStretch(1, 1);
+
+ gb = new QGroupBox(i18n("RAM"), d->f, "ramInfBox");
+ box->addWidget(gb);
+ d->g = new QGridLayout(gb, 1, 1, KDialog::marginHint(),
+ KDialog::spacingHint());
+ d->ramSize = makeEntry(i18n("Size:"), gb, 1);
+ QWhatsThis::add(d->ramSize,
+ i18n("This shows the total capacity of the RAM."));
+ d->ramFree = makeEntry(i18n("Free:"), gb, 2);
+ QWhatsThis::add(d->ramFree,
+ i18n("This shows the free capacity of the RAM."));
+ d->ramMaxFree = makeEntry(i18n("Max. free:"), gb, 3);
+ QWhatsThis::add(d->ramMaxFree,
+ i18n("This shows the size of the largest free block of the RAM."));
+ d->ramDiskSz = makeEntry(i18n("RAMDisk size:"), gb, 4);
+ QWhatsThis::add(d->ramMaxFree,
+ i18n("This shows, how much RAM is currently used for the RAMDisc."));
+ d->g->addRowSpacing(0, KDialog::marginHint());
+ d->g->setColStretch(1, 1);
+ box->addStretch(10);
+
+ KIO_ARGS << int(PLP_CMD_MACHINFO);
+ PlpMachInfoJob *job = new PlpMachInfoJob(packedArgs);
+ connect(job, SIGNAL(result(KIO::Job *)),
+ SLOT(slotJobFinished(KIO::Job *)));
+ connect(job, SIGNAL(data(KIO::Job *, const QByteArray &)),
+ SLOT(slotJobData(KIO::Job *, const QByteArray &)));
}
PlpMachinePage::~PlpMachinePage() {
- delete d;
+ delete d;
}
bool PlpMachinePage::supports(KFileItemList _items) {
- for (KFileItemListIterator it(_items); it.current(); ++it) {
- KFileItem *fi = it.current();
-
- QString path = fi->url().path(-1);
- if (path.contains('/') != 1)
- return false;
- if (fi->mimetype() != QString::fromLatin1("application/x-psion-machine"))
- return false;
- }
- return true;
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ if (fi->url().path() != QString::fromLatin1("/"))
+ return false;
+ }
+ return true;
}
-void PlpMachinePage::applyChanges() {
+void PlpMachinePage::slotJobData(KIO::Job *job, const QByteArray &data) {
+ cout << "Mjdata" << endl;
+ if (data.size() == sizeof(d->mi)) {
+ memcpy((char *)&d->mi, data, sizeof(d->mi));
+ cout << "got machInfo" << endl;
+
+ d->machType->setText(KGlobal::locale()->translate(d->mi.machineType));
+ d->machName->setText(QString::fromLatin1(d->mi.machineName));
+ // ??! None of QString's formatting methods knows about long long.
+ ostrstream s;
+ s << hex << setw(16) << d->mi.machineUID << '\0';
+ d->machUID->setText(QString::fromLatin1(s.str()));
+ d->machLang->setText(KGlobal::locale()->translate(d->mi.uiLanguage));
+ d->dispGeo->setText(QString::fromLatin1("%1x%2").arg(d->mi.displayWidth).arg(d->mi.displayHeight));
+ d->regSize->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(d->mi.registrySize)).arg(KGlobal::locale()->formatNumber(d->mi.registrySize, 0)));
+
+ QString rev;
+ rev.sprintf("%d.%02d(%d)", d->mi.romMajor, d->mi.romMinor,
+ d->mi.romBuild);
+ d->romVersion->setText(rev);
+ d->romSize->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(d->mi.romSize)).arg(KGlobal::locale()->formatNumber(d->mi.romSize, 0)));
+ d->romProg->setText(d->mi.romProgrammable ? i18n("yes") : i18n("no"));
+
+ d->ramSize->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(d->mi.ramSize)).arg(KGlobal::locale()->formatNumber(d->mi.ramSize, 0)));
+ d->ramFree->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(d->mi.ramFree)).arg(KGlobal::locale()->formatNumber(d->mi.ramFree, 0)));
+ d->ramMaxFree->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(d->mi.ramMaxFree)).arg(KGlobal::locale()->formatNumber(d->mi.ramMaxFree, 0)));
+ d->ramDiskSz->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(d->mi.ramDiskSize)).arg(KGlobal::locale()->formatNumber(d->mi.ramDiskSize, 0)));
+
+
+ PsiTime pt(&d->mi.time, &d->mi.tz);
+ QDateTime dt;
+ dt.setTime_t(pt.getTime());
+ d->machTime->setText(KGlobal::locale()->formatDateTime(dt, false));
+ d->machUTCo->setText(i18n("%1 seconds").arg(d->mi.tz.utc_offset));
+ d->machDST->setText((d->mi.tz.dst_zones & PsiTime::PSI_TZ_HOME) ? i18n("yes") : i18n("no"));
+
+ ostrstream mbs;
+ mbs << d->mi.mainBatteryUsedTime << '\0';
+ d->mbattUsage->setText(QString::fromLatin1(mbs.str()));
+ pt.setPsiTime(&d->mi.mainBatteryInsertionTime);
+ dt.setTime_t(pt.getTime());
+ d->mbattChanged->setText(KGlobal::locale()->formatDateTime(dt, false));
+ d->mbattStatus->setText(
+ KGlobal::locale()->translate(d->mi.mainBatteryStatus));
+ d->mbattPower->setText(QString::fromLatin1("%1 mAs").arg(KGlobal::locale()->formatNumber(d->mi.mainBatteryUsedPower, 0)));
+ d->mbattCurrent->setText(QString::fromLatin1("%1 mA").arg(KGlobal::locale()->formatNumber(d->mi.mainBatteryCurrent, 0)));
+ d->mbattVoltage->setText(QString::fromLatin1("%1 mV").arg(KGlobal::locale()->formatNumber(d->mi.mainBatteryVoltage, 0)));
+ d->mbattMaxVoltage->setText(QString::fromLatin1("%1 mV").arg(KGlobal::locale()->formatNumber(d->mi.mainBatteryMaxVoltage, 0)));
+
+ ostrstream bbs;
+ bbs << d->mi.backupBatteryUsedTime << '\0';
+ d->bbattUsage->setText(QString::fromLatin1(bbs.str()));
+ d->bbattStatus->setText(
+ KGlobal::locale()->translate(d->mi.backupBatteryStatus));
+ d->bbattVoltage->setText(QString::fromLatin1("%1 mV").arg(KGlobal::locale()->formatNumber(d->mi.backupBatteryVoltage, 0)));
+ d->bbattMaxVoltage->setText(QString::fromLatin1("%1 mV").arg(KGlobal::locale()->formatNumber(d->mi.backupBatteryMaxVoltage, 0)));
+ }
}
+void PlpMachinePage::slotJobFinished(KIO::Job *job) {
+ PlpMachInfoJob *mJob = static_cast<PlpMachInfoJob *>(job);
+
+ if (mJob->error())
+ job->showErrorDialog(d->props->dialog());
+}
class PlpOwnerPage::PlpOwnerPagePrivate
{
public:
- PlpOwnerPagePrivate() { }
- ~PlpOwnerPagePrivate() { }
+ PlpOwnerPagePrivate() { }
+ ~PlpOwnerPagePrivate() { }
- QFrame *m_frame;
+ QFrame *frame;
+ KPropertiesDialog *props;
+ QMultiLineEdit *owneredit;
};
-PlpOwnerPage::PlpOwnerPage( KPropertiesDialog *_props ) : KPropsDlgPlugin( _props ) {
- d = new PlpOwnerPagePrivate;
- d->m_frame = properties->dialog()->addPage(i18n("Psion &Owner"));
+PlpOwnerPage::PlpOwnerPage( KPropertiesDialog *_props ) {
+ d = new PlpOwnerPagePrivate;
+ d->props = _props;
+ d->frame = _props->dialog()->addPage(i18n("Psion &Owner"));
+ QBoxLayout *box = new QVBoxLayout( d->frame, KDialog::spacingHint() );
+ d->owneredit = new QMultiLineEdit(d->frame, "ownerinfo");
+ d->owneredit->setReadOnly(true);
+ box->addWidget(d->owneredit);
+ QWhatsThis::add(d->owneredit,
+ i18n("This shows the owner's information of the connected device."));
+
+ KIO_ARGS << int(PLP_CMD_OWNERINFO);
+ KIO::StatJob *job = new KIO::StatJob(KURL("psion:/"),
+ KIO::CMD_SPECIAL, packedArgs, false);
+ connect(job, SIGNAL(result(KIO::Job *)),
+ SLOT(slotSpecialFinished(KIO::Job *)));
+
+ box->addStretch(10);
}
PlpOwnerPage::~PlpOwnerPage() {
- delete d;
+ delete d;
}
bool PlpOwnerPage::supports(KFileItemList _items) {
- for (KFileItemListIterator it(_items); it.current(); ++it) {
- KFileItem *fi = it.current();
-
- QString path = fi->url().path(-1);
- if (path.contains('/') != 1)
- return false;
- if (fi->mimetype() != QString::fromLatin1("application/x-psion-owner"))
- return false;
+ for (KFileItemListIterator it(_items); it.current(); ++it) {
+ KFileItem *fi = it.current();
+
+ if (fi->url().path() != QString::fromLatin1("/"))
+ return false;
+ }
+ return true;
+}
+
+void PlpOwnerPage::slotSpecialFinished(KIO::Job *job) {
+ KIO::StatJob *sJob = static_cast<KIO::StatJob *>(job);
+
+ if (sJob->error())
+ job->showErrorDialog(d->props->dialog());
+ else {
+ KIO::UDSEntry e = sJob->statResult();
+ for (KIO::UDSEntry::ConstIterator it = e.begin();
+ it != e.end(); ++it) {
+ if ((*it).m_uds == KIO::UDS_NAME)
+ d->owneredit->setText((*it).m_str);
}
- return true;
+ }
}
-void PlpOwnerPage::applyChanges() {
+PlpMachInfoJob::PlpMachInfoJob(const QByteArray &packedArgs)
+ : KIO::TransferJob(KURL("psion:/"), KIO::CMD_SPECIAL,
+ packedArgs, QByteArray(), false) {
+}
+
+void PlpMachInfoJob::
+slotFinished() {
+ SimpleJob::slotFinished();
}
#include "plpprops.moc"
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/kde2/plugins/plpprops.h b/kde2/plugins/plpprops.h
index eeb3d4d..b7e23e0 100644
--- a/kde2/plugins/plpprops.h
+++ b/kde2/plugins/plpprops.h
@@ -1,146 +1,191 @@
-/* $Id$
+/*-*-c++-*-
+ * $Id$
+ *
+ * This file is part of plptools.
+ *
+ * Copyright (C) 1999 Philip Proudman <philip.proudman@btinternet.com>
+ * Copyright (C) 1999-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
*
- * This file holds the definitions for all classes used to
- * display a Psion related properties dialog.
*/
-
#ifndef _PLPPROPS_H_
#define _PLPPROPS_H_
#include <qstring.h>
#include <qlist.h>
#include <qgroupbox.h>
+#include <qmultilineedit.h>
#include <kurl.h>
#include <kfileitem.h>
#include <kdialogbase.h>
#include <kpropsdlg.h>
+#include <krun.h>
+#include <kio/job.h>
#include "pie3dwidget.h"
-namespace KIO { class Job; }
+class PlpMachInfoJob : public KIO::TransferJob {
+ Q_OBJECT
+
+public:
+ PlpMachInfoJob(const QByteArray &packedArgs);
+
+protected slots:
+ virtual void slotFinished();
+
+};
class PlpPropsPlugin : public KPropsDlgPlugin {
- Q_OBJECT
- public:
- /**
- * Constructor
- */
- PlpPropsPlugin( KPropertiesDialog *_props );
- virtual ~PlpPropsPlugin();
-
- /**
- * Applies all changes made.
- */
- virtual void applyChanges();
-
- /**
- * Tests whether the files specified by _items need a 'General' plugin.
- */
- static bool supports(KFileItemList _items);
-
- /**
- * Called after all plugins applied their changes
- */
- void postApplyChanges();
-
- private:
- class PlpPropsPluginPrivate;
- PlpPropsPluginPrivate *d;
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ PlpPropsPlugin( KPropertiesDialog *_props );
+ virtual ~PlpPropsPlugin();
+
+ /**
+ * Applies all changes made.
+ */
+ virtual void applyChanges();
+
+ /**
+ * Tests whether the files specified by _items need a 'General' plugin.
+ */
+ static bool supports(KFileItemList _items);
+
+signals:
+ void save();
+
+private slots:
+ void doChange();
+
+private:
+ class PlpPropsPluginPrivate;
+ PlpPropsPluginPrivate *d;
};
-class PlpFileAttrPage : public KPropsDlgPlugin {
- Q_OBJECT
- public:
- /**
- * Constructor
- */
- PlpFileAttrPage(KPropertiesDialog *_props);
- virtual ~PlpFileAttrPage();
+class PlpFileAttrPage : public QObject {
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ PlpFileAttrPage(KPropertiesDialog *_props);
+ virtual ~PlpFileAttrPage();
+
+ static bool supports(KFileItemList _items);
- virtual void applyChanges();
+public slots:
+ void applyChanges();
- static bool supports(KFileItemList _items);
+signals:
+ void changed();
- private:
- class PlpFileAttrPagePrivate;
- PlpFileAttrPagePrivate *d;
+private slots:
+ void slotGetSpecialFinished(KIO::Job *job);
+ void slotSetSpecialFinished(KIO::Job *job);
+ void slotCbToggled(bool);
+
+private:
+ class PlpFileAttrPagePrivate;
+ PlpFileAttrPagePrivate *d;
};
-class PlpDriveAttrPage : public KPropsDlgPlugin {
- Q_OBJECT
- public:
- /**
- * Constructor
- */
- PlpDriveAttrPage(KPropertiesDialog *_props);
- virtual ~PlpDriveAttrPage();
-
- virtual void applyChanges();
-
- static bool supports(KFileItemList _items);
-
- private slots:
- void slotSpecialFinished(KIO::Job *job);
-
- private:
- class PlpDriveAttrPagePrivate;
- PlpDriveAttrPagePrivate *d;
-
- unsigned long total;
- unsigned long unused;
-
- QGroupBox *gb;
- QLabel *uidLabel;
- QLabel *typeLabel;
- QLabel *totalLabel;
- QLabel *freeLabel;
- QColor usedColor;
- QColor freeColor;
- Pie3DWidget *pie;
+class PlpDriveAttrPage : public QObject {
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ PlpDriveAttrPage(KPropertiesDialog *_props);
+ virtual ~PlpDriveAttrPage();
+
+ static bool supports(KFileItemList _items);
+
+private slots:
+ void slotSpecialFinished(KIO::Job *job);
+ void slotBackupClicked();
+ void slotRestoreClicked();
+ void slotFormatClicked();
+
+private:
+ class PlpDriveAttrPagePrivate;
+ PlpDriveAttrPagePrivate *d;
+
};
/**
- * Used to view/edit machine info.
+ * Used to view machine info.
*/
-class PlpMachinePage : public KPropsDlgPlugin {
- Q_OBJECT
- public:
- /**
- * Constructor
- */
- PlpMachinePage(KPropertiesDialog *_props);
- virtual ~PlpMachinePage();
-
- virtual void applyChanges();
-
- static bool supports(KFileItemList _items);
-
- private:
- class PlpMachinePagePrivate;
- PlpMachinePagePrivate *d;
+class PlpMachinePage : public QObject {
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ PlpMachinePage(KPropertiesDialog *_props);
+ virtual ~PlpMachinePage();
+
+ static bool supports(KFileItemList _items);
+
+private slots:
+ void slotJobData(KIO::Job *job, const QByteArray &data);
+ void slotJobFinished(KIO::Job *job);
+
+private:
+ class PlpMachinePagePrivate;
+ PlpMachinePagePrivate *d;
+
+ QLabel *makeEntry(QString text, QWidget *w, int y);
};
/**
- * Used to view/edit owner info
+ * Used to view owner info
*/
-class PlpOwnerPage : public KPropsDlgPlugin {
- Q_OBJECT
- public:
- /**
- * Constructor
- */
- PlpOwnerPage(KPropertiesDialog *_props);
- virtual ~PlpOwnerPage();
-
- virtual void applyChanges();
-
- static bool supports(KFileItemList _items);
-
- private:
- class PlpOwnerPagePrivate;
- PlpOwnerPagePrivate *d;
+class PlpOwnerPage : public QObject {
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor
+ */
+ PlpOwnerPage(KPropertiesDialog *_props);
+ virtual ~PlpOwnerPage();
+
+ static bool supports(KFileItemList _items);
+
+private slots:
+void slotSpecialFinished(KIO::Job *job);
+
+private:
+ class PlpOwnerPagePrivate;
+ PlpOwnerPagePrivate *d;
};
#endif
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/kde2/plugins/plppropsFactory.cc b/kde2/plugins/plppropsFactory.cc
index 2c553cf..616b12b 100644
--- a/kde2/plugins/plppropsFactory.cc
+++ b/kde2/plugins/plppropsFactory.cc
@@ -1,3 +1,13 @@
+namespace LIBPLP {
+extern "C" {
+#include <intl.h>
+ void init_libplp_i18n() {
+ bind_textdomain_codeset(PACKAGE, "latin1");
+ textdomain(PACKAGE);
+ }
+};
+};
+
#include "plppropsFactory.h"
#include "plpprops.h"
@@ -15,7 +25,8 @@ plppropsFactory::plppropsFactory(QObject *parent, const char *name)
: KLibFactory(parent, name) {
s_global = new KInstance("plpprops");
// Install the translations
- //KGlobal::locale()->insertCatalogue("plpprops");
+ KGlobal::locale()->insertCatalogue(QString::fromLatin1("plptools"));
+ LIBPLP::init_libplp_i18n();
}
plppropsFactory::~plppropsFactory() {
@@ -26,7 +37,6 @@ QObject* plppropsFactory::createObject(QObject* parent, const char *name, const
QObject *obj = 0L;
- cout << "plppropsFactory: name=" << name << " class=" << classname << endl;
if ((strcmp(classname, "KPropsDlgPlugin") == 0) &&
parent &&
parent->inherits("KPropertiesDialog"))
diff --git a/kde2/po/Makefile.am b/kde2/po/Makefile.am
new file mode 100644
index 0000000..4504a98
--- /dev/null
+++ b/kde2/po/Makefile.am
@@ -0,0 +1,24 @@
+
+SUBDIRS = de
+
+APPS = kpsion
+
+merge:
+ @apps='$(APPS)'; \
+ langs='$(SUBDIRS)'; \
+ for cat in $$apps; do \
+ for lang in $$langs; do \
+ if test -r $$lang/$$cat.po; then \
+ echo $$cat; \
+ msgmerge -o $$cat.new $$lang/$$cat.po $$cat.pot; \
+ if test -s $$cat.new && diff $$lang/$$cat.po $$cat.new; then \
+ rm $$cat.new; \
+ else \
+ mv $$cat.new $$lang/$$cat.po ; \
+ fi; \
+ fi ;\
+ done ;\
+ done
+
+messages:
+
diff --git a/kde2/po/de/Makefile.am b/kde2/po/de/Makefile.am
new file mode 100644
index 0000000..62d74e6
--- /dev/null
+++ b/kde2/po/de/Makefile.am
@@ -0,0 +1,3 @@
+KDE_LANG = de
+
+POFILES = AUTO
diff --git a/kde2/po/de/kpsion.po b/kde2/po/de/kpsion.po
new file mode 100644
index 0000000..f145b98
--- /dev/null
+++ b/kde2/po/de/kpsion.po
@@ -0,0 +1,631 @@
+# Message catalog for KPsion.
+# Copyright (C) 2001 Free Software Foundation, Inc.
+# Fritz Elfert <felfert@to.com>, 2001.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: plptools 0.7\n"
+"POT-Creation-Date: 2001-02-15 21:17+0100\n"
+"PO-Revision-Date: 2001-02-15 22:13CET\n"
+"Last-Translator: Fritz Elfert <felfert@to.com>\n"
+"Language-Team: Deutsch <de@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 0.8\n"
+
+#: kpsion.cpp:37
+msgid "Idle"
+msgstr "Bereit"
+
+#: kpsion.cpp:62 wizards.cpp:210
+msgid "off"
+msgstr "aus"
+
+#: kpsion.cpp:66
+msgid ""
+"<qt>Here, you see your Psion's drives.<br/>Every drive is represented by an "
+"Icon. If you click on it, it gets selected for the next operation. E.g.: "
+"backup, restore or format.<br/>To unselect it, simply click on it "
+"again.<br/>Select as many drives a you want, then choose an operation.</qt>"
+msgstr ""
+"<qt>Hier sehen Sie die Laufwerke Ihres Psion.<br/>Jedes Laufwerk wird durch "
+"ein Icon repräsentiert. Wenn Sie auf dieses klicken, wird es für die "
+"nächste Operation angewählt. z.B.: Sicherung, Rücksicherung oder "
+"Formatierung.<br/>Klicken Sie einfach nochmal, um es wieder "
+"abzuwählen.<br/>Wählen Sie beliebig viele Laufwerke und dann eine "
+"Operation.</qt>"
+
+#: kpsion.cpp:101
+msgid "Start &Format"
+msgstr "Starte &Formatierung"
+
+#: kpsion.cpp:103
+msgid "Start Full &Backup"
+msgstr "Starte &Komplett-Sicherung"
+
+#: kpsion.cpp:105
+msgid "Start &Incremental Backup"
+msgstr "Starte &inkrementelle Sicherung"
+
+#: kpsion.cpp:107
+msgid "Start &Restore"
+msgstr "Starte &Rücksicherung"
+
+#: kpsion.cpp:116
+msgid "Full backup of selected drive(s)"
+msgstr "Komplett-Sicherung der ausgewählten Laufwerke"
+
+#: kpsion.cpp:117
+msgid "Incremental backup of selected drive(s)"
+msgstr "Inkrementelle Sicherung der ausgewählten Laufwerke"
+
+#: kpsion.cpp:118
+msgid "Restore selected drive(s)"
+msgstr "Sichere ausgewählte Laufwerke zurück"
+
+#: kpsion.cpp:119
+msgid "Format selected drive(s)"
+msgstr "Formatiere ausgewählte Laufwerke"
+
+#: kpsion.cpp:187
+msgid "Retrieving machine info ..."
+msgstr "Ermittle Geräte-Info ..."
+
+#: kpsion.cpp:190
+msgid "Could not get Psion machine info"
+msgstr "Konnte Psion Geräteinfo nicht ermitteln"
+
+#: kpsion.cpp:202
+msgid "an unknown machine"
+msgstr "einem unbekannten Gerät"
+
+#: kpsion.cpp:213
+msgid "Retrieving drive list ..."
+msgstr "Ermittle Laufwerks-Liste ..."
+
+#: kpsion.cpp:215
+msgid "Could not get list of drives"
+msgstr "Konnte Liste der Laufwerke nicht ermitteln"
+
+#: kpsion.cpp:233
+#, c-format
+msgid "Connected to %1"
+msgstr "Verbunden mit %1"
+
+#: kpsion.cpp:251
+msgid ""
+"A backup is running.\n"
+"Do you really want to quit?"
+msgstr ""
+"Eine Sicherung läuft.\n"
+"Wollen Sie wirklich das Programm beenden?"
+
+#: kpsion.cpp:253
+msgid ""
+"A restore is running.\n"
+"Do you really want to quit?"
+msgstr ""
+"Eine Rücksicherung läuft.\n"
+"Wollen Sie wirklich das Programm beenden?"
+
+#: kpsion.cpp:255
+msgid ""
+"A format is running.\n"
+"Do you really want to quit?"
+msgstr ""
+"Eine Formatierung läuft.\n"
+"Wollen Sie wirklich das Programm beenden?"
+
+#: kpsion.cpp:280
+msgid "Connecting ..."
+msgstr "Verbindungsaufbau ..."
+
+#: kpsion.cpp:282
+msgid "RFSV could not connect to ncpd at %1:%2. "
+msgstr "RFSV konnte ncpd auf %1:%2 nicht erreichen. "
+
+#: kpsion.cpp:285 kpsion.cpp:301 kpsion.cpp:319 kpsion.cpp:339
+msgid " (Retry in %1 seconds.)"
+msgstr " (Wiederholung in %1 Sekunden.)"
+
+#: kpsion.cpp:296
+#, c-format
+msgid "RFSV could not establish link: %1."
+msgstr "RFSV konnte keine Verbindung aufbauen: %1."
+
+#: kpsion.cpp:312
+msgid "RPCS could not connect to ncpd at %1:%2."
+msgstr "RPCS konnte ncpd auf %1:%2 nicht erreichen."
+
+#: kpsion.cpp:330
+#, c-format
+msgid "RPCS could not establish link: %1."
+msgstr "RPCS konnte keine Verbindung aufbauen: %1."
+
+#: kpsion.cpp:380 kpsion.cpp:433
+msgid "Backup"
+msgstr "Sicherung"
+
+#: kpsion.cpp:407
+#, c-format
+msgid "Could not retrieve drive details for drive %1"
+msgstr "Konnte Details des Laufwerks %1 nicht ermitteln."
+
+#: kpsion.cpp:414
+#, c-format
+msgid "Scanning drive %1"
+msgstr "Durchsuche Laufwerk %1"
+
+#: kpsion.cpp:423
+msgid "%1 files need backup"
+msgstr "%1 Dateien müssen gesichert werden"
+
+#: kpsion.cpp:425
+msgid "No files need backup"
+msgstr "Keine Dateien zu sichern"
+
+#: kpsion.cpp:446
+#, c-format
+msgid "Could not create backup folder %1"
+msgstr "Konnte Sicherungs-Ordner %1 nicht anlegen."
+
+#: kpsion.cpp:499
+#, c-format
+msgid "Backing up %1"
+msgstr "Sichere %1"
+
+#: kpsion.cpp:511
+msgid "<QT>Could not open<BR/><B>%1</B></QT>"
+msgstr "<QT>Konnte<BR/><B>%1</B><BR/>nicht öffnen</QT>"
+
+#: kpsion.cpp:530
+msgid "<QT>Could not read<BR/><B>%1</B></QT>"
+msgstr "<QT>Konnte<BR/><B>%1</B><BR/>nicht lesen</QT>"
+
+#: kpsion.cpp:551
+msgid "Backup done"
+msgstr "Sicherung beendet"
+
+#: kpsion.cpp:563
+msgid ""
+"<QT>This erases <B>ALL</B> data on the drive(s).<BR/>Do you really want to "
+"proceed?"
+msgstr ""
+"<QT>Hierdurch werden <B>ALLE</B> Daten auf dem(den) Laufwerk(en) gelöscht.<BR/>"
+"Wollen Sie wirklich fortfahren?</QT>"
+
+#: kpsion.cpp:611
+msgid "Backup %1% complete"
+msgstr "Sicherung %1% erledigt"
+
+#: kpsion.cpp:676
+#, c-format
+msgid "Stopping %1"
+msgstr "Stoppe %1"
+
+#: kpsion.cpp:697
+#, c-format
+msgid "Starting %1"
+msgstr "Starte %1"
+
+#: kpsion.moc.cpp:43 kpsion.moc.cpp:48
+msgid "KPsionMainWindow"
+msgstr "KPsionMainWindow"
+
+#: main.cpp:15
+msgid "perform backup"
+msgstr "Führe Sicherung durch"
+
+#: main.cpp:17
+msgid "perform restore"
+msgstr "Führe Rücksicherung durch"
+
+#: main.cpp:19
+msgid "format drive"
+msgstr "Formatiere Laufwerk"
+
+#: main.cpp:20
+msgid "The drive letter to backup/restore or format."
+msgstr "Der Buchstabe des zu bearbeitenden Laufwerks."
+
+#: main.cpp:25
+msgid "KPsion"
+msgstr "KPsion"
+
+#: main.cpp:26
+msgid "Psion connectivity utility"
+msgstr "Werkzeug für Psion PDA"
+
+#: main.cpp:31
+msgid "Original Developer/Maintainer"
+msgstr "Original Entwickler/Betreuer"
+
+#: setupdialog.cpp:20
+msgid "&General"
+msgstr "&Allgemein"
+
+#: setupdialog.cpp:25
+msgid "Backup &directory"
+msgstr "&Ordner für Sicherungen"
+
+#: setupdialog.cpp:30 wizards.cpp:87
+msgid "Browse"
+msgstr "Durchsuchen"
+
+#: setupdialog.cpp:33 wizards.cpp:160
+msgid "Backup &generations"
+msgstr "Sicherungs-&Generationen"
+
+#: setupdialog.cpp:39
+msgid "&Machines"
+msgstr "&Geräte"
+
+#: setupdialog.cpp:43
+msgid "Machine &Name"
+msgstr "&Name des Geräts"
+
+#: setupdialog.cpp:48
+msgid "Machine &UID"
+msgstr "&UID des Geräts"
+
+#: wizards.cpp:26
+msgid "KPsion Setup"
+msgstr "KPsion Einstellungen"
+
+#: wizards.cpp:28 wizards.cpp:411
+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:30 wizards.cpp:413
+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:32
+msgid ""
+"<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>"
+msgstr ""
+"<QT>Wenn Sie diese Schaltfläche betätigen, wird die Konfiguration von "
+"<B>KPsion</B> abgebrochen. Beim nächsten Start von <B>KPsion</B> wird dann "
+"die Konfiguration erneut gestartet.</QT>"
+
+#: wizards.cpp:49
+msgid ""
+"<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>"
+msgstr ""
+"<QT><H2>Willkommen bei KPsion!</H2>Offensichtlich haben Sie <B>KPsion</B> "
+"zum ersten Mal gestartet. Jedenfalls kann ich keine gültige Konfiguration "
+"finden.</BR>Auf den folgenden Seiten werden wir einige Informationen "
+"sammeln, die für die Arbeit mit <B>KPsion</B> nötig sind.</BR> </BR>Viel "
+"Spaß.</QT>"
+
+#: wizards.cpp:66
+msgid "<QT><BIG><B>Welcome<B></BIG></QT>"
+msgstr "<QT><BIG><B>Willkommen<B></BIG></QT>"
+
+#: wizards.cpp:74
+msgid ""
+"<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>"
+msgstr ""
+"<QT>Zuerst benötigen wir einen Ordner zum Speichern der Sicherungen Ihres "
+"Psion. Sie wollen vielleicht nicht, daß Andere darauf Zugriff haben. Daher "
+"ist es am Besten, wenn Sie einen Ordner in Ihrem persönlichen Verzeichnis "
+"wählen. Bitte durchsuchen Sie existierende Ordner und wählen dabei eine "
+"adäquate Stelle oder akzeptieren Sie einfach die unten angezeigte "
+"Vorgabe.</QT>"
+
+#: wizards.cpp:90
+msgid "This is the name of the backup folder."
+msgstr "Dies ist der Name des Sicherungs-Ordners."
+
+#: wizards.cpp:92
+msgid ""
+"Click here, for opening a dialog which lets you easily select the backup "
+"folder."
+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:107
+msgid "<QT><BIG><B>Step 1</B></BIG> - Specify backup directory</QT>"
+msgstr "<QT><BIG><B>Schritt 1</B></BIG> - Angabe des Sicherungs-Ordners</QT>"
+
+#: wizards.cpp:114
+msgid ""
+"<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>"
+msgstr ""
+"<QT>Als nächstes geben Sie bitte einige Informationen zur "
+"Sicherungs-Strategie an:<UL><LI>Wie viele Sicherungs-Generationen wollen Sie "
+"aufheben?</LI><LI>Soll ich Sie an Sicherungen erinnern?</LI><LI>Wenn ja, in "
+"welchen Intervallen?</LI></UL></QT>"
+
+#: wizards.cpp:124
+msgid "&Incremental backup reminder"
+msgstr "Erinnerung an &inkrementelle Sicherung"
+
+#: wizards.cpp:127 wizards.cpp:145
+msgid "none"
+msgstr "keine"
+
+#: wizards.cpp:128 wizards.cpp:146
+msgid "daily"
+msgstr "täglich"
+
+#: wizards.cpp:129 wizards.cpp:147
+msgid "every 2 days"
+msgstr "alle 2 Tage"
+
+#: wizards.cpp:130 wizards.cpp:148
+msgid "every 3 days"
+msgstr "alle 3 Tage"
+
+#: wizards.cpp:131 wizards.cpp:149
+msgid "every 4 days"
+msgstr "alle 4 Tage"
+
+#: wizards.cpp:132 wizards.cpp:150
+msgid "every 5 days"
+msgstr "alle 5 Tage"
+
+#: wizards.cpp:133 wizards.cpp:151
+msgid "every 6 days"
+msgstr "alle 6 Tage"
+
+#: wizards.cpp:134 wizards.cpp:152
+msgid "weekly"
+msgstr "wöchentlich"
+
+#: wizards.cpp:135 wizards.cpp:153
+msgid "every 2 weeks"
+msgstr "alle 2 Wochen"
+
+#: wizards.cpp:136 wizards.cpp:154
+msgid "every 3 weeks"
+msgstr "alle 3 Wochen"
+
+#: wizards.cpp:137 wizards.cpp:155
+msgid "monthly"
+msgstr "monatlich"
+
+#: wizards.cpp:142
+msgid "&Full backup reminder"
+msgstr "Erinnerung an &Komplett-Sicherung"
+
+#: wizards.cpp:178
+msgid "<QT><BIG><B>Step 2</B></BIG> - Backup policy</QT>"
+msgstr "<QT><BIG><B>Schritt 2</B></BIG> - Sicherungs-Strategie</QT>"
+
+#: wizards.cpp:186
+msgid ""
+"<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>"
+msgstr ""
+"<QT>Wenn beim Programmstart keine Verbindung aufgebaut werden kann, wird <B>KPsion</B> "
+"in regelmäßigen Abständen versuchen erneut eine Verbinung aufzubauen. Bitte geben Sie den"
+"Zeitintervall an, nach dem ein erneuter Aufbau der Verbindung versucht werden soll. Wenn Sie "
+"diese automatische Funktionalität nicht wünschen, dann setzen Sie bitte den Intervall auf 0. "
+"Weiterhin kann <B>KPsion</B> versuchen, den hierzu benötigten Prozess ncpd zu starten falls "
+"dieser nicht schon läuft. Um dies zu ermöglichen, müssen Sie"
+"<UL><LI>den zu benutzenden seriellen Port angeben.</LI>"
+"<LI>die Schnittstellengeschwindigkeit angeben</LI>"
+"<LI>die Rechte zum Öffnen des angegebenen Ports besitzen</LI></UL></QT>"
+
+#: wizards.cpp:201
+msgid "&Connection retry interval (sec.)"
+msgstr "&Verbindungsaufbau-Intervall (in sek.)"
+
+#: wizards.cpp:207
+msgid "Serial &device"
+msgstr "&Serielle Schnittstelle"
+
+#: wizards.cpp:211
+msgid "/dev/ttyS0"
+msgstr "/dev/ttyS0"
+
+#: wizards.cpp:212
+msgid "/dev/ttyS1"
+msgstr "/dev/ttyS1"
+
+#: wizards.cpp:213
+msgid "/dev/ttyS2"
+msgstr "/dev/ttyS2"
+
+#: wizards.cpp:214
+msgid "/dev/ttyS3"
+msgstr "/dev/ttyS3"
+
+#: wizards.cpp:215
+msgid "/dev/ircomm0"
+msgstr "/dev/ircomm0"
+
+#: wizards.cpp:216
+msgid "/dev/ircomm1"
+msgstr "/dev/ircomm1"
+
+#: wizards.cpp:217
+msgid "/dev/ircomm2"
+msgstr "/dev/ircomm2"
+
+#: wizards.cpp:218
+msgid "/dev/ircomm3"
+msgstr "/dev/ircomm3"
+
+#: wizards.cpp:223
+msgid "Serial &speed"
+msgstr "Schnittstellen-&Geschwindigkeit"
+
+#: wizards.cpp:247
+msgid "<QT><BIG><B>Step 3</B></BIG> - Connection parameters</QT>"
+msgstr "<QT><BIG><B>Schritt 3</B></BIG> - Verbindungs-Parameter</QT>"
+
+#: wizards.cpp:255
+msgid ""
+"<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>"
+msgstr ""
+"<QT>Das war's!<BR/>Als nächstes wird <B>KPsion</B> gestartet und wenn Ihr Psion "
+"schon angeschlossen ist und auch seine Kommunikation eingeschaltet ist (benutzen sie dazu "
+"<B>Strg-T</B> auf Systemebene), dann wird <B>KPsion</B> einen weiteren Dialog ähnlich "
+"wie Diesen zur Eingabe des Namens präsentieren. Hinterher empfehle ich, als Erstes eine "
+"Komplett-Sicherung durchzuführen.<BR/>Bitte betätigen Sie nun die Schaltfläche "
+"<B>Abschließen</B>.</QT>"
+
+#: wizards.cpp:274
+msgid "<QT><BIG><B>Finished</B></BIG></QT>"
+msgstr "<QT><BIG><B>Fertig<B></BIG></QT>"
+
+#: wizards.cpp:282
+msgid "Backup folder"
+msgstr "Sicherungs-Ordner"
+
+#: wizards.cpp:292
+msgid ""
+"<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>"
+msgstr ""
+"<QT>Sie sind im Begriff die erstmalige Konfiguration von <B>KPsion</B> "
+"abzubrechen.Es werden keine Einstellungen gespeichert und sie werden diesen "
+"Vorgang wiederholen müssen, wenn Sie <B>KPsion</B> das nächste Mal "
+"starten.<BR/>Wollen Sie das Programm wirklich verlassen?</QT>"
+
+#: wizards.cpp:347
+msgid "<QT>The folder <B>%1</B> does <B>not</B> exist.<BR/>Shall it be created?</QT>"
+msgstr ""
+"<QT>Der Ordner <B>%1</B> existiert <B>nicht</B>.<BR/>Soll er angelegt "
+"werden?</QT>"
+
+#: wizards.cpp:352
+msgid "<QT>The specified folder<BR/><B>%1</B><BR/>could <B>not</B> be created"
+msgstr "<QT>Der angegebene Ordner<BR/><B>%1</B><BR/>konnte nicht angelegt werden"
+
+#: wizards.cpp:357
+msgid ""
+", because you either don't have sufficient rights to do that, or the "
+"filesystem is readonly."
+msgstr ""
+", weil Sie entweder nicht die nötigen Rechte besitzen, oder das Dateisystem "
+"nur lesbar ist."
+
+#: wizards.cpp:361
+msgid ", because the filesystem has not enough space."
+msgstr ", weil auf dem Dateisystem kein Platz mehr ist."
+
+#: wizards.cpp:367
+msgid ", because there already exists another object with the same name."
+msgstr ", weil schon ein anderes Objekt mit dem selben Namen existiert."
+
+#: wizards.cpp:377
+msgid ""
+", because you specified a path which probably contains a dangling symbolic "
+"link."
+msgstr ""
+", weil Sie eine Pfad angegeben haben, der eine nicht aufgelöste symbolische "
+"Verknüpfung enthält."
+
+#: wizards.cpp:380
+msgid ""
+", because you specified a path which contains an element which is not a "
+"folder."
+msgstr ""
+", weil Sie eine Pfad angegeben haben, der ein Element enthält, welches kein "
+"Ordner ist."
+
+#: wizards.cpp:384
+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:391
+msgid "<BR/>Please select another folder.</QT>"
+msgstr "<BR/>Bitte wählen Sie einen anderen Ordner.</QT>"
+
+#: wizards.cpp:407
+msgid "New Psion detected"
+msgstr "Neuer Psion erkannt"
+
+#: wizards.cpp:415
+msgid ""
+"<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>"
+msgstr ""
+"<QT>Wenn Sie diese Schaltfläche betätigen, werden die Einstellungen für den neuen "
+"Psion nicht gespeichert. Beim nächsten Verbindungsaufbau mit diesem Psion wird "
+"<B>KPsion</B> dann erneut diesen Dialog präsentieren.</QT>"
+
+#: wizards.cpp:424
+msgid ""
+"<QT>The Psion with the unique ID <B>%1</B> is connected the first time. "
+"Please assign a name to it.</QT>"
+msgstr ""
+"<QT>Zum Psion mit der ID <B>%1</B> wurde erstmalig Verbindung aufgenommen. "
+"Bitte weisen Sie diesem Gerät einen Namen zu.</QT>"
+
+#: wizards.cpp:431
+msgid "&Name of new Psion"
+msgstr "&Name des neuen Psion"
+
+#: wizards.cpp:433
+msgid "My new Psion"
+msgstr "Mein neuer Psion"
+
+#: wizards.cpp:450
+msgid "<QT><BIG><B>New Psion detected<B></BIG></QT>"
+msgstr "<QT><BIG><B>Neuer Psion erkannt<B></BIG></QT>"
+
+#: wizards.cpp:458
+msgid ""
+"<QT>Please select the Drive(s), you want to be backed up when running in "
+"unattended backup mode.</QT>"
+msgstr ""
+"<QT>Bitte wählen sie die Laufwerke aus, die bei einer automatischen Sicherung gesichert"
+"werden sollen.</QT>"
+
+#: wizards.cpp:466
+msgid "Available drives"
+msgstr "Verfügbare Laufwerke"
+
+#: wizards.cpp:490
+msgid "<QT><BIG><B>Specify drives to backup<B></BIG></QT>"
+msgstr "<QT><BIG><B>Wahl der zu sichernden Laufwerke<B></BIG></QT>"
+
+#: wizards.cpp:514
+msgid "The name cannot be empty."
+msgstr "Der Name darf nicht leer sein."
+
+#: wizards.cpp:521
+msgid ""
+"<QT>The name <B>%1</B> is already assigned to another machine.<BR/>Please "
+"choose a different name.</QT>"
+msgstr ""
+"<QT>Der Name <B>%1</B> wurde bereits einem anderen Gerät zugewiesen.<BR/>Bitte "
+"wählen Sie einen anderen Namen.</QT>"
+
+#: wizards.moc.cpp:43 wizards.moc.cpp:48
+msgid "FirstTimeWizard"
+msgstr "FirstTimeWizard"
+
+#: wizards.moc.cpp:112 wizards.moc.cpp:117
+msgid "NewPsionWizard"
+msgstr "NewPsionWizard"
+
diff --git a/kde2/po/kpsion.pot b/kde2/po/kpsion.pot
new file mode 100644
index 0000000..fcb5025
--- /dev/null
+++ b/kde2/po/kpsion.pot
@@ -0,0 +1,559 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2001-02-15 21:17+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: ENCODING\n"
+
+#: kpsion.cpp:37
+msgid "Idle"
+msgstr ""
+
+#: kpsion.cpp:62 wizards.cpp:210
+msgid "off"
+msgstr ""
+
+#: kpsion.cpp:66
+msgid ""
+"<qt>Here, you see your Psion's drives.<br/>Every drive is represented by an "
+"Icon. If you click on it, it gets selected for the next operation. E.g.: "
+"backup, restore or format.<br/>To unselect it, simply click on it "
+"again.<br/>Select as many drives a you want, then choose an operation.</qt>"
+msgstr ""
+
+#: kpsion.cpp:101
+msgid "Start &Format"
+msgstr ""
+
+#: kpsion.cpp:103
+msgid "Start Full &Backup"
+msgstr ""
+
+#: kpsion.cpp:105
+msgid "Start &Incremental Backup"
+msgstr ""
+
+#: kpsion.cpp:107
+msgid "Start &Restore"
+msgstr ""
+
+#: kpsion.cpp:116
+msgid "Full backup of selected drive(s)"
+msgstr ""
+
+#: kpsion.cpp:117
+msgid "Incremental backup of selected drive(s)"
+msgstr ""
+
+#: kpsion.cpp:118
+msgid "Restore selected drive(s)"
+msgstr ""
+
+#: kpsion.cpp:119
+msgid "Format selected drive(s)"
+msgstr ""
+
+#: kpsion.cpp:187
+msgid "Retrieving machine info ..."
+msgstr ""
+
+#: kpsion.cpp:190
+msgid "Could not get Psion machine info"
+msgstr ""
+
+#: kpsion.cpp:202
+msgid "an unknown machine"
+msgstr ""
+
+#: kpsion.cpp:213
+msgid "Retrieving drive list ..."
+msgstr ""
+
+#: kpsion.cpp:215
+msgid "Could not get list of drives"
+msgstr ""
+
+#: kpsion.cpp:233
+#, c-format
+msgid "Connected to %1"
+msgstr ""
+
+#: kpsion.cpp:251
+msgid ""
+"A backup is running.\n"
+"Do you really want to quit?"
+msgstr ""
+
+#: kpsion.cpp:253
+msgid ""
+"A restore is running.\n"
+"Do you really want to quit?"
+msgstr ""
+
+#: kpsion.cpp:255
+msgid ""
+"A format is running.\n"
+"Do you really want to quit?"
+msgstr ""
+
+#: kpsion.cpp:280
+msgid "Connecting ..."
+msgstr ""
+
+#: kpsion.cpp:282
+msgid "RFSV could not connect to ncpd at %1:%2. "
+msgstr ""
+
+#: kpsion.cpp:285 kpsion.cpp:301 kpsion.cpp:319 kpsion.cpp:339
+msgid " (Retry in %1 seconds.)"
+msgstr ""
+
+#: kpsion.cpp:296
+#, c-format
+msgid "RFSV could not establish link: %1."
+msgstr ""
+
+#: kpsion.cpp:312
+msgid "RPCS could not connect to ncpd at %1:%2."
+msgstr ""
+
+#: kpsion.cpp:330
+#, c-format
+msgid "RPCS could not establish link: %1."
+msgstr ""
+
+#: kpsion.cpp:380 kpsion.cpp:433
+msgid "Backup"
+msgstr ""
+
+#: kpsion.cpp:407
+#, c-format
+msgid "Could not retrieve drive details for drive %1"
+msgstr ""
+
+#: kpsion.cpp:414
+#, c-format
+msgid "Scanning drive %1"
+msgstr ""
+
+#: kpsion.cpp:423
+msgid "%1 files need backup"
+msgstr ""
+
+#: kpsion.cpp:425
+msgid "No files need backup"
+msgstr ""
+
+#: kpsion.cpp:446
+#, c-format
+msgid "Could not create backup folder %1"
+msgstr ""
+
+#: kpsion.cpp:499
+#, c-format
+msgid "Backing up %1"
+msgstr ""
+
+#: kpsion.cpp:511
+msgid "<QT>Could not open<BR/><B>%1</B></QT>"
+msgstr ""
+
+#: kpsion.cpp:530
+msgid "<QT>Could not read<BR/><B>%1</B></QT>"
+msgstr ""
+
+#: kpsion.cpp:551
+msgid "Backup done"
+msgstr ""
+
+#: kpsion.cpp:563
+msgid ""
+"<QT>This erases <B>ALL</B> data on the drive(s).<BR/>Do you really want to "
+"proceed?"
+msgstr ""
+
+#: kpsion.cpp:611
+msgid "Backup %1% complete"
+msgstr ""
+
+#: kpsion.cpp:676
+#, c-format
+msgid "Stopping %1"
+msgstr ""
+
+#: kpsion.cpp:697
+#, c-format
+msgid "Starting %1"
+msgstr ""
+
+#: kpsion.moc.cpp:43 kpsion.moc.cpp:48
+msgid "KPsionMainWindow"
+msgstr ""
+
+#: main.cpp:15
+msgid "perform backup"
+msgstr ""
+
+#: main.cpp:17
+msgid "perform restore"
+msgstr ""
+
+#: main.cpp:19
+msgid "format drive"
+msgstr ""
+
+#: main.cpp:20
+msgid "The drive letter to backup/restore or format."
+msgstr ""
+
+#: main.cpp:25
+msgid "KPsion"
+msgstr ""
+
+#: main.cpp:26
+msgid "Psion connectivity utility"
+msgstr ""
+
+#: main.cpp:31
+msgid "Original Developer/Maintainer"
+msgstr ""
+
+#: setupdialog.cpp:20
+msgid "&General"
+msgstr ""
+
+#: setupdialog.cpp:25
+msgid "Backup &directory"
+msgstr ""
+
+#: setupdialog.cpp:30 wizards.cpp:87
+msgid "Browse"
+msgstr ""
+
+#: setupdialog.cpp:33 wizards.cpp:160
+msgid "Backup &generations"
+msgstr ""
+
+#: setupdialog.cpp:39
+msgid "&Machines"
+msgstr ""
+
+#: setupdialog.cpp:43
+msgid "Machine &Name"
+msgstr ""
+
+#: setupdialog.cpp:48
+msgid "Machine &UID"
+msgstr ""
+
+#: wizards.cpp:26
+msgid "KPsion Setup"
+msgstr ""
+
+#: wizards.cpp:28 wizards.cpp:411
+msgid "Click this button to continue with the next page."
+msgstr ""
+
+#: wizards.cpp:30 wizards.cpp:413
+msgid "Click this button, to go to a previous page."
+msgstr ""
+
+#: wizards.cpp:32
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:49
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:66
+msgid "<QT><BIG><B>Welcome<B></BIG></QT>"
+msgstr ""
+
+#: wizards.cpp:74
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:90
+msgid "This is the name of the backup folder."
+msgstr ""
+
+#: wizards.cpp:92
+msgid ""
+"Click here, for opening a dialog which lets you easily select the backup "
+"folder."
+msgstr ""
+
+#: wizards.cpp:107
+msgid "<QT><BIG><B>Step 1</B></BIG> - Specify backup directory</QT>"
+msgstr ""
+
+#: wizards.cpp:114
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:124
+msgid "&Incremental backup reminder"
+msgstr ""
+
+#: wizards.cpp:127 wizards.cpp:145
+msgid "none"
+msgstr ""
+
+#: wizards.cpp:128 wizards.cpp:146
+msgid "daily"
+msgstr ""
+
+#: wizards.cpp:129 wizards.cpp:147
+msgid "every 2 days"
+msgstr ""
+
+#: wizards.cpp:130 wizards.cpp:148
+msgid "every 3 days"
+msgstr ""
+
+#: wizards.cpp:131 wizards.cpp:149
+msgid "every 4 days"
+msgstr ""
+
+#: wizards.cpp:132 wizards.cpp:150
+msgid "every 5 days"
+msgstr ""
+
+#: wizards.cpp:133 wizards.cpp:151
+msgid "every 6 days"
+msgstr ""
+
+#: wizards.cpp:134 wizards.cpp:152
+msgid "weekly"
+msgstr ""
+
+#: wizards.cpp:135 wizards.cpp:153
+msgid "every 2 weeks"
+msgstr ""
+
+#: wizards.cpp:136 wizards.cpp:154
+msgid "every 3 weeks"
+msgstr ""
+
+#: wizards.cpp:137 wizards.cpp:155
+msgid "monthly"
+msgstr ""
+
+#: wizards.cpp:142
+msgid "&Full backup reminder"
+msgstr ""
+
+#: wizards.cpp:178
+msgid "<QT><BIG><B>Step 2</B></BIG> - Backup policy</QT>"
+msgstr ""
+
+#: wizards.cpp:186
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:201
+msgid "&Connection retry interval (sec.)"
+msgstr ""
+
+#: wizards.cpp:207
+msgid "Serial &device"
+msgstr ""
+
+#: wizards.cpp:211
+msgid "/dev/ttyS0"
+msgstr ""
+
+#: wizards.cpp:212
+msgid "/dev/ttyS1"
+msgstr ""
+
+#: wizards.cpp:213
+msgid "/dev/ttyS2"
+msgstr ""
+
+#: wizards.cpp:214
+msgid "/dev/ttyS3"
+msgstr ""
+
+#: wizards.cpp:215
+msgid "/dev/ircomm0"
+msgstr ""
+
+#: wizards.cpp:216
+msgid "/dev/ircomm1"
+msgstr ""
+
+#: wizards.cpp:217
+msgid "/dev/ircomm2"
+msgstr ""
+
+#: wizards.cpp:218
+msgid "/dev/ircomm3"
+msgstr ""
+
+#: wizards.cpp:223
+msgid "Serial &speed"
+msgstr ""
+
+#: wizards.cpp:247
+msgid "<QT><BIG><B>Step 3</B></BIG> - Connection parameters</QT>"
+msgstr ""
+
+#: wizards.cpp:255
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:274
+msgid "<QT><BIG><B>Finished</B></BIG></QT>"
+msgstr ""
+
+#: wizards.cpp:282
+msgid "Backup folder"
+msgstr ""
+
+#: wizards.cpp:292
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:347
+msgid ""
+"<QT>The folder <B>%1</B> does <B>not</B> exist.<BR/>Shall it be created?</QT>"
+msgstr ""
+
+#: wizards.cpp:352
+msgid "<QT>The specified folder<BR/><B>%1</B><BR/>could <B>not</B> be created"
+msgstr ""
+
+#: wizards.cpp:357
+msgid ""
+", because you either don't have sufficient rights to do that, or the "
+"filesystem is readonly."
+msgstr ""
+
+#: wizards.cpp:361
+msgid ", because the filesystem has not enough space."
+msgstr ""
+
+#: wizards.cpp:367
+msgid ", because there already exists another object with the same name."
+msgstr ""
+
+#: wizards.cpp:377
+msgid ""
+", because you specified a path which probably contains a dangling symbolic "
+"link."
+msgstr ""
+
+#: wizards.cpp:380
+msgid ""
+", because you specified a path which contains an element which is not a "
+"folder."
+msgstr ""
+
+#: wizards.cpp:384
+msgid ", because you specified a path which contains too many symbolic links."
+msgstr ""
+
+#: wizards.cpp:391
+msgid "<BR/>Please select another folder.</QT>"
+msgstr ""
+
+#: wizards.cpp:407
+msgid "New Psion detected"
+msgstr ""
+
+#: wizards.cpp:415
+msgid ""
+"<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>"
+msgstr ""
+
+#: wizards.cpp:424
+msgid ""
+"<QT>The Psion with the unique ID <B>%1</B> is connected the first time. "
+"Please assign a name to it.</QT>"
+msgstr ""
+
+#: wizards.cpp:431
+msgid "&Name of new Psion"
+msgstr ""
+
+#: wizards.cpp:433
+msgid "My new Psion"
+msgstr ""
+
+#: wizards.cpp:450
+msgid "<QT><BIG><B>New Psion detected<B></BIG></QT>"
+msgstr ""
+
+#: wizards.cpp:458
+msgid ""
+"<QT>Please select the Drive(s), you want to be backed up when running in "
+"unattended backup mode.</QT>"
+msgstr ""
+
+#: wizards.cpp:466
+msgid "Available drives"
+msgstr ""
+
+#: wizards.cpp:490
+msgid "<QT><BIG><B>Specify drives to backup<B></BIG></QT>"
+msgstr ""
+
+#: wizards.cpp:514
+msgid "The name cannot be empty."
+msgstr ""
+
+#: wizards.cpp:521
+msgid ""
+"<QT>The name <B>%1</B> is already assigned to another machine.<BR/>Please "
+"choose a different name.</QT>"
+msgstr ""
+
+#: wizards.moc.cpp:43 wizards.moc.cpp:48
+msgid "FirstTimeWizard"
+msgstr ""
+
+#: wizards.moc.cpp:112 wizards.moc.cpp:117
+msgid "NewPsionWizard"
+msgstr ""