2018-12-25 21:34:59 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* gui/MessagesDialog.h *
|
|
|
|
* *
|
|
|
|
* Copyright (c) 2006 Crypton <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2008-11-26 01:19:09 +00:00
|
|
|
|
|
|
|
#ifndef _MESSAGESDIALOG_H
|
|
|
|
#define _MESSAGESDIALOG_H
|
|
|
|
|
2010-02-13 18:49:56 +00:00
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
#include "mainpage.h"
|
|
|
|
#include "ui_MessagesDialog.h"
|
|
|
|
|
2016-08-16 22:02:30 +02:00
|
|
|
#define IMAGE_MESSAGES ":/icons/png/messages.png"
|
2014-05-10 02:38:47 +00:00
|
|
|
|
2014-10-09 22:04:12 +00:00
|
|
|
class RSTreeWidgetItemCompareRole;
|
2011-06-04 00:46:02 +00:00
|
|
|
class MessageWidget;
|
2019-02-08 15:41:20 +01:00
|
|
|
class QTreeWidgetItem;
|
|
|
|
class RsMessageModel;
|
2011-06-04 00:46:02 +00:00
|
|
|
|
2014-05-10 02:38:47 +00:00
|
|
|
class MessagesDialog : public MainPage
|
2008-11-26 01:19:09 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-19 16:01:21 +00:00
|
|
|
Q_PROPERTY(QColor textColorInbox READ textColorInbox WRITE setTextColorInbox)
|
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
public:
|
|
|
|
/** Default Constructor */
|
|
|
|
MessagesDialog(QWidget *parent = 0);
|
|
|
|
/** Default Destructor */
|
2010-04-27 21:46:28 +00:00
|
|
|
~MessagesDialog();
|
|
|
|
|
2014-05-10 02:38:47 +00:00
|
|
|
virtual QIcon iconPixmap() const { return QIcon(IMAGE_MESSAGES) ; } //MainPage
|
2017-01-17 16:35:20 +01:00
|
|
|
virtual QString pageName() const { return tr("Mail") ; } //MainPage
|
2014-05-10 02:38:47 +00:00
|
|
|
virtual QString helpText() const { return ""; } //MainPage
|
|
|
|
|
2012-08-05 20:12:55 +00:00
|
|
|
virtual UserNotify *getUserNotify(QObject *parent);
|
|
|
|
|
2010-05-06 14:39:50 +00:00
|
|
|
// replaced by shortcut
|
|
|
|
// virtual void keyPressEvent(QKeyEvent *) ;
|
2009-02-22 17:36:39 +00:00
|
|
|
|
2012-11-19 16:01:21 +00:00
|
|
|
QColor textColorInbox() const { return mTextColorInbox; }
|
|
|
|
|
|
|
|
void setTextColorInbox(QColor color) { mTextColorInbox = color; }
|
|
|
|
|
2011-05-02 21:50:20 +00:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
2012-11-19 16:01:21 +00:00
|
|
|
void changeEvent(QEvent *e);
|
2019-02-08 15:41:20 +01:00
|
|
|
int getSelectedMessages(QList<QString>& mid);
|
2011-05-02 21:50:20 +00:00
|
|
|
|
2009-02-22 17:36:39 +00:00
|
|
|
public slots:
|
2019-02-08 15:41:20 +01:00
|
|
|
//void insertMessages();
|
2010-08-22 22:12:26 +00:00
|
|
|
void messagesTagsChanged();
|
2010-01-25 12:44:12 +00:00
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
private slots:
|
|
|
|
/** Create the context popup menu and it's submenus */
|
2014-10-09 22:04:12 +00:00
|
|
|
void messageTreeWidgetCustomPopupMenu(QPoint point);
|
2013-05-04 22:03:48 +00:00
|
|
|
void folderlistWidgetCustomPopupMenu(QPoint);
|
2019-01-03 22:20:00 +01:00
|
|
|
void showAuthorInPeopleTab();
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2011-06-04 22:54:03 +00:00
|
|
|
void changeBox(int newrow);
|
|
|
|
void changeQuickView(int newrow);
|
2010-04-27 21:46:28 +00:00
|
|
|
void updateCurrentMessage();
|
2014-10-09 22:04:12 +00:00
|
|
|
void currentItemChanged(QTreeWidgetItem *item);
|
|
|
|
void clicked(QTreeWidgetItem *item, int column);
|
|
|
|
void doubleClicked(QTreeWidgetItem *item, int column);
|
2007-11-15 03:18:48 +00:00
|
|
|
|
|
|
|
void newmessage();
|
2011-06-04 00:46:02 +00:00
|
|
|
void openAsWindow();
|
|
|
|
void openAsTab();
|
2010-06-14 18:16:32 +00:00
|
|
|
void editmessage();
|
2008-11-26 01:19:09 +00:00
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
void removemessage();
|
2010-05-28 14:42:54 +00:00
|
|
|
void undeletemessage();
|
2010-05-27 19:48:52 +00:00
|
|
|
|
2010-05-23 17:21:30 +00:00
|
|
|
void markAsRead();
|
|
|
|
void markAsUnread();
|
2011-05-23 23:45:31 +00:00
|
|
|
void markWithStar(bool checked);
|
2010-05-23 17:21:30 +00:00
|
|
|
|
2010-10-29 20:57:23 +00:00
|
|
|
void emptyTrash();
|
|
|
|
|
2011-06-04 00:46:02 +00:00
|
|
|
void buttonStyle();
|
2010-02-13 18:49:56 +00:00
|
|
|
|
2012-04-05 21:03:03 +00:00
|
|
|
void filterChanged(const QString &text);
|
2012-10-29 10:59:26 +00:00
|
|
|
void filterColumnChanged(int column);
|
2010-02-14 12:29:50 +00:00
|
|
|
|
2010-05-27 19:48:52 +00:00
|
|
|
void tagAboutToShow();
|
2011-05-21 16:26:00 +00:00
|
|
|
void tagSet(int tagId, bool set);
|
|
|
|
void tagRemoveAll();
|
2008-01-26 13:08:28 +00:00
|
|
|
|
2011-06-04 00:46:02 +00:00
|
|
|
void tabChanged(int tab);
|
|
|
|
void tabCloseRequested(int tab);
|
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
private:
|
2010-06-03 22:12:07 +00:00
|
|
|
class LockUpdate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LockUpdate (MessagesDialog *pDialog, bool bUpdate);
|
|
|
|
~LockUpdate ();
|
|
|
|
|
2010-08-22 22:12:26 +00:00
|
|
|
void setUpdate(bool bUpdate);
|
|
|
|
|
2010-06-03 22:12:07 +00:00
|
|
|
private:
|
|
|
|
MessagesDialog *m_pDialog;
|
|
|
|
bool m_bUpdate;
|
|
|
|
};
|
|
|
|
|
2014-10-09 22:04:12 +00:00
|
|
|
void updateInterface();
|
2010-02-13 18:49:56 +00:00
|
|
|
|
2011-06-04 00:46:02 +00:00
|
|
|
void connectActions();
|
|
|
|
|
2010-08-09 21:20:34 +00:00
|
|
|
void updateMessageSummaryList();
|
2014-10-09 22:04:12 +00:00
|
|
|
void insertMsgTxtAndFiles(QTreeWidgetItem *item = NULL, bool bSetToRead = true);
|
2010-05-23 17:21:30 +00:00
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
bool getCurrentMsg(std::string &cid, std::string &mid);
|
2014-10-09 22:04:12 +00:00
|
|
|
void setMsgAsReadUnread(const QList<QTreeWidgetItem *> &items, bool read);
|
|
|
|
void setMsgStar(const QList<QTreeWidgetItem *> &items, bool mark);
|
2010-02-13 18:49:56 +00:00
|
|
|
|
2014-10-09 22:04:12 +00:00
|
|
|
int getSelectedMsgCount (QList<QTreeWidgetItem *> *items, QList<QTreeWidgetItem *> *itemsRead, QList<QTreeWidgetItem *> *itemsUnread, QList<QTreeWidgetItem *> *itemsStar);
|
|
|
|
bool isMessageRead(QTreeWidgetItem *item);
|
|
|
|
bool hasMessageStar(QTreeWidgetItem *item);
|
2010-02-13 18:49:56 +00:00
|
|
|
|
2011-06-04 00:46:02 +00:00
|
|
|
void processSettings(bool load);
|
2010-10-31 19:37:05 +00:00
|
|
|
|
2010-05-27 19:48:52 +00:00
|
|
|
void setToolbarButtonStyle(Qt::ToolButtonStyle style);
|
2011-06-04 22:54:03 +00:00
|
|
|
void fillQuickView();
|
2011-06-04 00:46:02 +00:00
|
|
|
|
|
|
|
void closeTab(const std::string &msgId);
|
|
|
|
|
2012-05-01 09:18:55 +00:00
|
|
|
bool inProcessSettings;
|
2011-06-04 22:54:03 +00:00
|
|
|
bool inChange;
|
2012-05-01 09:18:55 +00:00
|
|
|
int lockUpdate; // use with LockUpdate
|
2010-06-01 22:14:52 +00:00
|
|
|
|
2012-05-01 09:18:55 +00:00
|
|
|
enum { LIST_NOTHING, LIST_BOX, LIST_QUICKVIEW } listMode;
|
2010-05-20 21:53:27 +00:00
|
|
|
|
2007-11-15 03:18:48 +00:00
|
|
|
std::string mCurrMsgId;
|
2010-01-22 19:23:12 +00:00
|
|
|
|
2010-04-27 21:46:28 +00:00
|
|
|
// timer and index for showing message
|
|
|
|
QTimer *timer;
|
2014-10-09 22:04:12 +00:00
|
|
|
int timerIndex;
|
2010-05-06 14:39:50 +00:00
|
|
|
|
2014-10-09 22:04:12 +00:00
|
|
|
RSTreeWidgetItemCompareRole *mMessageCompareRole;
|
2011-06-04 00:46:02 +00:00
|
|
|
MessageWidget *msgWidget;
|
2019-02-08 15:41:20 +01:00
|
|
|
RsMessageModel *mMessageModel;
|
|
|
|
QSortFilterProxyModel *mMessageProxyModel;
|
2011-06-04 00:46:02 +00:00
|
|
|
|
2012-11-19 16:01:21 +00:00
|
|
|
/* Color definitions (for standard see qss.default) */
|
|
|
|
QColor mTextColorInbox;
|
|
|
|
|
2008-11-26 01:19:09 +00:00
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::MessagesDialog ui;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|