Added coordinates to Messages, added Message type.
[situare] / src / ui / messagepanel.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Jussi Laitinen - jussi.laitinen@ixonos.com
6
7     Situare is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License
9     version 2 as published by the Free Software Foundation.
10
11     Situare is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with Situare; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19     USA.
20 */
21
22 #ifndef NOTIFICATIONPANEL_H
23 #define NOTIFICATIONPANEL_H
24
25 #include "panelbase.h"
26
27 class ExtendedListItemDelegate;
28 class GeoCoordinate;
29 class HeaderListItemDelegate;
30 class ImageButton;
31 class Message;
32 class MessageListView;
33
34 /**
35  * @brief Message panel
36  *
37  * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
38  */
39 class MessagePanel : public PanelBase
40 {
41     Q_OBJECT
42
43 public:
44     /**
45      * @brief Default constructor
46      *
47      * @param parent
48      */
49     MessagePanel(QWidget *parent = 0);
50
51 /*******************************************************************************
52  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
53  ******************************************************************************/
54 protected:
55     /**
56     * @brief Re-implemented from QWidget::hideEvent()
57     *
58     * Calls clearListsSelections()
59     *
60     * @param event
61     */
62     void hideEvent(QHideEvent *event);
63
64 /*******************************************************************************
65  * MEMBER FUNCTIONS AND SLOTS
66  ******************************************************************************/
67 private slots:
68     /**
69     * @brief Called when any of the panel tabs is closed
70     *
71     * Calls clear item selection to list.
72     */
73     void anyPanelClosed();
74
75     /**
76     * @brief Called when message button is pressed.
77     *
78     * Calls requestMessageDialog with message receiver's ID and name
79     */
80     void messageButtonPressed();
81
82     /**
83     * @brief Populates message list view.
84     *
85     * @param received list of received Message objects
86     * @param sent list of sent Message objects
87     */
88     void populateMessageListView(QList<Message> &received, QList<Message> &sent);
89
90     /**
91     * @brief Removes message.
92     *
93     * Removes selected message from list view and emits removeMessage signal.
94     */
95     void removeMessage();
96
97     /**
98     * @brief Sets person's image.
99     *
100     * @param id image ID
101     * @param image image pixmap
102     */
103     void setImage(const QString &id, const QPixmap &image);
104
105 private:
106     /**
107     * @brief Inits item delegates for message list view.
108     */
109     void initItemDelegates();
110
111 /*******************************************************************************
112  * SIGNALS
113  ******************************************************************************/
114 signals:
115     /**
116      * @brief Signal for friend finding
117      *
118      * @param coordinates Target coordinate
119      */
120     void findFriend(const GeoCoordinate &coordinates);
121
122     /**
123     * @brief Requests message dialog.
124     *
125     * @param receiver receiver facebook ID and name
126     */
127     void requestMessageDialog(const QPair<QString, QString> &receiver);
128
129     /**
130     * @brief Requests messages sent to the user.
131     */
132     void requestMessages();
133
134     /**
135     * @brief Requests message remove.
136     *
137     * @param id message ID
138     */
139     void requestRemoveMessage(const QString &id);
140
141 /*******************************************************************************
142  * DATA MEMBERS
143  ******************************************************************************/
144 private:
145     MessageListView *m_messageListView;    ///< Message list view
146
147     ExtendedListItemDelegate *m_messageListItemDelegate;    ///< Message list item delegate
148     HeaderListItemDelegate *m_headerListItemDelegate;       ///< Header list item delegate
149 };
150
151 #endif // NOTIFICATIONPANEL_H