diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2020-11-26 15:57:05 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2020-12-01 13:06:39 +0300 |
commit | f6295918bf2845460fbfa6099c9c750d1e436077 (patch) | |
tree | 1e04cdaaad9d6c1bd7930b2c566b16dde3181715 | |
parent | f074b30f5da8a94c9ea0b7b8d1c2a391336cf3b2 (diff) |
Revert "Utility: Implement hasDarkSystray_private on Windows"
This reverts commit d1c6dabe5bbcaeefd0194423124a7c4406e0aa52.
-rw-r--r-- | changelog/2.7.0_2020-11-13/7356 | 2 | ||||
-rw-r--r-- | src/common/utility_win.cpp | 34 | ||||
-rw-r--r-- | src/common/winrthelper/winrthelper.cpp | 54 | ||||
-rw-r--r-- | src/common/winrthelper/winrthelper.h | 25 | ||||
-rw-r--r-- | src/csync/CMakeLists.txt | 10 |
5 files changed, 2 insertions, 123 deletions
diff --git a/changelog/2.7.0_2020-11-13/7356 b/changelog/2.7.0_2020-11-13/7356 index 3d4920751..7641412cc 100644 --- a/changelog/2.7.0_2020-11-13/7356 +++ b/changelog/2.7.0_2020-11-13/7356 @@ -1,5 +1,5 @@ Change: Detect the Windows 10 theme for the system tray -We now display the system tray icon according to the currrent theme +We now display the system tray icon according to the current theme https://github.com/owncloud/client/issues/7356 diff --git a/src/common/utility_win.cpp b/src/common/utility_win.cpp index 9843de818..699821904 100644 --- a/src/common/utility_win.cpp +++ b/src/common/utility_win.cpp @@ -31,9 +31,6 @@ #include <QFileInfo> #include <QLibrary> -#include "common/result.h" -#include "common/winrthelper/winrthelper.h" - extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; namespace { @@ -44,34 +41,7 @@ const QString systemRunPathC() { const QString runPathC() { return QStringLiteral("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"); } - -const QString rtHelperNameC() -{ - return QStringLiteral(APPLICATION_EXECUTABLE "_winrt"); } - -template <typename T> -static OCC::Result<std::function<T>, nullptr_t> funcLoadHelper(const QString &lib, const char *function) -{ - QFileInfo info(lib); - if (!info.isAbsolute()) { - info.setFile(QStringLiteral("%1/%2.dll").arg(QCoreApplication::instance()->applicationDirPath(), lib)); - } - if (!info.exists()) { - qCWarning(OCC::lcUtility) << "Failed to find:" << info.filePath(); - return nullptr; - } - - QLibrary library(info.filePath()); - QFunctionPointer f = library.resolve(function); - if (!f) { - qCWarning(OCC::lcUtility) << library.errorString(); - return nullptr; - } - return std::function<T> { reinterpret_cast<T *>(f) }; -} -} - namespace OCC { static void setupFavLink_private(const QString &folder) @@ -135,11 +105,9 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName, } } - static inline bool hasDarkSystray_private() { - static auto func = funcLoadHelper<bool()>(rtHelperNameC(), "hasDarkSystray"); - return func ? (*func)() : false; + return true; } QVariant Utility::registryGetKeyValue(HKEY hRootKey, const QString &subKey, const QString &valueName) diff --git a/src/common/winrthelper/winrthelper.cpp b/src/common/winrthelper/winrthelper.cpp deleted file mode 100644 index 3e5ba6e97..000000000 --- a/src/common/winrthelper/winrthelper.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "winrthelper.h" - -#include <wrl.h> -#include <Windows.UI.ViewManagement.h> - -#include <algorithm> - -#include <QColor> - -namespace { - -QColor GetThemeColor(ABI::Windows::UI::ViewManagement::UIColorType type, bool *ok) -{ - *ok = false; - ABI::Windows::UI::Color color; - Microsoft::WRL::ComPtr<ABI::Windows::UI::ViewManagement::IUISettings3> settings; - if (SUCCEEDED(Windows::Foundation::ActivateInstance(Microsoft::WRL::Wrappers::HStringReference( - RuntimeClass_Windows_UI_ViewManagement_UISettings) - .Get(), - &settings))) { - settings->GetColorValue(type, &color); - *ok = true; - } - return QColor(color.R, color.G, color.B); -} -} - -bool hasDarkSystray() -{ - bool ok; - const auto color = GetThemeColor(ABI::Windows::UI::ViewManagement::UIColorType::UIColorType_Background, &ok); - if (ok) { - return color.lightnessF() <= 0.5; - } - return true; -} diff --git a/src/common/winrthelper/winrthelper.h b/src/common/winrthelper/winrthelper.h deleted file mode 100644 index 4dfe6a43c..000000000 --- a/src/common/winrthelper/winrthelper.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef WINRTHELPER_H -#define WINRTHELPER_H - -extern "C" __declspec(dllexport) bool hasDarkSystray(); - - -#endif // WINRTHELPER_H diff --git a/src/csync/CMakeLists.txt b/src/csync/CMakeLists.txt index 5629c36d1..071673471 100644 --- a/src/csync/CMakeLists.txt +++ b/src/csync/CMakeLists.txt @@ -49,16 +49,6 @@ configure_file(csync_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/csync_version.h) add_library("${csync_NAME}" SHARED ${common_SOURCES} ${csync_SRCS}) -if (WIN32 AND NOT TOKEN_AUTH_ONLY) - find_package(Qt5 REQUIRED COMPONENTS Widgets) - add_library(ocwinrt SHARED ../common/winrthelper/winrthelper.cpp) - set_target_properties(ocwinrt PROPERTIES CXX_STANDARD 17 - OUTPUT_NAME "${APPLICATION_EXECUTABLE}_winrt") - target_link_libraries(ocwinrt PUBLIC runtimeobject Qt5::Widgets) - INSTALL(TARGETS ocwinrt ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -endif() - - target_include_directories( "${csync_NAME}" PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/std |