Merge pull request #1114 from PhenomRetroShare/Fix_DisableReplyToSystemMessage

Disable ReplyTo if System Message.
This commit is contained in:
csoler 2017-11-20 23:18:53 +01:00 committed by GitHub
commit d90514453e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 94 additions and 78 deletions

View File

@ -231,7 +231,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
QMenu *printmenu = new QMenu(); QMenu *printmenu = new QMenu();
printmenu->addAction(ui.actionPrint); printmenu->addAction(ui.actionPrint);
printmenu->addAction(ui.actionPrintPreview); printmenu->addAction(ui.actionPrintPreview);
ui.printbutton->setMenu(printmenu); ui.printButton->setMenu(printmenu);
QMenu *viewmenu = new QMenu(); QMenu *viewmenu = new QMenu();
viewmenu->addAction(ui.actionTextBesideIcon); viewmenu->addAction(ui.actionTextBesideIcon);
@ -346,9 +346,8 @@ void MessagesDialog::processSettings(bool load)
} }
// state of splitter // state of splitter
ui.msgSplitter->restoreState(Settings->value("Splitter").toByteArray()); ui.msgSplitter->restoreState(Settings->value("SplitterMsg").toByteArray());
ui.msgSplitter_2->restoreState(Settings->value("Splitter2").toByteArray()); ui.listSplitter->restoreState(Settings->value("SplitterList").toByteArray());
ui.listSplitter->restoreState(Settings->value("Splitter3").toByteArray());
/* toolbar button style */ /* toolbar button style */
Qt::ToolButtonStyle style = (Qt::ToolButtonStyle) Settings->value("ToolButon_Style", Qt::ToolButtonIconOnly).toInt(); Qt::ToolButtonStyle style = (Qt::ToolButtonStyle) Settings->value("ToolButon_Style", Qt::ToolButtonIconOnly).toInt();
@ -361,9 +360,8 @@ void MessagesDialog::processSettings(bool load)
Settings->setValue("MessageTreeVersion", messageTreeVersion); Settings->setValue("MessageTreeVersion", messageTreeVersion);
// state of splitter // state of splitter
Settings->setValue("Splitter", ui.msgSplitter->saveState()); Settings->setValue("SplitterMsg", ui.msgSplitter->saveState());
Settings->setValue("Splitter2", ui.msgSplitter_2->saveState()); Settings->setValue("SplitterList", ui.listSplitter->saveState());
Settings->setValue("Splitter3", ui.listSplitter->saveState());
/* toolbar button style */ /* toolbar button style */
Settings->setValue("ToolButon_Style", ui.newmessageButton->toolButtonStyle()); Settings->setValue("ToolButon_Style", ui.newmessageButton->toolButtonStyle());
@ -1527,8 +1525,8 @@ void MessagesDialog::insertMsgTxtAndFiles(QTreeWidgetItem *item, bool bSetToRead
} }
} }
msgWidget->fill(mCurrMsgId);
updateInterface(); updateInterface();
msgWidget->fill(mCurrMsgId);
} }
bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid) bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
@ -1607,7 +1605,7 @@ void MessagesDialog::setToolbarButtonStyle(Qt::ToolButtonStyle style)
ui.replyallmessageButton->setToolButtonStyle(style); ui.replyallmessageButton->setToolButtonStyle(style);
ui.forwardmessageButton->setToolButtonStyle(style); ui.forwardmessageButton->setToolButtonStyle(style);
ui.tagButton->setToolButtonStyle(style); ui.tagButton->setToolButtonStyle(style);
ui.printbutton->setToolButtonStyle(style); ui.printButton->setToolButtonStyle(style);
ui.viewtoolButton->setToolButtonStyle(style); ui.viewtoolButton->setToolButtonStyle(style);
} }
@ -1710,23 +1708,23 @@ void MessagesDialog::updateMessageSummaryList()
{ {
case ROW_INBOX: case ROW_INBOX:
textTotal = tr("Total:") + " " + QString::number(inboxCount); textTotal = tr("Total:") + " " + QString::number(inboxCount);
ui.total_label->setText(textTotal); ui.totalLabel->setText(textTotal);
break; break;
case ROW_OUTBOX: case ROW_OUTBOX:
textTotal = tr("Total:") + " " + QString::number(newOutboxCount); textTotal = tr("Total:") + " " + QString::number(newOutboxCount);
ui.total_label->setText(textTotal); ui.totalLabel->setText(textTotal);
break; break;
case ROW_DRAFTBOX: case ROW_DRAFTBOX:
textTotal = tr("Total:") + " " + QString::number(newDraftCount); textTotal = tr("Total:") + " " + QString::number(newDraftCount);
ui.total_label->setText(textTotal); ui.totalLabel->setText(textTotal);
break; break;
case ROW_SENTBOX: case ROW_SENTBOX:
textTotal = tr("Total:") + " " + QString::number(newSentboxCount); textTotal = tr("Total:") + " " + QString::number(newSentboxCount);
ui.total_label->setText(textTotal); ui.totalLabel->setText(textTotal);
break; break;
case ROW_TRASHBOX: case ROW_TRASHBOX:
textTotal = tr("Total:") + " " + QString::number(trashboxCount); textTotal = tr("Total:") + " " + QString::number(trashboxCount);
ui.total_label->setText(textTotal); ui.totalLabel->setText(textTotal);
break; break;
} }
@ -1967,7 +1965,7 @@ void MessagesDialog::connectActions()
ui.replymessageButton->disconnect(); ui.replymessageButton->disconnect();
ui.replyallmessageButton->disconnect(); ui.replyallmessageButton->disconnect();
ui.forwardmessageButton->disconnect(); ui.forwardmessageButton->disconnect();
ui.printbutton->disconnect(); ui.printButton->disconnect();
ui.actionPrint->disconnect(); ui.actionPrint->disconnect();
ui.actionPrintPreview->disconnect(); ui.actionPrintPreview->disconnect();
ui.actionSaveAs->disconnect(); ui.actionSaveAs->disconnect();
@ -1994,7 +1992,7 @@ void MessagesDialog::connectActions()
msg->connectAction(MessageWidget::ACTION_REPLY, ui.replymessageButton); msg->connectAction(MessageWidget::ACTION_REPLY, ui.replymessageButton);
msg->connectAction(MessageWidget::ACTION_REPLY_ALL, ui.replyallmessageButton); msg->connectAction(MessageWidget::ACTION_REPLY_ALL, ui.replyallmessageButton);
msg->connectAction(MessageWidget::ACTION_FORWARD, ui.forwardmessageButton); msg->connectAction(MessageWidget::ACTION_FORWARD, ui.forwardmessageButton);
msg->connectAction(MessageWidget::ACTION_PRINT, ui.printbutton); msg->connectAction(MessageWidget::ACTION_PRINT, ui.printButton);
msg->connectAction(MessageWidget::ACTION_PRINT, ui.actionPrint); msg->connectAction(MessageWidget::ACTION_PRINT, ui.actionPrint);
msg->connectAction(MessageWidget::ACTION_PRINT_PREVIEW, ui.actionPrintPreview); msg->connectAction(MessageWidget::ACTION_PRINT_PREVIEW, ui.actionPrintPreview);
msg->connectAction(MessageWidget::ACTION_SAVE_AS, ui.actionSaveAs); msg->connectAction(MessageWidget::ACTION_SAVE_AS, ui.actionSaveAs);
@ -2019,7 +2017,7 @@ void MessagesDialog::updateInterface()
ui.replymessageButton->setEnabled(count == 1); ui.replymessageButton->setEnabled(count == 1);
ui.replyallmessageButton->setEnabled(count == 1); ui.replyallmessageButton->setEnabled(count == 1);
ui.forwardmessageButton->setEnabled(count == 1); ui.forwardmessageButton->setEnabled(count == 1);
ui.printbutton->setEnabled(count == 1); ui.printButton->setEnabled(count == 1);
ui.actionPrint->setEnabled(count == 1); ui.actionPrint->setEnabled(count == 1);
ui.actionPrintPreview->setEnabled(count == 1); ui.actionPrintPreview->setEnabled(count == 1);
ui.actionSaveAs->setEnabled(count == 1); ui.actionSaveAs->setEnabled(count == 1);

View File

@ -49,7 +49,7 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="toolBarFrameGLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>2</number> <number>2</number>
</property> </property>
@ -66,7 +66,7 @@
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="9"> <item row="0" column="9">
<widget class="Line" name="line_2"> <widget class="Line" name="toolBarFrameLineR">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -219,7 +219,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="12"> <item row="0" column="12">
<widget class="QToolButton" name="printbutton"> <widget class="QToolButton" name="printButton">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -454,7 +454,7 @@
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="images.qrc"> <iconset resource="icons.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset> <normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
@ -466,7 +466,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="14"> <item row="0" column="14">
<spacer name="horizontalSpacer"> <spacer name="toolBarFrameSpacerR">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -479,7 +479,7 @@
</spacer> </spacer>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<spacer name="horizontalSpacer_2"> <spacer name="toolBarFrameSpacerL">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -495,7 +495,7 @@
</spacer> </spacer>
</item> </item>
<item row="0" column="5"> <item row="0" column="5">
<widget class="Line" name="line"> <widget class="Line" name="toolBarFrameLineL">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -513,7 +513,7 @@
<attribute name="title"> <attribute name="title">
<string notr="true">Main Tab</string> <string notr="true">Main Tab</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="tabGLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -535,7 +535,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QFrame" name="sideBarFrame"> <widget class="QFrame" name="sideBarFrame">
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="sideBarFrameGLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -629,7 +629,7 @@
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="total_label"> <widget class="QLabel" name="totalLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -646,7 +646,7 @@
<property name="autoFillBackground"> <property name="autoFillBackground">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="folderFrameHLayout">
<property name="topMargin"> <property name="topMargin">
<number>3</number> <number>3</number>
</property> </property>
@ -687,7 +687,7 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="quickViewFrameHLayout">
<property name="topMargin"> <property name="topMargin">
<number>3</number> <number>3</number>
</property> </property>
@ -726,38 +726,33 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="QSplitter" name="msgSplitter_2"> <widget class="RSTreeWidget" name="messageTreeWidget">
<property name="orientation"> <property name="contextMenuPolicy">
<enum>Qt::Vertical</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<widget class="RSTreeWidget" name="messageTreeWidget"> <property name="selectionMode">
<property name="contextMenuPolicy"> <enum>QAbstractItemView::ExtendedSelection</enum>
<enum>Qt::CustomContextMenu</enum> </property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property> </property>
<property name="selectionMode"> </column>
<enum>QAbstractItemView::ExtendedSelection</enum> </widget>
</property> <widget class="QWidget" name="layoutWidget">
<property name="rootIsDecorated"> <layout class="QGridLayout" name="msgLayout"/>
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="msgLayout"/>
</widget>
</widget> </widget>
</widget> </widget>
</widget> </widget>
@ -838,6 +833,11 @@
</action> </action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>LineEditClear</class> <class>LineEditClear</class>
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
@ -854,19 +854,14 @@
<header>gui/common/RSTabWidget.h</header> <header>gui/common/RSTabWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>replymessageButton</tabstop> <tabstop>replymessageButton</tabstop>
<tabstop>listWidget</tabstop> <tabstop>listWidget</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="images.qrc"/>
<include location="icons.qrc"/> <include location="icons.qrc"/>
<include location="images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -122,7 +122,7 @@ MessageWidget *MessageWidget::openMsg(const std::string &msgId, bool window)
/** Constructor */ /** Constructor */
MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags flags) MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags flags)
: QWidget(parent, flags) : QWidget(parent, flags), toolButtonReply(NULL)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
@ -196,6 +196,7 @@ void MessageWidget::connectAction(enumActionType actionType, QToolButton* button
break; break;
case ACTION_REPLY: case ACTION_REPLY:
connect(button, SIGNAL(clicked()), this, SLOT(reply())); connect(button, SIGNAL(clicked()), this, SLOT(reply()));
toolButtonReply = button;
break; break;
case ACTION_REPLY_ALL: case ACTION_REPLY_ALL:
connect(button, SIGNAL(clicked()), this, SLOT(replyAll())); connect(button, SIGNAL(clicked()), this, SLOT(replyAll()));
@ -600,9 +601,11 @@ void MessageWidget::fill(const std::string &msgId)
if ((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.rspeerid_srcId == ownId) { if ((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.rspeerid_srcId == ownId) {
ui.fromText->setText("RetroShare"); ui.fromText->setText("RetroShare");
if (toolButtonReply) toolButtonReply->setEnabled(false);
} else { } else {
ui.fromText->setText(link.toHtml()); ui.fromText->setText(link.toHtml());
ui.fromText->setToolTip(tooltip_string) ; ui.fromText->setToolTip(tooltip_string) ;
if (toolButtonReply) toolButtonReply->setEnabled(true);
} }
ui.subjectText->setText(QString::fromUtf8(msgInfo.title.c_str())); ui.subjectText->setText(QString::fromUtf8(msgInfo.title.c_str()));

View File

@ -95,6 +95,8 @@ private:
QList<QLabel*> tagLabels; QList<QLabel*> tagLabels;
QToolButton* toolButtonReply;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MessageWidget ui; Ui::MessageWidget ui;
}; };

View File

@ -68,7 +68,7 @@ MessageWindow::MessageWindow(QWidget *parent, Qt::WindowFlags flags)
QMenu *printmenu = new QMenu(); QMenu *printmenu = new QMenu();
printmenu->addAction(ui.actionPrint); printmenu->addAction(ui.actionPrint);
printmenu->addAction(ui.actionPrint_Preview); printmenu->addAction(ui.actionPrint_Preview);
ui.printbutton->setMenu(printmenu); ui.printButton->setMenu(printmenu);
// create view menu // create view menu
QMenu *viewmenu = new QMenu(); QMenu *viewmenu = new QMenu();
@ -120,7 +120,7 @@ void MessageWindow::addWidget(MessageWidget *widget)
msgWidget->connectAction(MessageWidget::ACTION_REPLY, ui.replymessageButton); msgWidget->connectAction(MessageWidget::ACTION_REPLY, ui.replymessageButton);
msgWidget->connectAction(MessageWidget::ACTION_REPLY_ALL, ui.replyallmessageButton); msgWidget->connectAction(MessageWidget::ACTION_REPLY_ALL, ui.replyallmessageButton);
msgWidget->connectAction(MessageWidget::ACTION_FORWARD, ui.forwardmessageButton); msgWidget->connectAction(MessageWidget::ACTION_FORWARD, ui.forwardmessageButton);
msgWidget->connectAction(MessageWidget::ACTION_PRINT, ui.printbutton); msgWidget->connectAction(MessageWidget::ACTION_PRINT, ui.printButton);
msgWidget->connectAction(MessageWidget::ACTION_PRINT, ui.actionPrint); msgWidget->connectAction(MessageWidget::ACTION_PRINT, ui.actionPrint);
msgWidget->connectAction(MessageWidget::ACTION_PRINT, actionPrint); msgWidget->connectAction(MessageWidget::ACTION_PRINT, actionPrint);
msgWidget->connectAction(MessageWidget::ACTION_PRINT_PREVIEW, ui.actionPrint_Preview); msgWidget->connectAction(MessageWidget::ACTION_PRINT_PREVIEW, ui.actionPrint_Preview);
@ -216,7 +216,7 @@ void MessageWindow::setToolbarButtonStyle(Qt::ToolButtonStyle style)
ui.replyallmessageButton->setToolButtonStyle(style); ui.replyallmessageButton->setToolButtonStyle(style);
ui.forwardmessageButton->setToolButtonStyle(style); ui.forwardmessageButton->setToolButtonStyle(style);
ui.tagButton->setToolButtonStyle(style); ui.tagButton->setToolButtonStyle(style);
ui.printbutton->setToolButtonStyle(style); ui.printButton->setToolButtonStyle(style);
ui.viewtoolButton->setToolButtonStyle(style); ui.viewtoolButton->setToolButtonStyle(style);
} }

View File

@ -11,11 +11,20 @@
</rect> </rect>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="centralwidgetGLayout">
<property name="verticalSpacing"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="margin"> <property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
@ -44,8 +53,17 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="toolBarFrameGLayout">
<property name="margin"> <property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<property name="horizontalSpacing"> <property name="horizontalSpacing">
@ -81,7 +99,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="Line" name="line"> <widget class="Line" name="toolBarFrameLineL">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -187,7 +205,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="5"> <item row="0" column="5">
<widget class="Line" name="line_2"> <widget class="Line" name="toolBarFrameLineR">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -223,7 +241,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="8"> <item row="0" column="8">
<widget class="QToolButton" name="printbutton"> <widget class="QToolButton" name="printButton">
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
@ -281,7 +299,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="10"> <item row="0" column="10">
<spacer name="horizontalSpacer"> <spacer name="toolBarFrameHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>