blob: 74010fc1593df955fb18408490372ac72885fa76 [file] [log] [blame]
Yingdi Yu348f5ea2014-03-01 14:47:25 -08001/* -*- 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
11#ifndef CONTACT_PANEL_H
12#define CONTACT_PANEL_H
13
14#include <QDialog>
15#include <QStringListModel>
16#include <QSqlTableModel>
17
18#include "set-alias-dialog.h"
19#include "endorse-combobox-delegate.h"
20
21#ifndef Q_MOC_RUN
22#endif
23
24
25namespace Ui {
26class ContactPanel;
27}
28
29class ContactPanel : public QDialog
30{
31 Q_OBJECT
32
33public:
34 explicit
35 ContactPanel(QWidget *parent = 0);
36
37 virtual
38 ~ContactPanel();
39
40private:
41 void
42 resetPanel();
43
44signals:
45 void
46 waitForContactList();
47
48 void
49 waitForContactInfo(const QString& identity);
50
51 void
52 removeContact(const QString& identity);
53
54 void
55 updateAlias(const QString& identity, const QString& alias);
56
57 void
58 updateIsIntroducer(const QString& identity, bool isIntro);
59
60 void
61 updateEndorseCertificate(const QString& identity);
62
63 void
64 warning(const QString& msg);
65
66public slots:
67 void
68 onCloseDBModule();
69
70 void
71 onIdentityUpdated(const QString& identity);
72
73 void
74 onContactAliasListReady(const QStringList& aliasList);
75
76 void
77 onContactIdListReady(const QStringList& idList);
78
79 void
80 onContactInfoReady(const QString& identity,
81 const QString& name,
82 const QString& institute,
83 bool isIntro);
84
85private slots:
86 void
87 onSelectionChanged(const QItemSelection &selected,
88 const QItemSelection &deselected);
89
90 void
91 onContextMenuRequested(const QPoint& pos);
92
93 void
94 onSetAliasDialogRequested();
95
96 void
97 onContactDeletionRequested();
98
99 void
100 onIsIntroducerChanged(int state);
101
102 void
103 onAddScopeClicked();
104
105 void
106 onDeleteScopeClicked();
107
108 void
109 onSaveScopeClicked();
110
111 void
112 onEndorseButtonClicked();
113
114 void
115 onAliasChanged(const QString& identity, const QString& alias);
116
117private:
118 Ui::ContactPanel* ui;
119
120 // Dialogs.
121 SetAliasDialog* m_setAliasDialog;
122
123 // Models.
124 QStringListModel* m_contactListModel;
125 QSqlTableModel* m_trustScopeModel;
126 QSqlTableModel* m_endorseDataModel;
127
128 // Delegates.
129 EndorseComboBoxDelegate* m_endorseComboBoxDelegate;
130
131 // Actions.
132 QAction* m_menuAlias;
133 QAction* m_menuDelete;
134
135 // Internal data structure.
136 QStringList m_contactAliasList;
137 QStringList m_contactIdList;
138 QString m_currentSelectedContact;
139};
140
141#endif // CONTACT_PANEL_H