summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-22 00:56:48 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-22 00:56:48 +0100
commit00c4aebeaafe08d6834c90b097c5018493ee62ec (patch)
treed8c891164cadc2ad1353a793cfddc98c2df282ed
parentee6f2f0a8ebdeede68b6768e1d75d047ec2c50de (diff)
downloadMultiMC-00c4aebeaafe08d6834c90b097c5018493ee62ec.tar
MultiMC-00c4aebeaafe08d6834c90b097c5018493ee62ec.tar.gz
MultiMC-00c4aebeaafe08d6834c90b097c5018493ee62ec.tar.lz
MultiMC-00c4aebeaafe08d6834c90b097c5018493ee62ec.tar.xz
MultiMC-00c4aebeaafe08d6834c90b097c5018493ee62ec.zip
GH-1731 more screenshot folder view hardening
-rw-r--r--application/pages/ScreenshotsPage.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/application/pages/ScreenshotsPage.cpp b/application/pages/ScreenshotsPage.cpp
index c40e391b..d58a5d63 100644
--- a/application/pages/ScreenshotsPage.cpp
+++ b/application/pages/ScreenshotsPage.cpp
@@ -351,12 +351,23 @@ void ScreenshotsPage::on_renameBtn_clicked()
void ScreenshotsPage::opened()
{
+ if(!m_valid)
+ {
+ m_valid = FS::ensureFolderPathExists(m_folder);
+ }
if (m_valid)
{
- ui->listView->setModel(m_filterModel.get());
QString path = QDir(m_folder).absolutePath();
- m_model->setRootPath(path);
- ui->listView->setRootIndex(m_filterModel->mapFromSource(m_model->index(path)));
+ auto idx = m_model->setRootPath(path);
+ if(idx.isValid())
+ {
+ ui->listView->setModel(m_filterModel.get());
+ ui->listView->setRootIndex(m_filterModel->mapFromSource(idx));
+ }
+ else
+ {
+ ui->listView->setModel(nullptr);
+ }
}
}