2007-08-12 16:47:35 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Riebeling
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "uninstallwindow.h"
|
|
|
|
#include "ui_uninstallfrm.h"
|
2009-05-09 16:59:14 +00:00
|
|
|
#include "rbsettings.h"
|
2007-08-12 16:47:35 +00:00
|
|
|
|
|
|
|
UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
2007-09-15 22:57:07 +00:00
|
|
|
ui.UninstalllistWidget->setAlternatingRowColors(true);
|
2021-12-25 16:29:55 +00:00
|
|
|
connect(ui.UninstalllistWidget,&QListWidget::itemSelectionChanged,this,&UninstallWindow::selectionChanged);
|
|
|
|
connect(ui.CompleteRadioBtn,&QAbstractButton::toggled,this,&UninstallWindow::UninstallMethodChanged);
|
2009-05-09 16:59:14 +00:00
|
|
|
|
|
|
|
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
|
|
|
|
uninstaller = new Uninstaller(this,mountpoint);
|
2010-06-11 17:14:00 +00:00
|
|
|
logger = new ProgressLoggerGui(this);
|
2021-12-26 18:50:19 +00:00
|
|
|
connect(uninstaller, &Uninstaller::logItem, logger, &ProgressLoggerGui::addItem);
|
2021-12-25 16:29:55 +00:00
|
|
|
connect(uninstaller, &Uninstaller::logProgress, logger, &ProgressLoggerGui::setProgress);
|
2021-12-26 18:50:19 +00:00
|
|
|
connect(uninstaller, &Uninstaller::logFinished, logger, &ProgressLoggerGui::setFinished);
|
2021-12-25 16:29:55 +00:00
|
|
|
connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close);
|
2009-05-09 16:59:14 +00:00
|
|
|
|
|
|
|
// disable smart uninstall, if not possible
|
|
|
|
if(!uninstaller->uninstallPossible())
|
|
|
|
{
|
|
|
|
ui.smartRadioButton->setEnabled(false);
|
|
|
|
ui.smartGroupBox->setEnabled(false);
|
|
|
|
ui.CompleteRadioBtn->setChecked(true);
|
|
|
|
}
|
|
|
|
else // fill in installed parts
|
|
|
|
{
|
|
|
|
ui.smartRadioButton->setChecked(true);
|
|
|
|
ui.UninstalllistWidget->addItems(uninstaller->getAllSections());
|
|
|
|
}
|
|
|
|
|
2007-08-12 16:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UninstallWindow::accept()
|
|
|
|
{
|
|
|
|
logger->show();
|
2008-04-06 19:50:38 +00:00
|
|
|
|
2007-08-12 16:47:35 +00:00
|
|
|
if(ui.CompleteRadioBtn->isChecked())
|
|
|
|
{
|
2010-06-11 17:14:00 +00:00
|
|
|
uninstaller->deleteAll();
|
2007-08-12 16:47:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-11 17:14:00 +00:00
|
|
|
uninstaller->uninstall();
|
2007-08-12 16:47:35 +00:00
|
|
|
}
|
2008-04-06 19:50:38 +00:00
|
|
|
|
2007-08-12 16:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UninstallWindow::selectionChanged()
|
|
|
|
{
|
|
|
|
QList<QListWidgetItem *> itemlist = ui.UninstalllistWidget->selectedItems();
|
|
|
|
QStringList seletedStrings;
|
|
|
|
for(int i=0;i < itemlist.size(); i++ )
|
|
|
|
{
|
|
|
|
seletedStrings << itemlist.at(i)->text();
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-12 16:47:35 +00:00
|
|
|
uninstaller->setSections(seletedStrings);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UninstallWindow::UninstallMethodChanged(bool complete)
|
|
|
|
{
|
|
|
|
if(complete)
|
|
|
|
ui.smartGroupBox->setEnabled(false);
|
|
|
|
else
|
2007-09-15 22:57:07 +00:00
|
|
|
ui.smartGroupBox->setEnabled(true);
|
2007-08-12 16:47:35 +00:00
|
|
|
}
|
|
|
|
|
2011-10-02 14:30:05 +00:00
|
|
|
|
|
|
|
void UninstallWindow::changeEvent(QEvent *e)
|
|
|
|
{
|
|
|
|
if(e->type() == QEvent::LanguageChange) {
|
|
|
|
ui.retranslateUi(this);
|
|
|
|
} else {
|
|
|
|
QWidget::changeEvent(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|