mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
Fixed saving new message to draft.
When you write a new message and save it to draft more than once, a new message in draft is created everytime you save. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3466 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d85ec3acf2
commit
061cb2a6a8
@ -807,6 +807,11 @@ bool p3MsgService::MessageToDraft(MessageInfo &info)
|
||||
}
|
||||
/* STORE MsgID */
|
||||
imsg[msg->msgId] = msg;
|
||||
|
||||
// return new message id
|
||||
std::ostringstream out;
|
||||
out << msg->msgId;
|
||||
info.msgId = out.str();
|
||||
}
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
@ -1267,8 +1272,6 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
|
||||
mis.ts = msg->sendTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, std::string to)
|
||||
{
|
||||
RsMsgItem *msg = new RsMsgItem();
|
||||
@ -1320,4 +1323,3 @@ RsMsgItem *p3MsgService::initMIRsMsg(MessageInfo &info, std::string to)
|
||||
//msg->print(std::cerr);
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
m_nBox = -1; // not defined
|
||||
|
||||
setupFileActions();
|
||||
setupEditActions();
|
||||
setupViewActions();
|
||||
@ -495,7 +493,7 @@ void MessageComposer::newMsg(std::string msgId /*= ""*/)
|
||||
insertSendList();
|
||||
|
||||
m_sMsgId = msgId;
|
||||
m_nBox = -1; // not defined
|
||||
m_sDraftMsgId.clear();
|
||||
|
||||
if (m_sMsgId.empty() == false) {
|
||||
// fill existing message
|
||||
@ -506,7 +504,9 @@ void MessageComposer::newMsg(std::string msgId /*= ""*/)
|
||||
return;
|
||||
}
|
||||
|
||||
m_nBox = msgInfo.msgflags & RS_MSG_BOXMASK;
|
||||
if (msgInfo.msgflags & RS_MSG_DRAFT) {
|
||||
m_sDraftMsgId = msgId;
|
||||
}
|
||||
|
||||
insertTitleText( QString::fromStdWString(msgInfo.title).toStdString());
|
||||
|
||||
@ -621,11 +621,11 @@ void MessageComposer::sendMessage_internal(bool bDraftbox)
|
||||
}
|
||||
|
||||
if (bDraftbox) {
|
||||
if (m_nBox != -1 && (m_nBox & RS_MSG_DRAFTBOX) == RS_MSG_DRAFTBOX) {
|
||||
// only save draft box to draft box again, for all other message create a new one in draft box
|
||||
mi.msgId = m_sMsgId;
|
||||
}
|
||||
mi.msgId = m_sDraftMsgId;
|
||||
rsMsgs->MessageToDraft(mi);
|
||||
|
||||
// use new message id
|
||||
m_sDraftMsgId = mi.msgId;
|
||||
} else {
|
||||
rsMsgs->MessageSend(mi);
|
||||
}
|
||||
@ -1440,4 +1440,4 @@ bool MessageComposer::FilterItem(QTreeWidgetItem *pItem, QString &sPattern)
|
||||
}
|
||||
|
||||
return (bVisible || nVisibleChildCount);
|
||||
}
|
||||
}
|
||||
|
@ -178,8 +178,8 @@ private:
|
||||
QHash<QString, QString> autoLinkTitleDictionary;
|
||||
QHash<QString, int> autoLinkTargetDictionary;
|
||||
|
||||
std::string m_sMsgId; // existing message id
|
||||
int m_nBox; // box from the existing message
|
||||
std::string m_sMsgId; // existing message id
|
||||
std::string m_sDraftMsgId; // existing message id
|
||||
|
||||
/* maps of files */
|
||||
std::list<AttachFileItem *> mAttachments;
|
||||
|
Loading…
Reference in New Issue
Block a user