[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. master/0.9.1-15-gbfdccff
Modestas Vainius
modax-guest at alioth.debian.org
Tue Mar 31 01:29:17 UTC 2009
The following commit has been merged in the master branch:
commit a49b4a9ba9dc2bbbcd5608277a8c23278a554102
Author: Modestas Vainius <modestas at vainius.eu>
Date: Tue Mar 31 01:39:52 2009 +0300
Smartly handle return values in case migration failures.
Also manage "Cancel" button state during migration process.
Make it possible to go back in case of migration failure.
Signed-off-by: Modestas Vainius <modestas at vainius.eu>
diff --git a/main.cpp b/main.cpp
index 9d039f6..c4d4895 100644
--- a/main.cpp
+++ b/main.cpp
@@ -54,9 +54,14 @@ int main(int argc, char* argv[])
{
// disable for debugging
// settings.touchStamp();
- return 0;
- } else if(exitvalue == QDialog::Rejected) {
- exitvalue = 1; // Canceled
+ exitvalue = 0; // OK
+ } else if (exitvalue == QDialog::Rejected) {
+ if (!main.migrationError().isEmpty()) {
+ qDebug() << "Migration failed with error:" << main.migrationError();
+ exitvalue = 2; // Failed
+ } else {
+ exitvalue = 1; // Canceled by the user
+ }
}
return exitvalue;
diff --git a/migrationpage.cpp b/migrationpage.cpp
index ac0ee18..a343c3a 100644
--- a/migrationpage.cpp
+++ b/migrationpage.cpp
@@ -19,6 +19,7 @@
#include "migrationpage_p.h"
#include "diroperations/diroperations.h"
#include "kaboomsettings.h"
+#include "migrationtool.h"
MigrationPagePrivate::MigrationPagePrivate(MigrationPage* parent)
@@ -39,7 +40,7 @@ MigrationPagePrivate::MigrationPagePrivate(MigrationPage* parent)
void MigrationPagePrivate::doMagic()
{
start->setEnabled(false);
- q->wizard()->setOptions(q->wizard()->options()|QWizard::DisabledBackButtonOnLastPage); //no way back
+ errorhandling();
q->setTitle(tr("Migration running"));
if(backup)
{
@@ -91,14 +92,19 @@ void MigrationPagePrivate::doMagic()
{
errorhandling(e.what());
}
-
- complete=true;
- emit q->completeChanged();
+ if (error->text().isEmpty()) // No error
+ {
+ complete=true;
+ q->wizard()->setOptions(q->wizard()->options()|QWizard::DisabledBackButtonOnLastPage); //no way back
+ emit q->completeChanged();
+ }
}
void MigrationPagePrivate::errorhandling(const QString& err)
{
+ q->wizard()->button(QWizard::CancelButton)->setEnabled(!err.isEmpty());
+ static_cast<MigrationTool*>(q->wizard())->setMigrationError(err);
error->setText(err);
- errorbox->show();
+ errorbox->setVisible(!err.isEmpty());
}
MigrationPage::MigrationPage(QWidget *parent) : QWizardPage(parent)
@@ -139,6 +145,12 @@ void MigrationPage::initializePage()
{
d->complete=false;
emit completeChanged();
+ d->start->setEnabled(true);
+
+ // Initialize error handling and reenable Cancel button
+ d->errorhandling();
+ d->q->wizard()->button(QWizard::CancelButton)->setEnabled(true);
+
if(field("backup").toBool())
{
d->backup=true;
@@ -159,5 +171,4 @@ void MigrationPage::initializePage()
{
qFatal("Cast failed");
}
-
}
diff --git a/migrationpage_p.h b/migrationpage_p.h
index 660184e..afb555e 100644
--- a/migrationpage_p.h
+++ b/migrationpage_p.h
@@ -35,7 +35,7 @@ class MigrationPagePrivate : public QObject
QGroupBox *errorbox;
bool backup;
bool complete;
- void errorhandling(const QString &s);
+ void errorhandling(const QString &s = QString::null);
public slots:
void doMagic();
};
diff --git a/migrationtool.cpp b/migrationtool.cpp
index e33bb7c..90c6e87 100644
--- a/migrationtool.cpp
+++ b/migrationtool.cpp
@@ -79,3 +79,13 @@ int MigrationTool::nextId() const
break;
}
}
+
+void MigrationTool::setMigrationError(const QString& error)
+{
+ d->migrationError = error;
+}
+
+QString MigrationTool::migrationError() const
+{
+ return d->migrationError;
+}
diff --git a/migrationtool.h b/migrationtool.h
index 356e20d..c73315f 100644
--- a/migrationtool.h
+++ b/migrationtool.h
@@ -38,6 +38,8 @@ class MigrationTool : public QWizard
};
MigrationTool(QWidget *parent=0);
int nextId() const;
+ void setMigrationError(const QString& error);
+ QString migrationError() const;
private:
MigrationToolPrivate *d;
diff --git a/migrationtool_p.h b/migrationtool_p.h
index 1f361a1..c75c431 100644
--- a/migrationtool_p.h
+++ b/migrationtool_p.h
@@ -33,6 +33,7 @@ class MigrationToolPrivate: public QObject
ChoicePage *choice;
WarningPage *warning;
MigrationPage *migration;
+ QString migrationError;
};
--
Kaboom - Debian KDE 3->4 migration tool
More information about the pkg-kde-commits
mailing list