From 4e5a67fc063243c4c10e04b5f601108dd01357f3 Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 17 Jul 2014 20:04:22 +0200 Subject: - bugfix: broke qt4 compatibility in trying to support qt5 - bugfix: overwrite dialog displayed system drives if the overwrite directory didn't exist - bugfix: ini tweak activation wasn't saved --- src/overwriteinfodialog.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/overwriteinfodialog.cpp') diff --git a/src/overwriteinfodialog.cpp b/src/overwriteinfodialog.cpp index 2ba81633..16242506 100644 --- a/src/overwriteinfodialog.cpp +++ b/src/overwriteinfodialog.cpp @@ -72,19 +72,17 @@ private: OverwriteInfoDialog::OverwriteInfoDialog(ModInfo::Ptr modInfo, QWidget *parent) : QDialog(parent), ui(new Ui::OverwriteInfoDialog), m_FileSystemModel(NULL), - m_DeleteAction(NULL), m_RenameAction(NULL), m_OpenAction(NULL), - m_ModInfo(modInfo) + m_DeleteAction(NULL), m_RenameAction(NULL), m_OpenAction(NULL) { ui->setupUi(this); this->setWindowModality(Qt::NonModal); - QString path = modInfo->absolutePath(); m_FileSystemModel = new MyFileSystemModel(this); m_FileSystemModel->setReadOnly(false); - m_FileSystemModel->setRootPath(path); + setModInfo(modInfo); ui->filesView->setModel(m_FileSystemModel); - ui->filesView->setRootIndex(m_FileSystemModel->index(path)); + ui->filesView->setRootIndex(m_FileSystemModel->index(modInfo->absolutePath())); ui->filesView->setColumnWidth(0, 250); m_DeleteAction = new QAction(tr("&Delete"), ui->filesView); @@ -102,6 +100,16 @@ OverwriteInfoDialog::~OverwriteInfoDialog() delete ui; } +void OverwriteInfoDialog::setModInfo(ModInfo::Ptr modInfo) +{ + m_ModInfo = modInfo; + if (QDir(modInfo->absolutePath()).exists()) { + m_FileSystemModel->setRootPath(modInfo->absolutePath()); + } else { + throw MyException(tr("%1 not found").arg(modInfo->absolutePath())); + } +} + bool OverwriteInfoDialog::recursiveDelete(const QModelIndex &index) { for (int childRow = 0; childRow < m_FileSystemModel->rowCount(index); ++childRow) { -- cgit v1.3.1