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
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#ifndef _CHAN_MSG_DIALOG_H
|
2008-11-25 20:19:09 -05:00
|
|
|
#define _CHAN_MSG_DIALOG_H
|
|
|
|
|
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>
|
2008-11-25 20:19:09 -05:00
|
|
|
#include <gui/Preferences/rsharesettings.h>
|
2007-11-18 18:35:53 -05:00
|
|
|
|
2008-03-24 13:36:17 -04:00
|
|
|
#include "ui_ChanMsgDialog.h"
|
|
|
|
|
|
|
|
class QAction;
|
2008-11-25 20:19:09 -05:00
|
|
|
class QComboBox;
|
|
|
|
class QFontComboBox;
|
|
|
|
class QTextEdit;
|
|
|
|
class QTextCharFormat;
|
|
|
|
|
|
|
|
class ChanMsgDialog : 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 */
|
|
|
|
|
|
|
|
ChanMsgDialog(bool isMsg, QWidget *parent = 0, Qt::WFlags flags = 0);
|
|
|
|
/** Default Destructor */
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
void newMsg();
|
|
|
|
|
|
|
|
/* worker fns */
|
|
|
|
void insertSendList(); /* for Msgs */
|
|
|
|
void insertChannelSendList(); /* for Channels */
|
|
|
|
void insertFileList(); /* for Both */
|
|
|
|
void insertTitleText(std::string title);
|
2008-09-08 08:41:46 -04:00
|
|
|
void insertPastedText(std::string msg) ;
|
2008-11-25 20:19:09 -05:00
|
|
|
void insertForwardPastedText(std::string msg);
|
2007-11-14 22:18:48 -05:00
|
|
|
void insertMsgText(std::string msg);
|
2009-02-11 13:43:37 -05:00
|
|
|
void addRecipient(std::string id) ;
|
2008-03-25 08:28:13 -04:00
|
|
|
void Create_New_Image_Tag( const QString urlremoteorlocal );
|
|
|
|
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.... */
|
|
|
|
void sendMessage();
|
|
|
|
void cancelMessage();
|
2008-03-25 08:28:13 -04:00
|
|
|
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-11-25 20:19:09 -05:00
|
|
|
/** Create the context popup menu and it's submenus */
|
2007-11-14 22:18:48 -05:00
|
|
|
void channelstreeViewCostumPopupMenu( QPoint point );
|
|
|
|
|
|
|
|
/** Defines the context menu functions*/
|
|
|
|
void deletechannel();
|
|
|
|
void createchannelmsg();
|
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 toggleChannelItem( 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();
|
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
|
|
|
|
|
|
|
/** 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
|
|
|
|
|
|
|
QHash<QString, QString> autoLinkDictionary;
|
|
|
|
QHash<QString, QString> autoLinkTitleDictionary;
|
|
|
|
QHash<QString, int> autoLinkTargetDictionary;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
bool mIsMsg; /* different behaviour for Msg or ChanMsg */
|
2008-11-25 20:19:09 -05:00
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::ChanMsgDialog ui;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|