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>
|
2008-11-25 20:19:09 -05:00
|
|
|
#include <QMap>
|
2008-03-24 13:36:17 -04:00
|
|
|
#include <QPointer>
|
2009-12-14 12:13:10 -05:00
|
|
|
#include <gui/settings/rsharesettings.h>
|
2010-01-20 16:39:27 -05:00
|
|
|
#include "gui/feeds/AttachFileItem.h"
|
2007-11-18 18:35:53 -05:00
|
|
|
|
2010-05-23 15:13:41 -04:00
|
|
|
#include "ui_MessageComposer.h"
|
2009-05-17 15:38:42 -04:00
|
|
|
#include "rsiface/rsfiles.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-05-23 15:13:41 -04:00
|
|
|
class MessageComposer : public QMainWindow
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
2008-11-25 20:19:09 -05:00
|
|
|
Q_OBJECT
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2008-11-25 20:19:09 -05:00
|
|
|
public:
|
|
|
|
/** Default Constructor */
|
|
|
|
|
2010-05-25 05:32:14 -04:00
|
|
|
MessageComposer(QWidget *parent = 0, Qt::WFlags flags = 0);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-05-25 05:32:14 -04:00
|
|
|
void newMsg(std::string msgId = "");
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
/* worker fns */
|
2010-05-25 05:32:14 -04:00
|
|
|
void insertSendList();
|
|
|
|
void insertFileList(const std::list<DirDetails>&);
|
2010-04-26 17:11:19 -04:00
|
|
|
void insertFileList(const std::list<FileInfo>&);
|
2010-01-25 09:03:38 -05: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 08:28:13 -04:00
|
|
|
QSettings setter;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
public slots:
|
2008-11-25 20:19:09 -05:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/* actions to take.... */
|
2010-01-25 09:03:38 -05:00
|
|
|
void sendMessage();
|
|
|
|
void cancelMessage();
|
|
|
|
void addImage();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2007-11-18 18:35:53 -05:00
|
|
|
protected:
|
|
|
|
void closeEvent (QCloseEvent * event);
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
private slots:
|
2008-03-24 13:36:17 -04:00
|
|
|
|
|
|
|
/* toggle Contacts DockWidget */
|
|
|
|
void toggleContacts();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
/* for toggling flags */
|
|
|
|
void togglePersonItem( QTreeWidgetItem *item, int col );
|
|
|
|
void toggleRecommendItem( QTreeWidgetItem *item, int col );
|
2008-03-24 13:36:17 -04:00
|
|
|
|
2008-11-25 20:19:09 -05:00
|
|
|
void fileNew();
|
|
|
|
void fileOpen();
|
|
|
|
bool fileSave();
|
|
|
|
bool fileSaveAs();
|
2008-03-26 15:30:34 -04:00
|
|
|
void filePrint();
|
2008-11-25 20:19:09 -05:00
|
|
|
|
|
|
|
//void filePrintPreview();
|
2008-03-24 21:41:01 -04:00
|
|
|
void filePrintPdf();
|
|
|
|
|
2008-11-25 20:19:09 -05: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 13:36:17 -04:00
|
|
|
void cursorPositionChanged();
|
2008-03-24 21:41:01 -04:00
|
|
|
|
|
|
|
void clipboardDataChanged();
|
2010-01-20 16:39:27 -05:00
|
|
|
|
|
|
|
void fileHashingFinished(AttachFileItem* file);
|
|
|
|
|
|
|
|
void attachFile();
|
|
|
|
void addAttachment(std::string);
|
2010-01-21 11:35:00 -05:00
|
|
|
void checkAttachmentReady();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-01-25 09:03:38 -05:00
|
|
|
void fontSizeIncrease();
|
|
|
|
void fontSizeDecrease();
|
|
|
|
void blockQuote();
|
|
|
|
void toggleCode();
|
2010-01-25 10:36:24 -05:00
|
|
|
void addPostSplitter();
|
2010-01-25 09:03:38 -05:00
|
|
|
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
private:
|
2008-09-08 08:41:46 -04:00
|
|
|
void setTextColor(const QColor& col) ;
|
2008-03-24 21:41:01 -04:00
|
|
|
void setupFileActions();
|
|
|
|
void setupEditActions();
|
2008-03-26 15:30:34 -04:00
|
|
|
void setupViewActions();
|
|
|
|
void setupInsertActions();
|
|
|
|
|
2008-03-24 21:41:01 -04:00
|
|
|
bool load(const QString &f);
|
|
|
|
bool maybeSave();
|
2008-03-25 08:28:13 -04:00
|
|
|
//bool image_extension( QString nametomake );
|
2008-03-24 21:41:01 -04:00
|
|
|
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-05-25 05:32:14 -04:00
|
|
|
void sendMessage_internal(bool bDraftbox);
|
|
|
|
|
2008-11-25 20:19:09 -05:00
|
|
|
/** Define the popup menus for the Context menu */
|
2007-11-14 22:18:48 -05:00
|
|
|
QMenu* contextMnu;
|
|
|
|
|
2008-11-25 20:19:09 -05:00
|
|
|
/** Defines the actions for the context menu */
|
|
|
|
QAction* deletechannelAct;
|
2007-11-14 22:18:48 -05:00
|
|
|
QAction* createchannelmsgAct;
|
2008-03-24 13:36:17 -04:00
|
|
|
|
2008-03-24 21:41:01 -04:00
|
|
|
QAction *actionSave,
|
2008-11-25 20:19:09 -05:00
|
|
|
*actionAlignLeft,
|
|
|
|
*actionAlignCenter,
|
|
|
|
*actionAlignRight,
|
2008-03-24 21:41:01 -04:00
|
|
|
*actionAlignJustify,
|
2008-11-25 20:19:09 -05:00
|
|
|
*actionUndo,
|
|
|
|
*actionRedo,
|
|
|
|
*actionCut,
|
|
|
|
*actionCopy,
|
2008-03-24 21:41:01 -04:00
|
|
|
*actionPaste;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
QTreeView *channelstreeView;
|
2008-03-24 21:41:01 -04:00
|
|
|
|
|
|
|
QString fileName;
|
2008-03-25 08:28:13 -04:00
|
|
|
QString nametomake;
|
2008-03-26 15:30:34 -04:00
|
|
|
|
2010-01-25 09:03:38 -05:00
|
|
|
QColor codeBackground;
|
|
|
|
QTextCharFormat defaultCharFormat;
|
|
|
|
|
2008-03-26 15:30:34 -04:00
|
|
|
QHash<QString, QString> autoLinkDictionary;
|
|
|
|
QHash<QString, QString> autoLinkTitleDictionary;
|
|
|
|
QHash<QString, int> autoLinkTargetDictionary;
|
2010-05-25 05:32:14 -04:00
|
|
|
|
|
|
|
std::string m_sMsgId; // exisiting message
|
|
|
|
|
2010-01-21 11:35:00 -05:00
|
|
|
/* maps of files */
|
2010-05-25 05:32:14 -04:00
|
|
|
std::list<AttachFileItem *> mAttachments;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-01-21 11:35:00 -05:00
|
|
|
bool mCheckAttachment;
|
2008-11-25 20:19:09 -05:00
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
2010-05-23 15:13:41 -04:00
|
|
|
Ui::MessageComposer ui;
|
2008-11-25 20:19:09 -05:00
|
|
|
|
2009-05-17 15:38:42 -04:00
|
|
|
std::list<FileInfo> _recList ;
|
2008-11-25 20:19:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|