From 7b78b87c65dc678e81f66ea37cfb72217c4894fb Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 4 Dec 2022 18:46:19 +0100 Subject: [PATCH] fixed coumn visibility depending on box --- retroshare-gui/src/gui/msgs/MessageModel.cpp | 2 +- retroshare-gui/src/gui/msgs/MessageModel.h | 6 +++--- retroshare-gui/src/gui/msgs/MessagesDialog.cpp | 11 ++++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/retroshare-gui/src/gui/msgs/MessageModel.cpp b/retroshare-gui/src/gui/msgs/MessageModel.cpp index 4c7c42e52..4e1debaba 100644 --- a/retroshare-gui/src/gui/msgs/MessageModel.cpp +++ b/retroshare-gui/src/gui/msgs/MessageModel.cpp @@ -88,7 +88,7 @@ int RsMessageModel::rowCount(const QModelIndex& parent) const int RsMessageModel::columnCount(const QModelIndex &/*parent*/) const { - return COLUMN_THREAD_NB_COLUMNS ; + return COLUMN_THREAD_NB_COLUMNS; } bool RsMessageModel::getMessageData(const QModelIndex& i,Rs::Msgs::MessageInfo& fmpe) const diff --git a/retroshare-gui/src/gui/msgs/MessageModel.h b/retroshare-gui/src/gui/msgs/MessageModel.h index e3b7d5188..fb8c6daa5 100644 --- a/retroshare-gui/src/gui/msgs/MessageModel.h +++ b/retroshare-gui/src/gui/msgs/MessageModel.h @@ -54,9 +54,9 @@ public: COLUMN_THREAD_DATE = 0x07, COLUMN_THREAD_TAGS = 0x08, COLUMN_THREAD_MSGID = 0x09, - COLUMN_THREAD_NB_COLUMNS = 0x0a, - COLUMN_THREAD_CONTENT = 0x0b - }; + COLUMN_THREAD_CONTENT = 0x0a, + COLUMN_THREAD_NB_COLUMNS = 0x0b + }; enum QuickViewFilter { QUICK_VIEW_ALL = 0x00, diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp index adbbe1256..4b790809d 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp @@ -254,9 +254,6 @@ MessagesDialog::MessagesDialog(QWidget *parent) sortColumn(RsMessageModel::COLUMN_THREAD_DATE,Qt::DescendingOrder); - // load settings - processSettings(true); - //ui.messageTreeWidget->installEventFilter(this); // remove close button of the the first tab @@ -299,6 +296,11 @@ MessagesDialog::MessagesDialog(QWidget *parent) connect(ui.messageTreeWidget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(currentChanged(const QModelIndex&,const QModelIndex&))); + // load settings + processSettings(true); + + ui.listWidget->setCurrentRow(0); // always starts with inbox => allows to setup the proper number of columns + mEventHandlerId=0; rsEvents->registerEventsHandler( [this](std::shared_ptr event) { RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); }); }, mEventHandlerId, RsEventType::MAIL_STATUS ); @@ -917,11 +919,14 @@ void MessagesDialog::changeBox(int box_row) } insertMsgTxtAndFiles(ui.messageTreeWidget->currentIndex()); + ui.messageTreeWidget->setPlaceholderText(placeholderText); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_READ,box_row!=ROW_INBOX); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_STAR,box_row==ROW_OUTBOX); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_SPAM,box_row==ROW_OUTBOX); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_TAGS,box_row==ROW_OUTBOX); + ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_MSGID,true); + ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_CONTENT,true); } else {