mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-14 12:02:29 -04:00
Show tags as label in MessagesDialog.
Fixed german language. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3728 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
618cc702a8
commit
5cc222d251
7 changed files with 159 additions and 38 deletions
|
@ -1580,6 +1580,54 @@ void MessagesDialog::markAsUnread()
|
|||
updateMessageSummaryList();
|
||||
}
|
||||
|
||||
void MessagesDialog::clearTagLabels()
|
||||
{
|
||||
/* clear all tags */
|
||||
while (tagLabels.size()) {
|
||||
delete tagLabels.front();
|
||||
tagLabels.pop_front();
|
||||
}
|
||||
while (ui.taglayout->count()) {
|
||||
delete ui.taglayout->takeAt(0);
|
||||
}
|
||||
|
||||
ui.tagslabel->setVisible(false);
|
||||
}
|
||||
|
||||
void MessagesDialog::showTagLabels()
|
||||
{
|
||||
clearTagLabels();
|
||||
|
||||
if (mCurrMsgId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
MsgTagInfo tagInfo;
|
||||
rsMsgs->getMessageTag(mCurrMsgId, tagInfo);
|
||||
|
||||
if (tagInfo.tagIds.empty() == false) {
|
||||
ui.tagslabel->setVisible(true);
|
||||
|
||||
MsgTagType Tags;
|
||||
rsMsgs->getMessageTagTypes(Tags);
|
||||
|
||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||
for (std::list<uint32_t>::iterator tagId = tagInfo.tagIds.begin(); tagId != tagInfo.tagIds.end(); tagId++) {
|
||||
Tag = Tags.types.find(*tagId);
|
||||
if (Tag != Tags.types.end()) {
|
||||
QLabel *tagLabel = new QLabel(TagDefs::name(Tag->first, Tag->second.first), this);
|
||||
tagLabel->setStyleSheet(TagDefs::labelStyleSheet(Tag->second.second));
|
||||
tagLabels.push_back(tagLabel);
|
||||
ui.taglayout->addWidget(tagLabel);
|
||||
ui.taglayout->addSpacing(3);
|
||||
}
|
||||
}
|
||||
ui.taglayout->addStretch();
|
||||
} else {
|
||||
ui.tagslabel->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
||||
{
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles()" << std::endl;
|
||||
|
@ -1591,12 +1639,23 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
|||
QModelIndex currentIndex = proxyModel->mapToSource(Index);
|
||||
if (currentIndex.isValid() == false)
|
||||
{
|
||||
mCurrCertId.clear();
|
||||
mCurrMsgId.clear();
|
||||
|
||||
/* blank it */
|
||||
ui.dateText-> setText("");
|
||||
ui.toText->setText("");
|
||||
ui.fromText->setText("");
|
||||
ui.filesText->setText("");
|
||||
|
||||
ui.cclabel->setVisible(false);
|
||||
ui.ccText->setVisible(false);
|
||||
ui.ccText->clear();
|
||||
|
||||
ui.bcclabel->setVisible(false);
|
||||
ui.bccText->setVisible(false);
|
||||
ui.bccText->clear();
|
||||
|
||||
ui.subjectText->setText("");
|
||||
ui.msgList->clear();
|
||||
ui.msgText->clear();
|
||||
|
@ -1605,18 +1664,17 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
|||
ui.actionPrintPreview->setDisabled(true);
|
||||
ui.actionPrint->setDisabled(true);
|
||||
|
||||
clearTagLabels();
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
QStandardItem *item;
|
||||
item = MessagesModel->item(currentIndex.row(),COLUMN_DATA);
|
||||
if (item == NULL) {
|
||||
return;
|
||||
}
|
||||
cid = item->data(ROLE_SRCID).toString().toStdString();
|
||||
mid = item->data(ROLE_MSGID).toString().toStdString();
|
||||
|
||||
QStandardItem *item = MessagesModel->item(currentIndex.row(),COLUMN_DATA);
|
||||
if (item == NULL) {
|
||||
return;
|
||||
}
|
||||
cid = item->data(ROLE_SRCID).toString().toStdString();
|
||||
mid = item->data(ROLE_MSGID).toString().toStdString();
|
||||
|
||||
int nCount = getSelectedMsgCount (NULL, NULL, NULL);
|
||||
if (nCount == 1) {
|
||||
|
@ -1634,6 +1692,8 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
|||
return;
|
||||
}
|
||||
|
||||
clearTagLabels();
|
||||
|
||||
/* Save the Data.... for later */
|
||||
|
||||
mCurrCertId = cid;
|
||||
|
@ -1775,6 +1835,8 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
|||
ui.filesText->setText(QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
showTagLabels();
|
||||
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Msg Displayed OK!" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -2295,6 +2357,8 @@ void MessagesDialog::tagTriggered(QAction *pAction)
|
|||
}
|
||||
}
|
||||
|
||||
showTagLabels();
|
||||
|
||||
// LockUpdate -> insertMessages();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue