Merge pull request #1950 from PhenomRetroShare/Fix_MessagesQuickViewUnselect

Fix Messages Quick View unselect.
This commit is contained in:
defnax 2020-05-19 20:58:56 +02:00 committed by GitHub
commit 623e803584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@
class MessageSortFilterProxyModel: public QSortFilterProxyModel class MessageSortFilterProxyModel: public QSortFilterProxyModel
{ {
public: public:
MessageSortFilterProxyModel(const QHeaderView *header,QObject *parent = NULL): QSortFilterProxyModel(parent),m_header(header) , m_sortingEnabled(false) {} MessageSortFilterProxyModel(QObject *parent = NULL): QSortFilterProxyModel(parent), m_sortingEnabled(false) {}
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override bool lessThan(const QModelIndex& left, const QModelIndex& right) const override
{ {
@ -113,7 +113,6 @@ public:
void setSortingEnabled(bool b) { m_sortingEnabled = b ; } void setSortingEnabled(bool b) { m_sortingEnabled = b ; }
private: private:
const QHeaderView *m_header ;
bool m_sortingEnabled; bool m_sortingEnabled;
}; };
@ -138,7 +137,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
listMode = LIST_NOTHING; listMode = LIST_NOTHING;
mMessageModel = new RsMessageModel(this); mMessageModel = new RsMessageModel(this);
mMessageProxyModel = new MessageSortFilterProxyModel(ui.messageTreeWidget->header(),this); mMessageProxyModel = new MessageSortFilterProxyModel(this);
mMessageProxyModel->setSourceModel(mMessageModel); mMessageProxyModel->setSourceModel(mMessageModel);
mMessageProxyModel->setSortRole(RsMessageModel::SortRole); mMessageProxyModel->setSortRole(RsMessageModel::SortRole);
mMessageProxyModel->setDynamicSortFilter(false); mMessageProxyModel->setDynamicSortFilter(false);
@ -663,17 +662,17 @@ void MessagesDialog::messageTreeWidgetCustomPopupMenu(QPoint /*point*/)
void MessagesDialog::showAuthorInPeopleTab() void MessagesDialog::showAuthorInPeopleTab()
{ {
std::string cid; std::string cid;
std::string mid; std::string mid;
if(!getCurrentMsg(cid, mid)) if(!getCurrentMsg(cid, mid))
return ; return ;
MessageInfo msgInfo; MessageInfo msgInfo;
if (!rsMail->getMessage(mid, msgInfo)) if (!rsMail->getMessage(mid, msgInfo))
return; return;
if(msgInfo.rsgxsid_srcId.isNull()) if(msgInfo.rsgxsid_srcId.isNull())
return ; return ;
/* window will destroy itself! */ /* window will destroy itself! */
IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People)); IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People));
@ -779,8 +778,9 @@ void MessagesDialog::changeBox(int box_row)
inChange = true; inChange = true;
ui.quickViewWidget->setCurrentItem(NULL); ui.quickViewWidget->setCurrentItem(NULL);
listMode = LIST_BOX; changeQuickView(-1);
listMode = LIST_BOX;
switch(box_row) switch(box_row)
{ {
@ -813,10 +813,10 @@ void MessagesDialog::changeBox(int box_row)
void MessagesDialog::changeQuickView(int newrow) void MessagesDialog::changeQuickView(int newrow)
{ {
Q_UNUSED(newrow);
ui.listWidget->setCurrentItem(NULL); ui.listWidget->setCurrentItem(NULL);
listMode = LIST_QUICKVIEW; changeBox(-1);
listMode = LIST_QUICKVIEW;
RsMessageModel::QuickViewFilter f = RsMessageModel::QUICK_VIEW_ALL ; RsMessageModel::QuickViewFilter f = RsMessageModel::QUICK_VIEW_ALL ;
@ -870,17 +870,14 @@ void MessagesDialog::messagesTagsChanged()
mMessageModel->updateMessages(); mMessageModel->updateMessages();
} }
static void InitIconAndFont(QTreeWidgetItem *item)
{
}
// click in messageTreeWidget // click in messageTreeWidget
void MessagesDialog::currentChanged(const QModelIndex& new_proxy_index,const QModelIndex& old_proxy_index) void MessagesDialog::currentChanged(const QModelIndex& new_proxy_index,const QModelIndex& /*old_proxy_index*/)
{ {
if(!new_proxy_index.isValid()) if(!new_proxy_index.isValid())
return; return;
// show current message directly // show current message directly
insertMsgTxtAndFiles(new_proxy_index); insertMsgTxtAndFiles(new_proxy_index);
} }