diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.cpp b/retroshare-gui/src/gui/msgs/MessageWidget.cpp index 7467e2e84..d74505e63 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.cpp +++ b/retroshare-gui/src/gui/msgs/MessageWidget.cpp @@ -135,6 +135,7 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f isWindow = false; currMsgFlags = 0; expandFiles = false; + ui.expandButton->hide(); ui.actionTextBesideIcon->setData(Qt::ToolButtonTextBesideIcon); ui.actionIconOnly->setData(Qt::ToolButtonIconOnly); @@ -144,7 +145,8 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended())); connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl))); connect(ui.sendInviteButton, SIGNAL(clicked()), this, SLOT(sendInvite())); - + connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(expandTo())); + connect(ui.replyButton, SIGNAL(clicked()), this, SLOT(reply())); connect(ui.replyallButton, SIGNAL(clicked()), this, SLOT(replyAll())); connect(ui.forwardButton, SIGNAL(clicked()), this, SLOT(forward())); @@ -551,6 +553,9 @@ void MessageWidget::fill(const std::string &msgId) ui.deleteButton->setEnabled(false); ui.moreButton->setEnabled(false); + ui.expandButton->hide(); + ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*1.5); + currMsgFlags = 0; return; @@ -635,6 +640,17 @@ void MessageWidget::fill(const std::string &msgId) ui.trans_ToText->setText(to_text); + int recipientsCount = ui.trans_ToText->toPlainText().split(QRegExp("(\\s|\\n|\\r)+"), QString::SkipEmptyParts).count(); + ui.expandButton->setText( QString::number(recipientsCount)+ " " + tr("more")); + + if (recipientsCount >=20) { + ui.expandButton->show(); + } else { + ui.expandButton->hide(); + ui.expandButton->setChecked(false); + ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*1.5); + } + if (!cc_text.isNull()) { ui.ccLabel->setVisible(true); @@ -937,3 +953,14 @@ void MessageWidget::checkLength() ui.sizeLabel->setText(text); } + +void MessageWidget::expandTo() +{ + if (ui.expandButton->isChecked()) { + ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*3.5); + ui.expandButton->setToolTip(tr("Show less")); + } else { + ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*1.5); + ui.expandButton->setToolTip(tr("Show more")); + } +} diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.h b/retroshare-gui/src/gui/msgs/MessageWidget.h index 12438e55c..d6465e5cf 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.h +++ b/retroshare-gui/src/gui/msgs/MessageWidget.h @@ -72,7 +72,7 @@ private slots: void saveAs(); void refill(); void sendInvite(); - + void expandTo(); void msgfilelistWidgetCostumPopupMenu(QPoint); void messagesTagsChanged(); diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.ui b/retroshare-gui/src/gui/msgs/MessageWidget.ui index 6f544a01b..de580d7e5 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.ui +++ b/retroshare-gui/src/gui/msgs/MessageWidget.ui @@ -51,93 +51,6 @@ 3 - - - - - 0 - 0 - - - - - 9 - - - - Bcc: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 9 - - - - To: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 9 - - - - Cc: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - - - 0 - 0 - - - - - 9 - - - - Tags: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -290,6 +203,114 @@ + + + + + 0 + 0 + + + + + 9 + + + + Tags: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 9 + + + + Subject: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 9 + + + + Cc: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + 0 + 0 + + + + + 9 + + + + Bcc: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 9 + + + + To: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -313,6 +334,25 @@ + + + + + 0 + 0 + + + + + 16777215 + 16 + + + + true + + + @@ -346,45 +386,7 @@ - - - - - 0 - 0 - - - - - 16777215 - 16 - - - - true - - - - - - - - 0 - 0 - - - - - 16777215 - 16 - - - - true - - - - + @@ -403,30 +405,9 @@ - + - - - - - 0 - 0 - - - - - 9 - - - - Subject: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -448,6 +429,48 @@ + + + + 6 + + + + + + 0 + 0 + + + + + 16777215 + 16 + + + + true + + + + + + + + + + true + + + QToolButton::InstantPopup + + + Qt::ToolButtonTextBesideIcon + + + + + diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp index 42e45a96a..1fb55821f 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp @@ -420,7 +420,7 @@ UserNotify *MessagesDialog::createUserNotify(QObject *parent) void MessagesDialog::processSettings(bool load) { - int messageTreeVersion = 3; // version number for the settings to solve problems when modifying the column count + int messageTreeVersion = 4; // version number for the settings to solve problems when modifying the column count inProcessSettings = true;