keepassxc/src/gui/DatabaseOpenWidget.h

87 lines
2.3 KiB
C++
Raw Normal View History

2011-11-13 08:55:20 -05:00
/*
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
2017-06-09 17:40:36 -04:00
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
2011-11-13 08:55:20 -05: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/>.
*/
#ifndef KEEPASSX_DATABASEOPENWIDGET_H
#define KEEPASSX_DATABASEOPENWIDGET_H
2011-11-13 08:55:20 -05:00
#include <QScopedPointer>
#include "gui/DialogyWidget.h"
2012-10-12 06:12:00 -04:00
#include "keys/CompositeKey.h"
2011-11-13 08:55:20 -05:00
class Database;
class QFile;
2018-03-31 16:01:30 -04:00
namespace Ui
{
class DatabaseOpenWidget;
2011-11-13 08:55:20 -05:00
}
class DatabaseOpenWidget : public DialogyWidget
2011-11-13 08:55:20 -05:00
{
Q_OBJECT
public:
2015-07-24 12:28:12 -04:00
explicit DatabaseOpenWidget(QWidget* parent = nullptr);
~DatabaseOpenWidget();
2012-07-06 12:50:52 -04:00
void load(const QString& filename);
void clearForms();
void enterKey(const QString& pw, const QString& keyFile);
QSharedPointer<Database> database();
public slots:
void pollYubikey();
signals:
void dialogFinished(bool accepted);
2011-11-13 08:55:20 -05:00
2012-10-12 06:12:00 -04:00
protected:
void showEvent(QShowEvent* event) override;
void hideEvent(QHideEvent* event) override;
2017-10-21 08:00:25 -04:00
QSharedPointer<CompositeKey> databaseKey();
2012-10-12 06:12:00 -04:00
protected slots:
virtual void openDatabase();
void reject();
private slots:
void browseKeyFile();
void clearKeyFileEdit();
void handleKeyFileComboEdited();
void handleKeyFileComboChanged();
void yubikeyDetected(int slot, bool blocking);
void yubikeyDetectComplete();
void noYubikeyFound();
void openHardwareKeyHelp();
void openKeyFileHelp();
2011-11-13 08:55:20 -05:00
protected:
const QScopedPointer<Ui::DatabaseOpenWidget> m_ui;
QSharedPointer<Database> m_db;
QString m_filename;
bool m_retryUnlockWithEmptyPassword = false;
2011-11-13 08:55:20 -05:00
private:
bool m_yubiKeyBeingPolled = false;
bool m_keyFileComboEdited = false;
bool m_isOpeningDatabase = false;
Q_DISABLE_COPY(DatabaseOpenWidget)
2011-11-13 08:55:20 -05:00
};
#endif // KEEPASSX_DATABASEOPENWIDGET_H