summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/uninstallwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rbutilqt/uninstallwindow.cpp')
-rw-r--r--utils/rbutilqt/uninstallwindow.cpp100
1 files changed, 100 insertions, 0 deletions
diff --git a/utils/rbutilqt/uninstallwindow.cpp b/utils/rbutilqt/uninstallwindow.cpp
new file mode 100644
index 0000000000..264b73f544
--- /dev/null
+++ b/utils/rbutilqt/uninstallwindow.cpp
@@ -0,0 +1,100 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Riebeling
10 *
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
13 *
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
16 *
17 ****************************************************************************/
18
19#include "uninstallwindow.h"
20#include "ui_uninstallfrm.h"
21#include "rbsettings.h"
22
23UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent)
24{
25 ui.setupUi(this);
26 ui.UninstalllistWidget->setAlternatingRowColors(true);
27 connect(ui.UninstalllistWidget,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged()));
28 connect(ui.CompleteRadioBtn,SIGNAL(toggled(bool)),this,SLOT(UninstallMethodChanged(bool)));
29
30 QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
31
32 uninstaller = new Uninstaller(this,mountpoint);
33 logger = new ProgressLoggerGui(this);
34 connect(uninstaller, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
35 connect(uninstaller, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
36 connect(uninstaller, SIGNAL(logFinished(void)), logger, SLOT(setFinished(void)));
37 connect(logger, SIGNAL(closed()), this, SLOT(close()));
38
39 // disable smart uninstall, if not possible
40 if(!uninstaller->uninstallPossible())
41 {
42 ui.smartRadioButton->setEnabled(false);
43 ui.smartGroupBox->setEnabled(false);
44 ui.CompleteRadioBtn->setChecked(true);
45 }
46 else // fill in installed parts
47 {
48 ui.smartRadioButton->setChecked(true);
49 ui.UninstalllistWidget->addItems(uninstaller->getAllSections());
50 }
51
52}
53
54
55void UninstallWindow::accept()
56{
57 logger->show();
58
59 if(ui.CompleteRadioBtn->isChecked())
60 {
61 uninstaller->deleteAll();
62 }
63 else
64 {
65 uninstaller->uninstall();
66 }
67
68}
69
70
71void UninstallWindow::selectionChanged()
72{
73 QList<QListWidgetItem *> itemlist = ui.UninstalllistWidget->selectedItems();
74 QStringList seletedStrings;
75 for(int i=0;i < itemlist.size(); i++ )
76 {
77 seletedStrings << itemlist.at(i)->text();
78 }
79
80 uninstaller->setSections(seletedStrings);
81}
82
83void UninstallWindow::UninstallMethodChanged(bool complete)
84{
85 if(complete)
86 ui.smartGroupBox->setEnabled(false);
87 else
88 ui.smartGroupBox->setEnabled(true);
89}
90
91
92void UninstallWindow::changeEvent(QEvent *e)
93{
94 if(e->type() == QEvent::LanguageChange) {
95 ui.retranslateUi(this);
96 } else {
97 QWidget::changeEvent(e);
98 }
99}
100