mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-01 10:51:20 -05:00
Merge branch 'master' of https://github.com/keepassx/keepassx
This commit is contained in:
commit
d70ee509b4
@ -149,9 +149,9 @@ elseif(APPLE)
|
|||||||
else()
|
else()
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
|
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}")
|
||||||
set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/keepassx")
|
set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/keepassx")
|
||||||
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/keepassx")
|
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/keepassx")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_TESTS)
|
if(WITH_TESTS)
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#define KEEPASSX_PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"
|
#define KEEPASSX_PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"
|
||||||
|
|
||||||
|
#define KEEPASSX_DATA_DIR "${DATA_INSTALL_DIR}"
|
||||||
|
|
||||||
#cmakedefine HAVE_PR_SET_DUMPABLE 1
|
#cmakedefine HAVE_PR_SET_DUMPABLE 1
|
||||||
#cmakedefine HAVE_RLIMIT_CORE 1
|
#cmakedefine HAVE_RLIMIT_CORE 1
|
||||||
#cmakedefine HAVE_PT_DENY_ATTACH 1
|
#cmakedefine HAVE_PT_DENY_ATTACH 1
|
||||||
|
@ -173,6 +173,8 @@ FilePath::FilePath()
|
|||||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||||
else if (testSetDir(QCoreApplication::applicationDirPath() + "/../share/keepassx")) {
|
else if (testSetDir(QCoreApplication::applicationDirPath() + "/../share/keepassx")) {
|
||||||
}
|
}
|
||||||
|
else if (testSetDir(KEEPASSX_DATA_DIR)) {
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
else if (testSetDir(QCoreApplication::applicationDirPath() + "/../Resources")) {
|
else if (testSetDir(QCoreApplication::applicationDirPath() + "/../Resources")) {
|
||||||
|
@ -434,6 +434,20 @@ QList<const Group*> Group::groupsRecursive(bool includeSelf) const
|
|||||||
groupList.append(this);
|
groupList.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_FOREACH (const Group* group, m_children) {
|
||||||
|
groupList.append(group->groupsRecursive(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Group*> Group::groupsRecursive(bool includeSelf)
|
||||||
|
{
|
||||||
|
QList<Group*> groupList;
|
||||||
|
if (includeSelf) {
|
||||||
|
groupList.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
Q_FOREACH (Group* group, m_children) {
|
Q_FOREACH (Group* group, m_children) {
|
||||||
groupList.append(group->groupsRecursive(true));
|
groupList.append(group->groupsRecursive(true));
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,7 @@ public:
|
|||||||
const QList<Entry*>& entries() const;
|
const QList<Entry*>& entries() const;
|
||||||
QList<Entry*> entriesRecursive(bool includeHistoryItems = false) const;
|
QList<Entry*> entriesRecursive(bool includeHistoryItems = false) const;
|
||||||
QList<const Group*> groupsRecursive(bool includeSelf) const;
|
QList<const Group*> groupsRecursive(bool includeSelf) const;
|
||||||
|
QList<Group*> groupsRecursive(bool includeSelf);
|
||||||
QSet<Uuid> customIconsRecursive() const;
|
QSet<Uuid> customIconsRecursive() const;
|
||||||
/**
|
/**
|
||||||
* Creates a duplicate of this group including all child entries and groups.
|
* Creates a duplicate of this group including all child entries and groups.
|
||||||
|
@ -347,9 +347,9 @@ void Metadata::addCustomIconScaled(const Uuid& uuid, const QImage& icon)
|
|||||||
{
|
{
|
||||||
QImage iconScaled;
|
QImage iconScaled;
|
||||||
|
|
||||||
// scale down to 64x64 if icon is larger
|
// scale down to 128x128 if icon is larger
|
||||||
if (icon.width() > 64 || icon.height() > 64) {
|
if (icon.width() > 128 || icon.height() > 128) {
|
||||||
iconScaled = icon.scaled(QSize(64, 64), Qt::KeepAspectRatio,
|
iconScaled = icon.scaled(QSize(128, 128), Qt::KeepAspectRatio,
|
||||||
Qt::SmoothTransformation);
|
Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -256,7 +256,7 @@ bool DatabaseTabWidget::closeAllDatabases()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseTabWidget::saveDatabase(Database* db)
|
bool DatabaseTabWidget::saveDatabase(Database* db)
|
||||||
{
|
{
|
||||||
DatabaseManagerStruct& dbStruct = m_dbList[db];
|
DatabaseManagerStruct& dbStruct = m_dbList[db];
|
||||||
|
|
||||||
@ -272,18 +272,20 @@ void DatabaseTabWidget::saveDatabase(Database* db)
|
|||||||
if (result) {
|
if (result) {
|
||||||
dbStruct.modified = false;
|
dbStruct.modified = false;
|
||||||
updateTabName(db);
|
updateTabName(db);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageBox::critical(this, tr("Error"), tr("Writing the database failed.") + "\n\n"
|
MessageBox::critical(this, tr("Error"), tr("Writing the database failed.") + "\n\n"
|
||||||
+ saveFile.errorString());
|
+ saveFile.errorString());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
saveDatabaseAs(db);
|
return saveDatabaseAs(db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseTabWidget::saveDatabaseAs(Database* db)
|
bool DatabaseTabWidget::saveDatabaseAs(Database* db)
|
||||||
{
|
{
|
||||||
DatabaseManagerStruct& dbStruct = m_dbList[db];
|
DatabaseManagerStruct& dbStruct = m_dbList[db];
|
||||||
QString oldFileName;
|
QString oldFileName;
|
||||||
@ -311,12 +313,17 @@ void DatabaseTabWidget::saveDatabaseAs(Database* db)
|
|||||||
dbStruct.dbWidget->updateFilename(dbStruct.filePath);
|
dbStruct.dbWidget->updateFilename(dbStruct.filePath);
|
||||||
updateTabName(db);
|
updateTabName(db);
|
||||||
updateLastDatabases(dbStruct.filePath);
|
updateLastDatabases(dbStruct.filePath);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageBox::critical(this, tr("Error"), tr("Writing the database failed.") + "\n\n"
|
MessageBox::critical(this, tr("Error"), tr("Writing the database failed.") + "\n\n"
|
||||||
+ saveFile.errorString());
|
+ saveFile.errorString());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseTabWidget::closeDatabase(int index)
|
bool DatabaseTabWidget::closeDatabase(int index)
|
||||||
@ -340,21 +347,22 @@ void DatabaseTabWidget::closeDatabaseFromSender()
|
|||||||
closeDatabase(db);
|
closeDatabase(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseTabWidget::saveDatabase(int index)
|
bool DatabaseTabWidget::saveDatabase(int index)
|
||||||
{
|
{
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
index = currentIndex();
|
index = currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
saveDatabase(indexDatabase(index));
|
return saveDatabase(indexDatabase(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseTabWidget::saveDatabaseAs(int index)
|
bool DatabaseTabWidget::saveDatabaseAs(int index)
|
||||||
{
|
{
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
index = currentIndex();
|
index = currentIndex();
|
||||||
}
|
}
|
||||||
saveDatabaseAs(indexDatabase(index));
|
|
||||||
|
return saveDatabaseAs(indexDatabase(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseTabWidget::changeMasterKey()
|
void DatabaseTabWidget::changeMasterKey()
|
||||||
@ -525,16 +533,69 @@ bool DatabaseTabWidget::hasLockableDatabases() const
|
|||||||
|
|
||||||
void DatabaseTabWidget::lockDatabases()
|
void DatabaseTabWidget::lockDatabases()
|
||||||
{
|
{
|
||||||
QHashIterator<Database*, DatabaseManagerStruct> i(m_dbList);
|
for (int i = 0; i < count(); i++) {
|
||||||
while (i.hasNext()) {
|
DatabaseWidget* dbWidget = static_cast<DatabaseWidget*>(widget(i));
|
||||||
i.next();
|
Database* db = databaseFromDatabaseWidget(dbWidget);
|
||||||
DatabaseWidget::Mode mode = i.value().dbWidget->currentMode();
|
|
||||||
|
|
||||||
if ((mode == DatabaseWidget::ViewMode || mode == DatabaseWidget::EditMode)
|
DatabaseWidget::Mode mode = dbWidget->currentMode();
|
||||||
&& i.value().dbWidget->dbHasKey()) {
|
|
||||||
i.value().dbWidget->lock();
|
if ((mode != DatabaseWidget::ViewMode && mode != DatabaseWidget::EditMode)
|
||||||
updateTabName(i.key());
|
|| !dbWidget->dbHasKey()) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// show the correct tab widget before we are asking questions about it
|
||||||
|
setCurrentWidget(dbWidget);
|
||||||
|
|
||||||
|
if (mode == DatabaseWidget::EditMode) {
|
||||||
|
QMessageBox::StandardButton result =
|
||||||
|
MessageBox::question(
|
||||||
|
this, tr("Lock database"),
|
||||||
|
tr("Can't lock the database as you are currently editing it.\nPlease press cancel to finish your changes or discard them."),
|
||||||
|
QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||||
|
if (result == QMessageBox::Cancel) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (m_dbList[db].modified && !m_dbList[db].saveToFilename) {
|
||||||
|
QMessageBox::StandardButton result =
|
||||||
|
MessageBox::question(
|
||||||
|
this, tr("Lock database"),
|
||||||
|
tr("This database has never been saved.\nYou can save the dabatase or stop locking it."),
|
||||||
|
QMessageBox::Save | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||||
|
if (result == QMessageBox::Save) {
|
||||||
|
if (!saveDatabase(db)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (result == QMessageBox::Cancel) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_dbList[db].modified) {
|
||||||
|
QMessageBox::StandardButton result =
|
||||||
|
MessageBox::question(
|
||||||
|
this, tr("Lock database"),
|
||||||
|
tr("This database has been modified.\nDo you want to save the database before locking it?\nOtherwise your changes are lost."),
|
||||||
|
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||||
|
if (result == QMessageBox::Save) {
|
||||||
|
if (!saveDatabase(db)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (result == QMessageBox::Discard) {
|
||||||
|
m_dbList[db].modified = false;
|
||||||
|
}
|
||||||
|
else if (result == QMessageBox::Cancel) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dbWidget->lock();
|
||||||
|
// database has changed so we can't use the db variable anymore
|
||||||
|
updateTabName(dbWidget->database());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ public Q_SLOTS:
|
|||||||
void newDatabase();
|
void newDatabase();
|
||||||
void openDatabase();
|
void openDatabase();
|
||||||
void importKeePass1Database();
|
void importKeePass1Database();
|
||||||
void saveDatabase(int index = -1);
|
bool saveDatabase(int index = -1);
|
||||||
void saveDatabaseAs(int index = -1);
|
bool saveDatabaseAs(int index = -1);
|
||||||
bool closeDatabase(int index = -1);
|
bool closeDatabase(int index = -1);
|
||||||
void closeDatabaseFromSender();
|
void closeDatabaseFromSender();
|
||||||
bool closeAllDatabases();
|
bool closeAllDatabases();
|
||||||
@ -88,8 +88,8 @@ private Q_SLOTS:
|
|||||||
void emitActivateDatabaseChanged();
|
void emitActivateDatabaseChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveDatabase(Database* db);
|
bool saveDatabase(Database* db);
|
||||||
void saveDatabaseAs(Database* db);
|
bool saveDatabaseAs(Database* db);
|
||||||
bool closeDatabase(Database* db);
|
bool closeDatabase(Database* db);
|
||||||
void deleteDatabase(Database* db);
|
void deleteDatabase(Database* db);
|
||||||
int databaseIndex(Database* db);
|
int databaseIndex(Database* db);
|
||||||
|
@ -188,14 +188,7 @@ DatabaseWidget::Mode DatabaseWidget::currentMode() const
|
|||||||
|
|
||||||
bool DatabaseWidget::isInEditMode() const
|
bool DatabaseWidget::isInEditMode() const
|
||||||
{
|
{
|
||||||
if (currentMode() == DatabaseWidget::LockedMode) {
|
return currentMode() == DatabaseWidget::EditMode;
|
||||||
return m_widgetBeforeLock != Q_NULLPTR
|
|
||||||
&& m_widgetBeforeLock != m_mainWidget
|
|
||||||
&& m_widgetBeforeLock != m_unlockDatabaseWidget;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return currentMode() == DatabaseWidget::EditMode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> DatabaseWidget::splitterSizes() const
|
QList<int> DatabaseWidget::splitterSizes() const
|
||||||
@ -231,6 +224,13 @@ void DatabaseWidget::setEntryViewHeaderSizes(const QList<int>& sizes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseWidget::clearAllWidgets()
|
||||||
|
{
|
||||||
|
m_editEntryWidget->clear();
|
||||||
|
m_historyEditEntryWidget->clear();
|
||||||
|
m_editGroupWidget->clear();
|
||||||
|
}
|
||||||
|
|
||||||
void DatabaseWidget::emitCurrentModeChanged()
|
void DatabaseWidget::emitCurrentModeChanged()
|
||||||
{
|
{
|
||||||
Q_EMIT currentModeChanged(currentMode());
|
Q_EMIT currentModeChanged(currentMode());
|
||||||
@ -274,6 +274,15 @@ void DatabaseWidget::setIconFromParent()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseWidget::replaceDatabase(Database* db)
|
||||||
|
{
|
||||||
|
Database* oldDb = m_db;
|
||||||
|
m_db = db;
|
||||||
|
m_groupView->changeDatabase(m_db);
|
||||||
|
Q_EMIT databaseChanged(m_db);
|
||||||
|
delete oldDb;
|
||||||
|
}
|
||||||
|
|
||||||
void DatabaseWidget::cloneEntry()
|
void DatabaseWidget::cloneEntry()
|
||||||
{
|
{
|
||||||
Entry* currentEntry = m_entryView->currentEntry();
|
Entry* currentEntry = m_entryView->currentEntry();
|
||||||
@ -604,11 +613,7 @@ void DatabaseWidget::updateMasterKey(bool accepted)
|
|||||||
void DatabaseWidget::openDatabase(bool accepted)
|
void DatabaseWidget::openDatabase(bool accepted)
|
||||||
{
|
{
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
Database* oldDb = m_db;
|
replaceDatabase(static_cast<DatabaseOpenWidget*>(sender())->database());
|
||||||
m_db = static_cast<DatabaseOpenWidget*>(sender())->database();
|
|
||||||
m_groupView->changeDatabase(m_db);
|
|
||||||
Q_EMIT databaseChanged(m_db);
|
|
||||||
delete oldDb;
|
|
||||||
setCurrentWidget(m_mainWidget);
|
setCurrentWidget(m_mainWidget);
|
||||||
|
|
||||||
// We won't need those anymore and KeePass1OpenWidget closes
|
// We won't need those anymore and KeePass1OpenWidget closes
|
||||||
@ -628,11 +633,24 @@ void DatabaseWidget::openDatabase(bool accepted)
|
|||||||
|
|
||||||
void DatabaseWidget::unlockDatabase(bool accepted)
|
void DatabaseWidget::unlockDatabase(bool accepted)
|
||||||
{
|
{
|
||||||
// cancel button is disabled
|
if (!accepted) {
|
||||||
Q_ASSERT(accepted);
|
Q_EMIT closeRequest();
|
||||||
Q_UNUSED(accepted);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setCurrentWidget(m_widgetBeforeLock);
|
replaceDatabase(static_cast<DatabaseOpenWidget*>(sender())->database());
|
||||||
|
|
||||||
|
QList<Group*> groups = m_db->rootGroup()->groupsRecursive(true);
|
||||||
|
Q_FOREACH (Group* group, groups) {
|
||||||
|
if (group->uuid() == m_groupBeforeLock) {
|
||||||
|
m_groupView->setCurrentGroup(group);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_groupBeforeLock = Uuid();
|
||||||
|
setCurrentWidget(m_mainWidget);
|
||||||
|
m_unlockDatabaseWidget->clearForms();
|
||||||
Q_EMIT unlockedDatabase();
|
Q_EMIT unlockedDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,9 +873,13 @@ void DatabaseWidget::lock()
|
|||||||
{
|
{
|
||||||
Q_ASSERT(currentMode() != DatabaseWidget::LockedMode);
|
Q_ASSERT(currentMode() != DatabaseWidget::LockedMode);
|
||||||
|
|
||||||
m_widgetBeforeLock = currentWidget();
|
m_groupBeforeLock = m_groupView->currentGroup()->uuid();
|
||||||
m_unlockDatabaseWidget->load(m_filename, m_db);
|
clearAllWidgets();
|
||||||
|
m_unlockDatabaseWidget->load(m_filename);
|
||||||
setCurrentWidget(m_unlockDatabaseWidget);
|
setCurrentWidget(m_unlockDatabaseWidget);
|
||||||
|
Database* newDb = new Database();
|
||||||
|
newDb->metadata()->setName(m_db->metadata()->name());
|
||||||
|
replaceDatabase(newDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseWidget::updateFilename(const QString& fileName)
|
void DatabaseWidget::updateFilename(const QString& fileName)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
|
||||||
#include "core/Global.h"
|
#include "core/Global.h"
|
||||||
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
#include "gui/entry/EntryModel.h"
|
#include "gui/entry/EntryModel.h"
|
||||||
|
|
||||||
@ -78,6 +79,7 @@ public:
|
|||||||
void setSplitterSizes(const QList<int>& sizes);
|
void setSplitterSizes(const QList<int>& sizes);
|
||||||
QList<int> entryHeaderViewSizes() const;
|
QList<int> entryHeaderViewSizes() const;
|
||||||
void setEntryViewHeaderSizes(const QList<int>& sizes);
|
void setEntryViewHeaderSizes(const QList<int>& sizes);
|
||||||
|
void clearAllWidgets();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void closeRequest();
|
void closeRequest();
|
||||||
@ -143,6 +145,7 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
void setClipboardTextAndMinimize(const QString& text);
|
void setClipboardTextAndMinimize(const QString& text);
|
||||||
void setIconFromParent();
|
void setIconFromParent();
|
||||||
|
void replaceDatabase(Database* db);
|
||||||
|
|
||||||
Database* m_db;
|
Database* m_db;
|
||||||
const QScopedPointer<Ui::SearchWidget> m_searchUi;
|
const QScopedPointer<Ui::SearchWidget> m_searchUi;
|
||||||
@ -164,8 +167,8 @@ private:
|
|||||||
Group* m_newParent;
|
Group* m_newParent;
|
||||||
Group* m_lastGroup;
|
Group* m_lastGroup;
|
||||||
QTimer* m_searchTimer;
|
QTimer* m_searchTimer;
|
||||||
QWidget* m_widgetBeforeLock;
|
|
||||||
QString m_filename;
|
QString m_filename;
|
||||||
|
Uuid m_groupBeforeLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_DATABASEWIDGET_H
|
#endif // KEEPASSX_DATABASEWIDGET_H
|
||||||
|
@ -168,7 +168,7 @@ void EditWidgetIcons::removeCustomIcon()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<const Group*> allGroups = m_database->rootGroup()->groupsRecursive(true);
|
QList<Group*> allGroups = m_database->rootGroup()->groupsRecursive(true);
|
||||||
Q_FOREACH (const Group* group, allGroups) {
|
Q_FOREACH (const Group* group, allGroups) {
|
||||||
if (iconUuid == group->iconUuid() && m_currentUuid != group->uuid()) {
|
if (iconUuid == group->iconUuid() && m_currentUuid != group->uuid()) {
|
||||||
iconUsedCount++;
|
iconUsedCount++;
|
||||||
|
@ -15,7 +15,16 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -25,7 +34,16 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pageDatabase">
|
<widget class="QWidget" name="pageDatabase">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -45,7 +63,16 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="pageSettings">
|
<widget class="QWidget" name="pageSettings">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -94,7 +121,6 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionImportKeePass1"/>
|
<addaction name="actionImportKeePass1"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionLockDatabases"/>
|
|
||||||
<addaction name="actionQuit"/>
|
<addaction name="actionQuit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuHelp">
|
<widget class="QMenu" name="menuHelp">
|
||||||
@ -138,10 +164,11 @@
|
|||||||
<addaction name="actionGroupEdit"/>
|
<addaction name="actionGroupEdit"/>
|
||||||
<addaction name="actionGroupDelete"/>
|
<addaction name="actionGroupDelete"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuExtras">
|
<widget class="QMenu" name="menuTools">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Extras</string>
|
<string>Tools</string>
|
||||||
</property>
|
</property>
|
||||||
|
<addaction name="actionLockDatabases"/>
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuView">
|
<widget class="QMenu" name="menuView">
|
||||||
@ -153,7 +180,7 @@
|
|||||||
<addaction name="menuEntries"/>
|
<addaction name="menuEntries"/>
|
||||||
<addaction name="menuGroups"/>
|
<addaction name="menuGroups"/>
|
||||||
<addaction name="menuView"/>
|
<addaction name="menuView"/>
|
||||||
<addaction name="menuExtras"/>
|
<addaction name="menuTools"/>
|
||||||
<addaction name="menuHelp"/>
|
<addaction name="menuHelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
|
@ -25,33 +25,6 @@ UnlockDatabaseWidget::UnlockDatabaseWidget(QWidget* parent)
|
|||||||
: DatabaseOpenWidget(parent)
|
: DatabaseOpenWidget(parent)
|
||||||
{
|
{
|
||||||
m_ui->labelHeadline->setText(tr("Unlock database"));
|
m_ui->labelHeadline->setText(tr("Unlock database"));
|
||||||
|
|
||||||
m_ui->buttonBox->removeButton(m_ui->buttonBox->button(QDialogButtonBox::Cancel));
|
|
||||||
connect(this, SIGNAL(editFinished(bool)), SLOT(clearForms()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void UnlockDatabaseWidget::load(const QString& filename, Database* db)
|
|
||||||
{
|
|
||||||
Q_ASSERT(db);
|
|
||||||
|
|
||||||
DatabaseOpenWidget::load(filename);
|
|
||||||
m_db = db;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UnlockDatabaseWidget::openDatabase()
|
|
||||||
{
|
|
||||||
CompositeKey masterKey = databaseKey();
|
|
||||||
if (masterKey.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_db->verifyKey(masterKey)) {
|
|
||||||
Q_EMIT editFinished(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MessageBox::warning(this, tr("Error"), tr("Wrong key."));
|
|
||||||
m_ui->editPassword->clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnlockDatabaseWidget::clearForms()
|
void UnlockDatabaseWidget::clearForms()
|
||||||
@ -60,4 +33,5 @@ void UnlockDatabaseWidget::clearForms()
|
|||||||
m_ui->comboKeyFile->clear();
|
m_ui->comboKeyFile->clear();
|
||||||
m_ui->checkPassword->setChecked(false);
|
m_ui->checkPassword->setChecked(false);
|
||||||
m_ui->checkKeyFile->setChecked(false);
|
m_ui->checkKeyFile->setChecked(false);
|
||||||
|
m_db = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,6 @@ class UnlockDatabaseWidget : public DatabaseOpenWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit UnlockDatabaseWidget(QWidget* parent = Q_NULLPTR);
|
explicit UnlockDatabaseWidget(QWidget* parent = Q_NULLPTR);
|
||||||
void load(const QString& filename, Database* db);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void openDatabase() Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void clearForms();
|
void clearForms();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -453,12 +453,7 @@ void EditEntryWidget::saveEntry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_entry = Q_NULLPTR;
|
clear();
|
||||||
m_database = Q_NULLPTR;
|
|
||||||
m_entryAttributes->clear();
|
|
||||||
m_entryAttachments->clear();
|
|
||||||
m_autoTypeAssoc->clear();
|
|
||||||
m_historyModel->clear();
|
|
||||||
|
|
||||||
Q_EMIT editFinished(true);
|
Q_EMIT editFinished(true);
|
||||||
}
|
}
|
||||||
@ -466,12 +461,8 @@ void EditEntryWidget::saveEntry()
|
|||||||
void EditEntryWidget::cancel()
|
void EditEntryWidget::cancel()
|
||||||
{
|
{
|
||||||
if (m_history) {
|
if (m_history) {
|
||||||
m_entry = Q_NULLPTR;
|
clear();
|
||||||
m_database = Q_NULLPTR;
|
|
||||||
m_entryAttributes->clear();
|
|
||||||
m_entryAttachments->clear();
|
|
||||||
Q_EMIT editFinished(false);
|
Q_EMIT editFinished(false);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_entry->iconUuid().isNull() &&
|
if (!m_entry->iconUuid().isNull() &&
|
||||||
@ -479,14 +470,19 @@ void EditEntryWidget::cancel()
|
|||||||
m_entry->setIcon(Entry::DefaultIconNumber);
|
m_entry->setIcon(Entry::DefaultIconNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_entry = 0;
|
clear();
|
||||||
m_database = 0;
|
|
||||||
|
Q_EMIT editFinished(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditEntryWidget::clear()
|
||||||
|
{
|
||||||
|
m_entry = Q_NULLPTR;
|
||||||
|
m_database = Q_NULLPTR;
|
||||||
m_entryAttributes->clear();
|
m_entryAttributes->clear();
|
||||||
m_entryAttachments->clear();
|
m_entryAttachments->clear();
|
||||||
m_autoTypeAssoc->clear();
|
m_autoTypeAssoc->clear();
|
||||||
m_historyModel->clear();
|
m_historyModel->clear();
|
||||||
|
|
||||||
Q_EMIT editFinished(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEntryWidget::togglePasswordGeneratorButton(bool checked)
|
void EditEntryWidget::togglePasswordGeneratorButton(bool checked)
|
||||||
|
@ -60,6 +60,7 @@ public:
|
|||||||
|
|
||||||
void createPresetsMenu(QMenu* expirePresetsMenu);
|
void createPresetsMenu(QMenu* expirePresetsMenu);
|
||||||
QString entryTitle() const;
|
QString entryTitle() const;
|
||||||
|
void clear();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void editFinished(bool accepted);
|
void editFinished(bool accepted);
|
||||||
|
@ -85,7 +85,10 @@ void EntryModel::setEntryList(const QList<Entry*>& entries)
|
|||||||
|
|
||||||
Q_FOREACH (Database* db, databases) {
|
Q_FOREACH (Database* db, databases) {
|
||||||
Q_ASSERT(db);
|
Q_ASSERT(db);
|
||||||
m_allGroups.append(db->rootGroup()->groupsRecursive(true));
|
Q_FOREACH (const Group* group, db->rootGroup()->groupsRecursive(true)) {
|
||||||
|
m_allGroups.append(group);
|
||||||
|
}
|
||||||
|
|
||||||
if (db->metadata()->recycleBin()) {
|
if (db->metadata()->recycleBin()) {
|
||||||
m_allGroups.removeOne(db->metadata()->recycleBin());
|
m_allGroups.removeOne(db->metadata()->recycleBin());
|
||||||
}
|
}
|
||||||
|
@ -109,8 +109,7 @@ void EditGroupWidget::save()
|
|||||||
m_group->setIcon(iconStruct.uuid);
|
m_group->setIcon(iconStruct.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_group = Q_NULLPTR;
|
clear();
|
||||||
m_database = Q_NULLPTR;
|
|
||||||
Q_EMIT editFinished(true);
|
Q_EMIT editFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,9 +120,14 @@ void EditGroupWidget::cancel()
|
|||||||
m_group->setIcon(Entry::DefaultIconNumber);
|
m_group->setIcon(Entry::DefaultIconNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
|
Q_EMIT editFinished(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditGroupWidget::clear()
|
||||||
|
{
|
||||||
m_group = Q_NULLPTR;
|
m_group = Q_NULLPTR;
|
||||||
m_database = Q_NULLPTR;
|
m_database = Q_NULLPTR;
|
||||||
Q_EMIT editFinished(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidget::addTriStateItems(QComboBox* comboBox, bool inheritDefault)
|
void EditGroupWidget::addTriStateItems(QComboBox* comboBox, bool inheritDefault)
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
~EditGroupWidget();
|
~EditGroupWidget();
|
||||||
|
|
||||||
void loadGroup(Group* group, bool create, Database* database);
|
void loadGroup(Group* group, bool create, Database* database);
|
||||||
|
void clear();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void editFinished(bool accepted);
|
void editFinished(bool accepted);
|
||||||
|
@ -421,10 +421,12 @@ void TestGui::testKeePass1Import()
|
|||||||
|
|
||||||
void TestGui::testDatabaseLocking()
|
void TestGui::testDatabaseLocking()
|
||||||
{
|
{
|
||||||
|
MessageBox::setNextAnswer(QMessageBox::Cancel);
|
||||||
|
|
||||||
triggerAction("actionLockDatabases");
|
triggerAction("actionLockDatabases");
|
||||||
|
|
||||||
QCOMPARE(m_tabWidget->tabText(0), QString("Save [locked]"));
|
QCOMPARE(m_tabWidget->tabText(0), QString("Save [locked]"));
|
||||||
QCOMPARE(m_tabWidget->tabText(1), QString("basic [New database] [locked]*"));
|
QCOMPARE(m_tabWidget->tabText(1), QString("basic [New database]*"));
|
||||||
|
|
||||||
QWidget* dbWidget = m_tabWidget->currentDatabaseWidget();
|
QWidget* dbWidget = m_tabWidget->currentDatabaseWidget();
|
||||||
QWidget* unlockDatabaseWidget = dbWidget->findChild<QWidget*>("unlockDatabaseWidget");
|
QWidget* unlockDatabaseWidget = dbWidget->findChild<QWidget*>("unlockDatabaseWidget");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user