1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Riebeling
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "uninstallwindow.h"
21 #include "ui_uninstallfrm.h"
24 UninstallWindow::UninstallWindow(QWidget
*parent
) : QDialog(parent
)
27 ui
.UninstalllistWidget
->setAlternatingRowColors(true);
28 connect(ui
.UninstalllistWidget
,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged()));
29 connect(ui
.CompleteRadioBtn
,SIGNAL(toggled(bool)),this,SLOT(UninstallMethodChanged(bool)));
33 void UninstallWindow::accept()
35 logger
= new ProgressLoggerGui(this);
38 connect(logger
,SIGNAL(closed()),this,SLOT(close()));
39 if(ui
.CompleteRadioBtn
->isChecked())
41 uninstaller
->deleteAll(logger
);
45 uninstaller
->uninstall(logger
);
51 void UninstallWindow::selectionChanged()
53 QList
<QListWidgetItem
*> itemlist
= ui
.UninstalllistWidget
->selectedItems();
54 QStringList seletedStrings
;
55 for(int i
=0;i
< itemlist
.size(); i
++ )
57 seletedStrings
<< itemlist
.at(i
)->text();
60 uninstaller
->setSections(seletedStrings
);
63 void UninstallWindow::UninstallMethodChanged(bool complete
)
66 ui
.smartGroupBox
->setEnabled(false);
68 ui
.smartGroupBox
->setEnabled(true);
72 void UninstallWindow::setSettings(RbSettings
*sett
)
76 QString mountpoint
=settings
->mountpoint();
77 uninstaller
= new Uninstaller(this,mountpoint
);
79 // disable smart uninstall, if not possible
80 if(!uninstaller
->uninstallPossible())
82 ui
.smartRadioButton
->setEnabled(false);
83 ui
.smartGroupBox
->setEnabled(false);
84 ui
.CompleteRadioBtn
->setChecked(true);
86 else // fill in installed parts
88 ui
.smartRadioButton
->setChecked(true);
89 ui
.UninstalllistWidget
->addItems(uninstaller
->getAllSections());