From d62669e1b48687842fb856f2190c3bd84c514fd0 Mon Sep 17 00:00:00 2001 From: Silarn Date: Sat, 7 Apr 2018 18:58:12 -0500 Subject: Fix overwritten file preview --- src/modinfodialog.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/modinfodialog.cpp') diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index f2042d15..f8655d6b 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -298,7 +298,9 @@ void ModInfoDialog::refreshLists() QStringList fields(relativeName); fields.append(ToQString(realOrigin.getName())); QTreeWidgetItem *item = new QTreeWidgetItem(fields); + item->setData(0, Qt::UserRole, fileName); item->setData(1, Qt::UserRole, ToQString(realOrigin.getName())); + item->setData(1, Qt::UserRole + 2, archive); ui->overwrittenTree->addTopLevelItem(item); ++numOverwritten; } @@ -1280,10 +1282,10 @@ void ModInfoDialog::on_overwriteTree_customContextMenuRequested(const QPoint &po menu.addAction(tr("Hide"), this, SLOT(hideConflictFile())); } - QString fileName = m_ConflictsContextItem->data(0, Qt::UserRole).toString(); - if (m_PluginContainer->previewGenerator().previewSupported(QFileInfo(fileName).suffix())) { - menu.addAction(tr("Preview"), this, SLOT(previewDataFile())); - } + QString fileName = m_ConflictsContextItem->data(0, Qt::UserRole).toString(); + if (m_PluginContainer->previewGenerator().previewSupported(QFileInfo(fileName).suffix())) { + menu.addAction(tr("Preview"), this, SLOT(previewDataFile())); + } menu.exec(ui->overwriteTree->mapToGlobal(pos)); } @@ -1294,7 +1296,7 @@ void ModInfoDialog::on_overwrittenTree_customContextMenuRequested(const QPoint & { //For some reason the m_ConflictsContextItem does not pick up valid data from the overwrittenTree. //TODO: find out what is going wrong. - /*m_ConflictsContextItem = ui->overwrittenTree->itemAt(pos.x(), pos.y()); + m_ConflictsContextItem = ui->overwrittenTree->itemAt(pos.x(), pos.y()); if (m_ConflictsContextItem != nullptr) { if (!m_ConflictsContextItem->data(1, Qt::UserRole + 2).toBool()) { @@ -1307,7 +1309,7 @@ void ModInfoDialog::on_overwrittenTree_customContextMenuRequested(const QPoint & menu.exec(ui->overwrittenTree->mapToGlobal(pos)); } - }*/ + } } -- cgit v1.3.1