Implement Milestone 2 profile schema, dialog, and connect lifecycle
This commit is contained in:
@@ -2,14 +2,20 @@
|
||||
#define ORBITHUB_PROFILE_REPOSITORY_H
|
||||
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
struct Profile
|
||||
{
|
||||
qint64 id;
|
||||
qint64 id = -1;
|
||||
QString name;
|
||||
QString host;
|
||||
int port = 22;
|
||||
QString username;
|
||||
QString protocol = QStringLiteral("SSH");
|
||||
QString authMode = QStringLiteral("Password");
|
||||
};
|
||||
|
||||
class ProfileRepository
|
||||
@@ -19,17 +25,22 @@ public:
|
||||
~ProfileRepository();
|
||||
|
||||
QString initError() const;
|
||||
QString lastError() const;
|
||||
|
||||
std::vector<Profile> listProfiles(const QString& searchQuery = QString()) const;
|
||||
std::optional<Profile> createProfile(const QString& name) const;
|
||||
bool updateProfile(qint64 id, const QString& name) const;
|
||||
std::optional<Profile> getProfile(qint64 id) const;
|
||||
std::optional<Profile> createProfile(const Profile& profile) const;
|
||||
bool updateProfile(const Profile& profile) const;
|
||||
bool deleteProfile(qint64 id) const;
|
||||
|
||||
private:
|
||||
QString m_connectionName;
|
||||
QString m_initError;
|
||||
mutable QString m_lastError;
|
||||
|
||||
bool initializeDatabase();
|
||||
bool ensureProfileSchema() const;
|
||||
void setLastError(const QString& error) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user