Yingdi Yu | 1f82464 | 2016-03-20 17:07:22 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2013-2014, Regents of the University of California, |
| 4 | * |
| 5 | * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD |
| 6 | * authors and contributors. |
| 7 | * |
| 8 | * NFD Control Center is free software: you can redistribute it and/or modify it under the |
| 9 | * terms of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY |
| 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 14 | * PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with NFD |
| 17 | * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef NDN_NCC_KEY_VIEWER_DIALOG_HPP |
| 21 | #define NDN_NCC_KEY_VIEWER_DIALOG_HPP |
| 22 | |
| 23 | #include "key-tree-model.hpp" |
Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 24 | #include "cert-tree-model.hpp" |
Yingdi Yu | 1f82464 | 2016-03-20 17:07:22 -0700 | [diff] [blame] | 25 | #include <ndn-cxx/security/key-chain.hpp> |
| 26 | |
| 27 | #include <QDialog> |
Yingdi Yu | addb142 | 2016-03-21 11:01:04 -0700 | [diff] [blame^] | 28 | #include <QTimer> |
Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 29 | |
Yingdi Yu | 1f82464 | 2016-03-20 17:07:22 -0700 | [diff] [blame] | 30 | |
| 31 | namespace Ui { |
| 32 | class KeyViewerDialog; |
| 33 | } |
| 34 | |
| 35 | namespace ndn { |
| 36 | namespace ncc { |
| 37 | |
| 38 | class KeyViewerDialog : public QDialog |
| 39 | { |
| 40 | Q_OBJECT |
| 41 | |
| 42 | public: |
| 43 | KeyViewerDialog(QWidget *parent = 0); |
| 44 | |
| 45 | virtual |
| 46 | ~KeyViewerDialog(); |
| 47 | |
| 48 | void |
| 49 | updateModel(); |
| 50 | |
| 51 | private: |
| 52 | KeyTreeItem* |
| 53 | createIdentityNode(const Name& identity); |
| 54 | |
| 55 | KeyTreeItem* |
| 56 | createKeyNode(const Name& keyName, KeyTreeItem* idItem); |
| 57 | |
| 58 | signals: |
| 59 | void |
| 60 | clicked(const QModelIndex &index); |
| 61 | |
| 62 | public slots: |
| 63 | void |
Yingdi Yu | addb142 | 2016-03-21 11:01:04 -0700 | [diff] [blame^] | 64 | display(); |
Yingdi Yu | 1f82464 | 2016-03-20 17:07:22 -0700 | [diff] [blame] | 65 | |
| 66 | private slots: |
| 67 | void |
| 68 | displayCert(const QModelIndex& index); |
Yingdi Yu | addb142 | 2016-03-21 11:01:04 -0700 | [diff] [blame^] | 69 | |
| 70 | void |
| 71 | present(); |
| 72 | |
| 73 | void |
| 74 | getSelection(const QModelIndex& index); |
| 75 | |
| 76 | void |
| 77 | showContextMenu(const QPoint& point); |
| 78 | |
| 79 | void |
| 80 | setDefault(); |
| 81 | |
Yingdi Yu | 1f82464 | 2016-03-20 17:07:22 -0700 | [diff] [blame] | 82 | // void insertChild(); |
| 83 | // bool insertColumn(); |
| 84 | // void insertRow(); |
| 85 | // bool removeColumn(); |
| 86 | // void removeRow(); |
| 87 | |
| 88 | private: |
| 89 | Ui::KeyViewerDialog* ui; |
| 90 | |
| 91 | shared_ptr<KeyTreeModel> m_model; |
| 92 | shared_ptr<KeyChain> m_keyChain; |
| 93 | |
Yingdi Yu | 95dbc71 | 2016-03-21 09:56:57 -0700 | [diff] [blame] | 94 | shared_ptr<CertTreeModel> m_tableModel; |
Yingdi Yu | addb142 | 2016-03-21 11:01:04 -0700 | [diff] [blame^] | 95 | |
| 96 | QTimer m_timer; |
| 97 | |
| 98 | QModelIndex m_selectedIndex; |
Yingdi Yu | 1f82464 | 2016-03-20 17:07:22 -0700 | [diff] [blame] | 99 | }; |
| 100 | |
| 101 | } // namespace ncc |
| 102 | } // namespace ndn |
| 103 | |
| 104 | #endif // NDN_NCC_KEY_VIEWER_DIALOG_HPP |