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
2 changes: 1 addition & 1 deletion src/core/Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Resources::Resources()
{
const QString appDirPath = QCoreApplication::applicationDirPath();
#if defined(Q_OS_UNIX) && !(defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE))
trySetResourceDir(KEEPASSX_DATA_DIR) || trySetResourceDir(QString("%1/../%2").arg(appDirPath, KEEPASSX_DATA_DIR))
trySetResourceDir(QString("%1/../%2").arg(appDirPath, KEEPASSX_DATA_DIR))
|| trySetResourceDir(QString("%1/%2").arg(KEEPASSX_PREFIX_DIR, KEEPASSX_DATA_DIR));
#elif defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE)
trySetResourceDir(appDirPath + QStringLiteral("/../Resources"));
Expand Down
10 changes: 9 additions & 1 deletion src/gui/DatabaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2022,10 +2022,18 @@ bool DatabaseWidget::focusNextPrevChild(bool next)

bool DatabaseWidget::lock()
{
if (isLocked() || m_attemptingLock) {
if (m_attemptingLock) {
return isLocked();
}

if (isLocked()) {
if (m_databaseOpenWidget && m_databaseOpenWidget->unlockingDatabase()) {
QMetaObject::invokeMethod(m_databaseOpenWidget, "reject", Qt::DirectConnection);
} else {
return true;
}
}

// ignore when reloading
if (m_reloading) {
return false;
Expand Down
10 changes: 10 additions & 0 deletions tests/TestTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
#include "TestTools.h"

#include "core/Clock.h"
#include "core/Resources.h"
#include "core/Tools.h"
#include "mock/MockClock.h"

#include <QDir>
#include <QFileInfo>
#include <QRegularExpression>
#include <QTest>
Expand Down Expand Up @@ -479,3 +481,11 @@ void TestTools::testEscapeAccelerators()
QCOMPARE(Tools::escapeAccelerators("Accel&&erator"), "Accel&&&&erator");
QCOMPARE(Tools::escapeAccelerators("Some & text"), "Some && text");
}

void TestTools::testResourcesInit()
{
auto* res = Resources::instance();
QVERIFY(res != nullptr);
QString dataPath = res->dataPath("");
QVERIFY(dataPath.isEmpty() || QDir::isAbsolutePath(dataPath));
}
1 change: 1 addition & 0 deletions tests/TestTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private slots:
void testCleanUsername();
void testCleanUsername_data();
void testEscapeAccelerators();
void testResourcesInit();
};

#endif // KEEPASSX_TESTTOOLS_H