mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
RecoveryWidget: doesn't disable child item when root item is unchecked, just uncheck it!
This commit is contained in:
parent
6f5d32eddf
commit
2ad3d828da
@ -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();
|
||||
|
@ -40,8 +40,6 @@ public:
|
||||
~RecoveryWidget();
|
||||
|
||||
private slots:
|
||||
void onItemChanged(QTreeWidgetItem* item, int column);
|
||||
|
||||
void restoreSession();
|
||||
void newSession();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user