1
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:
Razi Alavizadeh 2017-10-03 11:03:35 +03:30
parent 75bd63ff2d
commit ebd8dd051e
5 changed files with 68 additions and 42 deletions

View File

@ -81,7 +81,28 @@ endif()
if (WIN32)
add_definitions(-DW7API)
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()
# Optional: GnomeKeyring

View File

@ -31,6 +31,10 @@ DataPaths::DataPaths()
init();
}
DataPaths::~DataPaths()
{
}
// static
void DataPaths::setCurrentProfilePath(const QString &profilePath)
{

View File

@ -42,6 +42,7 @@ public:
};
explicit DataPaths();
~DataPaths();
// Set absolute path of current profile
static void setCurrentProfilePath(const QString &profilePath);

View File

@ -39,6 +39,7 @@
#ifdef Q_OS_WIN
#include "Shlwapi.h"
#include "shellapi.h"
#endif
//#define DOWNMANAGER_DEBUG

View File

@ -273,53 +273,52 @@ bool RegisterQAppAssociation::showNativeDefaultAppSettingsUi()
return false;
}
if (isWin10OrNewer()) {
IApplicationActivationManager* pActivator;
HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager,
nullptr,
CLSCTX_INPROC,
IID_IApplicationActivationManager,
(void**)&pActivator);
#ifdef _WIN32_WINNT_WIN8
IApplicationActivationManager* pActivator;
HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager,
nullptr,
CLSCTX_INPROC,
IID_IApplicationActivationManager,
(void**)&pActivator);
if (!SUCCEEDED(hr)) {
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();
if (!SUCCEEDED(hr)) {
return false;
}
else {
IApplicationAssociationRegistrationUI* pAARUI = NULL;
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
NULL, CLSCTX_INPROC, __uuidof(IApplicationAssociationRegistrationUI),
reinterpret_cast< void** > (&pAARUI));
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;
}
hr = pAARUI->LaunchAdvancedAssociationUI(reinterpret_cast<LPCWSTR>(_appRegisteredName.utf16()));
pAARUI->Release();
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 // 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;
}