| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// copyright : (C) 2013 by Eran Ifrah |
| 5 |
// file name : ssh_account_info.h |
| 6 |
// |
| 7 |
// ------------------------------------------------------------------------- |
| 8 |
// A |
| 9 |
// _____ _ _ _ _ |
| 10 |
// / __ \ | | | | (_) | |
| 11 |
// | / \/ ___ __| | ___| | _| |_ ___ |
| 12 |
// | | / _ \ / _ |/ _ \ | | | __/ _ ) |
| 13 |
// | \__/\ (_) | (_| | __/ |___| | || __/ |
| 14 |
// \____/\___/ \__,_|\___\_____/_|\__\___| |
| 15 |
// |
| 16 |
// F i l e |
| 17 |
// |
| 18 |
// This program is free software; you can redistribute it and/or modify |
| 19 |
// it under the terms of the GNU General Public License as published by |
| 20 |
// the Free Software Foundation; either version 2 of the License, or |
| 21 |
// (at your option) any later version. |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
|
| 26 |
#ifndef SSHACCOUNTINFO_H |
| 27 |
#define SSHACCOUNTINFO_H |
| 28 |
|
| 29 |
#include "cl_config.h" // Base class: clConfigItem |
| 30 |
#include "codelite_exports.h" |
| 31 |
|
| 32 |
#include <functional> |
| 33 |
#include <vector> |
| 34 |
|
| 35 |
class WXDLLIMPEXP_CL SSHAccountInfo : public clConfigItem |
| 36 |
{ |
| 37 |
wxString m_accountName; |
| 38 |
wxString m_username; |
| 39 |
wxString m_password; |
| 40 |
int m_port; |
| 41 |
wxString m_host; |
| 42 |
wxArrayString m_bookmarks; |
| 43 |
wxString m_defaultFolder; |
| 44 |
|
| 45 |
public: |
| 46 |
typedef std::vector<SSHAccountInfo> Vect_t; |
| 47 |
|
| 48 |
public: |
| 49 |
SSHAccountInfo(); |
| 50 |
|
| 51 |
virtual ~SSHAccountInfo(); |
| 52 |
SSHAccountInfo& operator=(const SSHAccountInfo& other); |
| 53 |
|
| 54 |
void AddBookmark(const wxString& location); |
| 55 |
|
| 56 |
void SetBookmarks(const wxArrayString& bookmarks) { this->m_bookmarks = bookmarks; } |
| 57 |
const wxArrayString& GetBookmarks() const { return m_bookmarks; } |
| 58 |
void SetAccountName(const wxString& accountName) { this->m_accountName = accountName; } |
| 59 |
const wxString& GetAccountName() const { return m_accountName; } |
| 60 |
void SetHost(const wxString& host) { this->m_host = host; } |
| 61 |
void SetPassword(const wxString& password) { this->m_password = password; } |
| 62 |
void SetPort(int port) { this->m_port = port; } |
| 63 |
void SetUsername(const wxString& username) { this->m_username = username; } |
| 64 |
const wxString& GetHost() const { return m_host; } |
| 65 |
const wxString& GetPassword() const { return m_password; } |
| 66 |
int GetPort() const { return m_port; } |
| 67 |
const wxString& GetUsername() const { return m_username; } |
| 68 |
void SetDefaultFolder(const wxString& defaultFolder) { this->m_defaultFolder = defaultFolder; } |
| 69 |
const wxString& GetDefaultFolder() const { return m_defaultFolder; } |
| 70 |
|
| 71 |
/** |
| 72 |
* @brief read list of accounts from the JSON file |
| 73 |
* @param matcher a callback that allows the user to filter matches |
| 74 |
*/ |
| 75 |
static SSHAccountInfo::Vect_t Load(const std::function<bool(const SSHAccountInfo&)>& matcher = nullptr); |
| 76 |
/** |
| 77 |
* @brief load a specific account from configuration |
| 78 |
*/ |
| 79 |
static SSHAccountInfo LoadAccount(const wxString& accountName); |
| 80 |
|
| 81 |
/** |
| 82 |
* @brief return user defined SSH client |
| 83 |
*/ |
| 84 |
static wxString GetSSHClient(); |
| 85 |
|
| 86 |
public: |
| 87 |
virtual void FromJSON(const JSONItem& json); |
| 88 |
virtual JSONItem ToJSON() const; |
| 89 |
}; |
| 90 |
#endif // SSHACCOUNTINFO_H |