mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 05:57:37 +03:00
Merge pull request #2610 from brainplot/performance-fixes
Performance fixes
This commit is contained in:
commit
7f3ce65d96
28 changed files with 62 additions and 51 deletions
|
@ -348,7 +348,7 @@ void BrowserService::addEntry(const QString& id,
|
||||||
const QString& realm,
|
const QString& realm,
|
||||||
const QString& group,
|
const QString& group,
|
||||||
const QString& groupUuid,
|
const QString& groupUuid,
|
||||||
QSharedPointer<Database> selectedDb)
|
const QSharedPointer<Database>& selectedDb)
|
||||||
{
|
{
|
||||||
if (thread() != QThread::currentThread()) {
|
if (thread() != QThread::currentThread()) {
|
||||||
QMetaObject::invokeMethod(this,
|
QMetaObject::invokeMethod(this,
|
||||||
|
@ -482,7 +482,8 @@ void BrowserService::updateEntry(const QString& id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Entry*> BrowserService::searchEntries(QSharedPointer<Database> db, const QString& hostname, const QString& url)
|
QList<Entry*>
|
||||||
|
BrowserService::searchEntries(const QSharedPointer<Database>& db, const QString& hostname, const QString& url)
|
||||||
{
|
{
|
||||||
QList<Entry*> entries;
|
QList<Entry*> entries;
|
||||||
auto* rootGroup = db->rootGroup();
|
auto* rootGroup = db->rootGroup();
|
||||||
|
@ -549,7 +550,7 @@ QList<Entry*> BrowserService::searchEntries(const QString& url, const StringPair
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserService::convertAttributesToCustomData(QSharedPointer<Database> currentDb)
|
void BrowserService::convertAttributesToCustomData(const QSharedPointer<Database>& currentDb)
|
||||||
{
|
{
|
||||||
auto db = currentDb ? currentDb : getDatabase();
|
auto db = currentDb ? currentDb : getDatabase();
|
||||||
if (!db) {
|
if (!db) {
|
||||||
|
@ -770,7 +771,7 @@ BrowserService::checkAccess(const Entry* entry, const QString& host, const QStri
|
||||||
return Unknown;
|
return Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* BrowserService::findCreateAddEntryGroup(QSharedPointer<Database> selectedDb)
|
Group* BrowserService::findCreateAddEntryGroup(const QSharedPointer<Database>& selectedDb)
|
||||||
{
|
{
|
||||||
auto db = selectedDb ? selectedDb : getDatabase();
|
auto db = selectedDb ? selectedDb : getDatabase();
|
||||||
if (!db) {
|
if (!db) {
|
||||||
|
@ -955,7 +956,7 @@ bool BrowserService::moveSettingsToCustomData(Entry* entry, const QString& name)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BrowserService::moveKeysToCustomData(Entry* entry, QSharedPointer<Database> db) const
|
int BrowserService::moveKeysToCustomData(Entry* entry, const QSharedPointer<Database>& db) const
|
||||||
{
|
{
|
||||||
int keyCounter = 0;
|
int keyCounter = 0;
|
||||||
for (const auto& key : entry->attributes()->keys()) {
|
for (const auto& key : entry->attributes()->keys()) {
|
||||||
|
|
|
@ -54,10 +54,10 @@ public:
|
||||||
const QString& realm,
|
const QString& realm,
|
||||||
const QString& group,
|
const QString& group,
|
||||||
const QString& groupUuid,
|
const QString& groupUuid,
|
||||||
QSharedPointer<Database> selectedDb = {});
|
const QSharedPointer<Database>& selectedDb = {});
|
||||||
QList<Entry*> searchEntries(QSharedPointer<Database> db, const QString& hostname, const QString& url);
|
QList<Entry*> searchEntries(const QSharedPointer<Database>& db, const QString& hostname, const QString& url);
|
||||||
QList<Entry*> searchEntries(const QString& url, const StringPairList& keyList);
|
QList<Entry*> searchEntries(const QString& url, const StringPairList& keyList);
|
||||||
void convertAttributesToCustomData(QSharedPointer<Database> currentDb = {});
|
void convertAttributesToCustomData(const QSharedPointer<Database>& currentDb = {});
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const char KEEPASSXCBROWSER_NAME[];
|
static const char KEEPASSXCBROWSER_NAME[];
|
||||||
|
@ -106,7 +106,7 @@ private:
|
||||||
const QString& realm);
|
const QString& realm);
|
||||||
QJsonObject prepareEntry(const Entry* entry);
|
QJsonObject prepareEntry(const Entry* entry);
|
||||||
Access checkAccess(const Entry* entry, const QString& host, const QString& submitHost, const QString& realm);
|
Access checkAccess(const Entry* entry, const QString& host, const QString& submitHost, const QString& realm);
|
||||||
Group* findCreateAddEntryGroup(QSharedPointer<Database> selectedDb = {});
|
Group* findCreateAddEntryGroup(const QSharedPointer<Database>& selectedDb = {});
|
||||||
int
|
int
|
||||||
sortPriority(const Entry* entry, const QString& host, const QString& submitUrl, const QString& baseSubmitUrl) const;
|
sortPriority(const Entry* entry, const QString& host, const QString& submitUrl, const QString& baseSubmitUrl) const;
|
||||||
bool matchUrlScheme(const QString& url);
|
bool matchUrlScheme(const QString& url);
|
||||||
|
@ -116,7 +116,7 @@ private:
|
||||||
QSharedPointer<Database> selectedDatabase();
|
QSharedPointer<Database> selectedDatabase();
|
||||||
QJsonArray addChildrenToGroup(Group* group);
|
QJsonArray addChildrenToGroup(Group* group);
|
||||||
bool moveSettingsToCustomData(Entry* entry, const QString& name) const;
|
bool moveSettingsToCustomData(Entry* entry, const QString& name) const;
|
||||||
int moveKeysToCustomData(Entry* entry, QSharedPointer<Database> db) const;
|
int moveKeysToCustomData(Entry* entry, const QSharedPointer<Database>& db) const;
|
||||||
bool checkLegacySettings();
|
bool checkLegacySettings();
|
||||||
void hideWindow() const;
|
void hideWindow() const;
|
||||||
void raiseWindow(const bool force = false);
|
void raiseWindow(const bool force = false);
|
||||||
|
|
|
@ -77,7 +77,7 @@ int Clip::execute(const QStringList& arguments)
|
||||||
return clipEntry(db, args.at(1), args.value(2), parser.isSet(totp), parser.isSet(Command::QuietOption));
|
return clipEntry(db, args.at(1), args.value(2), parser.isSet(totp), parser.isSet(Command::QuietOption));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clip::clipEntry(QSharedPointer<Database> database,
|
int Clip::clipEntry(const QSharedPointer<Database>& database,
|
||||||
const QString& entryPath,
|
const QString& entryPath,
|
||||||
const QString& timeout,
|
const QString& timeout,
|
||||||
bool clipTotp,
|
bool clipTotp,
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
Clip();
|
Clip();
|
||||||
~Clip();
|
~Clip();
|
||||||
int execute(const QStringList& arguments) override;
|
int execute(const QStringList& arguments) override;
|
||||||
int clipEntry(QSharedPointer<Database> database,
|
int clipEntry(const QSharedPointer<Database>& database,
|
||||||
const QString& entryPath,
|
const QString& entryPath,
|
||||||
const QString& timeout,
|
const QString& timeout,
|
||||||
bool clipTotp,
|
bool clipTotp,
|
||||||
|
|
|
@ -74,7 +74,7 @@ int Create::execute(const QStringList& arguments)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString databaseFilename = args.at(0);
|
const QString& databaseFilename = args.at(0);
|
||||||
if (QFileInfo::exists(databaseFilename)) {
|
if (QFileInfo::exists(databaseFilename)) {
|
||||||
err << QObject::tr("File %1 already exists.").arg(databaseFilename) << endl;
|
err << QObject::tr("File %1 already exists.").arg(databaseFilename) << endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -150,7 +150,7 @@ QSharedPointer<PasswordKey> Create::getPasswordFromStdin()
|
||||||
* @param fileKey Resulting fileKey
|
* @param fileKey Resulting fileKey
|
||||||
* @return true if the key file was loaded succesfully
|
* @return true if the key file was loaded succesfully
|
||||||
*/
|
*/
|
||||||
bool Create::loadFileKey(QString path, QSharedPointer<FileKey>& fileKey)
|
bool Create::loadFileKey(const QString& path, QSharedPointer<FileKey>& fileKey)
|
||||||
{
|
{
|
||||||
QTextStream err(Utils::STDERR, QIODevice::WriteOnly);
|
QTextStream err(Utils::STDERR, QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
private:
|
private:
|
||||||
QSharedPointer<PasswordKey> getPasswordFromStdin();
|
QSharedPointer<PasswordKey> getPasswordFromStdin();
|
||||||
QSharedPointer<FileKey> getFileKeyFromStdin();
|
QSharedPointer<FileKey> getFileKeyFromStdin();
|
||||||
bool loadFileKey(QString path, QSharedPointer<FileKey>& fileKey);
|
bool loadFileKey(const QString& path, QSharedPointer<FileKey>& fileKey);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_CREATE_H
|
#endif // KEEPASSXC_CREATE_H
|
||||||
|
|
|
@ -135,13 +135,13 @@ namespace Utils
|
||||||
|
|
||||||
auto db = QSharedPointer<Database>::create();
|
auto db = QSharedPointer<Database>::create();
|
||||||
QString error;
|
QString error;
|
||||||
if (db->open(databaseFilename, compositeKey, &error, false)) {
|
if (db->open(databaseFilename, compositeKey, &error, false)) {
|
||||||
return db;
|
return db;
|
||||||
}else {
|
} else {
|
||||||
err << error << endl;
|
err << error << endl;
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a user password from STDIN or return a password previously
|
* Read a user password from STDIN or return a password previously
|
||||||
|
|
|
@ -32,13 +32,13 @@
|
||||||
*/
|
*/
|
||||||
static const QMap<QString, QString> deprecationMap = {
|
static const QMap<QString, QString> deprecationMap = {
|
||||||
// >2.3.4
|
// >2.3.4
|
||||||
{"security/hidepassworddetails", "security/HidePasswordPreviewPanel"},
|
{QStringLiteral("security/hidepassworddetails"), QStringLiteral("security/HidePasswordPreviewPanel")},
|
||||||
// >2.3.4
|
// >2.3.4
|
||||||
{"GUI/HideDetailsView", "GUI/HidePreviewPanel"},
|
{QStringLiteral("GUI/HideDetailsView"), QStringLiteral("GUI/HidePreviewPanel")},
|
||||||
// >2.3.4
|
// >2.3.4
|
||||||
{"GUI/DetailSplitterState", "GUI/PreviewSplitterState"},
|
{QStringLiteral("GUI/DetailSplitterState"), QStringLiteral("GUI/PreviewSplitterState")},
|
||||||
// >2.3.4
|
// >2.3.4
|
||||||
{"security/IconDownloadFallbackToGoogle", "security/IconDownloadFallback"},
|
{QStringLiteral("security/IconDownloadFallbackToGoogle"), QStringLiteral("security/IconDownloadFallback")},
|
||||||
};
|
};
|
||||||
|
|
||||||
Config* Config::m_instance(nullptr);
|
Config* Config::m_instance(nullptr);
|
||||||
|
@ -91,7 +91,8 @@ void Config::sync()
|
||||||
|
|
||||||
void Config::upgrade()
|
void Config::upgrade()
|
||||||
{
|
{
|
||||||
for (const auto& setting : deprecationMap.keys()) {
|
const auto keys = deprecationMap.keys();
|
||||||
|
for (const auto& setting : keys) {
|
||||||
if (m_settings->contains(setting)) {
|
if (m_settings->contains(setting)) {
|
||||||
if (!deprecationMap.value(setting).isEmpty()) {
|
if (!deprecationMap.value(setting).isEmpty()) {
|
||||||
// Add entry with new name and old entry's value
|
// Add entry with new name and old entry's value
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "CustomData.h"
|
#include "CustomData.h"
|
||||||
|
|
||||||
|
#include "core/Global.h"
|
||||||
|
|
||||||
CustomData::CustomData(QObject* parent)
|
CustomData::CustomData(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +46,7 @@ bool CustomData::contains(const QString& key) const
|
||||||
|
|
||||||
bool CustomData::containsValue(const QString& value) const
|
bool CustomData::containsValue(const QString& value) const
|
||||||
{
|
{
|
||||||
return m_data.values().contains(value);
|
return asConst(m_data).values().contains(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomData::set(const QString& key, const QString& value)
|
void CustomData::set(const QString& key, const QString& value)
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "EntryAttachments.h"
|
#include "EntryAttachments.h"
|
||||||
|
|
||||||
|
#include "core/Global.h"
|
||||||
|
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ bool EntryAttachments::hasKey(const QString& key) const
|
||||||
|
|
||||||
QSet<QByteArray> EntryAttachments::values() const
|
QSet<QByteArray> EntryAttachments::values() const
|
||||||
{
|
{
|
||||||
return m_attachments.values().toSet();
|
return asConst(m_attachments).values().toSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray EntryAttachments::value(const QString& key) const
|
QByteArray EntryAttachments::value(const QString& key) const
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
#include "EntryAttributes.h"
|
#include "EntryAttributes.h"
|
||||||
|
|
||||||
|
#include "core/Global.h"
|
||||||
|
|
||||||
const QString EntryAttributes::TitleKey = "Title";
|
const QString EntryAttributes::TitleKey = "Title";
|
||||||
const QString EntryAttributes::UserNameKey = "UserName";
|
const QString EntryAttributes::UserNameKey = "UserName";
|
||||||
const QString EntryAttributes::PasswordKey = "Password";
|
const QString EntryAttributes::PasswordKey = "Password";
|
||||||
|
@ -72,7 +74,7 @@ bool EntryAttributes::contains(const QString& key) const
|
||||||
|
|
||||||
bool EntryAttributes::containsValue(const QString& value) const
|
bool EntryAttributes::containsValue(const QString& value) const
|
||||||
{
|
{
|
||||||
return m_attributes.values().contains(value);
|
return asConst(m_attributes).values().contains(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntryAttributes::isProtected(const QString& key) const
|
bool EntryAttributes::isProtected(const QString& key) const
|
||||||
|
|
|
@ -616,7 +616,8 @@ Merger::ChangeList Merger::mergeMetadata(const MergeContext& context)
|
||||||
auto* sourceMetadata = context.m_sourceDb->metadata();
|
auto* sourceMetadata = context.m_sourceDb->metadata();
|
||||||
auto* targetMetadata = context.m_targetDb->metadata();
|
auto* targetMetadata = context.m_targetDb->metadata();
|
||||||
|
|
||||||
for (QUuid customIconId : sourceMetadata->customIcons().keys()) {
|
const auto keys = sourceMetadata->customIcons().keys();
|
||||||
|
for (QUuid customIconId : keys) {
|
||||||
QImage customIcon = sourceMetadata->customIcon(customIconId);
|
QImage customIcon = sourceMetadata->customIcon(customIconId);
|
||||||
if (!targetMetadata->containsCustomIcon(customIconId)) {
|
if (!targetMetadata->containsCustomIcon(customIconId)) {
|
||||||
targetMetadata->addCustomIcon(customIconId, customIcon);
|
targetMetadata->addCustomIcon(customIconId, customIcon);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "core/Database.h"
|
#include "core/Database.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
|
||||||
bool CsvExporter::exportDatabase(const QString& filename, QSharedPointer<const Database> db)
|
bool CsvExporter::exportDatabase(const QString& filename, const QSharedPointer<const Database>& db)
|
||||||
{
|
{
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||||
|
@ -33,7 +33,7 @@ bool CsvExporter::exportDatabase(const QString& filename, QSharedPointer<const D
|
||||||
return exportDatabase(&file, db);
|
return exportDatabase(&file, db);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CsvExporter::exportDatabase(QIODevice* device, QSharedPointer<const Database> db)
|
bool CsvExporter::exportDatabase(QIODevice* device, const QSharedPointer<const Database>& db)
|
||||||
{
|
{
|
||||||
QString header;
|
QString header;
|
||||||
addColumn(header, "Group");
|
addColumn(header, "Group");
|
||||||
|
|
|
@ -29,8 +29,8 @@ class QIODevice;
|
||||||
class CsvExporter
|
class CsvExporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool exportDatabase(const QString& filename, QSharedPointer<const Database> db);
|
bool exportDatabase(const QString& filename, const QSharedPointer<const Database>& db);
|
||||||
bool exportDatabase(QIODevice* device, QSharedPointer<const Database> db);
|
bool exportDatabase(QIODevice* device, const QSharedPointer<const Database>& db);
|
||||||
QString errorString() const;
|
QString errorString() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -124,8 +124,8 @@ void KdbxXmlReader::readDatabase(QIODevice* device, Database* db, KeePass2Random
|
||||||
qWarning("KdbxXmlReader::readDatabase: found %d invalid entry reference(s)", m_tmpParent->children().size());
|
qWarning("KdbxXmlReader::readDatabase: found %d invalid entry reference(s)", m_tmpParent->children().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
const QSet<QString> poolKeys = m_binaryPool.keys().toSet();
|
const QSet<QString> poolKeys = asConst(m_binaryPool).keys().toSet();
|
||||||
const QSet<QString> entryKeys = m_binaryMap.keys().toSet();
|
const QSet<QString> entryKeys = asConst(m_binaryMap).keys().toSet();
|
||||||
const QSet<QString> unmappedKeys = entryKeys - poolKeys;
|
const QSet<QString> unmappedKeys = entryKeys - poolKeys;
|
||||||
const QSet<QString> unusedKeys = poolKeys - entryKeys;
|
const QSet<QString> unusedKeys = poolKeys - entryKeys;
|
||||||
|
|
||||||
|
|
|
@ -1532,7 +1532,7 @@ bool DatabaseWidget::saveAs()
|
||||||
{
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
QString oldFilePath = m_db->filePath();
|
QString oldFilePath = m_db->filePath();
|
||||||
if (!QFileInfo(oldFilePath).exists()) {
|
if (!QFileInfo::exists(oldFilePath)) {
|
||||||
oldFilePath = QDir::toNativeSeparators(config()->get("LastDir", QDir::homePath()).toString() + "/"
|
oldFilePath = QDir::toNativeSeparators(config()->get("LastDir", QDir::homePath()).toString() + "/"
|
||||||
+ tr("Passwords").append(".kdbx"));
|
+ tr("Passwords").append(".kdbx"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ void EditWidgetIcons::reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditWidgetIcons::load(const QUuid& currentUuid,
|
void EditWidgetIcons::load(const QUuid& currentUuid,
|
||||||
QSharedPointer<Database> database,
|
const QSharedPointer<Database>& database,
|
||||||
const IconStruct& iconStruct,
|
const IconStruct& iconStruct,
|
||||||
const QString& url)
|
const QString& url)
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,6 @@ void EditWidgetIcons::fetchFinished()
|
||||||
QImage image;
|
QImage image;
|
||||||
bool fallbackEnabled = config()->get("security/IconDownloadFallback", false).toBool();
|
bool fallbackEnabled = config()->get("security/IconDownloadFallback", false).toBool();
|
||||||
bool error = (m_reply->error() != QNetworkReply::NoError);
|
bool error = (m_reply->error() != QNetworkReply::NoError);
|
||||||
QUrl url = m_reply->url();
|
|
||||||
QUrl redirectTarget = getRedirectTarget(m_reply);
|
QUrl redirectTarget = getRedirectTarget(m_reply);
|
||||||
|
|
||||||
m_reply->deleteLater();
|
m_reply->deleteLater();
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
IconStruct state();
|
IconStruct state();
|
||||||
void reset();
|
void reset();
|
||||||
void load(const QUuid& currentUuid,
|
void load(const QUuid& currentUuid,
|
||||||
QSharedPointer<Database> database,
|
const QSharedPointer<Database>& database,
|
||||||
const IconStruct& iconStruct,
|
const IconStruct& iconStruct,
|
||||||
const QString& url = "");
|
const QString& url = "");
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
MessageBox::Button MessageBox::m_nextAnswer(MessageBox::NoButton);
|
MessageBox::Button MessageBox::m_nextAnswer(MessageBox::NoButton);
|
||||||
|
|
||||||
QMap<QAbstractButton*, MessageBox::Button> MessageBox::m_addedButtonLookup =
|
QHash<QAbstractButton*, MessageBox::Button> MessageBox::m_addedButtonLookup =
|
||||||
QMap<QAbstractButton*, MessageBox::Button>();
|
QHash<QAbstractButton*, MessageBox::Button>();
|
||||||
|
|
||||||
QMap<MessageBox::Button, std::pair<QString, QMessageBox::ButtonRole>> MessageBox::m_buttonDefs =
|
QMap<MessageBox::Button, std::pair<QString, QMessageBox::ButtonRole>> MessageBox::m_buttonDefs =
|
||||||
QMap<MessageBox::Button, std::pair<QString, QMessageBox::ButtonRole>>();
|
QMap<MessageBox::Button, std::pair<QString, QMessageBox::ButtonRole>>();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#ifndef KEEPASSX_MESSAGEBOX_H
|
#ifndef KEEPASSX_MESSAGEBOX_H
|
||||||
#define KEEPASSX_MESSAGEBOX_H
|
#define KEEPASSX_MESSAGEBOX_H
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -102,7 +103,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Button m_nextAnswer;
|
static Button m_nextAnswer;
|
||||||
static QMap<QAbstractButton*, Button> m_addedButtonLookup;
|
static QHash<QAbstractButton*, Button> m_addedButtonLookup;
|
||||||
static QMap<Button, std::pair<QString, QMessageBox::ButtonRole>> m_buttonDefs;
|
static QMap<Button, std::pair<QString, QMessageBox::ButtonRole>> m_buttonDefs;
|
||||||
|
|
||||||
static Button messageBox(QWidget* parent,
|
static Button messageBox(QWidget* parent,
|
||||||
|
|
|
@ -105,7 +105,7 @@ DatabaseSettingsDialog::~DatabaseSettingsDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseSettingsDialog::load(QSharedPointer<Database> db)
|
void DatabaseSettingsDialog::load(const QSharedPointer<Database>& db)
|
||||||
{
|
{
|
||||||
m_ui->categoryList->setCurrentCategory(0);
|
m_ui->categoryList->setCurrentCategory(0);
|
||||||
m_generalWidget->load(db);
|
m_generalWidget->load(db);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
~DatabaseSettingsDialog() override;
|
~DatabaseSettingsDialog() override;
|
||||||
Q_DISABLE_COPY(DatabaseSettingsDialog);
|
Q_DISABLE_COPY(DatabaseSettingsDialog);
|
||||||
|
|
||||||
void load(QSharedPointer<Database> db);
|
void load(const QSharedPointer<Database>& db);
|
||||||
void addSettingsPage(IDatabaseSettingsPage* page);
|
void addSettingsPage(IDatabaseSettingsPage* page);
|
||||||
void showMasterKeySettings();
|
void showMasterKeySettings();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "DatabaseSettingsWidget.h"
|
#include "DatabaseSettingsWidget.h"
|
||||||
#include "core/Database.h"
|
#include "core/Database.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
@ -38,6 +40,6 @@ DatabaseSettingsWidget::~DatabaseSettingsWidget()
|
||||||
*/
|
*/
|
||||||
void DatabaseSettingsWidget::load(QSharedPointer<Database> db)
|
void DatabaseSettingsWidget::load(QSharedPointer<Database> db)
|
||||||
{
|
{
|
||||||
m_db = db;
|
m_db = std::move(db);
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ EditGroupWidget::~EditGroupWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidget::loadGroup(Group* group, bool create, QSharedPointer<Database> database)
|
void EditGroupWidget::loadGroup(Group* group, bool create, const QSharedPointer<Database>& database)
|
||||||
{
|
{
|
||||||
m_group = group;
|
m_group = group;
|
||||||
m_db = database;
|
m_db = database;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
explicit EditGroupWidget(QWidget* parent = nullptr);
|
explicit EditGroupWidget(QWidget* parent = nullptr);
|
||||||
~EditGroupWidget();
|
~EditGroupWidget();
|
||||||
|
|
||||||
void loadGroup(Group* group, bool create, QSharedPointer<Database> database);
|
void loadGroup(Group* group, bool create, const QSharedPointer<Database>& database);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void addEditPage(IEditGroupPage* page);
|
void addEditPage(IEditGroupPage* page);
|
||||||
|
|
|
@ -50,7 +50,7 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
||||||
setDefaultDropAction(Qt::MoveAction);
|
setDefaultDropAction(Qt::MoveAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupView::changeDatabase(QSharedPointer<Database> newDb)
|
void GroupView::changeDatabase(const QSharedPointer<Database>& newDb)
|
||||||
{
|
{
|
||||||
m_model->changeDatabase(newDb.data());
|
m_model->changeDatabase(newDb.data());
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class GroupView : public QTreeView
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GroupView(Database* db, QWidget* parent = nullptr);
|
explicit GroupView(Database* db, QWidget* parent = nullptr);
|
||||||
void changeDatabase(QSharedPointer<Database> newDb);
|
void changeDatabase(const QSharedPointer<Database>& newDb);
|
||||||
void setModel(QAbstractItemModel* model) override;
|
void setModel(QAbstractItemModel* model) override;
|
||||||
Group* currentGroup();
|
Group* currentGroup();
|
||||||
void setCurrentGroup(Group* group);
|
void setCurrentGroup(Group* group);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class NewDatabaseWizardPage : public QWizardPage
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NewDatabaseWizardPage(QWidget* parent = nullptr);
|
explicit NewDatabaseWizardPage(QWidget* parent = nullptr);
|
||||||
Q_DISABLE_COPY(NewDatabaseWizardPage);
|
Q_DISABLE_COPY(NewDatabaseWizardPage)
|
||||||
~NewDatabaseWizardPage() override;
|
~NewDatabaseWizardPage() override;
|
||||||
|
|
||||||
void setPageWidget(DatabaseSettingsWidget* page);
|
void setPageWidget(DatabaseSettingsWidget* page);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue