Integrate convttf into tools/.
[kugel-rb/myfork.git] / rbutil / rbutilqt / uninstallwindow.cpp
blob4abfe93b1e42c5ec288e1d1fba837a5f86e52975
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Riebeling
10 * $Id$
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"
22 #include "rbsettings.h"
24 UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent)
26 ui.setupUi(this);
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)));
31 QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
33 uninstaller = new Uninstaller(this,mountpoint);
35 // disable smart uninstall, if not possible
36 if(!uninstaller->uninstallPossible())
38 ui.smartRadioButton->setEnabled(false);
39 ui.smartGroupBox->setEnabled(false);
40 ui.CompleteRadioBtn->setChecked(true);
42 else // fill in installed parts
44 ui.smartRadioButton->setChecked(true);
45 ui.UninstalllistWidget->addItems(uninstaller->getAllSections());
51 void UninstallWindow::accept()
53 logger = new ProgressLoggerGui(this);
54 logger->show();
56 connect(logger,SIGNAL(closed()),this,SLOT(close()));
57 if(ui.CompleteRadioBtn->isChecked())
59 uninstaller->deleteAll(logger);
61 else
63 uninstaller->uninstall(logger);
69 void UninstallWindow::selectionChanged()
71 QList<QListWidgetItem *> itemlist = ui.UninstalllistWidget->selectedItems();
72 QStringList seletedStrings;
73 for(int i=0;i < itemlist.size(); i++ )
75 seletedStrings << itemlist.at(i)->text();
78 uninstaller->setSections(seletedStrings);
81 void UninstallWindow::UninstallMethodChanged(bool complete)
83 if(complete)
84 ui.smartGroupBox->setEnabled(false);
85 else
86 ui.smartGroupBox->setEnabled(true);