blob: 51ba99880c41df355451abfb7fbd1b53b8be6051 [file] [log] [blame]
Yingdi Yu1f824642016-03-20 17:07:22 -07001/* -*- 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 Yu95dbc712016-03-21 09:56:57 -070024#include "cert-tree-model.hpp"
Yingdi Yu1f824642016-03-20 17:07:22 -070025#include <ndn-cxx/security/key-chain.hpp>
26
27#include <QDialog>
Yingdi Yuaddb1422016-03-21 11:01:04 -070028#include <QTimer>
Yingdi Yu95dbc712016-03-21 09:56:57 -070029
Yingdi Yu1f824642016-03-20 17:07:22 -070030
31namespace Ui {
32class KeyViewerDialog;
33}
34
35namespace ndn {
36namespace ncc {
37
38class KeyViewerDialog : public QDialog
39{
40 Q_OBJECT
41
42public:
43 KeyViewerDialog(QWidget *parent = 0);
44
45 virtual
46 ~KeyViewerDialog();
47
48 void
49 updateModel();
50
51private:
52 KeyTreeItem*
53 createIdentityNode(const Name& identity);
54
55 KeyTreeItem*
56 createKeyNode(const Name& keyName, KeyTreeItem* idItem);
57
58signals:
59 void
60 clicked(const QModelIndex &index);
61
62public slots:
63 void
Yingdi Yuaddb1422016-03-21 11:01:04 -070064 display();
Yingdi Yu1f824642016-03-20 17:07:22 -070065
66private slots:
67 void
68 displayCert(const QModelIndex& index);
Yingdi Yuaddb1422016-03-21 11:01:04 -070069
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 Yu1f824642016-03-20 17:07:22 -070082 // void insertChild();
83 // bool insertColumn();
84 // void insertRow();
85 // bool removeColumn();
86 // void removeRow();
87
88private:
89 Ui::KeyViewerDialog* ui;
90
91 shared_ptr<KeyTreeModel> m_model;
92 shared_ptr<KeyChain> m_keyChain;
93
Yingdi Yu95dbc712016-03-21 09:56:57 -070094 shared_ptr<CertTreeModel> m_tableModel;
Yingdi Yuaddb1422016-03-21 11:01:04 -070095
96 QTimer m_timer;
97
98 QModelIndex m_selectedIndex;
Yingdi Yu1f824642016-03-20 17:07:22 -070099};
100
101} // namespace ncc
102} // namespace ndn
103
104#endif // NDN_NCC_KEY_VIEWER_DIALOG_HPP