diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-11-22 00:56:48 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-11-22 00:56:48 +0100 |
commit | 00c4aebeaafe08d6834c90b097c5018493ee62ec (patch) | |
tree | d8c891164cadc2ad1353a793cfddc98c2df282ed | |
parent | ee6f2f0a8ebdeede68b6768e1d75d047ec2c50de (diff) | |
download | MultiMC-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.cpp | 17 |
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); + } } } |