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