#ifndef MASTERCONTROLLER_H #define MASTERCONTROLLER_H #include #include #include #include #include #include //namespace Botan { // class Sqlite3_Database; //} class ConnectionConfig; class ConnectionList; class ConnectionListModel; class ConnectionManagerWindow; class PasswordManager; /** \brief Controller class responsible for all things global. */ class MasterController : public QObject { Q_OBJECT public: explicit MasterController(QObject *parent = nullptr); MasterController(const MasterController&) = delete; MasterController &operator=(const MasterController&) = delete; ~MasterController(); void init(); ConnectionListModel *getConnectionListModel() { return m_connectionListModel; } void showConnectionManager(); void openSqlWindowForConnection(size_t connection_index); void openServerWindowForConnection(size_t connection_index); void openBackupDlgForConnection(size_t connection_index); // std::shared_ptr getUserConfigDatabase(); signals: public slots: private: ConnectionList *m_connectionList = nullptr; ConnectionListModel *m_connectionListModel = nullptr; ConnectionManagerWindow *m_connectionManagerWindow = nullptr; //std::shared_ptr m_userConfigDatabase; QSqlDatabase m_userConfigDatabase; /** Using long lived object so it can remember its master password for sometime * if the user wishes it. */ std::shared_ptr m_passwordManager; /** Retrieves the connection password from the user (directly or through the psk db) * */ bool retrieveConnectionPassword(ConnectionConfig &cc); bool getPasswordFromPskdb(const std::string &password_id, std::string &password); bool storePasswordInPskdb(const std::string &password_id, const std::string password); bool UnlockPasswordManagerIfNeeded(); static std::string getPskId(const ConnectionConfig &cc); }; #endif // MASTERCONTROLLER_H