Merge pull request #1955 from PhenomRetroShare/Fix_MessageQuickViewSelection

Fix Message QuickView Selection for user tags
This commit is contained in:
defnax 2020-05-21 14:23:17 +02:00 committed by GitHub
commit 0a4b191384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -834,49 +834,30 @@ void MessagesDialog::changeQuickView(int newrow)
listMode = LIST_QUICKVIEW; listMode = LIST_QUICKVIEW;
RsMessageModel::QuickViewFilter f = RsMessageModel::QUICK_VIEW_ALL ; RsMessageModel::QuickViewFilter f = RsMessageModel::QUICK_VIEW_ALL ;
QListWidgetItem* item = ui.quickViewWidget->item(newrow);
if(newrow >= 0) // -1 means that nothing is selected if(item )
switch(newrow)
{ {
case 0x00: f = RsMessageModel::QUICK_VIEW_STARRED ; switch (item->data(ROLE_QUICKVIEW_TYPE).toInt()) {
ui.tabWidget->setTabText(0, tr("Starred")); case QUICKVIEW_TYPE_TAG:
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_STAR_ON)); f = RsMessageModel::QuickViewFilter( item->data(ROLE_QUICKVIEW_ID).toUInt());
break; break;
case 0x01: f = RsMessageModel::QUICK_VIEW_SYSTEM ; case QUICKVIEW_TYPE_STATIC:
ui.tabWidget->setTabText(0, tr("System")); switch (item->data(ROLE_QUICKVIEW_ID).toInt()) {
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_SYSTEM)); case QUICKVIEW_STATIC_ID_STARRED: f = RsMessageModel::QUICK_VIEW_STARRED;
break; break;
case 0x02: f = RsMessageModel::QUICK_VIEW_SPAM ; case QUICKVIEW_STATIC_ID_SYSTEM: f = RsMessageModel::QUICK_VIEW_SYSTEM;
ui.tabWidget->setTabText(0, tr("Spam"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_SPAM_ON));
break; break;
case 0x03: f = RsMessageModel::QUICK_VIEW_ATTACHMENT ; case QUICKVIEW_STATIC_ID_SPAM: f = RsMessageModel::QUICK_VIEW_SPAM;
ui.tabWidget->setTabText(0, tr("Attachment"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_ATTACHMENT));
break; break;
case 0x04: f = RsMessageModel::QUICK_VIEW_IMPORTANT; case QUICKVIEW_STATIC_ID_ATTACHMENT: f = RsMessageModel::QUICK_VIEW_ATTACHMENT;
ui.tabWidget->setTabText(0, tr("Important"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x05: f = RsMessageModel::QUICK_VIEW_WORK ;
ui.tabWidget->setTabText(0, tr("Work"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x06: f = RsMessageModel::QUICK_VIEW_PERSONAL ;
ui.tabWidget->setTabText(0, tr("Personal"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x07: f = RsMessageModel::QUICK_VIEW_TODO ;
ui.tabWidget->setTabText(0, tr("Todo"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x08: f = RsMessageModel::QUICK_VIEW_LATER ;
ui.tabWidget->setTabText(0, tr("Later"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
default:
f = RsMessageModel::QuickViewFilter( (int)RsMessageModel::QUICK_VIEW_USER + newrow - 0x07);
} }
}
ui.tabWidget->setTabText(0, item->data(ROLE_QUICKVIEW_TEXT).toString());
ui.tabWidget->setTabIcon(0, item->icon());
}
mMessageModel->setQuickViewFilter(f); mMessageModel->setQuickViewFilter(f);
mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString)); // this triggers the update of the proxy model mMessageProxyModel->setFilterRegExp(QRegExp(RsMessageModel::FilterString)); // this triggers the update of the proxy model
@ -921,11 +902,13 @@ void MessagesDialog::clicked(const QModelIndex& proxy_index)
case RsMessageModel::COLUMN_THREAD_STAR: case RsMessageModel::COLUMN_THREAD_STAR:
{ {
mMessageModel->setMsgStar(real_index, !hasMessageStar(proxy_index)); mMessageModel->setMsgStar(real_index, !hasMessageStar(proxy_index));
updateMessageSummaryList();
return; return;
} }
case RsMessageModel::COLUMN_THREAD_SPAM: case RsMessageModel::COLUMN_THREAD_SPAM:
{ {
mMessageModel->setMsgJunk(real_index, !hasMessageSpam(proxy_index)); mMessageModel->setMsgJunk(real_index, !hasMessageSpam(proxy_index));
updateMessageSummaryList();
return; return;
} }
} }