Prefix compareversion test files.
[maemo-rb.git] / rbutil / rbutilqt / uninstallwindow.cpp
blob264b73f5448a321ab2992040c293b6883798f95f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
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)
25 ui.setupUi(this);
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()
57 logger->show();
59 if(ui.CompleteRadioBtn->isChecked())
61 uninstaller->deleteAll();
63 else
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)
85 if(complete)
86 ui.smartGroupBox->setEnabled(false);
87 else
88 ui.smartGroupBox->setEnabled(true);
92 void UninstallWindow::changeEvent(QEvent *e)
94 if(e->type() == QEvent::LanguageChange) {
95 ui.retranslateUi(this);
96 } else {
97 QWidget::changeEvent(e);