1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Riebeling
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.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
19 #include "uninstallwindow.h"
20 #include "ui_uninstallfrm.h"
21 #include "rbsettings.h"
23 UninstallWindow::UninstallWindow(QWidget
*parent
) : QDialog(parent
)
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)));
30 QString mountpoint
= RbSettings::value(RbSettings::Mountpoint
).toString();
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()));
39 // disable smart uninstall, if not possible
40 if(!uninstaller
->uninstallPossible())
42 ui
.smartRadioButton
->setEnabled(false);
43 ui
.smartGroupBox
->setEnabled(false);
44 ui
.CompleteRadioBtn
->setChecked(true);
46 else // fill in installed parts
48 ui
.smartRadioButton
->setChecked(true);
49 ui
.UninstalllistWidget
->addItems(uninstaller
->getAllSections());
55 void UninstallWindow::accept()
59 if(ui
.CompleteRadioBtn
->isChecked())
61 uninstaller
->deleteAll();
65 uninstaller
->uninstall();
71 void UninstallWindow::selectionChanged()
73 QList
<QListWidgetItem
*> itemlist
= ui
.UninstalllistWidget
->selectedItems();
74 QStringList seletedStrings
;
75 for(int i
=0;i
< itemlist
.size(); i
++ )
77 seletedStrings
<< itemlist
.at(i
)->text();
80 uninstaller
->setSections(seletedStrings
);
83 void UninstallWindow::UninstallMethodChanged(bool complete
)
86 ui
.smartGroupBox
->setEnabled(false);
88 ui
.smartGroupBox
->setEnabled(true);
92 void UninstallWindow::changeEvent(QEvent
*e
)
94 if(e
->type() == QEvent::LanguageChange
) {
95 ui
.retranslateUi(this);
97 QWidget::changeEvent(e
);