From 9d3a019445d7a7fdf3177bca9eeef4c44599e706 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Fri, 15 Dec 2017 09:10:47 -0300 Subject: Ignore baloo urls created from new KIO model Summary: For now ignore baloo urls that was created by new KIO::KFilePlacesModel, until we make use of new KIO API. BUG: 387888 Test Plan: Open any KIO file dialog using the new API. Runs dolphin v17.12.0 Make sure that baloo urls does not appear duplicated Reviewers: ngraham, elvisangelaccio Reviewed By: ngraham, elvisangelaccio Subscribers: cfeck, elvisangelaccio, ervin, mlaurent, #dolphin Differential Revision: https://phabricator.kde.org/D9347 --- src/panels/places/placesitemmodel.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/panels') diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 680d513b5..abdd4c20b 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -65,6 +65,17 @@ namespace { // Hence a prefix to the application-name of the stored bookmarks is // added, which is only read by PlacesItemModel. const char AppNamePrefix[] = "-places-panel"; + + static QList balooURLs = { + QUrl(QStringLiteral("timeline:/today")), + QUrl(QStringLiteral("timeline:/yesterday")), + QUrl(QStringLiteral("timeline:/thismonth")), + QUrl(QStringLiteral("timeline:/lastmonth")), + QUrl(QStringLiteral("search:/documents")), + QUrl(QStringLiteral("search:/images")), + QUrl(QStringLiteral("search:/audio")), + QUrl(QStringLiteral("search:/videos")) + }; } PlacesItemModel::PlacesItemModel(QObject* parent) : @@ -832,6 +843,12 @@ bool PlacesItemModel::acceptBookmark(const KBookmark& bookmark, const QString appName = bookmark.metaDataItem(QStringLiteral("OnlyInApp")); const bool deviceAvailable = availableDevices.contains(udi); + if (balooURLs.contains(url) && appName.isEmpty()) { + // Does not accept baloo URLS with empty appName, this came from new KIO model and will cause duplications + qCWarning(DolphinDebug) << "Ignore KIO url:" << url; + return false; + } + const bool allowedHere = (appName.isEmpty() || appName == KAboutData::applicationData().componentName() || appName == KAboutData::applicationData().componentName() + AppNamePrefix) -- cgit v1.3 From 65c0997164bd6f770c4286f7be83bcd2d3d145bd Mon Sep 17 00:00:00 2001 From: Michael Heidelbach Date: Sat, 6 Jan 2018 16:55:32 -0700 Subject: infopanel fully resizable Summary: Currently Infopanel does wrap its title when trying to narrow it. Initially: {F5619283} Expanded: {F5619284} Resizing fails, watch cursor: {F5619286} Patch applied: {F5619287} Maybe this behaviour it intentional. Personally, I prefer the patch. Test Plan: compile & run Resize infopanel with long title Reviewers: #dolphin, ngraham, elvisangelaccio Reviewed By: #dolphin, ngraham, elvisangelaccio Subscribers: renatoo, vhanda, nicolasfella, elvisangelaccio, ngraham Tags: #dolphin, #kde_applications Differential Revision: https://phabricator.kde.org/D9664 --- src/panels/information/informationpanelcontent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/panels') diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index fa4868e52..3c48a2296 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -107,7 +107,7 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : m_nameLabel->setFont(font); m_nameLabel->setTextFormat(Qt::PlainText); m_nameLabel->setAlignment(Qt::AlignHCenter); - m_nameLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + m_nameLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); const bool previewsShown = InformationPanelSettings::previewsShown(); m_preview->setVisible(previewsShown); -- cgit v1.3 From 3cb3d58fbf0a5d3736579ad7a52a2a46ab9c1d29 Mon Sep 17 00:00:00 2001 From: Michael Heidelbach Date: Sun, 14 Jan 2018 10:53:11 -0700 Subject: folderspanel context-menu option "Limit to Home Directory" should be always visible Summary: Only by chance I discovered that this option is visible but only when inside home. Before that I always edited dolphinrc to reenable it. I think it's less confusing to always show it but toggle its enabled state Test Plan: compile and run show folderspanel context-menu in different places Reviewers: #dolphin, emmanuelp, ngraham Reviewed By: #dolphin, ngraham Subscribers: elvisangelaccio Tags: #dolphin, #kde_applications Differential Revision: https://phabricator.kde.org/D9662 --- src/panels/folders/folderspanel.cpp | 28 ++++++++++++++++++---------- src/panels/folders/folderspanel.h | 3 ++- src/panels/folders/treeviewcontextmenu.cpp | 15 +++++++-------- 3 files changed, 27 insertions(+), 19 deletions(-) (limited to 'src/panels') diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index eef27ce47..add7f692b 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -137,7 +137,7 @@ bool FoldersPanel::urlChanged() void FoldersPanel::reloadTree() { if (m_controller) { - loadTree(url()); + loadTree(url(), true); } } @@ -316,34 +316,42 @@ void FoldersPanel::startFadeInAnimation() anim->setDuration(200); } -void FoldersPanel::loadTree(const QUrl& url) +void FoldersPanel::loadTree(const QUrl& url, bool allowJumpHome) { Q_ASSERT(m_controller); m_updateCurrentItem = false; + bool jumpHome = false; QUrl baseUrl; - if (url.isLocalFile()) { - const bool isInHomeFolder = Dolphin::homeUrl().isParentOf(url) || (Dolphin::homeUrl() == url); - if (FoldersPanelSettings::limitFoldersPanelToHome() && isInHomeFolder) { + if (!url.isLocalFile()) { + // Clear the path for non-local URLs and use it as base + baseUrl = url; + baseUrl.setPath(QString('/')); + } else if (Dolphin::homeUrl().isParentOf(url) || (Dolphin::homeUrl() == url)) { + if (FoldersPanelSettings::limitFoldersPanelToHome() ) { baseUrl = Dolphin::homeUrl(); } else { // Use the root directory as base for local URLs (#150941) baseUrl = QUrl::fromLocalFile(QDir::rootPath()); } + } else if (FoldersPanelSettings::limitFoldersPanelToHome() && allowJumpHome) { + baseUrl = Dolphin::homeUrl(); + jumpHome = true; } else { - // Clear the path for non-local URLs and use it as base - baseUrl = url; - baseUrl.setPath(QString('/')); + // Use the root directory as base for local URLs (#150941) + baseUrl = QUrl::fromLocalFile(QDir::rootPath()); } - if (m_model->directory() != baseUrl) { + if (m_model->directory() != baseUrl && !jumpHome) { m_updateCurrentItem = true; m_model->refreshDirectory(baseUrl); } const int index = m_model->index(url); - if (index >= 0) { + if (jumpHome == true) { + emit folderActivated(baseUrl); + } else if (index >= 0) { updateCurrentItem(index); } else if (url == baseUrl) { // clear the selection when visiting the base url diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h index ab6c41b34..a653b4584 100644 --- a/src/panels/folders/folderspanel.h +++ b/src/panels/folders/folderspanel.h @@ -89,8 +89,9 @@ private: * Initializes the base URL of the tree and expands all * directories until \a url. * @param url URL of the leaf directory that should get expanded. + * @param allowJumpHome indicate context menu got checked. */ - void loadTree(const QUrl& url); + void loadTree(const QUrl& url, bool allowJumpHome = false); void reloadTree(); diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index 6381a88ff..132637f15 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -127,14 +127,13 @@ void TreeViewContextMenu::open() // insert 'Limit to Home Directory' const QUrl url = m_fileItem.url(); - const bool showLimitToHomeDirectory = url.isLocalFile() && (Dolphin::homeUrl().isParentOf(url) || (Dolphin::homeUrl() == url)); - if (showLimitToHomeDirectory) { - QAction* limitFoldersPanelToHomeAction = new QAction(i18nc("@action:inmenu", "Limit to Home Directory"), this); - limitFoldersPanelToHomeAction->setCheckable(true); - limitFoldersPanelToHomeAction->setChecked(m_parent->limitFoldersPanelToHome()); - popup->addAction(limitFoldersPanelToHomeAction); - connect(limitFoldersPanelToHomeAction, &QAction::toggled, this, &TreeViewContextMenu::setLimitFoldersPanelToHome); - } + const bool enableLimitToHomeDirectory = url.isLocalFile(); + QAction* limitFoldersPanelToHomeAction = new QAction(i18nc("@action:inmenu", "Limit to Home Directory"), this); + limitFoldersPanelToHomeAction->setCheckable(true); + limitFoldersPanelToHomeAction->setEnabled(enableLimitToHomeDirectory); + limitFoldersPanelToHomeAction->setChecked(m_parent->limitFoldersPanelToHome()); + popup->addAction(limitFoldersPanelToHomeAction); + connect(limitFoldersPanelToHomeAction, &QAction::toggled, this, &TreeViewContextMenu::setLimitFoldersPanelToHome); // insert 'Automatic Scrolling' QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this); -- cgit v1.3 From 64d2fd29819fa46c293e8c726c7df2ff00b332b3 Mon Sep 17 00:00:00 2001 From: Michael Heidelbach Date: Tue, 16 Jan 2018 10:23:50 +0100 Subject: Folderspanel's context-menu option "Limit to Home Directory" is always visible Summary: Applied suggested changes to [[ https://phabricator.kde.org/D9662 | D9662 ]] - Enum instead of bool - Use QStringLiteral Test Plan: Visual inspection Reviewers: ngraham, elvisangelaccio, #dolphin Reviewed By: ngraham, #dolphin Subscribers: #dolphin Tags: #dolphin, #kde_applications Differential Revision: https://phabricator.kde.org/D9911 --- src/panels/folders/folderspanel.cpp | 10 +++++----- src/panels/folders/folderspanel.h | 11 +++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'src/panels') diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index add7f692b..4a476ad76 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -137,7 +137,7 @@ bool FoldersPanel::urlChanged() void FoldersPanel::reloadTree() { if (m_controller) { - loadTree(url(), true); + loadTree(url(), AllowJumpHome); } } @@ -316,7 +316,7 @@ void FoldersPanel::startFadeInAnimation() anim->setDuration(200); } -void FoldersPanel::loadTree(const QUrl& url, bool allowJumpHome) +void FoldersPanel::loadTree(const QUrl& url, FoldersPanel::NavigationBehaviour navigationBehaviour) { Q_ASSERT(m_controller); @@ -327,7 +327,7 @@ void FoldersPanel::loadTree(const QUrl& url, bool allowJumpHome) if (!url.isLocalFile()) { // Clear the path for non-local URLs and use it as base baseUrl = url; - baseUrl.setPath(QString('/')); + baseUrl.setPath(QStringLiteral("/")); } else if (Dolphin::homeUrl().isParentOf(url) || (Dolphin::homeUrl() == url)) { if (FoldersPanelSettings::limitFoldersPanelToHome() ) { baseUrl = Dolphin::homeUrl(); @@ -335,7 +335,7 @@ void FoldersPanel::loadTree(const QUrl& url, bool allowJumpHome) // Use the root directory as base for local URLs (#150941) baseUrl = QUrl::fromLocalFile(QDir::rootPath()); } - } else if (FoldersPanelSettings::limitFoldersPanelToHome() && allowJumpHome) { + } else if (FoldersPanelSettings::limitFoldersPanelToHome() && navigationBehaviour == AllowJumpHome) { baseUrl = Dolphin::homeUrl(); jumpHome = true; } else { @@ -349,7 +349,7 @@ void FoldersPanel::loadTree(const QUrl& url, bool allowJumpHome) } const int index = m_model->index(url); - if (jumpHome == true) { + if (jumpHome) { emit folderActivated(baseUrl); } else if (index >= 0) { updateCurrentItem(index); diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h index a653b4584..3b27dd3dd 100644 --- a/src/panels/folders/folderspanel.h +++ b/src/panels/folders/folderspanel.h @@ -85,13 +85,20 @@ private slots: private: + /** + * Indicate if it is allowed to leave current location. + */ + enum NavigationBehaviour { + StayWhereYouAre, ///< Don't leave current location. + AllowJumpHome ///< Go Home only when context menu option got checked. + }; /** * Initializes the base URL of the tree and expands all * directories until \a url. * @param url URL of the leaf directory that should get expanded. - * @param allowJumpHome indicate context menu got checked. + * @param navigationBehaviour Navigation behaviour \see NavigationBehaviour */ - void loadTree(const QUrl& url, bool allowJumpHome = false); + void loadTree(const QUrl& url, NavigationBehaviour navigationBehaviour = StayWhereYouAre); void reloadTree(); -- cgit v1.3