mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-02 11:36:18 -04:00
Adding a GUI prompt for password. (#587)
This commit is contained in:
parent
a75746c7c1
commit
c3bd5d21aa
6 changed files with 64 additions and 20 deletions
|
@ -19,18 +19,17 @@
|
|||
#include "UnlockDatabaseWidget.h"
|
||||
|
||||
#include "autotype/AutoType.h"
|
||||
#include "gui/DragTabBar.h"
|
||||
#include "core/Database.h"
|
||||
#include "gui/DragTabBar.h"
|
||||
|
||||
|
||||
UnlockDatabaseDialog::UnlockDatabaseDialog(QWidget *parent)
|
||||
UnlockDatabaseDialog::UnlockDatabaseDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, m_view(new UnlockDatabaseWidget(this))
|
||||
{
|
||||
connect(m_view, SIGNAL(editFinished(bool)), this, SLOT(complete(bool)));
|
||||
}
|
||||
|
||||
void UnlockDatabaseDialog::setDBFilename(const QString &filename)
|
||||
void UnlockDatabaseDialog::setDBFilename(const QString& filename)
|
||||
{
|
||||
m_view->load(filename);
|
||||
}
|
||||
|
@ -40,7 +39,7 @@ void UnlockDatabaseDialog::clearForms()
|
|||
m_view->clearForms();
|
||||
}
|
||||
|
||||
Database *UnlockDatabaseDialog::database()
|
||||
Database* UnlockDatabaseDialog::database()
|
||||
{
|
||||
return m_view->database();
|
||||
}
|
||||
|
@ -54,3 +53,20 @@ void UnlockDatabaseDialog::complete(bool r)
|
|||
reject();
|
||||
}
|
||||
}
|
||||
|
||||
Database* UnlockDatabaseDialog::openDatabasePrompt(QString databaseFilename)
|
||||
{
|
||||
|
||||
UnlockDatabaseDialog* unlockDatabaseDialog = new UnlockDatabaseDialog();
|
||||
unlockDatabaseDialog->setObjectName("Open database");
|
||||
unlockDatabaseDialog->setDBFilename(databaseFilename);
|
||||
unlockDatabaseDialog->show();
|
||||
unlockDatabaseDialog->exec();
|
||||
|
||||
Database* db = unlockDatabaseDialog->database();
|
||||
if (!db) {
|
||||
qWarning("Could not open database %s.", qPrintable(databaseFilename));
|
||||
}
|
||||
delete unlockDatabaseDialog;
|
||||
return db;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue