1 /*
2  * This file is part of Licq, an instant messaging client for UNIX.
3  * Copyright (C) 2000-2011 Licq developers
4  *
5  * Licq is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * Licq is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with Licq; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef USERVIEWEVENT_H
21 #define USERVIEWEVENT_H
22 
23 #include "usereventcommon.h"
24 
25 class QCheckBox;
26 class QGroupBox;
27 class QPushButton;
28 class QSplitter;
29 class QTreeWidgetItem;
30 
31 namespace Licq
32 {
33 class Event;
34 class UserEvent;
35 }
36 
37 namespace LicqQtGui
38 {
39 class MLView;
40 class MessageList;
41 class SkinnableButton;
42 
43 class UserViewEvent : public UserEventCommon
44 {
45   Q_OBJECT
46 
47 public:
48   /**
49    * Constructor, create and open dialog to view user events
50    *
51    * @param userId User to open dialog for
52    * @param parent Parent widget
53    */
54   UserViewEvent(const Licq::UserId& userId, QWidget* parent = 0);
55   virtual ~UserViewEvent();
56 
57 protected:
58   /**
59    * Overloaded resize event to save new dialog size
60    *
61    * @param event Resize event
62    */
63   virtual void resizeEvent(QResizeEvent* event);
64 
65 private:
66   QSplitter* myReadSplitter;
67   MLView* myMessageView;
68   MessageList* myMessageList;
69   Licq::UserEvent* myCurrentEvent;
70   QCheckBox* myAutoCloseCheck;
71   QGroupBox* myActionsBox;
72   QPushButton* myRead1Button;
73   QPushButton* myRead2Button;
74   QPushButton* myRead3Button;
75   QPushButton* myRead4Button;
76   QPushButton* myReadNextButton;
77   SkinnableButton* myCloseButton;
78 
79   // The currently displayed message in decoded (Unicode) form.
80   QString myMessageText;
81 
82   void generateReply();
83   void sendMsg(QString text);
84   void updateNextButton();
85 
86   /**
87    * A user has been update, this virtual function allows subclasses to add additional handling
88    * This function will only be called if user is in this conversation
89    *
90    * @param userId Updated user
91    * @param subSignal Type of update
92    * @param argument Signal specific argument
93    * @param cid Conversation id
94    */
95   virtual void userUpdated(const Licq::UserId& userId, unsigned long subSignal, int argument, unsigned long cid);
96 
97 private slots:
98   void autoClose();
99   void read1();
100   void read2();
101   void read3();
102   void read4();
103   void readNext();
104   void clearEvent();
105   void closeDialog();
106   void printMessage(QTreeWidgetItem* item);
107   void sentEvent(const Licq::Event* e);
108   void setEncoding();
109 };
110 
111 } // namespace LicqQtGui
112 
113 #endif
114