Disable ReplyTo if System Message.

This commit is contained in:
Phenom 2017-11-18 18:49:42 +01:00
parent ba7cf4995b
commit 71efb9f2a0
6 changed files with 94 additions and 78 deletions

View File

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

View File

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

View File

@ -122,7 +122,7 @@ MessageWidget *MessageWidget::openMsg(const std::string &msgId, bool window)
/** Constructor */
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 */
ui.setupUi(this);
@ -196,6 +196,7 @@ void MessageWidget::connectAction(enumActionType actionType, QToolButton* button
break;
case ACTION_REPLY:
connect(button, SIGNAL(clicked()), this, SLOT(reply()));
toolButtonReply = button;
break;
case ACTION_REPLY_ALL:
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) {
ui.fromText->setText("RetroShare");
if (toolButtonReply) toolButtonReply->setEnabled(false);
} else {
ui.fromText->setText(link.toHtml());
ui.fromText->setToolTip(tooltip_string) ;
if (toolButtonReply) toolButtonReply->setEnabled(true);
}
ui.subjectText->setText(QString::fromUtf8(msgInfo.title.c_str()));

View File

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

View File

@ -68,7 +68,7 @@ MessageWindow::MessageWindow(QWidget *parent, Qt::WindowFlags flags)
QMenu *printmenu = new QMenu();
printmenu->addAction(ui.actionPrint);
printmenu->addAction(ui.actionPrint_Preview);
ui.printbutton->setMenu(printmenu);
ui.printButton->setMenu(printmenu);
// create view menu
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_ALL, ui.replyallmessageButton);
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, actionPrint);
msgWidget->connectAction(MessageWidget::ACTION_PRINT_PREVIEW, ui.actionPrint_Preview);
@ -216,7 +216,7 @@ void MessageWindow::setToolbarButtonStyle(Qt::ToolButtonStyle style)
ui.replyallmessageButton->setToolButtonStyle(style);
ui.forwardmessageButton->setToolButtonStyle(style);
ui.tagButton->setToolButtonStyle(style);
ui.printbutton->setToolButtonStyle(style);
ui.printButton->setToolButtonStyle(style);
ui.viewtoolButton->setToolButtonStyle(style);
}

View File

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