mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Windows: Fix compile issues after build system changed to cmake.
Differential Revision: https://phabricator.kde.org/D8079
This commit is contained in:
parent
75bd63ff2d
commit
ebd8dd051e
@ -81,7 +81,28 @@ endif()
|
|||||||
if (WIN32)
|
if (WIN32)
|
||||||
add_definitions(-DW7API)
|
add_definitions(-DW7API)
|
||||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS WinExtras)
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS WinExtras)
|
||||||
# TODO set var for LIBS += User32.lib Ole32.lib Shell32.lib ShlWapi.lib Gdi32.lib ComCtl32.lib ?
|
|
||||||
|
# taken from https://stackoverflow.com/a/40217291
|
||||||
|
macro(get_WIN32_WINNT version)
|
||||||
|
if (CMAKE_SYSTEM_VERSION)
|
||||||
|
set(ver ${CMAKE_SYSTEM_VERSION})
|
||||||
|
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
|
||||||
|
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
|
||||||
|
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
|
||||||
|
if ("${verMajor}" MATCHES "10")
|
||||||
|
set(verMajor "A")
|
||||||
|
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
|
||||||
|
endif ("${verMajor}" MATCHES "10")
|
||||||
|
# Remove all remaining '.' characters.
|
||||||
|
string(REPLACE "." "" ver ${ver})
|
||||||
|
# Prepend each digit with a zero.
|
||||||
|
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
|
||||||
|
set(${version} "0x${ver}")
|
||||||
|
endif(CMAKE_SYSTEM_VERSION)
|
||||||
|
endmacro(get_WIN32_WINNT)
|
||||||
|
|
||||||
|
get_WIN32_WINNT(ver)
|
||||||
|
add_definitions(-D_WIN32_WINNT=${ver})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Optional: GnomeKeyring
|
# Optional: GnomeKeyring
|
||||||
|
@ -31,6 +31,10 @@ DataPaths::DataPaths()
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataPaths::~DataPaths()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void DataPaths::setCurrentProfilePath(const QString &profilePath)
|
void DataPaths::setCurrentProfilePath(const QString &profilePath)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
explicit DataPaths();
|
explicit DataPaths();
|
||||||
|
~DataPaths();
|
||||||
|
|
||||||
// Set absolute path of current profile
|
// Set absolute path of current profile
|
||||||
static void setCurrentProfilePath(const QString &profilePath);
|
static void setCurrentProfilePath(const QString &profilePath);
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include "Shlwapi.h"
|
#include "Shlwapi.h"
|
||||||
|
#include "shellapi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define DOWNMANAGER_DEBUG
|
//#define DOWNMANAGER_DEBUG
|
||||||
|
@ -273,53 +273,52 @@ bool RegisterQAppAssociation::showNativeDefaultAppSettingsUi()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWin10OrNewer()) {
|
#ifdef _WIN32_WINNT_WIN8
|
||||||
IApplicationActivationManager* pActivator;
|
IApplicationActivationManager* pActivator;
|
||||||
HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager,
|
HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager,
|
||||||
nullptr,
|
nullptr,
|
||||||
CLSCTX_INPROC,
|
CLSCTX_INPROC,
|
||||||
IID_IApplicationActivationManager,
|
IID_IApplicationActivationManager,
|
||||||
(void**)&pActivator);
|
(void**)&pActivator);
|
||||||
|
|
||||||
if (!SUCCEEDED(hr)) {
|
if (!SUCCEEDED(hr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
DWORD pid;
|
|
||||||
hr = pActivator->ActivateApplication(
|
|
||||||
L"windows.immersivecontrolpanel_cw5n1h2txyewy" // appUserModelId of "Settings"
|
|
||||||
L"!microsoft.windows.immersivecontrolpanel", // in Windows Store
|
|
||||||
L"page=SettingsPageAppsDefaults", AO_NONE, &pid);
|
|
||||||
|
|
||||||
if (!SUCCEEDED(hr)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not check error because we could at least open
|
|
||||||
// the "Default apps" setting.
|
|
||||||
pActivator->ActivateApplication(
|
|
||||||
L"windows.immersivecontrolpanel_cw5n1h2txyewy"
|
|
||||||
L"!microsoft.windows.immersivecontrolpanel",
|
|
||||||
L"page=SettingsPageAppsDefaults"
|
|
||||||
L"&target=SystemSettings_DefaultApps_Browser", AO_NONE, &pid);
|
|
||||||
|
|
||||||
pActivator->Release();
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
IApplicationAssociationRegistrationUI* pAARUI = NULL;
|
|
||||||
|
|
||||||
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
|
DWORD pid;
|
||||||
NULL, CLSCTX_INPROC, __uuidof(IApplicationAssociationRegistrationUI),
|
hr = pActivator->ActivateApplication(
|
||||||
reinterpret_cast< void** > (&pAARUI));
|
L"windows.immersivecontrolpanel_cw5n1h2txyewy" // appUserModelId of "Settings"
|
||||||
|
L"!microsoft.windows.immersivecontrolpanel", // in Windows Store
|
||||||
|
L"page=SettingsPageAppsDefaults", AO_NONE, &pid);
|
||||||
|
|
||||||
if (!SUCCEEDED(hr)) {
|
if (!SUCCEEDED(hr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
hr = pAARUI->LaunchAdvancedAssociationUI(reinterpret_cast<LPCWSTR>(_appRegisteredName.utf16()));
|
|
||||||
pAARUI->Release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not check error because we could at least open
|
||||||
|
// the "Default apps" setting.
|
||||||
|
pActivator->ActivateApplication(
|
||||||
|
L"windows.immersivecontrolpanel_cw5n1h2txyewy"
|
||||||
|
L"!microsoft.windows.immersivecontrolpanel",
|
||||||
|
L"page=SettingsPageAppsDefaults"
|
||||||
|
L"&target=SystemSettings_DefaultApps_Browser", AO_NONE, &pid);
|
||||||
|
|
||||||
|
pActivator->Release();
|
||||||
|
#else // Vista or Win7
|
||||||
|
IApplicationAssociationRegistrationUI* pAARUI = NULL;
|
||||||
|
|
||||||
|
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
|
||||||
|
NULL, CLSCTX_INPROC, __uuidof(IApplicationAssociationRegistrationUI),
|
||||||
|
reinterpret_cast< void** > (&pAARUI));
|
||||||
|
|
||||||
|
if (!SUCCEEDED(hr)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pAARUI->LaunchAdvancedAssociationUI(reinterpret_cast<LPCWSTR>(_appRegisteredName.utf16()));
|
||||||
|
pAARUI->Release();
|
||||||
|
#endif // _WIN32_WINNT_WIN8
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user