2016-11-11 22:26:07 +01:00
|
|
|
/*
|
2018-11-24 00:57:41 +01:00
|
|
|
* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
|
2016-11-11 22:26:07 +01: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/>.
|
|
|
|
*/
|
|
|
|
|
2018-01-25 14:21:05 +02:00
|
|
|
#ifndef KEEPASSX_UNLOCKDATABASEDIALOG_H
|
|
|
|
#define KEEPASSX_UNLOCKDATABASEDIALOG_H
|
2016-11-11 22:26:07 +01:00
|
|
|
|
|
|
|
#include "core/Global.h"
|
2025-02-01 17:58:45 +01:00
|
|
|
#include "gui/MessageWidget.h"
|
2016-11-11 22:26:07 +01:00
|
|
|
|
2018-11-24 00:57:41 +01:00
|
|
|
#include <QDialog>
|
2020-09-22 19:48:20 -04:00
|
|
|
#include <QList>
|
2018-11-24 00:57:41 +01:00
|
|
|
#include <QPointer>
|
2020-09-22 19:48:20 -04:00
|
|
|
#include <QTabBar>
|
2018-11-24 00:57:41 +01:00
|
|
|
|
2016-11-11 22:26:07 +01:00
|
|
|
class Database;
|
2018-11-24 00:57:41 +01:00
|
|
|
class DatabaseWidget;
|
|
|
|
class DatabaseOpenWidget;
|
2016-11-11 22:26:07 +01:00
|
|
|
|
2018-11-24 00:57:41 +01:00
|
|
|
class DatabaseOpenDialog : public QDialog
|
2016-11-11 22:26:07 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2018-11-24 00:57:41 +01:00
|
|
|
|
2016-11-11 22:26:07 +01:00
|
|
|
public:
|
2018-11-24 00:57:41 +01:00
|
|
|
enum class Intent
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
AutoType,
|
2018-01-25 14:21:05 +02:00
|
|
|
Merge,
|
2024-06-13 12:23:41 +02:00
|
|
|
RemoteSync,
|
2018-01-25 14:21:05 +02:00
|
|
|
Browser
|
2018-11-24 00:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
explicit DatabaseOpenDialog(QWidget* parent = nullptr);
|
2020-09-22 19:48:20 -04:00
|
|
|
void setTarget(DatabaseWidget* dbWidget, const QString& filePath);
|
|
|
|
void addDatabaseTab(DatabaseWidget* dbWidget);
|
|
|
|
void setActiveDatabaseTab(DatabaseWidget* dbWidget);
|
2018-11-24 00:57:41 +01:00
|
|
|
void setIntent(Intent intent);
|
|
|
|
Intent intent() const;
|
2020-09-22 19:48:20 -04:00
|
|
|
QSharedPointer<Database> database() const;
|
2018-11-24 00:57:41 +01:00
|
|
|
void clearForms();
|
2025-02-01 17:58:45 +01:00
|
|
|
void showMessage(const QString& text, MessageWidget::MessageType type, int autoHideTimeout);
|
2016-11-11 22:26:07 +01:00
|
|
|
|
2017-03-10 15:58:42 +01:00
|
|
|
signals:
|
2019-12-13 15:28:45 -05:00
|
|
|
void dialogFinished(bool accepted, DatabaseWidget* dbWidget);
|
2016-11-11 22:26:07 +01:00
|
|
|
|
2017-03-10 15:58:42 +01:00
|
|
|
public slots:
|
2025-02-01 17:58:45 +01:00
|
|
|
void done(int result) override;
|
2018-11-24 00:57:41 +01:00
|
|
|
void complete(bool accepted);
|
2020-09-22 19:48:20 -04:00
|
|
|
void tabChanged(int index);
|
2016-11-11 22:26:07 +01:00
|
|
|
|
2023-08-10 08:21:08 -04:00
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent* event) override;
|
|
|
|
|
2016-11-11 22:26:07 +01:00
|
|
|
private:
|
2024-06-13 12:23:41 +02:00
|
|
|
void closeEvent(QCloseEvent* e) override;
|
2020-09-22 19:48:20 -04:00
|
|
|
void selectTabOffset(int offset);
|
|
|
|
|
2018-11-24 00:57:41 +01:00
|
|
|
QPointer<DatabaseOpenWidget> m_view;
|
2020-09-22 19:48:20 -04:00
|
|
|
QPointer<QTabBar> m_tabBar;
|
2018-11-24 00:57:41 +01:00
|
|
|
QSharedPointer<Database> m_db;
|
2020-09-22 19:48:20 -04:00
|
|
|
QList<QPointer<DatabaseWidget>> m_tabDbWidgets;
|
|
|
|
QPointer<DatabaseWidget> m_currentDbWidget;
|
2018-11-24 00:57:41 +01:00
|
|
|
Intent m_intent = Intent::None;
|
2016-11-11 22:26:07 +01:00
|
|
|
};
|
|
|
|
|
2018-01-25 14:21:05 +02:00
|
|
|
#endif // KEEPASSX_UNLOCKDATABASEDIALOG_H
|