diff options
author | Martin Kampas <martin.kampas@jolla.com> | 2016-11-10 17:13:51 +0100 |
---|---|---|
committer | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-11-22 20:32:29 +0000 |
commit | d99e8c0513cba836972be008007ea97ad145f236 (patch) | |
tree | 6944c5cdce7ca39c818ea54a72a6681fc028a5ba | |
parent | cb3ed6c436c2281a055c98b3b0610b6efa88a5d5 (diff) |
Bench: Only allow displaying directories locally
This is also necessary for nice first-run behavior - to not end up with
project root directory immediately replacing the main QML initially
loaded by the application.
Change-Id: I80142371f858b3508d1ee5d24f0512c2e23d0ac9
Reviewed-by: Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>
-rw-r--r-- | src/bench/hostmanager.cpp | 9 | ||||
-rw-r--r-- | src/widgets/filesystemmodel.cpp | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/bench/hostmanager.cpp b/src/bench/hostmanager.cpp index c48937e..cfce965 100644 --- a/src/bench/hostmanager.cpp +++ b/src/bench/hostmanager.cpp @@ -36,9 +36,10 @@ #include "livehubengine.h" #include "logreceiver.h" #include "widgets/logview.h" -#include <QDockWidget> +#include <QDockWidget> #include <QDebug> +#include <QFileInfo> HostManager::HostManager(QWidget *parent) : QListView(parent) @@ -83,6 +84,9 @@ void HostManager::setLiveHubEngine(LiveHubEngine *engine) void HostManager::followTreeSelection(const QString ¤tFile) { + if (!QFileInfo(currentFile).isFile()) + return; + for (int i=0; i < m_model->rowCount(); i++) { HostWidget *widget = qobject_cast<HostWidget*>(indexWidget(m_model->index(i, 0))); if (widget && widget->followTreeSelection()) @@ -92,6 +96,9 @@ void HostManager::followTreeSelection(const QString ¤tFile) void HostManager::setCurrentFile(const QString ¤tFile) { + if (!QFileInfo(currentFile).isFile()) + return; + for (int i=0; i < m_model->rowCount(); i++) { HostWidget *widget = qobject_cast<HostWidget*>(indexWidget(m_model->index(i, 0))); if (widget) diff --git a/src/widgets/filesystemmodel.cpp b/src/widgets/filesystemmodel.cpp index f375f43..f3622b9 100644 --- a/src/widgets/filesystemmodel.cpp +++ b/src/widgets/filesystemmodel.cpp @@ -62,6 +62,7 @@ Qt::ItemFlags FileSystemModel::flags(const QModelIndex &index) const Qt::ItemFlags f = QFileSystemModel::flags(index); if (isDir(index)) { + f &= ~Qt::ItemIsDragEnabled; if (m_dirSelectable) return f; else |