From 8d34ae34135cfd495556a059c449a5f11ca6212c Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 13 Jul 2013 10:10:46 +0200 Subject: - some fixes to the refreshing behaviour - "fix" buttons in problems dialog are now actually functional - python proxy now has diagnosis functionality to warn user if correct proxy version is not available - python proxy now has a configurable python path --- src/problemsdialog.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/problemsdialog.cpp') diff --git a/src/problemsdialog.cpp b/src/problemsdialog.cpp index 8173e1e2..d5700381 100644 --- a/src/problemsdialog.cpp +++ b/src/problemsdialog.cpp @@ -20,13 +20,19 @@ ProblemsDialog::ProblemsDialog(std::vector diagnosePl QTreeWidgetItem *newItem = new QTreeWidgetItem(); newItem->setText(0, diagnose->shortDescription(key)); newItem->setData(0, Qt::UserRole, diagnose->fullDescription(key)); + newItem->setData(1, Qt::UserRole, qVariantFromValue(reinterpret_cast(diagnose))); + newItem->setData(1, Qt::UserRole + 1, key); + + ui->problemsWidget->addTopLevelItem(newItem); if (diagnose->hasGuidedFix(key)) { - ui->problemsWidget->setItemWidget(newItem, 1, new QPushButton(tr("Fix"))); + newItem->setText(1, tr("fix")); + QPushButton *fixButton = new QPushButton(tr("Fix")); + connect(fixButton, SIGNAL(clicked()), this, SLOT(startFix())); + ui->problemsWidget->setItemWidget(newItem, 1, fixButton); } else { newItem->setText(1, tr("No guided fix")); } - ui->problemsWidget->addTopLevelItem(newItem); } } connect(ui->problemsWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); @@ -52,6 +58,12 @@ void ProblemsDialog::selectionChanged() ui->descriptionText->setLineWrapMode(text.contains('\n') ? QTextEdit::NoWrap : QTextEdit::WidgetWidth); } +void ProblemsDialog::startFix() +{ + IPluginDiagnose *plugin = reinterpret_cast(ui->problemsWidget->currentItem()->data(1, Qt::UserRole).value()); + plugin->startGuidedFix(ui->problemsWidget->currentItem()->data(1, Qt::UserRole + 1).toUInt()); +} + void ProblemsDialog::urlClicked(const QUrl &url) { ::ShellExecuteW(NULL, L"open", ToWString(url.toString()).c_str(), NULL, NULL, SW_SHOWNORMAL); -- cgit v1.3.1