Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
<source>Custom</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>None</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ApplicationSettingsWidgetGeneral</name>
Expand Down Expand Up @@ -616,6 +620,34 @@
<source>Auto-generate password for new entries</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Keep remote desktop connection open after performing Auto-Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remote desktop mode:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Never remember session</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remember session until exit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remember session until revoked by desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Configure...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ApplicationSettingsWidgetSecurity</name>
Expand Down Expand Up @@ -810,6 +842,29 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AutoTypePlatformWayland</name>
<message>
<source>Session closed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User cancelled the interaction</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>User interaction was canceled for unknown reason</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No symbol found for key: &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No symbol found for character: &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AutoTypePlatformX11</name>
<message>
Expand Down Expand Up @@ -6658,6 +6713,22 @@ This version is not meant for production use.</source>
<source>Could not register global shortcut</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The XDG Desktop Portal for global shortcuts is not available on this system.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Trigger global Auto-Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC - Global Shortcuts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Global Auto-Type shortcut is already configured. To change it, open your system settings and navigate to the keyboard or application shortcuts section.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OpData01</name>
Expand Down
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,22 @@ if(UNIX AND NOT APPLE)
quickunlock/dbus/org.freedesktop.PolicyKit1.Authority.xml
polkit_dbus
)
qt6_add_dbus_interface(core_SOURCES
gui/osutils/nixutils/dbus/org.freedesktop.portal.Request.xml
xdp_request
)
qt6_add_dbus_interface(core_SOURCES
gui/osutils/nixutils/dbus/org.freedesktop.portal.Session.xml
xdp_session
)
qt6_add_dbus_interface(core_SOURCES
gui/osutils/nixutils/dbus/org.freedesktop.portal.GlobalShortcuts.xml
xdp_globalshortcuts
)
qt6_add_dbus_interface(core_SOURCES
gui/osutils/nixutils/dbus/org.freedesktop.portal.RemoteDesktop.xml
xdp_remotedesktop
)
endif()

if(WIN32)
Expand Down
40 changes: 26 additions & 14 deletions src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ AutoType::AutoType(QObject* parent, bool test)
}

connect(this, SIGNAL(autotypeFinished()), SLOT(resetAutoTypeState()));
connect(this, &AutoType::autotypeFinished, this, [this] {
if (m_plugin) {
m_plugin->finishAutoType();
}
});
connect(qApp, SIGNAL(aboutToQuit()), SLOT(unloadPlugin()));
}

Expand Down Expand Up @@ -398,6 +403,10 @@ void AutoType::performAutoTypeWithSequence(const Entry* entry, const QString& se

void AutoType::startGlobalAutoType(const QString& search)
{
if (!m_plugin) {
return;
}

// Never Auto-Type into KeePassXC itself
if (getMainWindow() && (qApp->activeWindow() || qApp->activeModalWidget())) {
return;
Expand Down Expand Up @@ -472,9 +481,10 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
qWarning() << "Auto-Type: Window title was empty from the operating system";
}

// Show the selection dialog if we always ask, have multiple matches, or no matches
// Show the selection dialog if we always ask, have multiple matches, no matches, or the window title was empty
if (getMainWindow()
&& (config()->get(Config::Security_AutoTypeAsk).toBool() || matchList.size() > 1 || matchList.isEmpty())) {
&& (config()->get(Config::Security_AutoTypeAsk).toBool() || matchList.size() > 1 || matchList.isEmpty()
|| m_windowTitleForGlobal.isEmpty())) {
// Close any open modal windows that would interfere with the process
getMainWindow()->closeModalWindow();

Expand All @@ -486,18 +496,19 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
}

connect(getMainWindow(), &MainWindow::databaseLocked, selectDialog, &AutoTypeSelectDialog::reject);
connect(selectDialog,
&AutoTypeSelectDialog::matchActivated,
this,
[this](const AutoTypeMatch& match, bool virtualMode) {
m_lastMatch = match;
m_lastMatchRetypeTimer.start(config()->get(Config::GlobalAutoTypeRetypeTime).toInt() * 1000);
executeAutoTypeActions(match.first,
match.second,
m_windowForGlobal,
virtualMode ? AutoTypeExecutor::Mode::VIRTUAL
: AutoTypeExecutor::Mode::NORMAL);
});
connect(
selectDialog,
&AutoTypeSelectDialog::matchActivated,
this,
[this](const AutoTypeMatch& match, bool virtualMode) {
m_lastMatch = match;
m_lastMatchRetypeTimer.start(config()->get(Config::GlobalAutoTypeRetypeTime).toInt() * 1000);
executeAutoTypeActions(match.first,
match.second,
m_windowForGlobal,
virtualMode ? AutoTypeExecutor::Mode::VIRTUAL : AutoTypeExecutor::Mode::NORMAL);
},
Qt::QueuedConnection);
connect(selectDialog, &QDialog::rejected, this, [this] {
restoreWindowState();
emit autotypeFinished();
Expand All @@ -510,6 +521,7 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi
selectDialog->show();
selectDialog->raise();
selectDialog->activateWindow();
m_plugin->prepareAutoType();
} else if (!matchList.isEmpty()) {
// Only one match and not asking, do it!
executeAutoTypeActions(matchList.first().first, matchList.first().second, m_windowForGlobal);
Expand Down
6 changes: 6 additions & 0 deletions src/autotype/AutoType.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "AutoTypeAction.h"
#include "AutoTypeMatch.h"

#include "autotype/AutoTypePlatformPlugin.h"
#include "core/Database.h"
#include "core/Entry.h"

Expand All @@ -52,6 +53,11 @@ class AutoType : public QObject
return m_plugin;
}

inline bool hasWindowAccess()
{
return m_plugin && m_plugin->hasWindowAccess();
}

static AutoType* instance();
static void createTestInstance();

Expand Down
13 changes: 13 additions & 0 deletions src/autotype/AutoTypePlatformPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,23 @@ class AutoTypePlatformInterface
virtual WId activeWindow() = 0;
virtual QString activeWindowTitle() = 0;
virtual bool raiseWindow(WId window) = 0;
virtual bool hasWindowAccess()
{
return true;
}

virtual void unload()
{
}

virtual void prepareAutoType()
{
}

virtual void finishAutoType()
{
}

virtual AutoTypeExecutor* createExecutor() = 0;

#if defined(Q_OS_MACOS)
Expand Down
2 changes: 2 additions & 0 deletions src/autotype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if(UNIX AND NOT APPLE AND NOT HAIKU)

add_subdirectory(xcb)
endif()

add_subdirectory(wayland)
elseif(APPLE)
add_subdirectory(mac)
elseif(WIN32)
Expand Down
Loading
Loading