Yingdi Yu | d59b593 | 2013-10-16 13:16:49 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Yingdi Yu |
| 5 | * |
| 6 | * BSD license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 9 | */ |
| 10 | |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 11 | #ifndef ADDCONTACTPANEL_H |
| 12 | #define ADDCONTACTPANEL_H |
| 13 | |
| 14 | #include <QDialog> |
Yingdi Yu | c29fb98 | 2013-10-20 19:43:10 -0700 | [diff] [blame] | 15 | #include <QMetaType> |
| 16 | #include "warningdialog.h" |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 17 | |
Yingdi Yu | d59b593 | 2013-10-16 13:16:49 -0700 | [diff] [blame] | 18 | #ifndef Q_MOC_RUN |
| 19 | #include "endorse-certificate.h" |
Yingdi Yu | 79c25a2 | 2013-10-21 13:38:38 -0700 | [diff] [blame] | 20 | #include "profile.h" |
Yingdi Yu | 0b82a4e | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 21 | #include "contact-manager.h" |
Yingdi Yu | d59b593 | 2013-10-16 13:16:49 -0700 | [diff] [blame] | 22 | #endif |
| 23 | |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 24 | namespace Ui { |
| 25 | class AddContactPanel; |
| 26 | } |
| 27 | |
Yingdi Yu | c29fb98 | 2013-10-20 19:43:10 -0700 | [diff] [blame] | 28 | Q_DECLARE_METATYPE(ndn::Name) |
| 29 | |
| 30 | Q_DECLARE_METATYPE(EndorseCertificate) |
| 31 | |
Yingdi Yu | 8dacdf2 | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 32 | Q_DECLARE_METATYPE(ndn::Data) |
| 33 | |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 34 | class AddContactPanel : public QDialog |
| 35 | { |
Yingdi Yu | 0b82a4e | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 36 | Q_OBJECT |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 37 | |
| 38 | public: |
Yingdi Yu | 6420611 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 39 | explicit AddContactPanel(ndn::ptr_lib::shared_ptr<ContactManager> contactManager, |
Yingdi Yu | 0b82a4e | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 40 | QWidget *parent = 0); |
| 41 | |
| 42 | ~AddContactPanel(); |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 43 | |
Yingdi Yu | 8dacdf2 | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 44 | private: |
| 45 | void |
| 46 | displayContactInfo(); |
| 47 | |
| 48 | bool |
| 49 | isCorrectName(const ndn::Name& name); |
| 50 | |
Yingdi Yu | c9ffa9f | 2014-01-13 11:19:47 -0800 | [diff] [blame^] | 51 | // static bool |
| 52 | // isSameBlob(const ndn::Blob& blobA, const ndn::Blob& blobB); |
Yingdi Yu | 6420611 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 53 | |
Yingdi Yu | d59b593 | 2013-10-16 13:16:49 -0700 | [diff] [blame] | 54 | private slots: |
| 55 | void |
| 56 | onCancelClicked(); |
| 57 | |
| 58 | void |
| 59 | onSearchClicked(); |
| 60 | |
| 61 | void |
| 62 | onAddClicked(); |
| 63 | |
Yingdi Yu | aa8d769 | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 64 | void |
Yingdi Yu | c29fb98 | 2013-10-20 19:43:10 -0700 | [diff] [blame] | 65 | selfEndorseCertificateFetched(const EndorseCertificate& endorseCertificate); |
| 66 | |
| 67 | void |
| 68 | selfEndorseCertificateFetchFailed(const ndn::Name& identity); |
Yingdi Yu | aa8d769 | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 69 | |
Yingdi Yu | 8dacdf2 | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 70 | void |
| 71 | onContactKeyFetched(const EndorseCertificate& endorseCertificate); |
| 72 | |
| 73 | void |
| 74 | onContactKeyFetchFailed(const ndn::Name& identity); |
| 75 | |
| 76 | void |
| 77 | onCollectEndorseFetched(const ndn::Data& data); |
| 78 | |
| 79 | void |
| 80 | onCollectEndorseFetchFailed(const ndn::Name& identity); |
| 81 | |
Yingdi Yu | 79c25a2 | 2013-10-21 13:38:38 -0700 | [diff] [blame] | 82 | signals: |
| 83 | void |
| 84 | newContactAdded(); |
| 85 | |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 86 | private: |
Yingdi Yu | d59b593 | 2013-10-16 13:16:49 -0700 | [diff] [blame] | 87 | Ui::AddContactPanel *ui; |
Yingdi Yu | aa8d769 | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 88 | ndn::Name m_searchIdentity; |
Yingdi Yu | 6420611 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 89 | ndn::ptr_lib::shared_ptr<ContactManager> m_contactManager; |
Yingdi Yu | c29fb98 | 2013-10-20 19:43:10 -0700 | [diff] [blame] | 90 | WarningDialog* m_warningDialog; |
Yingdi Yu | 6420611 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 91 | ndn::ptr_lib::shared_ptr<EndorseCertificate> m_currentEndorseCertificate; |
| 92 | ndn::ptr_lib::shared_ptr<ndn::Data> m_currentCollectEndorse; |
Yingdi Yu | 8dacdf2 | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 93 | bool m_currentEndorseCertificateReady; |
| 94 | bool m_currentCollectEndorseReady; |
Yingdi Yu | a489875 | 2013-10-15 20:31:37 -0700 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | #endif // ADDCONTACTPANEL_H |