File indexing completed on 2024-05-19 05:54:13
0001 /* This file was part of the KDE libraries 0002 0003 SPDX-FileCopyrightText: 2021 Tomaz Canabrava <tcanabrava@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef SSSHMANAGERPLUGINWIDGET_H 0009 #define SSSHMANAGERPLUGINWIDGET_H 0010 0011 #include <QModelIndex> 0012 #include <QWidget> 0013 #include <memory> 0014 0015 #include "sshconfigurationdata.h" 0016 0017 namespace Ui 0018 { 0019 class SSHTreeWidget; 0020 } 0021 0022 namespace Konsole 0023 { 0024 class SessionController; 0025 } 0026 class SSHManagerModel; 0027 0028 class SSHManagerTreeWidget : public QWidget 0029 { 0030 Q_OBJECT 0031 public: 0032 explicit SSHManagerTreeWidget(QWidget *parent = nullptr); 0033 ~SSHManagerTreeWidget() override; 0034 0035 // shows the panel for add a new ssh info. 0036 Q_SLOT void showInfoPane(); 0037 0038 // hides the panel. 0039 Q_SLOT void hideInfoPane(); 0040 0041 // saves the currently new ssh info 0042 Q_SLOT void addSshInfo(); 0043 0044 // clears the panel 0045 Q_SLOT void clearSshInfo(); 0046 0047 // save the currently edited ssh info 0048 Q_SLOT void saveEdit(); 0049 0050 // display the panel for editing 0051 Q_SLOT void editSshInfo(); 0052 0053 // starts importing from ~/.ssh/config 0054 Q_SLOT void requestImport(); 0055 0056 Q_SLOT void handleTreeClick(Qt::MouseButton btn, const QModelIndex idx); 0057 0058 Q_SIGNAL void requestNewTab(); 0059 0060 void setEditComponentsEnabled(bool enabled); 0061 0062 void setModel(SSHManagerModel *model); 0063 void triggerDelete(); 0064 void setCurrentController(Konsole::SessionController *controller); 0065 void handleImportedData(bool isImported); 0066 0067 Q_SIGNAL void quickAccessShortcutChanged(QKeySequence shortcut); 0068 0069 protected: 0070 void showEvent(QShowEvent *) override; 0071 0072 private: 0073 void updateProfileList(); 0074 0075 std::pair<bool, QString> checkFields() const; 0076 SSHConfigurationData info() const; 0077 0078 struct Private; 0079 std::unique_ptr<Ui::SSHTreeWidget> ui; 0080 std::unique_ptr<Private> d; 0081 }; 0082 0083 #endif