2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
2007-11-18 18:35:53 -05:00
|
|
|
* Copyright (C) 2007, RetroShare Team
|
2007-11-14 22:18:48 -05:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2008-11-25 20:19:09 -05:00
|
|
|
****************************************************************/
|
|
|
|
|
2010-05-23 15:13:41 -04:00
|
|
|
#ifndef _MESSAGECOMPOSER_H
|
|
|
|
#define _MESSAGECOMPOSER_H
|
2008-11-25 20:19:09 -05:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include <QMainWindow>
|
2010-08-06 05:40:23 -04:00
|
|
|
#include <retroshare/rstypes.h>
|
2010-05-23 15:13:41 -04:00
|
|
|
#include "ui_MessageComposer.h"
|
2008-03-24 13:36:17 -04:00
|
|
|
|
|
|
|
class QAction;
|
2008-11-25 20:19:09 -05:00
|
|
|
class QComboBox;
|
|
|
|
class QFontComboBox;
|
|
|
|
class QTextEdit;
|
|
|
|
class QTextCharFormat;
|
2010-09-27 17:05:52 -04:00
|
|
|
class RSTreeWidgetItemCompareRole;
|
2008-11-25 20:19:09 -05:00
|
|
|
|
2010-05-23 15:13:41 -04:00
|
|
|
class MessageComposer : public QMainWindow
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
2010-09-27 17:05:52 -04:00
|
|
|
Q_OBJECT
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2008-11-25 20:19:09 -05:00
|
|
|
public:
|
2010-09-27 17:05:52 -04:00
|
|
|
enum enumType { TO, CC, BCC };
|
2010-11-02 17:11:11 -04:00
|
|
|
enum enumMessageType { NORMAL, REPLY, FORWARD };
|
2008-11-25 20:19:09 -05:00
|
|
|
|
2010-09-27 17:05:52 -04:00
|
|
|
public:
|
|
|
|
/** Default Constructor */
|
|
|
|
|
|
|
|
MessageComposer(QWidget *parent = 0, Qt::WFlags flags = 0);
|
|
|
|
~MessageComposer();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-09-27 17:05:52 -04:00
|
|
|
static void msgFriend(std::string id, bool group);
|
2012-01-23 17:38:50 -05:00
|
|
|
static void recommendFriend(std::list <std::string> &sslIds);
|
2010-06-17 13:39:32 -04:00
|
|
|
|
2010-11-02 17:11:11 -04:00
|
|
|
static MessageComposer *newMsg(const std::string &msgId = "");
|
|
|
|
static MessageComposer *replyMsg(const std::string &msgId, bool all);
|
|
|
|
static MessageComposer *forwardMsg(const std::string &msgId);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-09-27 17:05:52 -04:00
|
|
|
/* worker fns */
|
|
|
|
void insertFileList(const std::list<DirDetails>&);
|
|
|
|
void insertFileList(const std::list<FileInfo>&);
|
2010-11-07 16:33:48 -05:00
|
|
|
void addFile(const FileInfo &fileInfo);
|
2010-11-02 17:11:11 -04:00
|
|
|
void insertTitleText(const QString &title, enumMessageType type = NORMAL);
|
|
|
|
void insertPastedText(QString msg) ;
|
|
|
|
void insertForwardPastedText(QString msg);
|
|
|
|
void insertHtmlText(const QString &msg);
|
|
|
|
void insertMsgText(const QString &msg);
|
2010-09-27 17:05:52 -04:00
|
|
|
void addRecipient(enumType type, const std::string &id, bool group);
|
|
|
|
void Create_New_Image_Tag(const QString urlremoteorlocal);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
public slots:
|
2010-09-27 17:05:52 -04:00
|
|
|
/* actions to take.... */
|
|
|
|
void sendMessage();
|
|
|
|
void cancelMessage();
|
|
|
|
void addImage();
|
2010-05-25 13:18:12 -04:00
|
|
|
|
2010-09-27 17:05:52 -04:00
|
|
|
void changeFormatType(int styleIndex );
|
2010-05-25 13:18:12 -04:00
|
|
|
|
2007-11-18 18:35:53 -05:00
|
|
|
protected:
|
2010-09-27 17:05:52 -04:00
|
|
|
void closeEvent (QCloseEvent * event);
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
2007-11-18 18:35:53 -05:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
private slots:
|
2010-09-27 17:05:52 -04:00
|
|
|
/* toggle Contacts DockWidget */
|
2010-11-21 16:12:35 -05:00
|
|
|
void contextMenu(QPoint);
|
|
|
|
void pasteLink();
|
|
|
|
void contextMenuFileList(QPoint);
|
2011-05-21 12:26:00 -04:00
|
|
|
void contextMenuMsgSendList(QPoint);
|
2010-11-21 16:12:35 -05:00
|
|
|
void pasteRecommended();
|
2010-09-27 17:05:52 -04:00
|
|
|
void on_contactsdockWidget_visibilityChanged(bool visible);
|
|
|
|
void toggleContacts();
|
2012-01-26 19:32:17 -05:00
|
|
|
void buildCompleter();
|
2010-09-27 17:05:52 -04:00
|
|
|
|
|
|
|
void fileNew();
|
|
|
|
void fileOpen();
|
|
|
|
bool fileSave();
|
|
|
|
bool fileSaveAs();
|
|
|
|
void filePrint();
|
|
|
|
void saveasDraft();
|
|
|
|
|
|
|
|
//void filePrintPreview();
|
|
|
|
void filePrintPdf();
|
|
|
|
|
|
|
|
void textBold();
|
|
|
|
void textUnderline();
|
|
|
|
void textItalic();
|
|
|
|
void textFamily(const QString &f);
|
|
|
|
void textSize(const QString &p);
|
|
|
|
void textStyle(int styleIndex);
|
|
|
|
void textColor();
|
|
|
|
void textAlign(QAction *a);
|
2010-11-10 08:35:38 -05:00
|
|
|
void smileyWidget();
|
|
|
|
void addSmileys();
|
2010-09-27 17:05:52 -04:00
|
|
|
|
|
|
|
void currentCharFormatChanged(const QTextCharFormat &format);
|
|
|
|
void cursorPositionChanged();
|
|
|
|
|
|
|
|
void clipboardDataChanged();
|
|
|
|
|
2011-12-07 08:08:12 -05:00
|
|
|
void fileHashingStarted();
|
|
|
|
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
2010-09-27 17:05:52 -04:00
|
|
|
|
|
|
|
void attachFile();
|
|
|
|
|
|
|
|
void fontSizeIncrease();
|
|
|
|
void fontSizeDecrease();
|
|
|
|
void blockQuote();
|
|
|
|
void toggleCode();
|
|
|
|
void addPostSplitter();
|
|
|
|
|
|
|
|
void titleChanged();
|
|
|
|
|
|
|
|
// Add to To/Cc/Bcc address fields
|
2011-05-21 12:26:00 -04:00
|
|
|
void addTo();
|
|
|
|
void addCc();
|
|
|
|
void addBcc();
|
|
|
|
void addRecommend();
|
2010-09-27 17:05:52 -04:00
|
|
|
void editingRecipientFinished();
|
2011-05-21 12:26:00 -04:00
|
|
|
void friendDetails();
|
2010-09-27 17:05:52 -04:00
|
|
|
|
|
|
|
void peerStatusChanged(const QString& peer_id, int status);
|
2010-07-07 19:03:34 -04:00
|
|
|
|
2011-05-21 12:26:00 -04:00
|
|
|
void tagAboutToShow();
|
|
|
|
void tagSet(int tagId, bool set);
|
|
|
|
void tagRemoveAll();
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
private:
|
2010-09-27 17:05:52 -04:00
|
|
|
void processSettings(bool bLoad);
|
|
|
|
|
2011-05-21 12:26:00 -04:00
|
|
|
void addContact(enumType type);
|
2010-09-27 17:05:52 -04:00
|
|
|
void setTextColor(const QColor& col) ;
|
|
|
|
void setupFileActions();
|
|
|
|
void setupEditActions();
|
|
|
|
void setupViewActions();
|
|
|
|
void setupInsertActions();
|
|
|
|
void setupFormatActions();
|
|
|
|
|
|
|
|
bool load(const QString &f);
|
|
|
|
bool maybeSave();
|
|
|
|
//bool image_extension( QString nametomake );
|
|
|
|
void setCurrentFileName(const QString &fileName);
|
2008-03-24 13:36:17 -04:00
|
|
|
|
2008-11-25 20:19:09 -05:00
|
|
|
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
|
|
|
|
void fontChanged(const QFont &f);
|
|
|
|
void colorChanged(const QColor &c);
|
2008-03-24 13:36:17 -04:00
|
|
|
void alignmentChanged(Qt::Alignment a);
|
2008-11-25 20:19:09 -05:00
|
|
|
|
2010-11-02 17:11:11 -04:00
|
|
|
bool sendMessage_internal(bool bDraftbox);
|
2010-09-27 17:05:52 -04:00
|
|
|
|
|
|
|
void calculateTitle();
|
|
|
|
void addEmptyRecipient();
|
|
|
|
|
|
|
|
bool getRecipientFromRow(int row, enumType &type, std::string &id, bool &group);
|
|
|
|
void setRecipientToRow(int row, enumType type, std::string id, bool group);
|
|
|
|
|
2011-05-21 12:26:00 -04:00
|
|
|
void clearTagLabels();
|
|
|
|
void showTagLabels();
|
|
|
|
|
2010-09-27 17:05:52 -04:00
|
|
|
QAction *actionSave,
|
|
|
|
*actionAlignLeft,
|
|
|
|
*actionAlignCenter,
|
|
|
|
*actionAlignRight,
|
|
|
|
*actionAlignJustify,
|
|
|
|
*actionUndo,
|
|
|
|
*actionRedo,
|
|
|
|
*actionCut,
|
|
|
|
*actionCopy,
|
|
|
|
*actionPaste;
|
|
|
|
|
|
|
|
QAction *contactSidebarAction;
|
|
|
|
|
|
|
|
QTreeView *channelstreeView;
|
|
|
|
|
|
|
|
QString fileName;
|
|
|
|
QString nametomake;
|
|
|
|
|
|
|
|
QColor codeBackground;
|
|
|
|
QTextCharFormat defaultCharFormat;
|
|
|
|
|
|
|
|
QHash<QString, QString> autoLinkDictionary;
|
|
|
|
QHash<QString, QString> autoLinkTitleDictionary;
|
|
|
|
QHash<QString, int> autoLinkTargetDictionary;
|
|
|
|
|
2010-11-02 17:11:11 -04:00
|
|
|
std::string m_msgParentId; // parent message id
|
2010-09-27 17:05:52 -04:00
|
|
|
std::string m_sDraftMsgId; // existing message id
|
2010-11-02 17:11:11 -04:00
|
|
|
enumMessageType m_msgType;
|
2011-05-21 12:26:00 -04:00
|
|
|
std::list<uint32_t> m_tagIds;
|
|
|
|
QList<QLabel*> tagLabels;
|
2010-09-27 17:05:52 -04:00
|
|
|
|
|
|
|
RSTreeWidgetItemCompareRole *m_compareRole;
|
|
|
|
QCompleter *m_completer;
|
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::MessageComposer ui;
|
|
|
|
|
|
|
|
std::list<FileInfo> _recList ;
|
2008-11-25 20:19:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|