1 /*  This file was part of the KDE libraries
2 
3     SPDX-FileCopyrightText: 2021 Tomaz Canabrava <tcanabrava@kde.org>
4 
5     SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #ifndef SSHMANAGERMODEL_H
9 #define SSHMANAGERMODEL_H
10 
11 #include <QStandardItemModel>
12 
13 #include <memory>
14 
15 class SSHConfigurationData;
16 
17 class SSHManagerModel : public QStandardItemModel
18 {
19     Q_OBJECT
20 public:
21     enum Roles {
22         SSHRole = Qt::UserRole + 1,
23     };
24 
25     SSHManagerModel(QObject *parent = nullptr);
26     ~SSHManagerModel() override;
27 
28     QStandardItem *addTopLevelItem(const QString &toplevel);
29     void addChildItem(const SSHConfigurationData &config, const QString &parentName);
30     void editChildItem(const SSHConfigurationData &config, const QModelIndex &idx);
31     void removeIndex(const QModelIndex &idx);
32     bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
33     QStringList folders() const;
34 
35     Qt::ItemFlags flags(const QModelIndex &index) const override;
36 
37     void startImportFromSshConfig();
38     void importFromSshConfigFile(const QString &file);
39     void load();
40     void save();
41 };
42 
43 #endif
44