From d6c086ad04adf306aea7cfc6961af805d8c4350e Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Sun, 17 Mar 2019 16:43:20 +0100 Subject: Make global view properties the default setting Summary: Automatic creation of .directory files is one of the most complained about things in dolphin. These days applications are supposed to store application-specific data within $XDG_DATA_HOME. Long-term that's the proper solution for this issue, but for now we can at least flip the default so that we no longer create .directory files out of the box. A tooltip is also added as a kind of warning for the users who want to change the setting. Ideally a proper warning should be shown using a KMessageWidget or KMessageBox, but neither play too well with the setting dialog workflow used by dolphin. CCBUG: 322922 Reviewers: #dolphin, #vdg, ngraham Reviewed By: #dolphin, #vdg, ngraham Subscribers: ngraham, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D19661 --- src/settings/dolphin_generalsettings.kcfg | 2 +- src/settings/general/behaviorsettingspage.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index 62c171846..5a6bba06b 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -48,7 +48,7 @@ - false + true diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp index 0747891b3..c7a909eca 100644 --- a/src/settings/general/behaviorsettingspage.cpp +++ b/src/settings/general/behaviorsettingspage.cpp @@ -48,14 +48,15 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) : // View properties - m_localViewProps = new QRadioButton(i18nc("@option:radio", "Remember properties for each folder")); m_globalViewProps = new QRadioButton(i18nc("@option:radio", "Use common properties for all folders")); + m_localViewProps = new QRadioButton(i18nc("@option:radio", "Remember properties for each folder")); + m_localViewProps->setToolTip(i18nc("@info", "Dolphin will create an hidden .directory file in each folder you change view properties for.")); QButtonGroup* viewGroup = new QButtonGroup(this); - viewGroup->addButton(m_localViewProps); viewGroup->addButton(m_globalViewProps); - topLayout->addRow(i18nc("@title:group", "View: "), m_localViewProps); - topLayout->addRow(QString(), m_globalViewProps); + viewGroup->addButton(m_localViewProps); + topLayout->addRow(i18nc("@title:group", "View: "), m_globalViewProps); + topLayout->addRow(QString(), m_localViewProps); topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed)); -- cgit v1.3 From f0a65179d8da50934ef2ef078c0e6bd221c4eed2 Mon Sep 17 00:00:00 2001 From: David Hallas Date: Wed, 13 Mar 2019 20:27:40 +0100 Subject: Fix crash at shutdown after showing a tooltip Summary: Fix crash at shutdown after showing a tooltip. The commit 94d7e1471e0a81b72285795ad91c4f6196157ae4 introduced a crash that occurs when closing Dolphin after Dolphin has showed a tooltip. This happens because the ToolTipManager::showToolTip function calls the KToopTipWidget::showBelow function passing in the pointer to the DolphinFileMetaDataWidget. But this also passes the ownership of the pointer to the KToopTipWidget as long as a new tooltip is not shown. The problem is that at shutdown, the KToopTipWidget instance will be destoyed first and therefore also destroy the DolphinFileMetaDataWidget instance (which the ToolTipManager still owns through the QScopedPointer) causing it to be deleted twice. The fix for this is simply to swap the order of these two members so that the DolphinFileMetaDataWidget is destroyed first by the QScopedPointer thereby removing it from the KToopTipWidget if it has been set as it's parent. Test Plan: Open Dolphin Show a Tool Tip Close Dolphin Reviewers: #dolphin, elvisangelaccio Reviewed By: #dolphin, elvisangelaccio Subscribers: kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D19737 --- src/views/tooltips/tooltipmanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h index 63c723f80..10f88ad76 100644 --- a/src/views/tooltips/tooltipmanager.h +++ b/src/views/tooltips/tooltipmanager.h @@ -84,8 +84,8 @@ private: /// Transient parent of the tooltip, mandatory on Wayland. QWindow* m_transientParent; - QScopedPointer m_fileMetaDataWidget; QScopedPointer m_tooltipWidget; + QScopedPointer m_fileMetaDataWidget; bool m_toolTipRequested; bool m_metaDataRequested; -- cgit v1.3 From 508dc815c75c9db8abaec26ae664ae41bf7f89b5 Mon Sep 17 00:00:00 2001 From: David Hallas Date: Wed, 13 Mar 2019 21:10:11 +0100 Subject: Fix "Add Network Folder" tooltip icon does not show on Breeze, shows correctly on Breeze Dark Summary: Fix "Add Network Folder" tooltip icon does not show on Breeze, shows correctly on Breeze Dark. The fix is taken from D19596. Test Plan: Open Dolphin with the Breeze theme Hover the mouse over the "Add Network Folder" The icon is black on black BUG: 404858 Reviewers: #dolphin, elvisangelaccio, ngraham Reviewed By: #dolphin, elvisangelaccio, ngraham Subscribers: broulik, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D19738 --- src/views/tooltips/tooltipmanager.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index 9e79a8f70..2990f4249 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -34,6 +35,15 @@ #include #include +class IconLoaderSingleton { +public: + IconLoaderSingleton() = default; + + KIconLoader self; +}; + +Q_GLOBAL_STATIC(IconLoaderSingleton, iconLoader) + ToolTipManager::ToolTipManager(QWidget* parent) : QObject(parent), m_showToolTipTimer(nullptr), @@ -167,8 +177,13 @@ void ToolTipManager::previewFailed() if (!m_toolTipRequested) { return; } - - const QPixmap pixmap = QIcon::fromTheme(m_item.iconName()).pixmap(128, 128); + QPalette pal; + for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) { + pal.setBrush(state, QPalette::WindowText, pal.toolTipText()); + pal.setBrush(state, QPalette::Window, pal.toolTipBase()); + } + iconLoader->self.setCustomPalette(pal); + const QPixmap pixmap = KDE::icon(m_item.iconName(), &iconLoader->self).pixmap(128, 128); m_fileMetaDataWidget->setPreview(pixmap); if (!m_showToolTipTimer->isActive()) { showToolTip(); -- cgit v1.3