mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
removed mMsgTagIds since tags are not in RsMailStorageItem struct
This commit is contained in:
parent
0db41deb9f
commit
006f4c53be
@ -1081,7 +1081,7 @@ MessageComposer *MessageComposer::newMsg(const std::string &msgId /* = ""*/)
|
|||||||
MsgTagInfo tagInfo;
|
MsgTagInfo tagInfo;
|
||||||
rsMail->getMessageTag(msgId, tagInfo);
|
rsMail->getMessageTag(msgId, tagInfo);
|
||||||
|
|
||||||
msgComposer->m_tagIds = tagInfo.tagIds;
|
msgComposer->m_tagIds = tagInfo;
|
||||||
msgComposer->showTagLabels();
|
msgComposer->showTagLabels();
|
||||||
std::cerr << "Setting modified 005 = false" << std::endl;
|
std::cerr << "Setting modified 005 = false" << std::endl;
|
||||||
msgComposer->ui.msgText->document()->setModified(false);
|
msgComposer->ui.msgText->document()->setModified(false);
|
||||||
@ -1267,7 +1267,7 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
|
|||||||
MsgTagInfo tagInfo;
|
MsgTagInfo tagInfo;
|
||||||
rsMail->getMessageTag(msgId, tagInfo);
|
rsMail->getMessageTag(msgId, tagInfo);
|
||||||
|
|
||||||
msgComposer->m_tagIds = tagInfo.tagIds;
|
msgComposer->m_tagIds = tagInfo;
|
||||||
msgComposer->showTagLabels();
|
msgComposer->showTagLabels();
|
||||||
|
|
||||||
msgComposer->calculateTitle();
|
msgComposer->calculateTitle();
|
||||||
@ -1563,18 +1563,15 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||||||
|
|
||||||
/* insert new tags */
|
/* insert new tags */
|
||||||
std::list<uint32_t>::iterator tag;
|
std::list<uint32_t>::iterator tag;
|
||||||
for (tag = m_tagIds.begin(); tag != m_tagIds.end(); ++tag) {
|
for (auto tag:m_tagIds)
|
||||||
if (std::find(tagInfo.tagIds.begin(), tagInfo.tagIds.end(), *tag) == tagInfo.tagIds.end()) {
|
if (tagInfo.find(tag) == tagInfo.end())
|
||||||
rsMail->setMessageTag(mi.msgId, *tag, true);
|
rsMail->setMessageTag(mi.msgId, tag, true);
|
||||||
} else {
|
else
|
||||||
tagInfo.tagIds.remove(*tag);
|
tagInfo.erase(tag);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove deleted tags */
|
/* remove deleted tags */
|
||||||
for (tag = tagInfo.tagIds.begin(); tag != tagInfo.tagIds.end(); ++tag) {
|
for (auto tag:tagInfo)
|
||||||
rsMail->setMessageTag(mi.msgId, *tag, false);
|
rsMail->setMessageTag(mi.msgId, tag, false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
std::cerr << "Setting modified 001 = false" << std::endl;
|
std::cerr << "Setting modified 001 = false" << std::endl;
|
||||||
ui.msgText->document()->setModified(false);
|
ui.msgText->document()->setModified(false);
|
||||||
@ -2801,17 +2798,17 @@ void MessageComposer::tagSet(int tagId, bool set)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<uint32_t>::iterator tag = std::find(m_tagIds.begin(), m_tagIds.end(), tagId);
|
auto tag = m_tagIds.find(tagId);
|
||||||
if (tag == m_tagIds.end()) {
|
|
||||||
if (set) {
|
if (tag == m_tagIds.end())
|
||||||
m_tagIds.push_back(tagId);
|
{
|
||||||
/* Keep the list sorted */
|
if (set)
|
||||||
m_tagIds.sort();
|
m_tagIds.insert(tagId);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (set == false) {
|
|
||||||
m_tagIds.remove(tagId);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (set == false)
|
||||||
|
m_tagIds.erase(tagId);
|
||||||
}
|
}
|
||||||
|
|
||||||
showTagLabels();
|
showTagLabels();
|
||||||
@ -2838,8 +2835,8 @@ void MessageComposer::showTagLabels()
|
|||||||
rsMail->getMessageTagTypes(tags);
|
rsMail->getMessageTagTypes(tags);
|
||||||
|
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator tag;
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator tag;
|
||||||
for (std::list<uint32_t>::iterator tagId = m_tagIds.begin(); tagId != m_tagIds.end(); ++tagId) {
|
for (auto tagId:m_tagIds) {
|
||||||
tag = tags.types.find(*tagId);
|
tag = tags.types.find(tagId);
|
||||||
if (tag != tags.types.end()) {
|
if (tag != tags.types.end()) {
|
||||||
QLabel *tagLabel = new QLabel(TagDefs::name(tag->first, tag->second.first), this);
|
QLabel *tagLabel = new QLabel(TagDefs::name(tag->first, tag->second.first), this);
|
||||||
tagLabel->setMaximumHeight(QFontMetrics(tagLabel->font()).height()*1.2);
|
tagLabel->setMaximumHeight(QFontMetrics(tagLabel->font()).height()*1.2);
|
||||||
|
@ -251,7 +251,7 @@ private:
|
|||||||
std::string m_msgParentId; // parent message id
|
std::string m_msgParentId; // parent message id
|
||||||
std::string m_sDraftMsgId; // existing message id
|
std::string m_sDraftMsgId; // existing message id
|
||||||
enumMessageType m_msgType;
|
enumMessageType m_msgType;
|
||||||
std::list<uint32_t> m_tagIds;
|
std::set<uint32_t> m_tagIds;
|
||||||
QList<QLabel*> tagLabels;
|
QList<QLabel*> tagLabels;
|
||||||
|
|
||||||
// needed to send system flags with reply
|
// needed to send system flags with reply
|
||||||
|
@ -508,15 +508,14 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
|
|||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
// build tag names
|
// build tag names
|
||||||
for (auto tagit = tagInfo.tagIds.begin(); tagit != tagInfo.tagIds.end(); ++tagit)
|
for (auto tag:tagInfo)
|
||||||
{
|
{
|
||||||
if (!text.isNull())
|
if (!text.isNull())
|
||||||
text += ",";
|
text += ",";
|
||||||
|
|
||||||
auto Tag = Tags.types.find(*tagit);
|
auto Tag = Tags.types.find(tag);
|
||||||
|
|
||||||
if (Tag != Tags.types.end()) if (Tag != Tags.types.end())
|
|
||||||
|
|
||||||
|
if (Tag != Tags.types.end())
|
||||||
text += TagDefs::name(Tag->first, Tag->second.first);
|
text += TagDefs::name(Tag->first, Tag->second.first);
|
||||||
else
|
else
|
||||||
RS_WARN("Unknown tag ", (int)Tag->first, " in message ", fmpe.msgId);
|
RS_WARN("Unknown tag ", (int)Tag->first, " in message ", fmpe.msgId);
|
||||||
|
@ -475,15 +475,17 @@ void MessageWidget::showTagLabels()
|
|||||||
MsgTagInfo tagInfo;
|
MsgTagInfo tagInfo;
|
||||||
rsMail->getMessageTag(currMsgId, tagInfo);
|
rsMail->getMessageTag(currMsgId, tagInfo);
|
||||||
|
|
||||||
if (tagInfo.tagIds.empty() == false) {
|
if (!tagInfo.empty())
|
||||||
|
{
|
||||||
ui.tagsLabel->setVisible(true);
|
ui.tagsLabel->setVisible(true);
|
||||||
|
|
||||||
MsgTagType Tags;
|
MsgTagType Tags;
|
||||||
rsMail->getMessageTagTypes(Tags);
|
rsMail->getMessageTagTypes(Tags);
|
||||||
|
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
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) {
|
for (auto tag:tagInfo)
|
||||||
Tag = Tags.types.find(*tagId);
|
{
|
||||||
|
Tag = Tags.types.find(tag);
|
||||||
if (Tag != Tags.types.end()) {
|
if (Tag != Tags.types.end()) {
|
||||||
QLabel *tagLabel = new QLabel(TagDefs::name(Tag->first, Tag->second.first), this);
|
QLabel *tagLabel = new QLabel(TagDefs::name(Tag->first, Tag->second.first), this);
|
||||||
tagLabel->setMaximumHeight(16);
|
tagLabel->setMaximumHeight(16);
|
||||||
|
@ -150,7 +150,7 @@ void MessageWindow::tagAboutToShow()
|
|||||||
MsgTagInfo tagInfo;
|
MsgTagInfo tagInfo;
|
||||||
rsMail->getMessageTag(msgWidget->msgId(), tagInfo);
|
rsMail->getMessageTag(msgWidget->msgId(), tagInfo);
|
||||||
|
|
||||||
menu->activateActions(tagInfo.tagIds);
|
menu->activateActions(tagInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageWindow::tagRemoveAll()
|
void MessageWindow::tagRemoveAll()
|
||||||
|
@ -170,7 +170,7 @@ void TagsMenu::fillTags()
|
|||||||
addAction(action);
|
addAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagsMenu::activateActions(std::list<uint32_t>& tagIds)
|
void TagsMenu::activateActions(std::set<uint32_t>& tagIds)
|
||||||
{
|
{
|
||||||
foreach(QObject *object, children()) {
|
foreach(QObject *object, children()) {
|
||||||
QAction *action = qobject_cast<QAction*> (object);
|
QAction *action = qobject_cast<QAction*> (object);
|
||||||
@ -186,7 +186,7 @@ void TagsMenu::activateActions(std::list<uint32_t>& tagIds)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<uint32_t>::iterator tagId = std::find(tagIds.begin(), tagIds.end(), values [ACTION_TAGSINDEX_ID]);
|
auto tagId = std::find(tagIds.begin(), tagIds.end(), values [ACTION_TAGSINDEX_ID]);
|
||||||
action->setChecked(tagId != tagIds.end());
|
action->setChecked(tagId != tagIds.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
TagsMenu(const QString &title, QWidget *parent);
|
TagsMenu(const QString &title, QWidget *parent);
|
||||||
virtual ~TagsMenu();
|
virtual ~TagsMenu();
|
||||||
|
|
||||||
void activateActions(std::list<uint32_t>& tagIds);
|
void activateActions(std::set<uint32_t> &tagIds);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tagSet(int tagId, bool set);
|
void tagSet(int tagId, bool set);
|
||||||
|
Loading…
Reference in New Issue
Block a user