mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-22 20:51:23 -05:00
Fix auto-start settings on Windows
This commit is contained in:
parent
9c0fa376a1
commit
05a0df799e
@ -51,7 +51,7 @@
|
|||||||
<RegistryValue Id="Autostart.rst" Root="HKCU" Action="write"
|
<RegistryValue Id="Autostart.rst" Root="HKCU" Action="write"
|
||||||
Key="Software\Microsoft\Windows\CurrentVersion\Run"
|
Key="Software\Microsoft\Windows\CurrentVersion\Run"
|
||||||
Name="$(var.CPACK_PACKAGE_NAME)"
|
Name="$(var.CPACK_PACKAGE_NAME)"
|
||||||
Value="[#CM_FP_KeePassXC.exe]"
|
Value=""[#CM_FP_KeePassXC.exe]""
|
||||||
Type="string" />
|
Type="string" />
|
||||||
<Condition>AUTOSTARTPROGRAM</Condition>
|
<Condition>AUTOSTARTPROGRAM</Condition>
|
||||||
</Component>
|
</Component>
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "WinUtils.h"
|
#include "WinUtils.h"
|
||||||
#include <QAbstractNativeEventFilter>
|
#include <QAbstractNativeEventFilter>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QDir>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -88,14 +89,13 @@ bool WinUtils::isLaunchAtStartupEnabled() const
|
|||||||
{
|
{
|
||||||
return QSettings(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)", QSettings::NativeFormat)
|
return QSettings(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)", QSettings::NativeFormat)
|
||||||
.contains(qAppName());
|
.contains(qAppName());
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinUtils::setLaunchAtStartup(bool enable)
|
void WinUtils::setLaunchAtStartup(bool enable)
|
||||||
{
|
{
|
||||||
QSettings reg(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)", QSettings::NativeFormat);
|
QSettings reg(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)", QSettings::NativeFormat);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
reg.setValue(qAppName(), QApplication::applicationFilePath());
|
reg.setValue(qAppName(), QString("\"%1\"").arg(QDir::toNativeSeparators(QApplication::applicationFilePath())));
|
||||||
} else {
|
} else {
|
||||||
reg.remove(qAppName());
|
reg.remove(qAppName());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user