diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.cpp b/retroshare-gui/src/gui/msgs/MessageWidget.cpp index 02eb42ac8..a37924c43 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.cpp +++ b/retroshare-gui/src/gui/msgs/MessageWidget.cpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "gui/notifyqt.h" #include "gui/RetroShareLink.h" @@ -131,6 +133,9 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f isWindow = false; currMsgFlags = 0; + ui.actionTextBesideIcon->setData(Qt::ToolButtonTextBesideIcon); + ui.actionIconOnly->setData(Qt::ToolButtonIconOnly); + connect(ui.msgList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(msgfilelistWidgetCostumPopupMenu(QPoint))); connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview())); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended())); @@ -141,6 +146,16 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f connect(ui.replyallButton, SIGNAL(clicked()), this, SLOT(replyAll())); connect(ui.forwardButton, SIGNAL(clicked()), this, SLOT(forward())); connect(ui.deleteButton, SIGNAL(clicked()), this, SLOT(remove())); + + connect(ui.actionSaveAs, SIGNAL(triggered()), this, SLOT(saveAs())); + connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print())); + connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printPreview())); + connect(ui.actionIconOnly, SIGNAL(triggered()), this, SLOT(buttonStyle())); + connect(ui.actionTextBesideIcon, SIGNAL(triggered()), this, SLOT(buttonStyle())); + + QAction *viewsource = new QAction(tr("View source"), this); + viewsource->setShortcut(QKeySequence("CTRL+O")); + connect(viewsource, SIGNAL(triggered()), this, SLOT(viewSource())); connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged())); connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged())); @@ -162,6 +177,16 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f msglheader->resizeSection (COLUMN_FILE_SIZE, 100); msglheader->resizeSection (COLUMN_FILE_HASH, 200); + QMenu *moremenu = new QMenu(); + moremenu->addAction(viewsource); + moremenu->addAction(ui.actionSaveAs); + moremenu->addAction(ui.actionPrint); + moremenu->addAction(ui.actionPrintPreview); + moremenu->addSeparator(); + moremenu->addAction(ui.actionTextBesideIcon); + moremenu->addAction(ui.actionIconOnly); + ui.moreButton->setMenu(moremenu); + QFont font = QFont("Arial", 10, QFont::Bold); ui.subjectText->setFont(font); @@ -260,11 +285,18 @@ void MessageWidget::processSettings(const QString &settingsGroup, bool load) ui.expandFilesButton->setChecked(value); ui.msgList->setVisible(value); togglefileview(); + + // toolbar button style + Qt::ToolButtonStyle style = (Qt::ToolButtonStyle) Settings->value("ToolButon_Style", Qt::ToolButtonTextBesideIcon).toInt(); + setToolbarButtonStyle(style); } else { // save settings // expandFiles Settings->setValue("expandFiles", ui.expandFilesButton->isChecked()); + + //toolbar button style + Settings->setValue("ToolButon_Style", ui.replyButton->toolButtonStyle()); } Settings->endGroup(); @@ -801,3 +833,34 @@ void MessageWidget::sendInvite() //} } + +void MessageWidget::setToolbarButtonStyle(Qt::ToolButtonStyle style) +{ + ui.deleteButton->setToolButtonStyle(style); + ui.replyButton->setToolButtonStyle(style); + ui.replyallButton->setToolButtonStyle(style); + ui.forwardButton->setToolButtonStyle(style); + ui.moreButton->setToolButtonStyle(style); +} + +void MessageWidget::buttonStyle() +{ + setToolbarButtonStyle((Qt::ToolButtonStyle) dynamic_cast(sender())->data().toInt()); +} + +void MessageWidget::viewSource() +{ + QDialog *dialog = new QDialog(this); + QPlainTextEdit *pte = new QPlainTextEdit(dialog); + pte->setPlainText( ui.msgText->toHtml() ); + QGridLayout *gl = new QGridLayout(dialog); + gl->addWidget(pte,0,0,1,1); + dialog->setWindowTitle(tr("Document source")); + dialog->resize(500, 400); + + dialog->exec(); + + ui.msgText->setHtml(pte->toPlainText()); + + delete dialog; +} diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.h b/retroshare-gui/src/gui/msgs/MessageWidget.h index a56a75d73..4bce2466f 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.h +++ b/retroshare-gui/src/gui/msgs/MessageWidget.h @@ -82,10 +82,13 @@ private slots: void anchorClicked(const QUrl &url); void loadImagesAlways(); + void buttonStyle(); + void viewSource(); private: void clearTagLabels(); void showTagLabels(); + void setToolbarButtonStyle(Qt::ToolButtonStyle style); bool isControlled; bool isWindow; diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.ui b/retroshare-gui/src/gui/msgs/MessageWidget.ui index fec99f5e3..aef85952a 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.ui +++ b/retroshare-gui/src/gui/msgs/MessageWidget.ui @@ -256,6 +256,38 @@ + + + + + 0 + 0 + + + + <html><head/><body><p>More actions</p></body></html> + + + More + + + + :/icons/png/options2.png:/icons/png/options2.png + + + + 22 + 22 + + + + QToolButton::InstantPopup + + + Qt::ToolButtonTextBesideIcon + + + @@ -719,7 +751,7 @@ Print - + Print Preview @@ -729,6 +761,19 @@ Save as + + + Buttons Text Beside Icon + + + Buttons Text Beside Icon + + + + + Buttons Icon only + +