2011-11-13 13:55:20 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
|
2017-06-09 21:40:36 +00:00
|
|
|
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
2011-11-13 13:55:20 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 or (at your option)
|
|
|
|
|
* version 3 of the License.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-06-28 07:21:15 +00:00
|
|
|
#ifndef KEEPASSX_DATABASEOPENWIDGET_H
|
|
|
|
|
#define KEEPASSX_DATABASEOPENWIDGET_H
|
2011-11-13 13:55:20 +00:00
|
|
|
|
2013-10-03 13:18:16 +00:00
|
|
|
#include <QScopedPointer>
|
2020-06-06 13:54:57 +00:00
|
|
|
#include <QTimer>
|
2012-06-28 07:21:15 +00:00
|
|
|
|
|
|
|
|
#include "gui/DialogyWidget.h"
|
2011-11-13 13:55:20 +00:00
|
|
|
|
2021-07-12 02:10:29 +00:00
|
|
|
class CompositeKey;
|
2012-04-05 17:03:55 +00:00
|
|
|
class Database;
|
|
|
|
|
class QFile;
|
|
|
|
|
|
2018-03-31 20:01:30 +00:00
|
|
|
namespace Ui
|
|
|
|
|
{
|
2012-06-28 07:21:15 +00:00
|
|
|
class DatabaseOpenWidget;
|
2011-11-13 13:55:20 +00:00
|
|
|
}
|
|
|
|
|
|
2012-06-28 07:21:15 +00:00
|
|
|
class DatabaseOpenWidget : public DialogyWidget
|
2011-11-13 13:55:20 +00:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2015-07-24 16:28:12 +00:00
|
|
|
explicit DatabaseOpenWidget(QWidget* parent = nullptr);
|
2012-06-28 07:21:15 +00:00
|
|
|
~DatabaseOpenWidget();
|
2012-07-06 16:50:52 +00:00
|
|
|
void load(const QString& filename);
|
2020-04-06 12:42:20 +00:00
|
|
|
QString filename();
|
2017-09-23 15:43:29 +00:00
|
|
|
void clearForms();
|
2012-04-24 09:47:16 +00:00
|
|
|
void enterKey(const QString& pw, const QString& keyFile);
|
2018-11-22 10:47:31 +00:00
|
|
|
QSharedPointer<Database> database();
|
2022-03-29 22:03:35 +00:00
|
|
|
void resetQuickUnlock();
|
2022-06-12 20:35:42 +00:00
|
|
|
bool unlockingDatabase();
|
2012-06-28 07:21:15 +00:00
|
|
|
|
2017-02-21 01:19:11 +00:00
|
|
|
signals:
|
2018-11-22 10:47:31 +00:00
|
|
|
void dialogFinished(bool accepted);
|
2011-11-13 13:55:20 +00:00
|
|
|
|
2012-10-12 10:12:00 +00:00
|
|
|
protected:
|
2016-11-26 14:37:25 +00:00
|
|
|
void showEvent(QShowEvent* event) override;
|
2017-10-08 01:25:42 +00:00
|
|
|
void hideEvent(QHideEvent* event) override;
|
2020-07-01 23:16:40 +00:00
|
|
|
QSharedPointer<CompositeKey> buildDatabaseKey();
|
2022-02-22 01:40:01 +00:00
|
|
|
void setUserInteractionLock(bool state);
|
|
|
|
|
// Quick Unlock helper functions
|
|
|
|
|
bool isOnQuickUnlockScreen();
|
2012-10-12 10:12:00 +00:00
|
|
|
|
2020-06-06 13:54:57 +00:00
|
|
|
const QScopedPointer<Ui::DatabaseOpenWidget> m_ui;
|
|
|
|
|
QSharedPointer<Database> m_db;
|
|
|
|
|
QString m_filename;
|
|
|
|
|
bool m_retryUnlockWithEmptyPassword = false;
|
|
|
|
|
|
2017-02-21 01:19:11 +00:00
|
|
|
protected slots:
|
2012-05-12 08:08:41 +00:00
|
|
|
virtual void openDatabase();
|
2012-06-28 07:21:15 +00:00
|
|
|
void reject();
|
2012-05-12 08:08:41 +00:00
|
|
|
|
2017-02-21 01:19:11 +00:00
|
|
|
private slots:
|
2011-12-24 18:19:52 +00:00
|
|
|
void browseKeyFile();
|
2020-06-06 13:54:57 +00:00
|
|
|
void clearKeyFileText();
|
2020-04-06 12:42:20 +00:00
|
|
|
void pollHardwareKey();
|
|
|
|
|
void hardwareKeyResponse(bool found);
|
2019-06-22 16:00:31 +00:00
|
|
|
void openHardwareKeyHelp();
|
2019-11-06 10:10:02 +00:00
|
|
|
void openKeyFileHelp();
|
2011-11-13 13:55:20 +00:00
|
|
|
|
2012-05-12 08:08:41 +00:00
|
|
|
private:
|
2020-04-06 12:42:20 +00:00
|
|
|
bool m_pollingHardwareKey = false;
|
2022-02-22 01:40:01 +00:00
|
|
|
bool m_blockQuickUnlock = false;
|
2022-06-12 20:35:42 +00:00
|
|
|
bool m_unlockingDatabase = false;
|
2020-06-06 13:54:57 +00:00
|
|
|
QTimer m_hideTimer;
|
|
|
|
|
|
2012-06-28 07:21:15 +00:00
|
|
|
Q_DISABLE_COPY(DatabaseOpenWidget)
|
2011-11-13 13:55:20 +00:00
|
|
|
};
|
|
|
|
|
|
2012-06-28 07:21:15 +00:00
|
|
|
#endif // KEEPASSX_DATABASEOPENWIDGET_H
|