2011-11-13 08:55:20 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
|
|
|
|
*
|
|
|
|
* 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 03:21:15 -04:00
|
|
|
#ifndef KEEPASSX_DATABASEOPENWIDGET_H
|
|
|
|
#define KEEPASSX_DATABASEOPENWIDGET_H
|
2011-11-13 08:55:20 -05:00
|
|
|
|
2013-10-03 09:18:16 -04:00
|
|
|
#include <QScopedPointer>
|
2012-06-28 03:21:15 -04:00
|
|
|
|
|
|
|
#include "gui/DialogyWidget.h"
|
2012-10-12 06:12:00 -04:00
|
|
|
#include "keys/CompositeKey.h"
|
2011-11-13 08:55:20 -05:00
|
|
|
|
2012-04-05 13:03:55 -04:00
|
|
|
class Database;
|
|
|
|
class QFile;
|
|
|
|
|
2011-11-13 08:55:20 -05:00
|
|
|
namespace Ui {
|
2012-06-28 03:21:15 -04:00
|
|
|
class DatabaseOpenWidget;
|
2011-11-13 08:55:20 -05:00
|
|
|
}
|
|
|
|
|
2012-06-28 03:21:15 -04:00
|
|
|
class DatabaseOpenWidget : public DialogyWidget
|
2011-11-13 08:55:20 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-06-29 17:17:36 -04:00
|
|
|
explicit DatabaseOpenWidget(QWidget* parent = Q_NULLPTR);
|
2012-06-28 03:21:15 -04:00
|
|
|
~DatabaseOpenWidget();
|
2012-07-06 12:50:52 -04:00
|
|
|
void load(const QString& filename);
|
2012-04-24 05:47:16 -04:00
|
|
|
void enterKey(const QString& pw, const QString& keyFile);
|
2013-04-24 16:38:34 -04:00
|
|
|
void enterKey(const CompositeKey& masterKey);
|
2012-06-28 03:21:15 -04:00
|
|
|
Database* database();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void editFinished(bool accepted);
|
2011-11-13 08:55:20 -05:00
|
|
|
|
2012-10-12 06:12:00 -04:00
|
|
|
protected:
|
|
|
|
CompositeKey databaseKey();
|
|
|
|
|
2012-05-12 04:08:41 -04:00
|
|
|
protected Q_SLOTS:
|
|
|
|
virtual void openDatabase();
|
2013-04-24 16:38:34 -04:00
|
|
|
void openDatabase(const CompositeKey& masterKey);
|
2012-06-28 03:21:15 -04:00
|
|
|
void reject();
|
2012-05-12 04:08:41 -04:00
|
|
|
|
2011-11-13 08:55:20 -05:00
|
|
|
private Q_SLOTS:
|
2011-11-16 12:46:09 -05:00
|
|
|
void activatePassword();
|
2011-12-24 13:19:52 -05:00
|
|
|
void activateKeyFile();
|
|
|
|
void setOkButtonEnabled();
|
|
|
|
void browseKeyFile();
|
2011-11-13 08:55:20 -05:00
|
|
|
|
2012-05-12 04:08:41 -04:00
|
|
|
protected:
|
2012-06-28 03:21:15 -04:00
|
|
|
const QScopedPointer<Ui::DatabaseOpenWidget> m_ui;
|
2012-04-05 13:03:55 -04:00
|
|
|
Database* m_db;
|
2012-06-28 03:21:15 -04:00
|
|
|
QString m_filename;
|
2011-11-13 08:55:20 -05:00
|
|
|
|
2012-05-12 04:08:41 -04:00
|
|
|
private:
|
2012-06-28 03:21:15 -04:00
|
|
|
Q_DISABLE_COPY(DatabaseOpenWidget)
|
2011-11-13 08:55:20 -05:00
|
|
|
};
|
|
|
|
|
2012-06-28 03:21:15 -04:00
|
|
|
#endif // KEEPASSX_DATABASEOPENWIDGET_H
|