Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2020-12-21 17:32:28 +0300
committerHannah von Reth <vonreth@kde.org>2020-12-21 17:47:57 +0300
commit7eb617558d05148eba0bb4ac4fcbce1f8f1a841e (patch)
treeddbf8825a77347a2f2d1c06c5ea821e80a616992
parent362685734028b40b90adf2c37843fdba52333a78 (diff)
Allow to specify the theme fallback mode
-rw-r--r--src/libsync/theme.cpp8
-rw-r--r--src/libsync/theme.h8
2 files changed, 11 insertions, 5 deletions
diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp
index f1ca5131d..ea150f139 100644
--- a/src/libsync/theme.cpp
+++ b/src/libsync/theme.cpp
@@ -148,9 +148,9 @@ bool Theme::isUsingDarkTheme() const
* helper to load a icon from either the icon theme the desktop provides or from
* the apps Qt resources.
*/
-QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisible, bool useCoreIcon) const
+QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisible, IconFallback fallbackType) const
{
- useCoreIcon = useCoreIcon || isVanilla();
+ const bool useCoreIcon = (fallbackType == IconFallback::CoreIcon) || isVanilla();
QString flavor;
if (sysTray) {
flavor = systrayIconFlavor(_mono, sysTrayMenuVisible);
@@ -190,8 +190,8 @@ QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisibl
}
}
if (cached.isNull()) {
- if (!useCoreIcon) {
- return themeIcon(name, sysTray, sysTrayMenuVisible, true);
+ if (!useCoreIcon && fallbackType == IconFallback::FallbackToCoreIcon) {
+ return themeIcon(name, sysTray, sysTrayMenuVisible, IconFallback::CoreIcon);
}
qWarning() << "Failed to locate the icon" << name;
}
diff --git a/src/libsync/theme.h b/src/libsync/theme.h
index 84c7b3ea3..e3efa5ba3 100644
--- a/src/libsync/theme.h
+++ b/src/libsync/theme.h
@@ -399,7 +399,13 @@ public:
protected:
#ifndef TOKEN_AUTH_ONLY
- QIcon themeIcon(const QString &name, bool sysTray = false, bool sysTrayMenuVisible = false, bool useCoreIcon = false) const;
+ enum class IconFallback {
+ NoFallbackToCoreIcon,
+ FallbackToCoreIcon,
+ CoreIcon
+ };
+
+ QIcon themeIcon(const QString &name, bool sysTray = false, bool sysTrayMenuVisible = false, IconFallback fallbackType = IconFallback::FallbackToCoreIcon) const;
static bool hasTheme(const QString &theme);
#endif
Theme();