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"
|
||||
Key="Software\Microsoft\Windows\CurrentVersion\Run"
|
||||
Name="$(var.CPACK_PACKAGE_NAME)"
|
||||
Value="[#CM_FP_KeePassXC.exe]"
|
||||
Value=""[#CM_FP_KeePassXC.exe]""
|
||||
Type="string" />
|
||||
<Condition>AUTOSTARTPROGRAM</Condition>
|
||||
</Component>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "WinUtils.h"
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
|
||||
#include <windows.h>
|
||||
@ -88,14 +89,13 @@ bool WinUtils::isLaunchAtStartupEnabled() const
|
||||
{
|
||||
return QSettings(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)", QSettings::NativeFormat)
|
||||
.contains(qAppName());
|
||||
;
|
||||
}
|
||||
|
||||
void WinUtils::setLaunchAtStartup(bool enable)
|
||||
{
|
||||
QSettings reg(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)", QSettings::NativeFormat);
|
||||
if (enable) {
|
||||
reg.setValue(qAppName(), QApplication::applicationFilePath());
|
||||
reg.setValue(qAppName(), QString("\"%1\"").arg(QDir::toNativeSeparators(QApplication::applicationFilePath())));
|
||||
} else {
|
||||
reg.remove(qAppName());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user