| 38 | } |
| 39 | |
| 40 | SSHManagerModel::SSHManagerModel(QObject *parent) |
| 41 | : QStandardItemModel(parent) |
| 42 | { |
| 43 | load(); |
| 44 | if (!m_sshConfigTopLevelItem) { |
| 45 | // this also sets the m_sshConfigTopLevelItem if the text is `SSH Config`. |
| 46 | addTopLevelItem(i18nc("@item:inlistbox Hosts from ssh/config file", "SSH Config")); |
| 47 | } |
| 48 | if (invisibleRootItem()->rowCount() == 0) { |
| 49 | addTopLevelItem(i18nc("@item:inlistbox The default list of ssh hosts", "Default")); |
| 50 | } |
| 51 | if (QFileInfo::exists(sshDir + QStringLiteral("config"))) { |
| 52 | m_sshConfigWatcher.addPath(sshDir + QStringLiteral("config")); |
| 53 | connect(&m_sshConfigWatcher, &QFileSystemWatcher::fileChanged, this, [this] { |
| 54 | startImportFromSshConfig(); |
| 55 | }); |
| 56 | startImportFromSshConfig(); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | SSHManagerModel::~SSHManagerModel() noexcept |
| 61 | { |