summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-23 11:15:46 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-26 18:30:27 +0200
commit9b783bc1050d9288e5392cb1eb90dcde2401f8bb (patch)
treed4b8e7590fc9ef522cc89370cf2737b054098010 /rbutil
parentf419128a6b371d2752553ef3850f10c2cdf46912 (diff)
Separate select and install parts in themes install window.
Allow using the themes installation dialog as selection dialog separately from installing themes. For this the installation is now triggered separately and can be told to not to do the installation on Ok button. In this case the dialog is selection only, and the Ok button is changed to Select. The installation itself is still done in the class but started by calling the install() method separately. Change-Id: I856db8204788302b2b539e6d8283f73cb354f033
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.cpp27
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.h7
2 files changed, 29 insertions, 5 deletions
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp
index 061882cb04..9218a085d0 100644
--- a/rbutil/rbutilqt/themesinstallwindow.cpp
+++ b/rbutil/rbutilqt/themesinstallwindow.cpp
@@ -46,6 +46,8 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
this, SLOT(updateDetails(QListWidgetItem*, QListWidgetItem*)));
connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize()));
connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool)));
+
+ logger = NULL;
}
ThemesInstallWindow::~ThemesInstallWindow()
@@ -285,6 +287,9 @@ void ThemesInstallWindow::resizeEvent(QResizeEvent* e)
void ThemesInstallWindow::show()
{
QDialog::show();
+ if(windowSelectOnly)
+ ui.buttonOk->setText(tr("Select"));
+
logger = new ProgressLoggerGui(this);
logger->show();
logger->addItem(tr("getting themes information ..."), LOGINFO);
@@ -304,7 +309,16 @@ void ThemesInstallWindow::abort()
}
-void ThemesInstallWindow::accept()
+void ThemesInstallWindow::accept(void)
+{
+ if(!windowSelectOnly)
+ install();
+ else
+ close();
+}
+
+
+void ThemesInstallWindow::install()
{
if(ui.listThemes->selectedItems().size() == 0) {
this->close();
@@ -329,7 +343,8 @@ void ThemesInstallWindow::accept()
}
qDebug() << "[Themes] installing:" << themes;
- logger = new ProgressLoggerGui(this);
+ if(logger == NULL)
+ logger = new ProgressLoggerGui(this);
logger->show();
QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();
qDebug() << "[Themes] mountpoint:" << mountPoint;
@@ -348,13 +363,15 @@ void ThemesInstallWindow::accept()
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
- connect(logger, SIGNAL(closed()), this, SLOT(close()));
+ if(!windowSelectOnly) {
+ connect(logger, SIGNAL(closed()), this, SLOT(close()));
+ connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
+ }
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
- connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
+ connect(installer, SIGNAL(done(bool)), this, SIGNAL(done(bool)));
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
installer->install();
-
}
diff --git a/rbutil/rbutilqt/themesinstallwindow.h b/rbutil/rbutilqt/themesinstallwindow.h
index 7b48d8bcce..9214e5ccbf 100644
--- a/rbutil/rbutilqt/themesinstallwindow.h
+++ b/rbutil/rbutilqt/themesinstallwindow.h
@@ -38,10 +38,16 @@ class ThemesInstallWindow : public QDialog
~ThemesInstallWindow();
void downloadInfo(void);
void show(void);
+ void setLogger(ProgressLoggerGui* l) { logger = l; }
+ void setSelectOnly(bool state) { windowSelectOnly = state; }
+ void install(void);
public slots:
void accept(void);
+ signals:
+ void done(bool);
+
private:
Ui::ThemeInstallFrm ui;
HttpGet *getter;
@@ -56,6 +62,7 @@ class ThemesInstallWindow : public QDialog
QString fileName;
QString infocachedir;
+ bool windowSelectOnly;
private slots:
void downloadDone(bool);