diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index a3b8683fe..aecd73731 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -121,7 +121,7 @@ MessagesDialog::MessagesDialog(QWidget *parent) ui.printbutton->setIcon(QIcon(QString(":/images/print24.png"))); ui.forwardmessageButton->setToolTip(tr("Forward selected Message")); - ui.replyallmessageButton->setToolTip(tr("Replay to All")); + ui.replyallmessageButton->setToolTip(tr("Reply to All")); QMenu * printmenu = new QMenu(); printmenu->addAction(ui.actionPrint); @@ -260,7 +260,7 @@ void MessagesDialog::replytomessage() nMsgDialog->insertTitleText( (QString("Re: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ; } - nMsgDialog->setWindowTitle(tr("Re: ") + QString::fromStdWString(msgInfo.title) ) ; + nMsgDialog->setWindowTitle( tr ("Compose: ") + tr("Re: ") + QString::fromStdWString(msgInfo.title) ) ; QTextDocument doc ; @@ -305,7 +305,7 @@ void MessagesDialog::replyallmessage() { nMsgDialog->insertTitleText( (QString("Re: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ; } - nMsgDialog->setWindowTitle(tr("Re: ") + QString::fromStdWString(msgInfo.title) ) ; + nMsgDialog->setWindowTitle( tr ("Compose: ") + tr("Re: ") + QString::fromStdWString(msgInfo.title) ) ; QTextDocument doc ; @@ -361,7 +361,7 @@ void MessagesDialog::forwardmessage() nMsgDialog->insertTitleText( (QString("Fwd: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ; } - nMsgDialog->setWindowTitle(tr("Fwd: ") + QString::fromStdWString(msgInfo.title) ) ; + nMsgDialog->setWindowTitle( tr ("Compose: ") + tr("Fwd: ") + QString::fromStdWString(msgInfo.title) ) ; QTextDocument doc ; diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp index a0b56425b..ca9d8437c 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp @@ -32,7 +32,7 @@ #include "util/misc.h" #include - +#include #include #include #include @@ -59,7 +59,7 @@ /** Constructor */ ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags) -: mIsMsg(msg), QMainWindow(parent, flags) +: mIsMsg(msg), QMainWindow(parent, flags), mCheckAttachment(true) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); @@ -493,7 +493,11 @@ void ChanMsgDialog::insertFileList(const std::list& files_info) void ChanMsgDialog::newMsg() { /* clear all */ + QString titlestring = ui.titleEdit->text(); + + setWindowTitle(tr("Compose: ") + titlestring ); ui.titleEdit->setText("No Title"); + ui.msgText->setText(""); /* worker fns */ @@ -1126,6 +1130,13 @@ void ChanMsgDialog::addAttachment(std::string filePath) { } else { QObject::connect(file,SIGNAL(fileFinished(AttachFileItem *)),this, SLOT(fileHashingFinished(AttachFileItem *))) ; } + mAttachments.push_back(file); + + if (mCheckAttachment) + { + checkAttachmentReady(); + } + } void ChanMsgDialog::fileHashingFinished(AttachFileItem* file) { @@ -1170,3 +1181,35 @@ void ChanMsgDialog::fileHashingFinished(AttachFileItem* file) { } +void ChanMsgDialog::checkAttachmentReady() +{ + std::list::iterator fit; + + mCheckAttachment = false; + + for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++) + { + if (!(*fit)->isHidden()) + { + if (!(*fit)->ready()) + { + /* + */ + ui.actionSend->setEnabled(false); + break; + + + return; + } + } + } + + if (fit == mAttachments.end()) + { + ui.actionSend->setEnabled(true); + } + + /* repeat... */ + int msec_rate = 1000; + QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void))); +} diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.h b/retroshare-gui/src/gui/msgs/ChanMsgDialog.h index e04eafbcb..fab4c6f28 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.h +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.h @@ -117,6 +117,7 @@ private slots: void attachFile(); void addAttachment(std::string); + void checkAttachmentReady(); private: @@ -162,8 +163,12 @@ private: QHash autoLinkDictionary; QHash autoLinkTitleDictionary; QHash autoLinkTargetDictionary; + + /* maps of files */ + std::list mAttachments; bool mIsMsg; /* different behaviour for Msg or ChanMsg */ + bool mCheckAttachment; /** Qt Designer generated object */ Ui::ChanMsgDialog ui;