2 Copyright 2013-2015 Mats Sjöberg
4 This file is part of the Pumpa programme.
6 Pumpa is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Pumpa is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pumpa. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef MESSAGE_WINDOW_H
21 #define MESSAGE_WINDOW_H
25 #include <QVBoxLayout>
27 #include <QHBoxLayout>
28 #include <QPushButton>
29 #include <QFormLayout>
32 #include <QScrollArea>
35 #include "messageedit.h"
36 #include "qactivitystreams.h"
37 #include "pumpasettings.h"
38 #include "texttoolbutton.h"
39 #include "richtextlabel.h"
40 #include "messagerecipients.h"
42 //------------------------------------------------------------------------------
44 class PictureLabel
: public QLabel
{
48 PictureLabel(QWidget
* parent
);
49 void setOriginalPixmap(QPixmap
);
52 virtual void resizeEvent(QResizeEvent
* event
);
54 QPixmap m_originalPixmap
;
57 //------------------------------------------------------------------------------
59 class MessageWindow
: public QDialog
{
63 MessageWindow(PumpaSettings
* s
, const RecipientList
* rl
, QWidget
* parent
=0);
64 virtual void accept();
66 void newMessage(QASObject
* obj
, QASObjectList
* to
, QASObjectList
* cc
);
67 void editMessage(QASObject
* obj
);
69 void setCompletions(const MessageEdit::completion_t
* completions
);
72 virtual void showEvent(QShowEvent
*);
75 void sendMessage(QString
, QString
, RecipientList
, RecipientList
);
76 void sendImage(QString
, QString
, QString
, RecipientList
, RecipientList
);
77 void sendReply(QASObject
*, QString
, RecipientList
, RecipientList
);
78 void sendEdit(QASObject
*, QString
, QString
);
82 void onRemovePicture();
84 void updatePreview(bool force
=false);
85 void onAddRecipient(QASActor
*);
88 void onMarkdownChecked(int);
91 void initWindow(QString title
, QString buttonText
, bool showRecipients
);
92 void addRecipientWindow(MessageRecipients
*, QString
);
93 void updateAddPicture();
95 void copyRecipients(MessageRecipients
*, QASObjectList
*);
96 void setDefaultRecipients(MessageRecipients
*, int);
97 void addToRecipientList(QString
, QASObject
*);
99 QVBoxLayout
* m_layout
;
102 QLabel
* m_markupLabel
;
103 QHBoxLayout
* m_infoLayout
;
105 QCheckBox
* m_markdownCheckBox
;
107 QFormLayout
* m_addressLayout
;
109 MessageEdit
* m_textEdit
;
110 QHBoxLayout
* m_buttonLayout
;
112 QHBoxLayout
* m_pictureButtonLayout
;
113 TextToolButton
* m_addPictureButton
;
114 TextToolButton
* m_removePictureButton
;
115 TextToolButton
* m_addToButton
;
116 TextToolButton
* m_addCcButton
;
121 QLabel
* m_charCountLabel
;
122 RichTextLabel
* m_previewLabel
;
123 QScrollArea
* m_previewArea
;
124 QSplitter
* m_splitter
;
126 PictureLabel
* m_pictureLabel
;
129 QPushButton
* m_cancelButton
;
130 QPushButton
* m_sendButton
;
131 QPushButton
* m_previewButton
;
133 QString m_imageFileName
;
135 MessageRecipients
* m_toRecipients
;
136 MessageRecipients
* m_ccRecipients
;
138 QMap
<QString
, QASObject
*> m_recipientSelection
;
139 QStringList m_recipientList
;
146 const RecipientList
* m_rl
;