From 2ad3d828da9d01db71a9075a4a8b79edc1afbba9 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Sat, 29 Dec 2012 21:18:59 +0330 Subject: [PATCH] RecoveryWidget: doesn't disable child item when root item is unchecked, just uncheck it! --- src/lib/session/recoverywidget.cpp | 16 ++-------------- src/lib/session/recoverywidget.h | 2 -- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/lib/session/recoverywidget.cpp b/src/lib/session/recoverywidget.cpp index 4dbee3c20..8f465d834 100644 --- a/src/lib/session/recoverywidget.cpp +++ b/src/lib/session/recoverywidget.cpp @@ -39,6 +39,7 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) const RestoreManager::WindowData &wd = data.at(i); QTreeWidgetItem* root = new QTreeWidgetItem(ui->treeWidget); + root->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsTristate); root->setText(0, tr("Window %1").arg((i + 1))); root->setCheckState(0, Qt::Checked); @@ -46,6 +47,7 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) const WebTab::SavedTab &st = wd.tabsState.at(tab); QTreeWidgetItem* child = new QTreeWidgetItem(root); + child->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled); child->setCheckState(0, Qt::Checked); child->setIcon(0, st.icon); child->setText(0, st.title); @@ -54,24 +56,10 @@ RecoveryWidget::RecoveryWidget(WebView* view, QupZilla* mainClass) ui->treeWidget->expandAll(); - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onItemChanged(QTreeWidgetItem*, int))); connect(ui->restoreSession, SIGNAL(clicked()), this, SLOT(restoreSession())); connect(ui->newSession, SIGNAL(clicked()), this, SLOT(newSession())); } -void RecoveryWidget::onItemChanged(QTreeWidgetItem* item, int column) -{ - if (column != 0 || item->childCount() == 0) { - return; - } - - bool disabled = item->checkState(0) == Qt::Unchecked; - - for (int i = 0; i < item->childCount(); ++i) { - item->child(i)->setDisabled(disabled); - } -} - void RecoveryWidget::restoreSession() { RestoreManager* manager = mApp->restoreManager(); diff --git a/src/lib/session/recoverywidget.h b/src/lib/session/recoverywidget.h index 18257614a..6a1d1c65c 100644 --- a/src/lib/session/recoverywidget.h +++ b/src/lib/session/recoverywidget.h @@ -40,8 +40,6 @@ public: ~RecoveryWidget(); private slots: - void onItemChanged(QTreeWidgetItem* item, int column); - void restoreSession(); void newSession();