diff options
author | Fritz Elfert <felfert@to.com> | 2001-03-12 10:46:02 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2001-03-12 10:46:02 +0000 |
commit | 656792e5a7a655c140aae178593896086cec25df (patch) | |
tree | 68e6bd2c527c771fcdcefaf44447ceaf557fe8c9 /kde2 | |
parent | fd8c3ec28d9f721e15ee89de412ad565f94e79d3 (diff) | |
download | plptools-656792e5a7a655c140aae178593896086cec25df.tar.gz plptools-656792e5a7a655c140aae178593896086cec25df.tar.bz2 plptools-656792e5a7a655c140aae178593896086cec25df.zip |
Put some classes in separate files.
Started setup dialog
Use a QMap for Optionnames in config file. (prevents typos).
Diffstat (limited to 'kde2')
-rw-r--r-- | kde2/kpsion/Makefile.am | 4 | ||||
-rw-r--r-- | kde2/kpsion/kpsion.cpp | 649 | ||||
-rw-r--r-- | kde2/kpsion/kpsion.h | 110 | ||||
-rw-r--r-- | kde2/kpsion/kpsionbackuplistview.cpp | 467 | ||||
-rw-r--r-- | kde2/kpsion/kpsionbackuplistview.h | 127 | ||||
-rw-r--r-- | kde2/kpsion/kpsionconfig.cpp | 96 | ||||
-rw-r--r-- | kde2/kpsion/kpsionconfig.h | 64 | ||||
-rw-r--r-- | kde2/kpsion/kpsionrestoredialog.cpp | 91 | ||||
-rw-r--r-- | kde2/kpsion/kpsionrestoredialog.h | 56 | ||||
-rw-r--r-- | kde2/kpsion/main.cpp | 8 | ||||
-rw-r--r-- | kde2/kpsion/setupdialog.cpp | 382 | ||||
-rw-r--r-- | kde2/kpsion/setupdialog.h | 73 | ||||
-rw-r--r-- | kde2/kpsion/wizards.cpp | 544 | ||||
-rw-r--r-- | kde2/po/de/kpsion.po | 158 | ||||
-rw-r--r-- | kde2/po/kpsion.pot | 150 |
15 files changed, 1888 insertions, 1091 deletions
diff --git a/kde2/kpsion/Makefile.am b/kde2/kpsion/Makefile.am index d0b27f4..043ae37 100644 --- a/kde2/kpsion/Makefile.am +++ b/kde2/kpsion/Makefile.am @@ -13,7 +13,9 @@ bin_PROGRAMS = kpsion libkpsion_la_LDFLAGS = $(LIBDEBUG) $(all_libraries) -module -version-info $(LIBVERSION) libkpsion_la_SOURCES = kpsion.cpp setupdialog.cpp wizards.cpp \ - statusbarprogress.cpp + statusbarprogress.cpp kpsionconfig.cpp kpsionbackuplistview.cpp \ + kpsionrestoredialog.cpp + libkpsion_la_LIBADD = -L$(top_srcdir)/lib -lplp $(LIB_KFILE) kpsion_SOURCES = main.cpp diff --git a/kde2/kpsion/kpsion.cpp b/kde2/kpsion/kpsion.cpp index fad18da..c7fdc1d 100644 --- a/kde2/kpsion/kpsion.cpp +++ b/kde2/kpsion/kpsion.cpp @@ -26,6 +26,7 @@ #endif #include "kpsion.h" +#include "kpsionconfig.h" #include "wizards.h" #include <kapp.h> @@ -57,402 +58,6 @@ #define STID_CONNECTION 1 -class KPsionCheckListItem::KPsionCheckListItemMetaData { - friend KPsionCheckListItem; - -private: - KPsionCheckListItemMetaData(); - ~KPsionCheckListItemMetaData() { }; - - bool parentIsKPsionCheckListItem; - bool dontPropagate; - int backupType; - int size; - time_t when; - u_int32_t timeHi; - u_int32_t timeLo; - u_int32_t attr; - QString name; -}; - -KPsionCheckListItem::KPsionCheckListItemMetaData::KPsionCheckListItemMetaData() { - when = 0; - size = 0; - timeHi = 0; - timeLo = 0; - attr = 0; - name = QString::null; - backupType = KPsionBackupListView::UNKNOWN; -} - -KPsionCheckListItem::~KPsionCheckListItem() { - delete meta; -} - -KPsionCheckListItem *KPsionCheckListItem:: -firstChild() const { - return (KPsionCheckListItem *)QListViewItem::firstChild(); -} - -KPsionCheckListItem *KPsionCheckListItem:: -nextSibling() const { - return (KPsionCheckListItem *)QListViewItem::nextSibling(); -} - -void KPsionCheckListItem:: -init(bool myparent) { - setSelectable(false); - meta = new KPsionCheckListItemMetaData(); - meta->dontPropagate = false; - meta->parentIsKPsionCheckListItem = myparent; -} - -void KPsionCheckListItem:: -setMetaData(int type, time_t when, QString name, int size, - u_int32_t tHi, u_int32_t tLo, u_int32_t attr) { - meta->backupType = type; - meta->when = when; - meta->name = name; - meta->size = size; - meta->timeHi = tHi; - meta->timeLo = tLo; - meta->attr = attr; -} - -void KPsionCheckListItem:: -stateChange(bool state) { - QCheckListItem::stateChange(state); - - if (meta->dontPropagate) - return; - if (meta->parentIsKPsionCheckListItem) - ((KPsionCheckListItem *)QListViewItem::parent())->propagateUp(state); - else - emit rootToggled(); - propagateDown(state); -} - -void KPsionCheckListItem:: -propagateDown(bool state) { - setOn(state); - KPsionCheckListItem *child = firstChild(); - while (child) { - child->propagateDown(state); - child = child->nextSibling(); - } -} - -void KPsionCheckListItem:: -propagateUp(bool state) { - bool deactivateThis = false; - - KPsionCheckListItem *child = firstChild(); - while (child) { - if ((child->isOn() != state) || (!child->isEnabled())) { - deactivateThis = true; - break; - } - child = child->nextSibling(); - } - meta->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); - meta->dontPropagate = false; - if (meta->parentIsKPsionCheckListItem) - ((KPsionCheckListItem *)QListViewItem::parent())->propagateUp(state); - else - emit rootToggled(); -} - -QString KPsionCheckListItem:: -key(int column, bool ascending) const { - if (meta->when) { - QString tmp; - tmp.sprintf("%08d", meta->when); - return tmp; - } - return text(); -} - -QString KPsionCheckListItem:: -psionname() { - if (meta->parentIsKPsionCheckListItem) - return meta->name; - else - return QString::null; -} - -QString KPsionCheckListItem:: -unixname() { - if (meta->parentIsKPsionCheckListItem) - return KPsionMainWindow::psion2unix(meta->name); - else - return QString::null; -} - -QString KPsionCheckListItem:: -tarname() { - if (meta->parentIsKPsionCheckListItem) - return ((KPsionCheckListItem *)QListViewItem::parent())->tarname(); - else - return meta->name; -} - -int KPsionCheckListItem:: -backupType() { - if (meta->parentIsKPsionCheckListItem) - return ((KPsionCheckListItem *)QListViewItem::parent())->backupType(); - else - return meta->backupType; -} - -time_t KPsionCheckListItem:: -when() { - if (meta->parentIsKPsionCheckListItem) - return ((KPsionCheckListItem *)QListViewItem::parent())->when(); - else - return meta->when; -} - -PlpDirent KPsionCheckListItem:: -plpdirent() { - assert(meta->parentIsKPsionCheckListItem); - return PlpDirent(meta->size, meta->attr, meta->timeHi, meta->timeLo, - meta->name); -} - -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); -} - -KPsionCheckListItem *KPsionBackupListView:: -firstChild() const { - return (KPsionCheckListItem *)QListView::firstChild(); -} - -void KPsionBackupListView:: -readBackups(QString uid) { - QString bdir(backupDir); - bdir += "/"; - bdir += uid; - QDir d(bdir); - kapp->processEvents(); - const QFileInfoList *fil = - d.entryInfoList("*.tar.gz", QDir::Files|QDir::Readable, QDir::Name); - QFileInfoListIterator it(*fil); - QFileInfo *fi; - while ((fi = it.current())) { - kapp->processEvents(); - - 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(KGlobal::locale()->formatDateTime(date, false)); - QByteArray a = ((KTarFile *)te)->data(); - QTextIStream indexData(a); - - indexData.readLine(); - indexData.flags(QTextStream::hex); - indexData.fill('0'); - indexData.width(8); - - KPsionCheckListItem *i = - new KPsionCheckListItem(this, n, - KPsionCheckListItem::CheckBox); - i->setMetaData(bType, te->date(), tgz.fileName(), 0, 0, 0, 0); - i->setPixmap(0, KGlobal::iconLoader()->loadIcon("mime_empty", - KIcon::Small)); - connect(i, SIGNAL(rootToggled()), this, SLOT(slotRootToggled())); - - 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), indexData, 0); - } - tgz.close(); - ++it; - } - header()->setClickEnabled(false); - header()->setResizeEnabled(false); - header()->setMovingEnabled(false); - setMinimumSize(columnWidth(0) + 4, height()); - QWhatsThis::add(this, i18n( - "<qt>Here, you can select the available backups." - " Select the items you want to restore, the click" - " on <b>Start</b> to start restoring these items." - "</qt>")); -} - -void KPsionBackupListView:: -listTree(KPsionCheckListItem *cli, const KTarEntry *te, QTextIStream &idx, - int level) { - KPsionCheckListItem *i = - new KPsionCheckListItem(cli, te->name(), - KPsionCheckListItem::CheckBox); - kapp->processEvents(); - 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)); - i->setMetaData(0, 0, QString::null, 0, 0, 0, 0); - KTarDirectory *td = (KTarDirectory *)te; - QStringList files = td->entries(); - for (QStringList::Iterator f = files.begin(); f != files.end(); f++) - listTree(i, td->entry(*f), idx, level + 1); - } else { - uint32_t timeHi; - uint32_t timeLo; - uint32_t size; - uint32_t attr; - QString name; - - i->setPixmap(0, KGlobal::iconLoader()->loadIcon("mime_empty", - KIcon::Small)); - idx >> timeHi >> timeLo >> size >> attr >> name; - i->setMetaData(0, 0, name, size, timeHi, timeLo, attr); - } -} - -void KPsionBackupListView:: -slotRootToggled() { - bool anyOn = false; - KPsionCheckListItem *i = firstChild(); - while (i != 0L) { - if (i->isOn()) { - anyOn = true; - break; - } - i = i->nextSibling(); - } - emit itemsEnabled(anyOn); -} - -QStringList KPsionBackupListView:: -getSelectedTars() { - QStringList l; - - KPsionCheckListItem *i = firstChild(); - while (i != 0L) { - if (i->isOn()) - l += i->tarname(); - i = i->nextSibling(); - } - return l; -} - -bool KPsionBackupListView:: -autoSelect(QString drive) { - KPsionCheckListItem *latest = NULL; - time_t stamp = 0; - - drive += ":"; - // Find latest full backup for given drive - KPsionCheckListItem *i = firstChild(); - while (i != 0L) { - if ((i->backupType() == FULL) && (i->when() > stamp)) { - KPsionCheckListItem *c = i->firstChild(); - while (c != 0L) { - if (c->text() == drive) { - latest = c; - stamp = i->when(); - break; - } - c = c->nextSibling(); - } - } - i = i->nextSibling(); - } - // Now find all incremental backups for given drive which are newer than - // selected backup - if (latest != 0) { - latest->setOn(true); - i = firstChild(); - while (i != 0L) { - if ((i->backupType() == INCREMENTAL) && (i->when() >= stamp)) { - KPsionCheckListItem *c = i->firstChild(); - while (c != 0L) { - if (c->text() == drive) - c->setOn(true); - c = c->nextSibling(); - } - } - i = i->nextSibling(); - } - } - return (latest != 0L); -} - -void KPsionBackupListView:: -collectEntries(KPsionCheckListItem *i) { - while (i != 0L) { - KPsionCheckListItem *c = i->firstChild(); - if (c == 0L) { - if (i->isOn()) - toRestore.push_back(i->plpdirent()); - } else - collectEntries(c); - i = i->nextSibling(); - } -} - -PlpDir &KPsionBackupListView:: -getRestoreList(QString tarname) { - toRestore.clear(); - KPsionCheckListItem *i = firstChild(); - while (i != 0L) { - if ((i->tarname() == tarname) && (i->isOn())) { - collectEntries(i->firstChild()); - break; - } - i = i->nextSibling(); - } - return toRestore; -} - KPsionMainWindow::KPsionMainWindow() : KMainWindow() { setupActions(); @@ -488,18 +93,33 @@ KPsionMainWindow::KPsionMainWindow() connect(this, SIGNAL(rearrangeIcons(bool)), view, SLOT(arrangeItemsInGrid(bool))); 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); + KPsionConfig pcfg; + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_UIDS)); + QStringList uids = config->readListEntry( + pcfg.getOptionName(KPsionConfig::OPT_UIDS)); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_MACHNAME)); + QString tmp = pcfg.getOptionName(KPsionConfig::OPT_MACHNAME); + + for (QStringList::Iterator it = uids.begin(); it != uids.end(); it++) + machines.insert(*it, config->readEntry(tmp.arg(*it))); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDIR)); + backupDir = config->readEntry( + pcfg.getOptionName(KPsionConfig::OPT_BACKUPDIR)); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_CONNRETRY)); + reconnectTime = config->readNumEntry( + pcfg.getOptionName(KPsionConfig::OPT_CONNRETRY)); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALDEV)); + ncpdDevice = config->readEntry(pcfg.getOptionName( + KPsionConfig::OPT_SERIALDEV)); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALSPEED)); + ncpdSpeed = config->readNumEntry( + pcfg.getOptionName(KPsionConfig::OPT_SERIALSPEED)); QWhatsThis::add(view, i18n( "<qt>Here, you see your Psion's drives.<br/>" @@ -691,15 +311,16 @@ queryPsion() { QString uid = getMachineUID(); bool machineFound = false; KConfig *config = kapp->config(); - config->setGroup("Psion"); + KPsionConfig pcfg; + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDRIVES)); + QString tmp = pcfg.getOptionName(KPsionConfig::OPT_BACKUPDRIVES); 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); + backupDrives = config->readListEntry(tmp.arg(it.key())); machineFound = true; } } @@ -1172,50 +793,6 @@ doBackup() { statusBar()->message(i18n("Backup done"), 2000); } -KPsionRestoreDialog::KPsionRestoreDialog(QWidget *parent, QString uid) - : KDialogBase(parent, "restoreDialog", true, i18n("Restore"), - KDialogBase::Cancel | KDialogBase::Ok, - KDialogBase::Ok, true) { - - setButtonOKText(i18n("Start")); - enableButtonOK(false); - setButtonWhatsThis(KDialogBase::Ok, - i18n("Select items in the list of" - " available backups, then click" - " here to start restore of these" - " items.")); - - QWidget *w = new QWidget(this); - setMainWidget(w); - QGridLayout *gl = new QGridLayout(w, 1, 1, KDialog::marginHint(), - KDialog::marginHint()); - backupView = new KPsionBackupListView(w, "restoreSelector"); - gl->addWidget(backupView, 0, 0); - backupView->readBackups(uid); - connect(backupView, SIGNAL(itemsEnabled(bool)), this, - SLOT(slotBackupsSelected(bool))); -} - -void KPsionRestoreDialog:: -slotBackupsSelected(bool any) { - enableButtonOK(any); -} - -QStringList KPsionRestoreDialog:: -getSelectedTars() { - return backupView->getSelectedTars(); -} - -bool KPsionRestoreDialog:: -autoSelect(QString drive) { - return backupView->autoSelect(drive); -} - -PlpDir &KPsionRestoreDialog:: -getRestoreList(QString tarname) { - return backupView->getRestoreList(tarname); -} - bool KPsionMainWindow:: askOverwrite(PlpDirent e) { if (overWriteAll) @@ -1327,6 +904,7 @@ slotStartRestore() { if (restoreDialog.exec() == KDialogBase::Accepted) { QStringList tars = restoreDialog.getSelectedTars(); + QStringList fmtDrives = restoreDialog.getFormatDrives(); QStringList::Iterator t; backupSize = 0; @@ -1389,6 +967,22 @@ slotStartRestore() { int bslash = cpDir.findRev('\\'); if (bslash > 0) cpDir = cpDir.left(bslash); + + QString drv = cpDir.left(1); + if (fmtDrives.find(drv) != fmtDrives.end()) { + int tSave = progressCount; + doFormat(drv); + fmtDrives.remove(drv); + progressTotalText = i18n("Restore %1% done"); + progressTotal = backupSize; + progressCount = tSave; + progressLocal = e.getSize(); + progressLocalCount = 0; + progressLocalPercent = -1; + emit setProgressText(QString("%1").arg(fn)); + emit enableProgressText(true); + emit setProgress(0); + } if (pDir != cpDir) { pDir = cpDir; res = plpRfsv->mkdir(pDir); @@ -1447,14 +1041,28 @@ slotStartRestore() { u_int32_t mask = e.getAttr() ^ oldattr; u_int32_t sattr = e.getAttr() & mask; u_int32_t dattr = ~sattr & mask; - res = plpRfsv->fsetattr(fn, sattr, dattr); + int retry = 10; + // Retry, because file somtimes takes some time + // to close; + do { + res = plpRfsv->fsetattr(fn, sattr, dattr); + if (res != rfsv::E_PSI_GEN_NONE) + usleep(100000); + retry--; + } while ((res != rfsv::E_PSI_GEN_NONE) && (retry > 0)); if (res != rfsv::E_PSI_GEN_NONE) { KMessageBox::error(this, i18n( "<QT>Could not set attributes of<BR/>" "<B>%1</B><BR/>Reason: %2</QT>").arg(fn).arg(KGlobal::locale()->translate(res))); continue; } - res = plpRfsv->fsetmtime(fn, e.getPsiTime()); + retry = 10; + do { + res = plpRfsv->fsetmtime(fn, e.getPsiTime()); + if (res != rfsv::E_PSI_GEN_NONE) + usleep(100000); + retry--; + } while ((res != rfsv::E_PSI_GEN_NONE) && (retry > 0)); if (res != rfsv::E_PSI_GEN_NONE) { KMessageBox::error(this, i18n( "<QT>Could not set modification time of<BR/>" @@ -1488,6 +1096,66 @@ slotStartRestore() { } void KPsionMainWindow:: +doFormat(QString drive) { + int handle; + int count; + const char dchar = drive[0].latin1(); + QString dname(""); + + PlpDrive drv; + if (plpRfsv->devinfo(dchar, drv) == rfsv::E_PSI_GEN_NONE) + dname = QString(drv.getName().c_str()); + + statusBar()->changeItem(i18n("Formatting drive %1:").arg(dchar), + STID_CONNECTION); + update(); + + emit setProgressText(QString("")); + emit setProgress(0); + emit enableProgressText(true); + + Enum<rfsv::errs> res = plpRpcs->formatOpen(dchar, handle, count); + if (res != rfsv::E_PSI_GEN_NONE) { + KMessageBox::error(this, i18n( + "<QT>Could not format drive %1:<BR/>" + "%2</QT>").arg(dchar).arg(KGlobal::locale()->translate(res))); + emit setProgress(0); + emit enableProgressText(false); + statusBar()->changeItem(i18n("Connected to %1").arg(machineName), + STID_CONNECTION); + return; + } + progressTotal = 0; + progressLocal = count; + progressLocalCount = 0; + progressLocalPercent = -1; + updateProgress(0); + for (int i = 0; i < count; i++) { + res = plpRpcs->formatRead(handle); + if (res != rfsv::E_PSI_GEN_NONE) { + KMessageBox::error(this, i18n( + "<QT>Error during format of drive %1:<BR/>" + "%2</QT>").arg(dchar).arg(KGlobal::locale()->translate(res))); + emit setProgress(0); + emit enableProgressText(false); + statusBar()->changeItem( + i18n("Connected to %1").arg(machineName), + STID_CONNECTION); + count = 0; + return; + } + updateProgress(1); + } + setDriveName(dchar, dname); + + emit setProgress(0); + emit enableProgressText(false); + statusBar()->changeItem(i18n("Connected to %1").arg(machineName), + STID_CONNECTION); + statusBar()->message(i18n("Format done"), 2000); +} + +void KPsionMainWindow:: slotStartFormat() { if (KMessageBox::warningYesNo(this, i18n( "<QT>This erases <B>ALL</B> data " @@ -1497,75 +1165,16 @@ slotStartFormat() { return; formatRunning = true; switchActions(); - killSave(); for (QIconViewItem *i = view->firstItem(); i; i = i->nextItem()) { - if (i->isSelected() && (i->key() != "Z")) { - int handle; - int count; - QString drive = i->key(); - const char dchar = drive[0].latin1(); - QString dname(""); - - PlpDrive drv; - if (plpRfsv->devinfo(dchar - 'A', drv) == rfsv::E_PSI_GEN_NONE) - dname = QString(drv.getName().c_str()); - - statusBar()->changeItem(i18n("Formatting drive %1:").arg(dchar), - STID_CONNECTION); - update(); - - emit setProgressText(QString("")); - emit setProgress(0); - emit enableProgressText(true); - - Enum<rfsv::errs> res = plpRpcs->formatOpen(dchar, handle, count); - if (res != rfsv::E_PSI_GEN_NONE) { - KMessageBox::error(this, i18n( - "<QT>Could not format drive %1:<BR/>" - "%2</QT>").arg(dchar).arg(KGlobal::locale()->translate(res))); - emit setProgress(0); - emit enableProgressText(false); - statusBar()->changeItem(i18n("Connected to %1").arg(machineName), - STID_CONNECTION); - continue; - } - progressTotal = 0; - progressLocal = count; - progressLocalCount = 0; - progressLocalPercent = -1; - updateProgress(0); - for (int i = 0; i < count; i++) { - updateProgress(i); - res = plpRpcs->formatRead(handle); - if (res != rfsv::E_PSI_GEN_NONE) { - KMessageBox::error(this, i18n( - "<QT>Error during format of drive %1:<BR/>" - "%2</QT>").arg(dchar).arg(KGlobal::locale()->translate(res))); - emit setProgress(0); - emit enableProgressText(false); - statusBar()->changeItem( - i18n("Connected to %1").arg(machineName), - STID_CONNECTION); - count = 0; - continue; - } - } - setDriveName(dchar, dname); - } + if (i->isSelected() && (i->key() != "Z")) + doFormat(i->key()); } runRestore(); - formatRunning = false; switchActions(); - - emit setProgress(0); - emit enableProgressText(false); - statusBar()->changeItem(i18n("Connected to %1").arg(machineName), - STID_CONNECTION); - statusBar()->message(i18n("Format done"), 2000); } void KPsionMainWindow:: @@ -1641,6 +1250,8 @@ slotSaveOptions() { void KPsionMainWindow:: slotPreferences() { + SetupDialog d(this, plpRfsv, plpRpcs); + d.exec(); } void KPsionMainWindow:: diff --git a/kde2/kpsion/kpsion.h b/kde2/kpsion/kpsion.h index ce9430e..faae85a 100644 --- a/kde2/kpsion/kpsion.h +++ b/kde2/kpsion/kpsion.h @@ -25,15 +25,13 @@ #include "setupdialog.h" #include "statusbarprogress.h" +#include "kpsionrestoredialog.h" #include <kmainwindow.h> #include <kcmdlineargs.h> #include <kiconview.h> -#include <klistview.h> #include <kdialogbase.h> -#include <ktar.h> -#include <qtextstream.h> #include <rfsv.h> #include <rpcs.h> #include <ppsocket.h> @@ -41,109 +39,6 @@ typedef QMap<char,QString> driveMap; typedef QMap<QString,QString> psionMap; -class KPsionCheckListItem : public QObject, public QCheckListItem { - Q_OBJECT - -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); } - - KPsionCheckListItem *firstChild() const; - KPsionCheckListItem *nextSibling() const; - - ~KPsionCheckListItem(); - - virtual QString key(int column, bool ascending) const; - void setMetaData(int bType, time_t bTime, QString tarName, int size, - u_int32_t tHi, u_int32_t tLo, u_int32_t attr); - - QString unixname(); - QString psionname(); - QString tarname(); - PlpDirent plpdirent(); - int backupType(); - int size(); - time_t when(); - bool isPathChecked(QString path); - -signals: - void rootToggled(void); - -protected: - virtual void stateChange(bool); - void propagateUp(bool); - void propagateDown(bool); - -private: - void init(bool); - class KPsionCheckListItemMetaData; - KPsionCheckListItemMetaData *meta; -}; - -class KPsionBackupListView : public KListView { - Q_OBJECT - -public: - enum backupTypes { - UNKNOWN = 0, - FULL = 1, - INCREMENTAL = 2, - }; - - KPsionBackupListView(QWidget *parent = 0, const char *name = 0); - KPsionCheckListItem *firstChild() const; - - void readBackups(QString uid); - PlpDir &getRestoreList(QString tarname); - QStringList getSelectedTars(); - bool autoSelect(QString drive); - -signals: - void itemsEnabled(bool); - -private slots: - void slotRootToggled(void); - -private: - void collectEntries(KPsionCheckListItem *i); - void listTree(KPsionCheckListItem *cli, const KTarEntry *te, - QTextIStream &idx, int level); - - QString uid; - QString backupDir; - PlpDir toRestore; -}; - -class KPsionRestoreDialog : public KDialogBase { - Q_OBJECT - -public: - KPsionRestoreDialog(QWidget *parent, QString uid); - - PlpDir &getRestoreList(QString tarname); - QStringList getSelectedTars(); - bool autoSelect(QString drive); - -private slots: - void slotBackupsSelected(bool); - -private: - KPsionBackupListView *backupView; -}; - class KPsionMainWindow : public KMainWindow { Q_OBJECT @@ -203,6 +98,7 @@ private: void createIndex(); bool askOverwrite(PlpDirent e); void setDriveName(const char dchar, QString dname); + void doFormat(QString drive); rfsv *plpRfsv; rpcs *plpRpcs; @@ -248,8 +144,8 @@ private: int progressPercent; int progressLocalPercent; }; - #endif + /* * Local variables: * c-basic-offset: 4 diff --git a/kde2/kpsion/kpsionbackuplistview.cpp b/kde2/kpsion/kpsionbackuplistview.cpp new file mode 100644 index 0000000..c51c62d --- /dev/null +++ b/kde2/kpsion/kpsionbackuplistview.cpp @@ -0,0 +1,467 @@ +/*-*-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 "kpsionbackuplistview.h" +#include "kpsion.h" +#include "kpsionconfig.h" + +#include <kapp.h> +#include <klocale.h> +#include <kconfig.h> +#include <kiconloader.h> + +#include <qwhatsthis.h> +#include <qiodevice.h> +#include <qheader.h> +#include <qdir.h> + +class KPsionCheckListItem::KPsionCheckListItemMetaData { + friend KPsionCheckListItem; + +private: + KPsionCheckListItemMetaData(); + ~KPsionCheckListItemMetaData() { }; + + bool parentIsKPsionCheckListItem; + bool dontPropagate; + int backupType; + int size; + time_t when; + u_int32_t timeHi; + u_int32_t timeLo; + u_int32_t attr; + QString name; +}; + +KPsionCheckListItem::KPsionCheckListItemMetaData::KPsionCheckListItemMetaData() { + when = 0; + size = 0; + timeHi = 0; + timeLo = 0; + attr = 0; + name = QString::null; + backupType = KPsionBackupListView::UNKNOWN; +} + +KPsionCheckListItem::~KPsionCheckListItem() { + delete meta; +} + +KPsionCheckListItem *KPsionCheckListItem:: +firstChild() const { + return (KPsionCheckListItem *)QListViewItem::firstChild(); +} + +KPsionCheckListItem *KPsionCheckListItem:: +nextSibling() const { + return (KPsionCheckListItem *)QListViewItem::nextSibling(); +} + +void KPsionCheckListItem:: +init(bool myparent) { + setSelectable(false); + meta = new KPsionCheckListItemMetaData(); + meta->dontPropagate = false; + meta->parentIsKPsionCheckListItem = myparent; +} + +void KPsionCheckListItem:: +setMetaData(int type, time_t when, QString name, int size, + u_int32_t tHi, u_int32_t tLo, u_int32_t attr) { + meta->backupType = type; + meta->when = when; + meta->name = name; + meta->size = size; + meta->timeHi = tHi; + meta->timeLo = tLo; + meta->attr = attr; +} + +void KPsionCheckListItem:: +stateChange(bool state) { + QCheckListItem::stateChange(state); + + if (meta->dontPropagate) + return; + if (meta->parentIsKPsionCheckListItem) + ((KPsionCheckListItem *)QListViewItem::parent())->propagateUp(state); + else + emit rootToggled(); + propagateDown(state); +} + +void KPsionCheckListItem:: +propagateDown(bool state) { + setOn(state); + KPsionCheckListItem *child = firstChild(); + while (child) { + child->propagateDown(state); + child = child->nextSibling(); + } +} + +void KPsionCheckListItem:: +propagateUp(bool state) { + bool deactivateThis = false; + + KPsionCheckListItem *child = firstChild(); + while (child) { + if ((child->isOn() != state) || (!child->isEnabled())) { + deactivateThis = true; + break; + } + child = child->nextSibling(); + } + meta->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); + meta->dontPropagate = false; + if (meta->parentIsKPsionCheckListItem) + ((KPsionCheckListItem *)QListViewItem::parent())->propagateUp(state); + else + emit rootToggled(); +} + +QString KPsionCheckListItem:: +key(int column, bool ascending) const { + if (meta->when) { + QString tmp; + tmp.sprintf("%08d", meta->when); + return tmp; + } + return text(); +} + +QString KPsionCheckListItem:: +psionname() { + if (meta->parentIsKPsionCheckListItem) + return meta->name; + else + return QString::null; +} + +QString KPsionCheckListItem:: +unixname() { + if (meta->parentIsKPsionCheckListItem) + return KPsionMainWindow::psion2unix(meta->name); + else + return QString::null; +} + +QString KPsionCheckListItem:: +tarname() { + if (meta->parentIsKPsionCheckListItem) + return ((KPsionCheckListItem *)QListViewItem::parent())->tarname(); + else + return meta->name; +} + +int KPsionCheckListItem:: +backupType() { + if (meta->parentIsKPsionCheckListItem) + return ((KPsionCheckListItem *)QListViewItem::parent())->backupType(); + else + return meta->backupType; +} + +time_t KPsionCheckListItem:: +when() { + if (meta->parentIsKPsionCheckListItem) + return ((KPsionCheckListItem *)QListViewItem::parent())->when(); + else + return meta->when; +} + +PlpDirent KPsionCheckListItem:: +plpdirent() { + assert(meta->parentIsKPsionCheckListItem); + return PlpDirent(meta->size, meta->attr, meta->timeHi, meta->timeLo, + meta->name); +} + +KPsionBackupListView::KPsionBackupListView(QWidget *parent, const char *name) + : KListView(parent, name) { + + toRestore.clear(); + uid = QString::null; + KConfig *config = kapp->config(); + KPsionConfig pcfg; + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDIR)); + backupDir = config->readEntry( + pcfg.getOptionName(KPsionConfig::OPT_BACKUPDIR)); + addColumn(i18n("Available backups")); + setRootIsDecorated(true); +} + +KPsionCheckListItem *KPsionBackupListView:: +firstChild() const { + return (KPsionCheckListItem *)QListView::firstChild(); +} + +void KPsionBackupListView:: +readBackups(QString uid) { + QString bdir(backupDir); + bdir += "/"; + bdir += uid; + QDir d(bdir); + kapp->processEvents(); + const QFileInfoList *fil = + d.entryInfoList("*.tar.gz", QDir::Files|QDir::Readable, QDir::Name); + QFileInfoListIterator it(*fil); + QFileInfo *fi; + while ((fi = it.current())) { + kapp->processEvents(); + + 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(KGlobal::locale()->formatDateTime(date, false)); + QByteArray a = ((KTarFile *)te)->data(); + QTextIStream indexData(a); + + indexData.readLine(); + indexData.flags(QTextStream::hex); + indexData.fill('0'); + indexData.width(8); + + KPsionCheckListItem *i = + new KPsionCheckListItem(this, n, + KPsionCheckListItem::CheckBox); + i->setMetaData(bType, te->date(), tgz.fileName(), 0, 0, 0, 0); + i->setPixmap(0, KGlobal::iconLoader()->loadIcon("mime_empty", + KIcon::Small)); + connect(i, SIGNAL(rootToggled()), this, SLOT(slotRootToggled())); + + 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), indexData, 0); + } + tgz.close(); + ++it; + } + header()->setClickEnabled(false); + header()->setResizeEnabled(false); + header()->setMovingEnabled(false); + setMinimumSize(columnWidth(0) + 4, height()); + QWhatsThis::add(this, i18n( + "<qt>Here, you can select the available backups." + " Select the items you want to restore, the click" + " on <b>Start</b> to start restoring these items." + "</qt>")); +} + +void KPsionBackupListView:: +listTree(KPsionCheckListItem *cli, const KTarEntry *te, QTextIStream &idx, + int level) { + KPsionCheckListItem *i = + new KPsionCheckListItem(cli, te->name(), + KPsionCheckListItem::CheckBox); + kapp->processEvents(); + 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)); + i->setMetaData(0, 0, QString::null, 0, 0, 0, 0); + KTarDirectory *td = (KTarDirectory *)te; + QStringList files = td->entries(); + for (QStringList::Iterator f = files.begin(); f != files.end(); f++) + listTree(i, td->entry(*f), idx, level + 1); + } else { + uint32_t timeHi; + uint32_t timeLo; + uint32_t size; + uint32_t attr; + QString name; + + i->setPixmap(0, KGlobal::iconLoader()->loadIcon("mime_empty", + KIcon::Small)); + idx >> timeHi >> timeLo >> size >> attr >> name; + i->setMetaData(0, 0, name, size, timeHi, timeLo, attr); + } +} + +void KPsionBackupListView:: +slotRootToggled() { + bool anyOn = false; + KPsionCheckListItem *i = firstChild(); + while (i != 0L) { + if (i->isOn()) { + anyOn = true; + break; + } + i = i->nextSibling(); + } + emit itemsEnabled(anyOn); +} + +QStringList KPsionBackupListView:: +getSelectedTars() { + QStringList l; + + KPsionCheckListItem *i = firstChild(); + while (i != 0L) { + if (i->isOn()) + l += i->tarname(); + i = i->nextSibling(); + } + return l; +} + +QStringList KPsionBackupListView:: +getFormatDrives() { + QStringList l; + + KPsionCheckListItem *i = firstChild(); + while (i != 0L) { + if (i->isOn()) { + KPsionCheckListItem *c = i->firstChild(); + while (c != 0L) { + if (c->isOn()) { + QString drv = c->text().left(1); + if (l.find(drv) == l.end()) + l += drv; + } + c = c->nextSibling(); + } + } + i = i->nextSibling(); + } + return l; +} + +bool KPsionBackupListView:: +autoSelect(QString drive) { + KPsionCheckListItem *latest = NULL; + time_t stamp = 0; + + drive += ":"; + // Find latest full backup for given drive + KPsionCheckListItem *i = firstChild(); + while (i != 0L) { + if ((i->backupType() == FULL) && (i->when() > stamp)) { + KPsionCheckListItem *c = i->firstChild(); + while (c != 0L) { + if (c->text() == drive) { + latest = c; + stamp = i->when(); + break; + } + c = c->nextSibling(); + } + } + i = i->nextSibling(); + } + // Now find all incremental backups for given drive which are newer than + // selected backup + if (latest != 0) { + latest->setOn(true); + i = firstChild(); + while (i != 0L) { + if ((i->backupType() == INCREMENTAL) && (i->when() >= stamp)) { + KPsionCheckListItem *c = i->firstChild(); + while (c != 0L) { + if (c->text() == drive) + c->setOn(true); + c = c->nextSibling(); + } + } + i = i->nextSibling(); + } + } + return (latest != 0L); +} + +void KPsionBackupListView:: +collectEntries(KPsionCheckListItem *i) { + while (i != 0L) { + KPsionCheckListItem *c = i->firstChild(); + if (c == 0L) { + if (i->isOn()) + toRestore.push_back(i->plpdirent()); + } else + collectEntries(c); + i = i->nextSibling(); + } +} + +PlpDir &KPsionBackupListView:: +getRestoreList(QString tarname) { + toRestore.clear(); + KPsionCheckListItem *i = firstChild(); + while (i != 0L) { + if ((i->tarname() == tarname) && (i->isOn())) { + collectEntries(i->firstChild()); + break; + } + i = i->nextSibling(); + } + return toRestore; +} + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/kde2/kpsion/kpsionbackuplistview.h b/kde2/kpsion/kpsionbackuplistview.h new file mode 100644 index 0000000..f4c3fed --- /dev/null +++ b/kde2/kpsion/kpsionbackuplistview.h @@ -0,0 +1,127 @@ +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * 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 + * + */ +#ifndef _KPSIONBACKUPLISTVIEW_H_ +#define _KPSIONBACKUPLISTVIEW_H_ + +#include <rfsv.h> + +#include <klistview.h> +#include <ktar.h> + +#include <qcheckbox.h> +#include <qstringlist.h> +#include <qtextstream.h> + +class KPsionCheckListItem : public QObject, public QCheckListItem { + Q_OBJECT + +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); } + + KPsionCheckListItem *firstChild() const; + KPsionCheckListItem *nextSibling() const; + + ~KPsionCheckListItem(); + + virtual QString key(int column, bool ascending) const; + void setMetaData(int bType, time_t bTime, QString tarName, int size, + u_int32_t tHi, u_int32_t tLo, u_int32_t attr); + + QString unixname(); + QString psionname(); + QString tarname(); + PlpDirent plpdirent(); + int backupType(); + int size(); + time_t when(); + bool isPathChecked(QString path); + +signals: + void rootToggled(void); + +protected: + virtual void stateChange(bool); + void propagateUp(bool); + void propagateDown(bool); + +private: + void init(bool); + class KPsionCheckListItemMetaData; + KPsionCheckListItemMetaData *meta; +}; + +class KPsionBackupListView : public KListView { + Q_OBJECT + +public: + enum backupTypes { + UNKNOWN = 0, + FULL = 1, + INCREMENTAL = 2, + }; + + KPsionBackupListView(QWidget *parent = 0, const char *name = 0); + KPsionCheckListItem *firstChild() const; + + void readBackups(QString uid); + PlpDir &getRestoreList(QString tarname); + QStringList getSelectedTars(); + QStringList getFormatDrives(); + bool autoSelect(QString drive); + +signals: + void itemsEnabled(bool); + +private slots: + void slotRootToggled(void); + +private: + void collectEntries(KPsionCheckListItem *i); + void listTree(KPsionCheckListItem *cli, const KTarEntry *te, + QTextIStream &idx, int level); + + QString uid; + QString backupDir; + PlpDir toRestore; +}; +#endif + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/kde2/kpsion/kpsionconfig.cpp b/kde2/kpsion/kpsionconfig.cpp new file mode 100644 index 0000000..7748862 --- /dev/null +++ b/kde2/kpsion/kpsionconfig.cpp @@ -0,0 +1,96 @@ +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * 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 + * + */ + +#include "kpsionconfig.h" + +#include <klocale.h> + +#include <iostream.h> + +KPsionConfig::KPsionConfig() { + optionNames.insert(OPT_BACKUPDIR, QString("Settings/BackupDir")); + optionNames.insert(OPT_BACKUPGEN, QString("Settings/BackupGenerations")); + optionNames.insert(OPT_INCINTERVAL, QString("Settings/IncrementalInterval")); + optionNames.insert(OPT_FULLINTERVAL, QString("Settings/FullInterval")); + optionNames.insert(OPT_CONNRETRY, QString("Connection/Retry")); + optionNames.insert(OPT_SERIALDEV, QString("Connection/Device")); + optionNames.insert(OPT_SERIALSPEED, QString("Connection/Speed")); + optionNames.insert(OPT_UIDS, QString("Psion/MachineUIDs")); + optionNames.insert(OPT_MACHNAME, QString("Psion/Name_%1")); + optionNames.insert(OPT_BACKUPDRIVES, QString("Psion/BackupDrives_%1")); +} + +const QString KPsionConfig:: +getOptionName(int optIdx) { + + optMap::Iterator it = optionNames.find(optIdx); + if (it == optionNames.end()) + return QString::null; + int slash = (*it).find('/'); + return (*it).mid(slash + 1); +} + +const QString KPsionConfig:: +getSectionName(int optIdx) { + optMap::Iterator it = optionNames.find(optIdx); + if (it == optionNames.end()) + return QString::null; + int slash = (*it).find('/'); + return (*it).left(slash); +} + +QStringList KPsionConfig:: +getConfigDevices() { + QStringList l; + + l += i18n("off"); + l += i18n("/dev/ttyS0"); + l += i18n("/dev/ttyS1"); + l += i18n("/dev/ttyS2"); + l += i18n("/dev/ttyS3"); + l += i18n("/dev/ircomm0"); + l += i18n("/dev/ircomm1"); + l += i18n("/dev/ircomm2"); + l += i18n("/dev/ircomm3"); + + return l; +} + +QStringList KPsionConfig:: +getConfigSpeeds() { + QStringList l; + + l += QString("9600"); + l += QString("19200"); + l += QString("38400"); + l += QString("57600"); + l += QString("115200"); + + return l; +} + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/kde2/kpsion/kpsionconfig.h b/kde2/kpsion/kpsionconfig.h new file mode 100644 index 0000000..95cbb50 --- /dev/null +++ b/kde2/kpsion/kpsionconfig.h @@ -0,0 +1,64 @@ +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * 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 + * + */ +#ifndef _KPSIONCONFIG_H_ +#define _KPSIONCONFIG_H_ + +#include <qstringlist.h> +#include <qmap.h> + +typedef QMap<int,QString> optMap; + +class KPsionConfig { +public: + + enum cfgOptions { + OPT_BACKUPDIR = 0, + OPT_INCINTERVAL = 1, + OPT_FULLINTERVAL = 2, + OPT_CONNRETRY = 3, + OPT_SERIALDEV = 4, + OPT_SERIALSPEED = 5, + OPT_BACKUPGEN = 6, + OPT_UIDS = 7, + OPT_MACHNAME = 8, + OPT_BACKUPDRIVES = 9, + }; + + KPsionConfig(); + + QStringList getConfigDevices(); + QStringList getConfigSpeeds(); + const QString getOptionName(int); + const QString getSectionName(int); + +private: + optMap optionNames; + +}; +#endif + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/kde2/kpsion/kpsionrestoredialog.cpp b/kde2/kpsion/kpsionrestoredialog.cpp new file mode 100644 index 0000000..972dc17 --- /dev/null +++ b/kde2/kpsion/kpsionrestoredialog.cpp @@ -0,0 +1,91 @@ +/*-*-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 "kpsionrestoredialog.h" + +#include <klocale.h> + +#include <qlayout.h> + +KPsionRestoreDialog::KPsionRestoreDialog(QWidget *parent, QString uid) + : KDialogBase(parent, "restoreDialog", true, i18n("Restore"), + KDialogBase::Cancel | KDialogBase::Ok, + KDialogBase::Ok, true) { + + setButtonOKText(i18n("Start")); + enableButtonOK(false); + setButtonWhatsThis(KDialogBase::Ok, + i18n("Select items in the list of" + " available backups, then click" + " here to start restore of these" + " items.")); + + QWidget *w = new QWidget(this); + setMainWidget(w); + QGridLayout *gl = new QGridLayout(w, 1, 1, KDialog::marginHint(), + KDialog::marginHint()); + backupView = new KPsionBackupListView(w, "restoreSelector"); + gl->addWidget(backupView, 0, 0); + fmtCheck = new QCheckBox(i18n("Format drive before restore"), w, "fmtCheck"); + gl->addWidget(fmtCheck, 1, 0); + backupView->readBackups(uid); + connect(backupView, SIGNAL(itemsEnabled(bool)), this, + SLOT(slotBackupsSelected(bool))); +} + +void KPsionRestoreDialog:: +slotBackupsSelected(bool any) { + enableButtonOK(any); +} + +QStringList KPsionRestoreDialog:: +getSelectedTars() { + return backupView->getSelectedTars(); +} + +bool KPsionRestoreDialog:: +autoSelect(QString drive) { + return backupView->autoSelect(drive); +} + +QStringList KPsionRestoreDialog:: +getFormatDrives() { + if (fmtCheck->isChecked()) + return backupView->getFormatDrives(); + return QStringList(); +} + +PlpDir &KPsionRestoreDialog:: +getRestoreList(QString tarname) { + return backupView->getRestoreList(tarname); +} + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/kde2/kpsion/kpsionrestoredialog.h b/kde2/kpsion/kpsionrestoredialog.h new file mode 100644 index 0000000..e946f1c --- /dev/null +++ b/kde2/kpsion/kpsionrestoredialog.h @@ -0,0 +1,56 @@ +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * 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 + * + */ +#ifndef _KPSIONRESTOREDIALOG_H_ +#define _KPSIONRESTOREDIALOG_H_ + +#include "kpsionbackuplistview.h" + +#include <kdialogbase.h> + +#include <qstringlist.h> +#include <qcheckbox.h> + +#include <rfsv.h> + +typedef QMap<char,QString> driveMap; +typedef QMap<QString,QString> psionMap; + +class KPsionRestoreDialog : public KDialogBase { + Q_OBJECT + +public: + KPsionRestoreDialog(QWidget *parent, QString uid); + + PlpDir &getRestoreList(QString tarname); + QStringList getSelectedTars(); + QStringList getFormatDrives(); + bool autoSelect(QString drive); + +private slots: + void slotBackupsSelected(bool); + +private: + KPsionBackupListView *backupView; + QCheckBox *fmtCheck; +}; +#endif diff --git a/kde2/kpsion/main.cpp b/kde2/kpsion/main.cpp index 5ccffc6..60c9a77 100644 --- a/kde2/kpsion/main.cpp +++ b/kde2/kpsion/main.cpp @@ -25,6 +25,7 @@ #endif #include "kpsion.h" +#include "kpsionconfig.h" #include "wizards.h" #include <kapp.h> #include <klocale.h> @@ -75,8 +76,11 @@ int main(int argc, char **argv) { KGlobal::locale()->insertCatalogue(QString::fromLatin1("plptools")); KConfig *config = kapp->config(); - config->setGroup("Settings"); - QString backupDir = config->readEntry("BackupDir"); + KPsionConfig pcfg; + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDIR)); + QString backupDir = config->readEntry( + pcfg.getOptionName(KPsionConfig::OPT_BACKUPDIR)); if (backupDir.isEmpty()) { FirstTimeWizard *wiz = new FirstTimeWizard(0L, "firsttimewizard"); diff --git a/kde2/kpsion/setupdialog.cpp b/kde2/kpsion/setupdialog.cpp index 370bb30..03eea8c 100644 --- a/kde2/kpsion/setupdialog.cpp +++ b/kde2/kpsion/setupdialog.cpp @@ -1,62 +1,348 @@ +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * 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 + * + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "kpsionconfig.h" #include "setupdialog.h" #include <kapp.h> #include <kconfig.h> #include <klocale.h> -#include <knuminput.h> -#include <klineedit.h> -#include <kcombobox.h> +#include <kfiledialog.h> +#include <kmessagebox.h> #include <qlayout.h> -#include <qlabel.h> +#include <qwhatsthis.h> + +#include <errno.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())); + : KDialogBase(Tabbed, "Settings", Ok|Apply|Default|Cancel, Ok, parent, + "settingsDialog", true, true) +{ + int i; + QString tmp; + QStringList sl; + QStringList::Iterator sli; + KPsionConfig pcfg; + + enableLinkedHelp(false); + + KConfig *config = kapp->config(); + + // Page 1 + page1 = addPage(i18n("Backup &folder")); + QGridLayout *grid = new QGridLayout(page1, 1, 1, + marginHint() * 2, spacingHint() * 2); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDIR)); + tmp = config->readEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPDIR)); + bdirLabel = new QLabel(page1, "bdirLabel"); + bdirLabel->setText(tmp); + bdirButton = new QPushButton(i18n("Browse"), page1); + + 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, 0, 1); + grid->addWidget(bdirButton, 0, 2); + + grid->setColStretch(1, 1); + + connect(bdirButton, SIGNAL(clicked()), SLOT(slotBdirBrowse())); + + + // Page 2 + page2 = addPage(i18n("Backup &policy")); + grid = new QGridLayout(page2); + + QLabel *l = new QLabel(i18n("&Incremental backup reminder"), page2, + "iBackupIntLabel"); + grid->addWidget(l, 3, 1); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_INCINTERVAL)); + i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_INCINTERVAL)); + iIntCombo = new KComboBox(false, page2, "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(i); + grid->addWidget(iIntCombo, 3, 2); + l->setBuddy(iIntCombo); + + l = new QLabel(i18n("&Full backup reminder"), page2, "fBackupIntLabel"); + grid->addWidget(l, 5, 1); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_FULLINTERVAL)); + i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_FULLINTERVAL)); + fIntCombo = new KComboBox(false, page2, "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(i); + grid->addWidget(fIntCombo, 5, 2); + l->setBuddy(fIntCombo); + + l = new QLabel(i18n("Backup &generations"), page2, "backupGenLabel"); + grid->addWidget(l, 7, 1); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPGEN)); + i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPGEN)); + genSpin = new KIntSpinBox(0, 10, 1, i, 10, page2, "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()); + + // Page 3 + page3 = addPage(i18n("&Connection")); + grid = new QGridLayout(page3); + + l = new QLabel(i18n("&Connection retry interval (sec.)"), page3, + "rconLabel"); + grid->addWidget(l, 3, 1); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_CONNRETRY)); + i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_CONNRETRY)); + rconSpin = new KIntSpinBox(0, 600, 1, i, 10, page3, "rconSpin"); + grid->addWidget(rconSpin, 3, 2); + l->setBuddy(rconSpin); + + l = new QLabel(i18n("Serial &device"), page3, "devLabel"); + grid->addWidget(l, 5, 1); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALDEV)); + tmp = config->readEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALDEV)); + + devCombo = new KComboBox(false, page3, "devCombo"); + sl = pcfg.getConfigDevices(); + devCombo->insertStringList(sl); + for (i = 0, sli = sl.begin(); sli != sl.end(); ++i, ++sli) { + if (*sli == tmp) + devCombo->setCurrentItem(i); + } + grid->addWidget(devCombo, 5, 2); + l->setBuddy(devCombo); + + l = new QLabel(i18n("Serial &speed"), page3, "speedLabel"); + grid->addWidget(l, 7, 1); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALSPEED)); + tmp = config->readEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALSPEED)); + + speedCombo = new KComboBox(false, page3, "speedCombo"); + sl = pcfg.getConfigSpeeds(); + speedCombo->insertStringList(sl); + for (i = 0, sli = sl.begin(); sli != sl.end(); ++i, ++sli) { + if (*sli == tmp) + speedCombo->setCurrentItem(i); + } + 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()); + + connect(this, SIGNAL(okClicked()), SLOT(slotSaveSettings())); + connect(this, SIGNAL(applyClicked()), SLOT(slotSaveSettings())); } void SetupDialog:: slotDefaultClicked() { - enableLinkedHelp(false); } + +void SetupDialog:: +slotBdirBrowse() { + QString dir = KFileDialog::getExistingDirectory(bdirLabel->text(), this, + i18n("Backup folder")); + checkBackupDir(dir); +} + +void SetupDialog:: +slotSaveSettings() { + KConfig *config = kapp->config(); + KPsionConfig pcfg; + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDIR)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPDIR), + bdirLabel->text()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPGEN)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPGEN), + genSpin->value()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_INCINTERVAL)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_INCINTERVAL), + iIntCombo->currentItem()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_FULLINTERVAL)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_FULLINTERVAL), + fIntCombo->currentItem()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_CONNRETRY)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_CONNRETRY), + rconSpin->value()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALDEV)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALDEV), + devCombo->currentText()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALSPEED)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALSPEED), + speedCombo->currentText()); +} + +bool SetupDialog:: +showPage(int index) { + switch (activePageIndex()) { + case 1: + QString dir(bdirLabel->text()); + if (!checkBackupDir(dir)) + return false; + } + return KDialogBase::showPage(index); +} + +void SetupDialog:: +closeEvent(QCloseEvent *e) { + reject(); +} + +bool SetupDialog:: +checkBackupDir(QString &dir) { + KConfig *config = kapp->config(); + KPsionConfig pcfg; + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDIR)); + QString tmp = + config->readEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPDIR)); + + 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(tmp); + 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(tmp); + 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(tmp); + return false; +} + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/kde2/kpsion/setupdialog.h b/kde2/kpsion/setupdialog.h index b385dce..df9c46e 100644 --- a/kde2/kpsion/setupdialog.h +++ b/kde2/kpsion/setupdialog.h @@ -1,3 +1,25 @@ +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * 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 + * + */ #ifndef _SETUPDIALOGS_H_ #define _SETUPDIALOGS_H_ @@ -5,13 +27,56 @@ #include <rpcs.h> #include <kdialogbase.h> +#include <knuminput.h> +#include <kcombobox.h> +#include <klineedit.h> +#include <klistview.h> + +#include <qpushbutton.h> +#include <qcheckbox.h> +#include <qlabel.h> class SetupDialog : public KDialogBase { - public: - SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs); + Q_OBJECT + +public: + SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs); + bool showPage(int index); + +protected: + virtual void closeEvent(QCloseEvent *e); + +private slots: + void slotDefaultClicked(); + void slotSaveSettings(); + void slotBdirBrowse(); - private slots: - void slotDefaultClicked(); +private: + bool checkBackupDir(QString &dir); + + QFrame *page1; + QFrame *page2; + QFrame *page3; + QFrame *page4; + + QLabel *bdirLabel; + KIntSpinBox *genSpin; + KIntSpinBox *rconSpin; + QPushButton *bdirButton; + QCheckBox *remCheck; + KComboBox *iIntCombo; + KComboBox *fIntCombo; + KComboBox *devCombo; + KComboBox *speedCombo; + + QString bdirDefault; + QString bdirCreated; }; #endif + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/kde2/kpsion/wizards.cpp b/kde2/kpsion/wizards.cpp index 62734b5..eb878c4 100644 --- a/kde2/kpsion/wizards.cpp +++ b/kde2/kpsion/wizards.cpp @@ -29,6 +29,7 @@ #include <unistd.h> #include <pwd.h> +#include "kpsionconfig.h" #include "wizards.h" #include <kapp.h> @@ -44,253 +45,249 @@ #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>")); - - bdirDefault = locateLocal("data", "kpsion/backups"); - 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); + : KWizard(parent, name, true) +{ + QStringList sl; + KPsionConfig pcfg; + + 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>")); + + bdirDefault = locateLocal("data", "kpsion/backups"); + 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"); + sl = pcfg.getConfigDevices(); + devCombo->insertStringList(sl); + 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"); + sl = pcfg.getConfigSpeeds(); + speedCombo->insertStringList(sl); + 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:: @@ -316,15 +313,36 @@ reject() { 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()); + KPsionConfig pcfg; + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPDIR)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPDIR), + bdirLabel->text()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPGEN)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPGEN), + genSpin->value()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_INCINTERVAL)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_INCINTERVAL), + iIntCombo->currentItem()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_FULLINTERVAL)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_FULLINTERVAL), + fIntCombo->currentItem()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_CONNRETRY)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_CONNRETRY), + rconSpin->value()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALDEV)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALDEV), + devCombo->currentText()); + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALSPEED)); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALSPEED), + speedCombo->currentText()); + hide(); setResult(Accepted); } @@ -545,11 +563,14 @@ checkPsionName(QString &name) { void NewPsionWizard:: accept() { KConfig *config = kapp->config(); - config->setGroup("Psion"); - QStringList machines = config->readListEntry("MachineUIDs"); + KPsionConfig pcfg; + + config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_UIDS)); + QStringList machines = config->readListEntry( + pcfg.getOptionName(KPsionConfig::OPT_UIDS)); machines += uid; - config->writeEntry("MachineUIDs", machines); - QString tmp = QString::fromLatin1("Name_%1").arg(uid); + config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_UIDS), machines); + QString tmp = pcfg.getOptionName(KPsionConfig::OPT_MACHNAME).arg(uid); config->writeEntry(tmp, nameEdit->text()); tmp = nameEdit->text(); psion->setMachineName(tmp); @@ -569,7 +590,8 @@ accept() { } } } - config->writeEntry("BackupDrives", bdrives); + config->writeEntry( + pcfg.getOptionName(KPsionConfig::OPT_BACKUPDRIVES).arg(uid), bdrives); hide(); setResult(Accepted); } diff --git a/kde2/po/de/kpsion.po b/kde2/po/de/kpsion.po index e3c6219..50e4764 100644 --- a/kde2/po/de/kpsion.po +++ b/kde2/po/de/kpsion.po @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: plptools 0.7\n" -"POT-Creation-Date: 2001-03-06 17:49+0100\n" -"PO-Revision-Date: 2001-03-06 17:50CET\n" +"POT-Creation-Date: 2001-03-12 05:15+0100\n" +"PO-Revision-Date: 2001-03-12 05:17CET\n" "Last-Translator: Fritz Elfert <felfert@to.com>\n" "Language-Team: Deutsch <de@li.org>\n" "MIME-Version: 1.0\n" @@ -39,15 +39,15 @@ msgstr "" "die Siezurücksichern wollen aus. Klicken Sie dann auf die Schaltfläche " "<B>Start</B> um dieseDateien zu restaurieren.</qt>" -#: kpsion.cpp:460 +#: kpsion.cpp:482 msgid "Idle" msgstr "Bereit" -#: kpsion.cpp:501 wizards.cpp:227 +#: kpsion.cpp:523 wizards.cpp:227 msgid "off" msgstr "aus" -#: kpsion.cpp:505 +#: kpsion.cpp:527 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.: " @@ -61,66 +61,66 @@ msgstr "" "abzuwählen.<br/>Wählen Sie beliebig viele Laufwerke und dann eine " "Operation.</qt>" -#: kpsion.cpp:573 +#: kpsion.cpp:595 msgid "Start &Format" msgstr "Starte &Formatierung" -#: kpsion.cpp:575 +#: kpsion.cpp:597 msgid "Start Full &Backup" msgstr "Starte &Komplett-Sicherung" -#: kpsion.cpp:578 +#: kpsion.cpp:600 msgid "Start &Incremental Backup" msgstr "Starte &inkrementelle Sicherung" -#: kpsion.cpp:580 +#: kpsion.cpp:602 msgid "Start &Restore" msgstr "Starte &Rücksicherung" -#: kpsion.cpp:594 +#: kpsion.cpp:616 msgid "Full backup of selected drive(s)" msgstr "Komplett-Sicherung der ausgewählten Laufwerke" -#: kpsion.cpp:596 +#: kpsion.cpp:618 msgid "Incremental backup of selected drive(s)" msgstr "Inkrementelle Sicherung der ausgewählten Laufwerke" -#: kpsion.cpp:598 +#: kpsion.cpp:620 msgid "Restore selected drive(s)" msgstr "Sichere ausgewählte Laufwerke zurück" -#: kpsion.cpp:600 +#: kpsion.cpp:622 msgid "Format selected drive(s)" msgstr "Formatiere ausgewählte Laufwerke" -#: kpsion.cpp:671 +#: kpsion.cpp:693 msgid "Retrieving machine info ..." msgstr "Ermittle Geräte-Info ..." -#: kpsion.cpp:682 +#: kpsion.cpp:704 msgid "Could not get Psion machine info" msgstr "Konnte Psion Geräteinfo nicht ermitteln" -#: kpsion.cpp:695 +#: kpsion.cpp:717 msgid "an unknown machine" msgstr "einem unbekannten Gerät" -#: kpsion.cpp:708 +#: kpsion.cpp:730 msgid "Retrieving drive list ..." msgstr "Ermittle Laufwerks-Liste ..." -#: kpsion.cpp:711 +#: kpsion.cpp:733 msgid "Could not get list of drives" msgstr "Konnte Liste der Laufwerke nicht ermitteln" -#: kpsion.cpp:741 kpsion.cpp:1013 kpsion.cpp:1035 kpsion.cpp:1058 -#: kpsion.cpp:1168 kpsion.cpp:1345 kpsion.cpp:1476 kpsion.cpp:1485 -#: kpsion.cpp:1530 kpsion.cpp:1549 kpsion.cpp:1566 +#: kpsion.cpp:763 kpsion.cpp:1035 kpsion.cpp:1057 kpsion.cpp:1080 +#: kpsion.cpp:1190 kpsion.cpp:1377 kpsion.cpp:1538 kpsion.cpp:1547 +#: kpsion.cpp:1578 kpsion.cpp:1596 kpsion.cpp:1607 #, c-format msgid "Connected to %1" msgstr "Verbunden mit %1" -#: kpsion.cpp:775 +#: kpsion.cpp:797 msgid "" "<QT>The selected drive <B>Z:</B> is a <B>ROM</B> drive and therefore cannot " "be restored.</QT>" @@ -128,7 +128,7 @@ msgstr "" "<QT>Das gewählte Laufwerk <B>Z:</B> ist ein <B>ROM</B> Laufwerk und kann " "deshalb nicht rückgesichert werden.</QT>" -#: kpsion.cpp:822 +#: kpsion.cpp:844 msgid "" "A backup is running.\n" "Do you really want to quit?" @@ -136,7 +136,7 @@ msgstr "" "Eine Sicherung läuft.\n" "Wollen Sie wirklich das Programm beenden?" -#: kpsion.cpp:824 +#: kpsion.cpp:846 msgid "" "A restore is running.\n" "Do you really want to quit?" @@ -144,7 +144,7 @@ msgstr "" "Eine Rücksicherung läuft.\n" "Wollen Sie wirklich das Programm beenden?" -#: kpsion.cpp:826 +#: kpsion.cpp:848 msgid "" "A format is running.\n" "Do you really want to quit?" @@ -152,88 +152,88 @@ msgstr "" "Eine Formatierung läuft.\n" "Wollen Sie wirklich das Programm beenden?" -#: kpsion.cpp:852 +#: kpsion.cpp:874 msgid "Connecting ..." msgstr "Verbindungsaufbau ..." -#: kpsion.cpp:854 +#: kpsion.cpp:876 msgid "RFSV could not connect to ncpd at %1:%2. " msgstr "RFSV konnte ncpd auf %1:%2 nicht erreichen. " -#: kpsion.cpp:857 kpsion.cpp:879 kpsion.cpp:902 kpsion.cpp:927 +#: kpsion.cpp:879 kpsion.cpp:901 kpsion.cpp:924 kpsion.cpp:949 msgid " (Retry in %1 seconds.)" msgstr " (Wiederholung in %1 Sekunden.)" -#: kpsion.cpp:874 +#: kpsion.cpp:896 #, c-format msgid "RFSV could not establish link: %1." msgstr "RFSV konnte keine Verbindung aufbauen: %1." -#: kpsion.cpp:895 +#: kpsion.cpp:917 msgid "RPCS could not connect to ncpd at %1:%2." msgstr "RPCS konnte ncpd auf %1:%2 nicht erreichen." -#: kpsion.cpp:918 +#: kpsion.cpp:940 #, c-format msgid "RPCS could not establish link: %1." msgstr "RPCS konnte keine Verbindung aufbauen: %1." -#: kpsion.cpp:1017 +#: kpsion.cpp:1039 #, c-format msgid "Could not retrieve drive details for drive %1" msgstr "Konnte Details des Laufwerks %1 nicht ermitteln." -#: kpsion.cpp:1022 +#: kpsion.cpp:1044 #, c-format msgid "Scanning drive %1" msgstr "Durchsuche Laufwerk %1" -#: kpsion.cpp:1031 +#: kpsion.cpp:1053 msgid "%1 files need backup" msgstr "%1 Dateien müssen gesichert werden" -#: kpsion.cpp:1037 +#: kpsion.cpp:1059 msgid "No files need backup" msgstr "Keine Dateien zu sichern" -#: kpsion.cpp:1060 +#: kpsion.cpp:1082 #, c-format msgid "Could not create backup folder %1" msgstr "Konnte Sicherungs-Ordner %1 nicht anlegen." -#: kpsion.cpp:1084 +#: kpsion.cpp:1106 msgid "Backup %1% done" msgstr "Sicherung %1% beendet" -#: kpsion.cpp:1104 +#: kpsion.cpp:1126 msgid "<QT>Could not open<BR/><B>%1</B></QT>" msgstr "<QT>Konnte<BR/><B>%1</B><BR/>nicht öffnen</QT>" -#: kpsion.cpp:1124 +#: kpsion.cpp:1146 msgid "<QT>Could not read<BR/><B>%1</B></QT>" msgstr "<QT>Konnte<BR/><B>%1</B><BR/>nicht lesen</QT>" -#: kpsion.cpp:1137 +#: kpsion.cpp:1159 msgid "Resetting archive attributes" msgstr "Setze Archiv-Attribute zurück" -#: kpsion.cpp:1150 +#: kpsion.cpp:1172 msgid "<QT>Could not set attributes of<BR/><B>%1</B></QT>" msgstr "<QT>Konnte Attribute der Datei<BR/><B>%1</B><BR/>nicht setzen</QT>" -#: kpsion.cpp:1172 +#: kpsion.cpp:1194 msgid "Backup done" msgstr "Sicherung beendet" -#: kpsion.cpp:1176 +#: kpsion.cpp:1198 msgid "Restore" msgstr "Rücksicherung" -#: kpsion.cpp:1180 +#: kpsion.cpp:1202 msgid "Start" msgstr "Start" -#: kpsion.cpp:1183 +#: kpsion.cpp:1205 msgid "" "Select items in the list of available backups, then click here to start " "restore of these items." @@ -241,21 +241,25 @@ msgstr "" "Wählen Sie in der Liste der verfügbaren Sicherungen Dateien aus und " "klicken Sie dann hier um die gewählten Dateien zu restaurieren." -#: kpsion.cpp:1230 kpsion.cpp:1443 +#: kpsion.cpp:1216 +msgid "Format drive before restore" +msgstr "Formatiere Laufwerk vor Rücksicherung" + +#: kpsion.cpp:1261 kpsion.cpp:1491 msgid "<QT>Could not get attributes of<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" "<QT>Konnte Attribute der Datei<BR/><B>%1</B> nicht abfragen<BR/>Grund: " "%2</QT>" -#: kpsion.cpp:1259 +#: kpsion.cpp:1290 msgid "Overwrite" msgstr "Überschreiben" -#: kpsion.cpp:1262 +#: kpsion.cpp:1293 msgid "Overwrite &All" msgstr "Überschreibe &Alles" -#: kpsion.cpp:1275 +#: kpsion.cpp:1306 msgid "" "<QT>The file <B>%1</B> exists already on the Psion with different size " "and/or attributes.<P><B>On the Psion:</B><BR/> Size: %2<BR/> Date: %3<BR/> " @@ -268,73 +272,73 @@ msgstr "" "%5<BR/> Datum: %6<BR/> Attribute: %7</P>Wollen Sie die Datei " "überschreiben?</QT>" -#: kpsion.cpp:1313 +#: kpsion.cpp:1344 msgid "Reading backups ..." msgstr "Lese Sicherungsdaten ..." -#: kpsion.cpp:1318 +#: kpsion.cpp:1349 msgid "Selecting backups ..." msgstr "Wähle Sicherungsdaten ..." -#: kpsion.cpp:1350 +#: kpsion.cpp:1382 kpsion.cpp:1430 msgid "Restore %1% done" msgstr "Rücksicherung %1% abgeschlossen" -#: kpsion.cpp:1398 +#: kpsion.cpp:1446 msgid "<QT>Could not create directory<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "<QT>Konnte den Ordner<BR/><B>%1</B> nicht anlegen.<BR/>Grund: %2</QT>" -#: kpsion.cpp:1413 +#: kpsion.cpp:1461 msgid "<QT>Could not create<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "<QT>Konnte<BR/><B>%1</B> nicht anlegen<BR/>Grund: %2</QT>" -#: kpsion.cpp:1435 +#: kpsion.cpp:1483 msgid "<QT>Could not write to<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "<QT>Konnte nicht auf <BR/><B>%1</B> schreiben<BR/>Grund: %2</QT>" -#: kpsion.cpp:1453 +#: kpsion.cpp:1509 msgid "<QT>Could not set attributes of<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "<QT>Konnte Attribute der Datei<BR/><B>%1</B>nicht setzen.<BR/>Grund: %2</QT>" -#: kpsion.cpp:1460 +#: kpsion.cpp:1522 msgid "<QT>Could not set modification time of<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" "<QT>Konnte Änderungsdatum der Datei<BR/><B>%1</B> nicht setzen<BR/>Grund: " "%2</QT>" -#: kpsion.cpp:1487 +#: kpsion.cpp:1549 msgid "Restore done" msgstr "Rücksicherung abgeschlossen" -#: kpsion.cpp:1493 -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:1515 +#: kpsion.cpp:1563 msgid "Formatting drive %1:" msgstr "Formatiere Laufwerk %1:" -#: kpsion.cpp:1526 +#: kpsion.cpp:1574 msgid "<QT>Could not format drive %1:<BR/>%2</QT>" msgstr "<QT>Konnte Laufwerk %1 nicht formatieren:<BR/>%2</QT>" -#: kpsion.cpp:1544 +#: kpsion.cpp:1591 msgid "<QT>Error during format of drive %1:<BR/>%2</QT>" msgstr "<QT>Fehler beim Formatieren von Laufwerk %1:<BR/>%2</QT>" -#: kpsion.cpp:1568 +#: kpsion.cpp:1609 msgid "Format done" msgstr "Formatierung beendet" -#: kpsion.cpp:1573 +#: kpsion.cpp:1615 +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:1636 msgid "Assign drive name" msgstr "Weise Laufwerksnamen zu" -#: kpsion.cpp:1582 +#: kpsion.cpp:1645 msgid "" "<QT>Formatting of drive %1: finished. Please assign a name for that " "drive.</QT>" @@ -342,22 +346,24 @@ msgstr "" "<QT>Die Formatierung des Laufwerks %1 ist beendet. Bitte weisen Sie dem " "Laufwerk nun einen Namen zu.</QT>" -#: kpsion.cpp:1586 +#: kpsion.cpp:1649 msgid "New name of drive %1:" msgstr "Neuer Name für Laufwerk %1:" -#: kpsion.cpp:1730 +#: kpsion.cpp:1793 #, c-format msgid "Stopping %1" msgstr "Stoppe %1" -#: kpsion.cpp:1748 +#: kpsion.cpp:1811 msgid "" "<QT>Could not stop all processes.<BR/>Please stop running programs manually " "on the Psion, then klick <B>Ok</B>." msgstr "" +"<QT>Konnte nicht alle Prozesse stoppen.<BR/>Bitte beenden Sie laufende Progamme " +"auf dem Psion manuell. Klickens Die dann <B>Ok</B>." -#: kpsion.cpp:1771 +#: kpsion.cpp:1834 #, c-format msgid "Starting %1" msgstr "Starte %1" diff --git a/kde2/po/kpsion.pot b/kde2/po/kpsion.pot index 61591be..afb5721 100644 --- a/kde2/po/kpsion.pot +++ b/kde2/po/kpsion.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-03-06 17:49+0100\n" +"POT-Creation-Date: 2001-03-12 05:15+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" @@ -36,15 +36,15 @@ msgid "" "restore, the click on <b>Start</b> to start restoring these items.</qt>" msgstr "" -#: kpsion.cpp:460 +#: kpsion.cpp:482 msgid "Idle" msgstr "" -#: kpsion.cpp:501 wizards.cpp:227 +#: kpsion.cpp:523 wizards.cpp:227 msgid "off" msgstr "" -#: kpsion.cpp:505 +#: kpsion.cpp:527 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.: " @@ -52,189 +52,193 @@ msgid "" "again.<br/>Select as many drives a you want, then choose an operation.</qt>" msgstr "" -#: kpsion.cpp:573 +#: kpsion.cpp:595 msgid "Start &Format" msgstr "" -#: kpsion.cpp:575 +#: kpsion.cpp:597 msgid "Start Full &Backup" msgstr "" -#: kpsion.cpp:578 +#: kpsion.cpp:600 msgid "Start &Incremental Backup" msgstr "" -#: kpsion.cpp:580 +#: kpsion.cpp:602 msgid "Start &Restore" msgstr "" -#: kpsion.cpp:594 +#: kpsion.cpp:616 msgid "Full backup of selected drive(s)" msgstr "" -#: kpsion.cpp:596 +#: kpsion.cpp:618 msgid "Incremental backup of selected drive(s)" msgstr "" -#: kpsion.cpp:598 +#: kpsion.cpp:620 msgid "Restore selected drive(s)" msgstr "" -#: kpsion.cpp:600 +#: kpsion.cpp:622 msgid "Format selected drive(s)" msgstr "" -#: kpsion.cpp:671 +#: kpsion.cpp:693 msgid "Retrieving machine info ..." msgstr "" -#: kpsion.cpp:682 +#: kpsion.cpp:704 msgid "Could not get Psion machine info" msgstr "" -#: kpsion.cpp:695 +#: kpsion.cpp:717 msgid "an unknown machine" msgstr "" -#: kpsion.cpp:708 +#: kpsion.cpp:730 msgid "Retrieving drive list ..." msgstr "" -#: kpsion.cpp:711 +#: kpsion.cpp:733 msgid "Could not get list of drives" msgstr "" -#: kpsion.cpp:741 kpsion.cpp:1013 kpsion.cpp:1035 kpsion.cpp:1058 -#: kpsion.cpp:1168 kpsion.cpp:1345 kpsion.cpp:1476 kpsion.cpp:1485 -#: kpsion.cpp:1530 kpsion.cpp:1549 kpsion.cpp:1566 +#: kpsion.cpp:763 kpsion.cpp:1035 kpsion.cpp:1057 kpsion.cpp:1080 +#: kpsion.cpp:1190 kpsion.cpp:1377 kpsion.cpp:1538 kpsion.cpp:1547 +#: kpsion.cpp:1578 kpsion.cpp:1596 kpsion.cpp:1607 #, c-format msgid "Connected to %1" msgstr "" -#: kpsion.cpp:775 +#: kpsion.cpp:797 msgid "" "<QT>The selected drive <B>Z:</B> is a <B>ROM</B> drive and therefore cannot " "be restored.</QT>" msgstr "" -#: kpsion.cpp:822 +#: kpsion.cpp:844 msgid "" "A backup is running.\n" "Do you really want to quit?" msgstr "" -#: kpsion.cpp:824 +#: kpsion.cpp:846 msgid "" "A restore is running.\n" "Do you really want to quit?" msgstr "" -#: kpsion.cpp:826 +#: kpsion.cpp:848 msgid "" "A format is running.\n" "Do you really want to quit?" msgstr "" -#: kpsion.cpp:852 +#: kpsion.cpp:874 msgid "Connecting ..." msgstr "" -#: kpsion.cpp:854 +#: kpsion.cpp:876 msgid "RFSV could not connect to ncpd at %1:%2. " msgstr "" -#: kpsion.cpp:857 kpsion.cpp:879 kpsion.cpp:902 kpsion.cpp:927 +#: kpsion.cpp:879 kpsion.cpp:901 kpsion.cpp:924 kpsion.cpp:949 msgid " (Retry in %1 seconds.)" msgstr "" -#: kpsion.cpp:874 +#: kpsion.cpp:896 #, c-format msgid "RFSV could not establish link: %1." msgstr "" -#: kpsion.cpp:895 +#: kpsion.cpp:917 msgid "RPCS could not connect to ncpd at %1:%2." msgstr "" -#: kpsion.cpp:918 +#: kpsion.cpp:940 #, c-format msgid "RPCS could not establish link: %1." msgstr "" -#: kpsion.cpp:1017 +#: kpsion.cpp:1039 #, c-format msgid "Could not retrieve drive details for drive %1" msgstr "" -#: kpsion.cpp:1022 +#: kpsion.cpp:1044 #, c-format msgid "Scanning drive %1" msgstr "" -#: kpsion.cpp:1031 +#: kpsion.cpp:1053 msgid "%1 files need backup" msgstr "" -#: kpsion.cpp:1037 +#: kpsion.cpp:1059 msgid "No files need backup" msgstr "" -#: kpsion.cpp:1060 +#: kpsion.cpp:1082 #, c-format msgid "Could not create backup folder %1" msgstr "" -#: kpsion.cpp:1084 +#: kpsion.cpp:1106 msgid "Backup %1% done" msgstr "" -#: kpsion.cpp:1104 +#: kpsion.cpp:1126 msgid "<QT>Could not open<BR/><B>%1</B></QT>" msgstr "" -#: kpsion.cpp:1124 +#: kpsion.cpp:1146 msgid "<QT>Could not read<BR/><B>%1</B></QT>" msgstr "" -#: kpsion.cpp:1137 +#: kpsion.cpp:1159 msgid "Resetting archive attributes" msgstr "" -#: kpsion.cpp:1150 +#: kpsion.cpp:1172 msgid "<QT>Could not set attributes of<BR/><B>%1</B></QT>" msgstr "" -#: kpsion.cpp:1172 +#: kpsion.cpp:1194 msgid "Backup done" msgstr "" -#: kpsion.cpp:1176 +#: kpsion.cpp:1198 msgid "Restore" msgstr "" -#: kpsion.cpp:1180 +#: kpsion.cpp:1202 msgid "Start" msgstr "" -#: kpsion.cpp:1183 +#: kpsion.cpp:1205 msgid "" "Select items in the list of available backups, then click here to start " "restore of these items." msgstr "" -#: kpsion.cpp:1230 kpsion.cpp:1443 +#: kpsion.cpp:1216 +msgid "Format drive before restore" +msgstr "" + +#: kpsion.cpp:1261 kpsion.cpp:1491 msgid "<QT>Could not get attributes of<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" -#: kpsion.cpp:1259 +#: kpsion.cpp:1290 msgid "Overwrite" msgstr "" -#: kpsion.cpp:1262 +#: kpsion.cpp:1293 msgid "Overwrite &All" msgstr "" -#: kpsion.cpp:1275 +#: kpsion.cpp:1306 msgid "" "<QT>The file <B>%1</B> exists already on the Psion with different size " "and/or attributes.<P><B>On the Psion:</B><BR/> Size: %2<BR/> Date: %3<BR/> " @@ -242,91 +246,91 @@ msgid "" "Attributes: %7</P>Do you want to overwrite it?</QT>" msgstr "" -#: kpsion.cpp:1313 +#: kpsion.cpp:1344 msgid "Reading backups ..." msgstr "" -#: kpsion.cpp:1318 +#: kpsion.cpp:1349 msgid "Selecting backups ..." msgstr "" -#: kpsion.cpp:1350 +#: kpsion.cpp:1382 kpsion.cpp:1430 msgid "Restore %1% done" msgstr "" -#: kpsion.cpp:1398 +#: kpsion.cpp:1446 msgid "<QT>Could not create directory<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" -#: kpsion.cpp:1413 +#: kpsion.cpp:1461 msgid "<QT>Could not create<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" -#: kpsion.cpp:1435 +#: kpsion.cpp:1483 msgid "<QT>Could not write to<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" -#: kpsion.cpp:1453 +#: kpsion.cpp:1509 msgid "<QT>Could not set attributes of<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" -#: kpsion.cpp:1460 +#: kpsion.cpp:1522 msgid "" "<QT>Could not set modification time of<BR/><B>%1</B><BR/>Reason: %2</QT>" msgstr "" -#: kpsion.cpp:1487 +#: kpsion.cpp:1549 msgid "Restore done" msgstr "" -#: kpsion.cpp:1493 -msgid "" -"<QT>This erases <B>ALL</B> data on the drive(s).<BR/>Do you really want to " -"proceed?" -msgstr "" - -#: kpsion.cpp:1515 +#: kpsion.cpp:1563 msgid "Formatting drive %1:" msgstr "" -#: kpsion.cpp:1526 +#: kpsion.cpp:1574 msgid "<QT>Could not format drive %1:<BR/>%2</QT>" msgstr "" -#: kpsion.cpp:1544 +#: kpsion.cpp:1591 msgid "<QT>Error during format of drive %1:<BR/>%2</QT>" msgstr "" -#: kpsion.cpp:1568 +#: kpsion.cpp:1609 msgid "Format done" msgstr "" -#: kpsion.cpp:1573 +#: kpsion.cpp:1615 +msgid "" +"<QT>This erases <B>ALL</B> data on the drive(s).<BR/>Do you really want to " +"proceed?" +msgstr "" + +#: kpsion.cpp:1636 msgid "Assign drive name" msgstr "" -#: kpsion.cpp:1582 +#: kpsion.cpp:1645 msgid "" "<QT>Formatting of drive %1: finished. Please assign a name for that " "drive.</QT>" msgstr "" -#: kpsion.cpp:1586 +#: kpsion.cpp:1649 msgid "New name of drive %1:" msgstr "" -#: kpsion.cpp:1730 +#: kpsion.cpp:1793 #, c-format msgid "Stopping %1" msgstr "" -#: kpsion.cpp:1748 +#: kpsion.cpp:1811 msgid "" "<QT>Could not stop all processes.<BR/>Please stop running programs manually " "on the Psion, then klick <B>Ok</B>." msgstr "" -#: kpsion.cpp:1771 +#: kpsion.cpp:1834 #, c-format msgid "Starting %1" msgstr "" |