Commit 230265b8 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Set root of file list model before selection.

If the selection is set first, the root is not set correctly when opening
a network share on Mac OS X. To reproduce it, open a file on a network share,
set configuration to open the last file on startup and restart Kid3.
Then the root directory / is shown in the file list, not the directory of the
selected file.
parent 3e88b8ed
...@@ -651,6 +651,9 @@ void Kid3Application::onDirectoryOpened() ...@@ -651,6 +651,9 @@ void Kid3Application::onDirectoryOpened()
QModelIndex fsRoot = m_fileProxyModel->mapToSource(m_fileProxyModelRootIndex); QModelIndex fsRoot = m_fileProxyModel->mapToSource(m_fileProxyModelRootIndex);
m_dirProxyModelRootIndex = m_dirProxyModel->mapFromSource(fsRoot); m_dirProxyModelRootIndex = m_dirProxyModel->mapFromSource(fsRoot);
emit fileRootIndexChanged(m_fileProxyModelRootIndex);
emit dirRootIndexChanged(m_dirProxyModelRootIndex);
if (m_fileProxyModelRootIndex.isValid()) { if (m_fileProxyModelRootIndex.isValid()) {
m_fileSelectionModel->clearSelection(); m_fileSelectionModel->clearSelection();
if (!m_fileProxyModelFileIndexes.isEmpty()) { if (!m_fileProxyModelFileIndexes.isEmpty()) {
...@@ -668,9 +671,6 @@ void Kid3Application::onDirectoryOpened() ...@@ -668,9 +671,6 @@ void Kid3Application::onDirectoryOpened()
} }
} }
emit fileRootIndexChanged(m_fileProxyModelRootIndex);
emit dirRootIndexChanged(m_dirProxyModelRootIndex);
if (m_dirUpIndex.isValid()) { if (m_dirUpIndex.isValid()) {
m_dirSelectionModel->setCurrentIndex(m_dirUpIndex, m_dirSelectionModel->setCurrentIndex(m_dirUpIndex,
QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment