summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-11-01 17:16:02 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-11-01 17:16:02 +0000
commit04f84cf1e81e6930bd3f84c1f4066da70ff6c467 (patch)
treea33faa9016bd99ea15d8af96bd66a6b5f695bc0d /rbutil
parent3216d32a0538e4b75ae9e82dadc555011181633f (diff)
downloadrockbox-04f84cf1e81e6930bd3f84c1f4066da70ff6c467.tar.gz
rockbox-04f84cf1e81e6930bd3f84c1f4066da70ff6c467.tar.bz2
rockbox-04f84cf1e81e6930bd3f84c1f4066da70ff6c467.zip
FS#10747 - Disable actions if rbutil is not configured properly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23466 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index aa81513d88..18534029a5 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -93,6 +93,8 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
// disable quick install until version info is available
ui.buttonSmall->setEnabled(false);
ui.buttonComplete->setEnabled(false);
+ ui.actionSmall_Installation->setEnabled(false);
+ ui.actionComplete_Installation->setEnabled(false);
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
@@ -204,14 +206,12 @@ void RbUtilQt::downloadDone(bool error)
versmap.insert("rel_rev", info.value(RbSettings::value(RbSettings::CurBuildserverModel).toString()).toString());
info.endGroup();
- if(versmap.value("rel_rev").isEmpty()) {
- ui.buttonSmall->setEnabled(false);
- ui.buttonComplete->setEnabled(false);
- }
- else {
- ui.buttonSmall->setEnabled(true);
- ui.buttonComplete->setEnabled(true);
- }
+ bool installable = !versmap.value("rel_rev").isEmpty();
+
+ ui.buttonSmall->setEnabled(installable);
+ ui.buttonComplete->setEnabled(installable);
+ ui.actionSmall_Installation->setEnabled(installable);
+ ui.actionComplete_Installation->setEnabled(installable);
bleeding = new HttpGet(this);
connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
@@ -343,24 +343,27 @@ void RbUtilQt::updateSettings()
void RbUtilQt::updateDevice()
{
- if(RbSettings::value(RbSettings::CurBootloaderMethod) == "none" ) {
- ui.buttonBootloader->setEnabled(false);
- ui.buttonRemoveBootloader->setEnabled(false);
- ui.labelBootloader->setEnabled(false);
- ui.labelRemoveBootloader->setEnabled(false);
- }
- else {
- ui.buttonBootloader->setEnabled(true);
- ui.labelBootloader->setEnabled(true);
- if(RbSettings::value(RbSettings::CurBootloaderMethod) == "fwpatcher") {
- ui.labelRemoveBootloader->setEnabled(false);
- ui.buttonRemoveBootloader->setEnabled(false);
- }
- else {
- ui.labelRemoveBootloader->setEnabled(true);
- ui.buttonRemoveBootloader->setEnabled(true);
- }
- }
+ /* TODO: We should check the flags of the bootloaderinstall classes, and not
+ * just check if its != none or != "fwpatcher" */
+
+ /* Enable bootloader installation, if possible */
+ bool bootloaderInstallable =
+ RbSettings::value(RbSettings::CurBootloaderMethod) != "none";
+ ui.buttonBootloader->setEnabled(bootloaderInstallable);
+ ui.labelBootloader->setEnabled(bootloaderInstallable);
+ ui.actionInstall_Bootloader->setEnabled(bootloaderInstallable);
+
+ /* Enable bootloader uninstallation, if possible */
+ bool bootloaderUninstallable = bootloaderInstallable &&
+ RbSettings::value(RbSettings::CurBootloaderMethod) != "fwpatcher";
+ ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable);
+ ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable);
+ ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
+
+ /* Disable the whole tab widget if configuration is invalid */
+ bool configurationValid = !chkConfig(false);
+ ui.tabWidget->setEnabled(configurationValid);
+ ui.menuA_ctions->setEnabled(configurationValid);
// displayed device info
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();