┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2018-03-19 09:57:24 +0100
committerKai Uwe Broulik <[email protected]>2018-03-19 09:57:24 +0100
commit7cee23157f099837fffc22380b85ac33a2006a49 (patch)
tree7db6d1f55e74f9d518b94a1147f1cd8699a72ea9 /src/dolphinmainwindow.cpp
parent6f05c66cc0d2416a21fd8eaff0ec6e7a9161d59c (diff)
Introduce singleton for KFilePlacesModel
There are various places where Dolphin created a new KFilePlacesModel which would then query all storage devices and do other expensive work. Differential Revision: https://phabricator.kde.org/D11283
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index b09d7deef..d112007bc 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -25,6 +25,7 @@
#include "dolphindockwidget.h"
#include "dolphincontextmenu.h"
#include "dolphinnewfilemenu.h"
+#include "dolphinplacesmodelsingleton.h"
#include "dolphinrecenttabsmenu.h"
#include "dolphintabwidget.h"
#include "dolphinviewcontainer.h"
@@ -993,8 +994,6 @@ void DolphinMainWindow::tabCountChanged(int count)
void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
{
- static KFilePlacesModel s_placesModel;
-
QString schemePrefix;
if (!url.isLocalFile()) {
schemePrefix.append(url.scheme() + " - ");
@@ -1009,10 +1008,11 @@ void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
return;
}
- const auto& matchedPlaces = s_placesModel.match(s_placesModel.index(0,0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly);
+ KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
+ const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly);
if (!matchedPlaces.isEmpty()) {
- setWindowTitle(s_placesModel.text(matchedPlaces.first()));
+ setWindowTitle(placesModel->text(matchedPlaces.first()));
return;
}