2007-11-15 03:18:48 +00:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
2007-11-18 23:35:53 +00:00
|
|
|
* Copyright (C) 2007, RetroShare Team
|
2007-11-15 03:18:48 +00: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-26 01:19:09 +00:00
|
|
|
****************************************************************/
|
|
|
|
|
2010-05-23 19:13:41 +00:00
|
|
|
#ifndef _MESSAGECOMPOSER_H
|
|
|
|
#define _MESSAGECOMPOSER_H
|
2008-11-26 01:19:09 +00:00
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
#include <QMainWindow>
|
2010-07-23 18:52:58 +00:00
|
|
|
#include <QSettings>
|
2010-08-06 09:40:23 +00:00
|
|
|
#include <retroshare/rstypes.h>
|
2010-05-23 19:13:41 +00:00
|
|
|
#include "ui_MessageComposer.h"
|
2008-03-24 17:36:17 +00:00
|
|
|
|
|
|
|
class QAction;
|
2008-11-26 01:19:09 +00:00
|
|
|
class QComboBox;
|
|
|
|
class QFontComboBox;
|
|
|
|
class QTextEdit;
|
|
|
|
class QTextCharFormat;
|
2010-07-23 18:52:58 +00:00
|
|
|
class AttachFileItem;
|
2008-11-26 01:19:09 +00:00
|
|
|
|
2010-05-23 19:13:41 +00:00
|
|
|
class MessageComposer : public QMainWindow
|
2007-11-15 03:18:48 +00:00
|
|
|
{
|
2008-11-26 01:19:09 +00:00
|
|
|
Q_OBJECT
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
public:
|
|
|
|
/** Default Constructor */
|
|
|
|
|
2010-05-25 09:32:14 +00:00
|
|
|
MessageComposer(QWidget *parent = 0, Qt::WFlags flags = 0);
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-06-17 17:39:32 +00:00
|
|
|
static void msgFriend(std::string id);
|
2010-07-15 11:25:34 +00:00
|
|
|
static void recommendFriend(std::list <std::string> &peerids);
|
2010-06-17 17:39:32 +00:00
|
|
|
|
2010-05-25 09:32:14 +00:00
|
|
|
void newMsg(std::string msgId = "");
|
2007-11-15 03:18:48 +00:00
|
|
|
|
|
|
|
/* worker fns */
|
2010-05-25 09:32:14 +00:00
|
|
|
void insertSendList();
|
|
|
|
void insertFileList(const std::list<DirDetails>&);
|
2010-04-26 21:11:19 +00:00
|
|
|
void insertFileList(const std::list<FileInfo>&);
|
2010-01-25 14:03:38 +00:00
|
|
|
void insertTitleText(std::string title);
|
|
|
|
void insertPastedText(std::string msg) ;
|
|
|
|
void insertForwardPastedText(std::string msg);
|
|
|
|
void insertHtmlText(std::string msg);
|
|
|
|
void insertMsgText(std::string msg);
|
|
|
|
void addRecipient(std::string id) ;
|
|
|
|
void Create_New_Image_Tag( const QString urlremoteorlocal );
|
2008-03-25 12:28:13 +00:00
|
|
|
QSettings setter;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
|
|
|
public slots:
|
2008-11-26 01:19:09 +00:00
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
/* actions to take.... */
|
2010-01-25 14:03:38 +00:00
|
|
|
void sendMessage();
|
|
|
|
void cancelMessage();
|
|
|
|
void addImage();
|
2010-05-25 17:18:12 +00:00
|
|
|
|
|
|
|
void changeFormatType(int styleIndex );
|
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2007-11-18 23:35:53 +00:00
|
|
|
protected:
|
|
|
|
void closeEvent (QCloseEvent * event);
|
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
private slots:
|
2008-03-24 17:36:17 +00:00
|
|
|
|
|
|
|
/* toggle Contacts DockWidget */
|
|
|
|
void toggleContacts();
|
2007-11-15 03:18:48 +00:00
|
|
|
|
|
|
|
/* for toggling flags */
|
|
|
|
void togglePersonItem( QTreeWidgetItem *item, int col );
|
|
|
|
void toggleRecommendItem( QTreeWidgetItem *item, int col );
|
2008-03-24 17:36:17 +00:00
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
void fileNew();
|
|
|
|
void fileOpen();
|
|
|
|
bool fileSave();
|
|
|
|
bool fileSaveAs();
|
2010-05-25 10:41:26 +00:00
|
|
|
void filePrint();
|
|
|
|
void saveasDraft();
|
2008-11-26 01:19:09 +00:00
|
|
|
|
|
|
|
//void filePrintPreview();
|
2008-03-25 01:41:01 +00:00
|
|
|
void filePrintPdf();
|
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
void currentCharFormatChanged(const QTextCharFormat &format);
|
2008-03-24 17:36:17 +00:00
|
|
|
void cursorPositionChanged();
|
2008-03-25 01:41:01 +00:00
|
|
|
|
|
|
|
void clipboardDataChanged();
|
2010-01-20 21:39:27 +00:00
|
|
|
|
|
|
|
void fileHashingFinished(AttachFileItem* file);
|
|
|
|
|
|
|
|
void attachFile();
|
|
|
|
void addAttachment(std::string);
|
2010-01-21 16:35:00 +00:00
|
|
|
void checkAttachmentReady();
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-01-25 14:03:38 +00:00
|
|
|
void fontSizeIncrease();
|
|
|
|
void fontSizeDecrease();
|
|
|
|
void blockQuote();
|
|
|
|
void toggleCode();
|
2010-01-25 15:36:24 +00:00
|
|
|
void addPostSplitter();
|
2010-01-25 14:03:38 +00:00
|
|
|
|
2010-05-29 19:05:10 +00:00
|
|
|
void filterRegExpChanged();
|
|
|
|
void clearFilter();
|
2010-07-07 23:03:34 +00:00
|
|
|
void titleChanged();
|
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
private:
|
2008-09-08 12:41:46 +00:00
|
|
|
void setTextColor(const QColor& col) ;
|
2008-03-25 01:41:01 +00:00
|
|
|
void setupFileActions();
|
|
|
|
void setupEditActions();
|
2008-03-26 19:30:34 +00:00
|
|
|
void setupViewActions();
|
|
|
|
void setupInsertActions();
|
2010-05-25 22:30:25 +00:00
|
|
|
void setupFormatActions();
|
2008-03-26 19:30:34 +00:00
|
|
|
|
2008-03-25 01:41:01 +00:00
|
|
|
bool load(const QString &f);
|
|
|
|
bool maybeSave();
|
2008-03-25 12:28:13 +00:00
|
|
|
//bool image_extension( QString nametomake );
|
2008-03-25 01:41:01 +00:00
|
|
|
void setCurrentFileName(const QString &fileName);
|
2008-03-24 17:36:17 +00:00
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
|
|
|
|
void fontChanged(const QFont &f);
|
|
|
|
void colorChanged(const QColor &c);
|
2008-03-24 17:36:17 +00:00
|
|
|
void alignmentChanged(Qt::Alignment a);
|
2008-11-26 01:19:09 +00:00
|
|
|
|
2010-05-25 09:32:14 +00:00
|
|
|
void sendMessage_internal(bool bDraftbox);
|
2010-05-29 19:05:10 +00:00
|
|
|
|
|
|
|
void FilterItems();
|
|
|
|
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern);
|
2010-05-25 09:32:14 +00:00
|
|
|
|
2010-07-07 23:03:34 +00:00
|
|
|
void calculateTitle();
|
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
/** Define the popup menus for the Context menu */
|
2007-11-15 03:18:48 +00:00
|
|
|
QMenu* contextMnu;
|
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
/** Defines the actions for the context menu */
|
|
|
|
QAction* deletechannelAct;
|
2007-11-15 03:18:48 +00:00
|
|
|
QAction* createchannelmsgAct;
|
2008-03-24 17:36:17 +00:00
|
|
|
|
2008-03-25 01:41:01 +00:00
|
|
|
QAction *actionSave,
|
2008-11-26 01:19:09 +00:00
|
|
|
*actionAlignLeft,
|
|
|
|
*actionAlignCenter,
|
|
|
|
*actionAlignRight,
|
2008-03-25 01:41:01 +00:00
|
|
|
*actionAlignJustify,
|
2008-11-26 01:19:09 +00:00
|
|
|
*actionUndo,
|
|
|
|
*actionRedo,
|
|
|
|
*actionCut,
|
|
|
|
*actionCopy,
|
2008-03-25 01:41:01 +00:00
|
|
|
*actionPaste;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
|
|
|
QTreeView *channelstreeView;
|
2008-03-25 01:41:01 +00:00
|
|
|
|
|
|
|
QString fileName;
|
2008-03-25 12:28:13 +00:00
|
|
|
QString nametomake;
|
2008-03-26 19:30:34 +00:00
|
|
|
|
2010-01-25 14:03:38 +00:00
|
|
|
QColor codeBackground;
|
|
|
|
QTextCharFormat defaultCharFormat;
|
|
|
|
|
2008-03-26 19:30:34 +00:00
|
|
|
QHash<QString, QString> autoLinkDictionary;
|
|
|
|
QHash<QString, QString> autoLinkTitleDictionary;
|
|
|
|
QHash<QString, int> autoLinkTargetDictionary;
|
2010-05-25 09:32:14 +00:00
|
|
|
|
2010-06-14 18:16:32 +00:00
|
|
|
std::string m_sMsgId; // existing message id
|
|
|
|
int m_nBox; // box from the existing message
|
2010-05-25 09:32:14 +00:00
|
|
|
|
2010-01-21 16:35:00 +00:00
|
|
|
/* maps of files */
|
2010-05-25 09:32:14 +00:00
|
|
|
std::list<AttachFileItem *> mAttachments;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-01-21 16:35:00 +00:00
|
|
|
bool mCheckAttachment;
|
2008-11-26 01:19:09 +00:00
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
2010-05-23 19:13:41 +00:00
|
|
|
Ui::MessageComposer ui;
|
2008-11-26 01:19:09 +00:00
|
|
|
|
2009-05-17 19:38:42 +00:00
|
|
|
std::list<FileInfo> _recList ;
|
2008-11-26 01:19:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|