- Added blocking of embedded images (+ settings) to forums and messages

- Added image support for forum messages
- Renamed LinkTextBrowser to RSTextBrowser
- Updated english translation

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6752 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-09-23 19:53:26 +00:00
parent 8ffc0e05de
commit 6b1613d8bb
31 changed files with 907 additions and 454 deletions

View File

@ -265,7 +265,7 @@
</item>
</layout>
</widget>
<widget class="LinkTextBrowser" name="msgText">
<widget class="RSTextBrowser" name="msgText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -287,9 +287,9 @@
</widget>
<customwidgets>
<customwidget>
<class>LinkTextBrowser</class>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>LineEditClear</class>

View File

@ -352,59 +352,59 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="521"/>
<location filename="../gui/FeedReaderDialog.cpp" line="524"/>
<source>No name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="733"/>
<location filename="../gui/FeedReaderDialog.cpp" line="736"/>
<source>Add new folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="734"/>
<location filename="../gui/FeedReaderDialog.cpp" line="737"/>
<source>Please enter a name for the folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="740"/>
<location filename="../gui/FeedReaderDialog.cpp" line="793"/>
<location filename="../gui/FeedReaderDialog.cpp" line="743"/>
<location filename="../gui/FeedReaderDialog.cpp" line="796"/>
<source>Create folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="740"/>
<location filename="../gui/FeedReaderDialog.cpp" line="793"/>
<location filename="../gui/FeedReaderDialog.cpp" line="743"/>
<location filename="../gui/FeedReaderDialog.cpp" line="796"/>
<source>Cannot create folder.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="766"/>
<location filename="../gui/FeedReaderDialog.cpp" line="769"/>
<source>Remove folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="766"/>
<location filename="../gui/FeedReaderDialog.cpp" line="769"/>
<source>Remove feed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="766"/>
<location filename="../gui/FeedReaderDialog.cpp" line="769"/>
<source>Do you want to remove the folder %1?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="766"/>
<location filename="../gui/FeedReaderDialog.cpp" line="769"/>
<source>Do you want to remove the feed %1?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="786"/>
<location filename="../gui/FeedReaderDialog.cpp" line="789"/>
<source>Edit folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/FeedReaderDialog.cpp" line="787"/>
<location filename="../gui/FeedReaderDialog.cpp" line="790"/>
<source>Please enter a new name for the folder</source>
<translation type="unfinished"></translation>
</message>

View File

@ -139,6 +139,8 @@ ForumsDialog::ForumsDialog(QWidget *parent)
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)));
ui.postText->setImageBlockWidget(ui.imageBlockWidget);
/* Set initial size the splitter */
QList<int> sizes;
sizes << 300 << width(); // Qt calculates the right sizes
@ -888,6 +890,7 @@ void ForumsDialog::insertThreads()
ui.newthreadButton->setEnabled (false);
ui.postText->clear();
ui.postText->resetImagesStatus(false);
ui.threadTitle->clear();
if (mCurrForumId.empty())
@ -1133,6 +1136,7 @@ void ForumsDialog::insertPost()
if (mCurrForumId.empty())
{
ui.postText->setText("");
ui.postText->resetImagesStatus(false);
ui.threadTitle->setText("");
ui.previousButton->setEnabled(false);
ui.nextButton->setEnabled(false);
@ -1149,10 +1153,12 @@ void ForumsDialog::insertPost()
ForumInfo fi;
if (!rsForums->getForumInfo(mCurrForumId, fi)) {
ui.postText->setText("");
ui.postText->resetImagesStatus(false);
ui.threadTitle->setText("");
return;
}
ui.threadTitle->setText(tr("Forum Description"));
ui.postText->resetImagesStatus(false);
ui.postText->setText(QString::fromStdWString(fi.forumDesc));
return;
}
@ -1177,6 +1183,7 @@ void ForumsDialog::insertPost()
ForumMsgInfo msg;
if (!rsForums->getForumMessage(mCurrForumId, mCurrThreadId, msg))
{
ui.postText->resetImagesStatus(false);
ui.postText->setText("");
return;
}
@ -1203,6 +1210,7 @@ void ForumsDialog::insertPost()
QString extraTxt = RsHtml().formatText(ui.postText->document(), messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
ui.postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages());
ui.postText->setHtml(extraTxt);
ui.threadTitle->setText(titleFromInfo(msg));
}

View File

@ -114,6 +114,92 @@
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QFrame" name="toolBarFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QToolButton" name="newthreadButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Start new Thread for Selected Forum</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="newmessageButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Reply Message</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_reply.png</normaloff>:/images/mail_reply.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout">
<item>
@ -192,53 +278,39 @@
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QTreeWidget" name="threadTreeWidget">
<item row="4" column="0">
<layout class="QHBoxLayout" name="progressBarLayOut">
<item>
<widget class="QLabel" name="progLayOutTxt">
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Title</string>
<string>Loading</string>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/message-state-header.png</normaloff>:/images/message-state-header.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>Date</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
</column>
<column>
<property name="text">
<string>Signed</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<layout class="QGridLayout">
<item row="0" column="1">
@ -415,128 +487,72 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QFrame" name="toolBarFrame">
<item row="3" column="0">
<widget class="QTreeWidget" name="threadTreeWidget">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/message-state-header.png</normaloff>:/images/message-state-header.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>Date</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
</column>
<column>
<property name="text">
<string>Signed</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<layout class="QVBoxLayout" name="postLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="RSImageBlockWidget" name="imageBlockWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QToolButton" name="newthreadButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Start new Thread for Selected Forum</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="newmessageButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Reply Message</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_reply.png</normaloff>:/images/mail_reply.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="progressBarLayOut">
<item>
<widget class="QLabel" name="progLayOutTxt">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Loading</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="LinkTextBrowser" name="postText">
<widget class="RSTextBrowser" name="postText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -549,6 +565,9 @@
</font>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
@ -567,6 +586,17 @@
<zorder>titleBarFrame</zorder>
</widget>
<customwidgets>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>RSImageBlockWidget</class>
<extends>QWidget</extends>
<header>gui/common/RSImageBlockWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GroupTreeWidget</class>
<extends>QWidget</extends>
@ -578,11 +608,6 @@
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>LinkTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>

View File

@ -656,7 +656,7 @@
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="LinkTextBrowser" name="msgText">
<widget class="RSTextBrowser" name="msgText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -837,9 +837,9 @@
</widget>
<customwidgets>
<customwidget>
<class>LinkTextBrowser</class>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>AvatarWidget</class>

View File

@ -212,7 +212,7 @@ border-image: url(:/images/closepressed.png)
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="LinkTextBrowser" name="textBrowser">
<widget class="RSTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@ -707,9 +707,9 @@ border-image: url(:/images/closepressed.png)
</widget>
<customwidgets>
<customwidget>
<class>LinkTextBrowser</class>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>HashBox</class>

View File

@ -1,61 +0,0 @@
#include <QDesktopServices>
#include <QPainter>
#include "LinkTextBrowser.h"
LinkTextBrowser::LinkTextBrowser(QWidget *parent) :
QTextBrowser(parent)
{
setOpenExternalLinks(true);
setOpenLinks(false);
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
}
void LinkTextBrowser::linkClicked(const QUrl &url)
{
// some links are opened directly in the QTextBrowser with open external links set to true,
// so we handle links by our own
#ifdef TO_DO
// If we want extra file links to be anonymous, we need to insert the actual source here.
if(url.host() == HOST_EXTRAFILE)
{
std::cerr << "Extra file link detected. Adding parent id " << _target_sslid << " to sourcelist" << std::endl;
RetroShareLink link ;
link.fromUrl(url) ;
link.createExtraFile( link.name(),link.size(),link.hash(), _target_ssl_id) ;
QDesktopServices::openUrl(link.toUrl());
}
else
#endif
QDesktopServices::openUrl(url);
}
void LinkTextBrowser::setPlaceholderText(const QString &text)
{
placeholderText = text;
viewport()->repaint();
}
void LinkTextBrowser::paintEvent(QPaintEvent *event)
{
QTextBrowser::paintEvent(event);
if (placeholderText.isEmpty() == false && document()->isEmpty()) {
QWidget *vieportWidget = viewport();
QPainter painter(vieportWidget);
QPen pen = painter.pen();
QColor color = pen.color();
color.setAlpha(128);
pen.setColor(color);
painter.setPen(pen);
painter.drawText(QRect(QPoint(), vieportWidget->size()), Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextWordWrap, placeholderText);
}
}

View File

@ -1,24 +0,0 @@
#ifndef LINKTEXTBROWSER_H
#define LINKTEXTBROWSER_H
#include <QTextBrowser>
class LinkTextBrowser : public QTextBrowser
{
Q_OBJECT
public:
explicit LinkTextBrowser(QWidget *parent = 0);
void setPlaceholderText(const QString &text);
private slots:
void linkClicked(const QUrl &url);
protected:
void paintEvent(QPaintEvent *event);
QString placeholderText;
};
#endif // LINKTEXTBROWSER_H

View File

@ -0,0 +1,16 @@
#include "RSImageBlockWidget.h"
#include "ui_RSImageBlockWidget.h"
RSImageBlockWidget::RSImageBlockWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::RSImageBlockWidget)
{
ui->setupUi(this);
connect(ui->loadImagesButton, SIGNAL(clicked()), this, SIGNAL(showImages()));
}
RSImageBlockWidget::~RSImageBlockWidget()
{
delete ui;
}

View File

@ -0,0 +1,25 @@
#ifndef RSIMAGEBLOCKWIDGET_H
#define RSIMAGEBLOCKWIDGET_H
#include <QWidget>
namespace Ui {
class RSImageBlockWidget;
}
class RSImageBlockWidget : public QWidget
{
Q_OBJECT
public:
explicit RSImageBlockWidget(QWidget *parent = 0);
~RSImageBlockWidget();
signals:
void showImages();
private:
Ui::RSImageBlockWidget *ui;
};
#endif // RSIMAGEBLOCKWIDGET_H

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RSImageBlockWidget</class>
<widget class="QWidget" name="RSImageBlockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>37</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="infoFrame">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>178</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="infoLabel">
<property name="text">
<string>The loading of embedded images is blocked.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>162</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="loadImagesButton">
<property name="text">
<string>Load images</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,126 @@
#include <QDesktopServices>
#include <QPainter>
#include "RSTextBrowser.h"
#include "RSImageBlockWidget.h"
RSTextBrowser::RSTextBrowser(QWidget *parent) :
QTextBrowser(parent)
{
setOpenExternalLinks(true);
setOpenLinks(false);
mShowImages = true;
mImageBlockWidget = NULL;
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
}
void RSTextBrowser::linkClicked(const QUrl &url)
{
// some links are opened directly in the QTextBrowser with open external links set to true,
// so we handle links by our own
#ifdef TO_DO
// If we want extra file links to be anonymous, we need to insert the actual source here.
if(url.host() == HOST_EXTRAFILE)
{
std::cerr << "Extra file link detected. Adding parent id " << _target_sslid << " to sourcelist" << std::endl;
RetroShareLink link ;
link.fromUrl(url) ;
link.createExtraFile( link.name(),link.size(),link.hash(), _target_ssl_id) ;
QDesktopServices::openUrl(link.toUrl());
}
else
#endif
QDesktopServices::openUrl(url);
}
void RSTextBrowser::setPlaceholderText(const QString &text)
{
mPlaceholderText = text;
viewport()->repaint();
}
void RSTextBrowser::paintEvent(QPaintEvent *event)
{
QTextBrowser::paintEvent(event);
if (mPlaceholderText.isEmpty() == false && document()->isEmpty()) {
QWidget *vieportWidget = viewport();
QPainter painter(vieportWidget);
QPen pen = painter.pen();
QColor color = pen.color();
color.setAlpha(128);
pen.setColor(color);
painter.setPen(pen);
painter.drawText(QRect(QPoint(), vieportWidget->size()), Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextWordWrap, mPlaceholderText);
}
}
QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
{
if (mShowImages || type != QTextDocument::ImageResource || name.scheme().compare("data", Qt::CaseInsensitive) != 0) {
return QTextBrowser::loadResource(type, name);
}
if (mImageBlockWidget) {
mImageBlockWidget->show();
}
return QPixmap(":/trolltech/styles/commonstyle/images/file-16.png");
}
void RSTextBrowser::setImageBlockWidget(RSImageBlockWidget *widget)
{
if (mImageBlockWidget) {
// disconnect
disconnect(mImageBlockWidget, SIGNAL(destroyed()), this, SLOT(destroyImageBlockWidget()));
disconnect(mImageBlockWidget, SIGNAL(showImages()), this, SLOT(showImages()));
}
mImageBlockWidget = widget;
if (mImageBlockWidget) {
// connect
connect(mImageBlockWidget, SIGNAL(destroyed()), this, SLOT(destroyImageBlockWidget()));
connect(mImageBlockWidget, SIGNAL(showImages()), this, SLOT(showImages()));
}
resetImagesStatus(false);
}
void RSTextBrowser::destroyImageBlockWidget()
{
mImageBlockWidget = NULL;
}
void RSTextBrowser::showImages()
{
if (mImageBlockWidget && sender() == mImageBlockWidget) {
mImageBlockWidget->hide();
}
if (mShowImages) {
return;
}
mShowImages = true;
QString html = toHtml();
clear();
setHtml(html);
}
void RSTextBrowser::resetImagesStatus(bool load)
{
if (mImageBlockWidget) {
mImageBlockWidget->hide();
}
mShowImages = load;
}

View File

@ -0,0 +1,36 @@
#ifndef RSTEXTBROWSER_H
#define RSTEXTBROWSER_H
#include <QTextBrowser>
class RSImageBlockWidget;
class RSTextBrowser : public QTextBrowser
{
Q_OBJECT
public:
explicit RSTextBrowser(QWidget *parent = 0);
void setPlaceholderText(const QString &text);
void setImageBlockWidget(RSImageBlockWidget *widget);
void resetImagesStatus(bool load);
virtual QVariant loadResource(int type, const QUrl &name);
public slots:
void showImages();
private slots:
void linkClicked(const QUrl &url);
void destroyImageBlockWidget();
protected:
void paintEvent(QPaintEvent *event);
QString mPlaceholderText;
bool mShowImages;
RSImageBlockWidget *mImageBlockWidget;
};
#endif // RSTEXTBROWSER_H

View File

@ -25,7 +25,7 @@
#include "UIStateHelper.h"
#include "RSTreeWidget.h"
#include "LinkTextBrowser.h"
#include "RSTextBrowser.h"
class UIStateHelperObject
{
@ -45,10 +45,10 @@ public:
init();
mTreeWidget = widget;
}
UIStateHelperObject(LinkTextBrowser *widget)
UIStateHelperObject(RSTextBrowser *widget)
{
init();
mLinkTextBrowser = widget;
mRSTextBrowser = widget;
}
void setPlaceholder(bool loading, const QString &text, bool clear) const
@ -77,12 +77,12 @@ public:
mTreeWidget->setPlaceholderText(text);
}
if (mLinkTextBrowser) {
if (mRSTextBrowser) {
if (loading && clear) {
mLinkTextBrowser->clear();
mRSTextBrowser->clear();
}
mLinkTextBrowser->setPlaceholderText(text);
mRSTextBrowser->setPlaceholderText(text);
}
}
@ -100,8 +100,8 @@ public:
mTreeWidget->clear();
}
if (mLinkTextBrowser) {
mLinkTextBrowser->clear();
if (mRSTextBrowser) {
mRSTextBrowser->clear();
}
}
@ -119,8 +119,8 @@ public:
return mTreeWidget;
}
if (mLinkTextBrowser) {
return mLinkTextBrowser;
if (mRSTextBrowser) {
return mRSTextBrowser;
}
return NULL;
@ -140,7 +140,7 @@ public:
return true;
}
if (mLinkTextBrowser == widget) {
if (mRSTextBrowser == widget) {
return true;
}
@ -152,7 +152,7 @@ public:
if (mLabel == data.mLabel &&
mLineEdit == data.mLineEdit &&
mTreeWidget == data.mTreeWidget &&
mLinkTextBrowser == data.mLinkTextBrowser) {
mRSTextBrowser == data.mRSTextBrowser) {
return true;
}
@ -164,7 +164,7 @@ public:
if (mLabel < data.mLabel ||
mLineEdit < data.mLineEdit ||
mTreeWidget < data.mTreeWidget ||
mLinkTextBrowser < data.mLinkTextBrowser) {
mRSTextBrowser < data.mRSTextBrowser) {
return true;
}
@ -177,14 +177,14 @@ private:
mLabel = NULL;
mLineEdit = NULL;
mTreeWidget = NULL;
mLinkTextBrowser = NULL;
mRSTextBrowser = NULL;
}
private:
QLabel *mLabel;
QLineEdit *mLineEdit;
RSTreeWidget *mTreeWidget;
LinkTextBrowser *mLinkTextBrowser;
RSTextBrowser *mRSTextBrowser;
};
class UIStateHelperData
@ -258,7 +258,7 @@ void UIStateHelper::addLoadPlaceholder(int index, RSTreeWidget *widget, bool cle
data->mLoad.insert(UIStateHelperObject(widget), QPair<QString, bool>(text.isEmpty() ? tr("Loading") : text, clear));
}
void UIStateHelper::addLoadPlaceholder(int index, LinkTextBrowser *widget, bool clear, const QString &text)
void UIStateHelper::addLoadPlaceholder(int index, RSTextBrowser *widget, bool clear, const QString &text)
{
UIStateHelperData *data = findData(index, true);
data->mLoad.insert(UIStateHelperObject(widget), QPair<QString, bool>(text.isEmpty() ? tr("Loading") : text, clear));
@ -291,7 +291,7 @@ void UIStateHelper::addClear(int index, RSTreeWidget *widget)
data->mClear.push_back(UIStateHelperObject(widget));
}
void UIStateHelper::addClear(int index, LinkTextBrowser *widget)
void UIStateHelper::addClear(int index, RSTextBrowser *widget)
{
UIStateHelperData *data = findData(index, true);
if (data->mClear.contains(widget)) {

View File

@ -30,7 +30,7 @@ class QLabel;
class QLineEdit;
class RSTreeWidget;
class UIStateHelperData;
class LinkTextBrowser;
class RSTextBrowser;
enum UIState // State is untouched when bit is not set
{
@ -61,11 +61,11 @@ public:
void addLoadPlaceholder(int index, QLabel *widget, bool clear = true, const QString &text = "" /* ="Loading" */);
void addLoadPlaceholder(int index, QLineEdit *widget, bool clear = true, const QString &text = "" /* ="Loading" */);
void addLoadPlaceholder(int index, RSTreeWidget *widget, bool clear = true, const QString &text = "" /* ="Loading" */);
void addLoadPlaceholder(int index, LinkTextBrowser *widget, bool clear = true, const QString &text = "" /* ="Loading" */);
void addLoadPlaceholder(int index, RSTextBrowser *widget, bool clear = true, const QString &text = "" /* ="Loading" */);
void addClear(int index, QLabel *widget);
void addClear(int index, QLineEdit *widget);
void addClear(int index, RSTreeWidget *widget);
void addClear(int index, LinkTextBrowser *widget);
void addClear(int index, RSTextBrowser *widget);
/* Set state */
void setLoading(int index, bool loading);

View File

@ -129,7 +129,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="LinkTextBrowser" name="rsid">
<widget class="RSTextBrowser" name="rsid">
<property name="enabled">
<bool>true</bool>
</property>
@ -584,7 +584,7 @@
</property>
<layout class="QVBoxLayout" name="_11">
<item>
<widget class="LinkTextBrowser" name="signers"/>
<widget class="RSTextBrowser" name="signers"/>
</item>
</layout>
</widget>
@ -917,9 +917,9 @@ Some services (Discovery, anonymous routing) can be switched off globally, which
<container>1</container>
</customwidget>
<customwidget>
<class>LinkTextBrowser</class>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
</customwidgets>
<resources>

View File

@ -27,6 +27,7 @@
#include <QDesktopWidget>
#include <QDropEvent>
#include <QPushButton>
#include <QTextDocumentFragment>
#include <retroshare/rsforums.h>
#include <retroshare/rspeers.h>
@ -66,6 +67,7 @@ CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId)
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile()));
connect(ui.attachPictureButton, SIGNAL(clicked()), this, SLOT(addPicture()));
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
setAcceptDrops(true);
@ -213,6 +215,19 @@ void CreateForumMsg::addFile()
}
}
void CreateForumMsg::addPicture()
{
// select a picture file
QString file;
if (misc::getOpenFileName(window(), RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg)", file)) {
QString encodedImage;
if (RsHtml::makeEmbeddedImage(file, encodedImage, 640*480)) {
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
ui.forumMessage->textCursor().insertFragment(fragment);
}
}
}
void CreateForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
{
std::cerr << "CreateForumMsg::fileHashingFinished() started." << std::endl;

View File

@ -48,6 +48,7 @@ private slots:
void smileyWidgetForums();
void addSmileys();
void addFile();
void addPicture();
protected:
void closeEvent (QCloseEvent * event);

View File

@ -101,9 +101,6 @@
<property name="toolTip">
<string>Attach File</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
@ -120,12 +117,32 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="emoticonButton">
<widget class="QToolButton" name="attachPictureButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
<property name="toolTip">
<string>Attach a Picture</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="emoticonButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
@ -186,9 +203,6 @@
<property name="toolTip">
<string>Paste RetroShare Link</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
@ -208,7 +222,7 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="forumMessage">
<widget class="MimeTextEdit" name="forumMessage">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
@ -217,7 +231,7 @@
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -262,18 +276,23 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>

View File

@ -490,7 +490,7 @@
</item>
</layout>
</widget>
<widget class="LinkTextBrowser" name="postText">
<widget class="RSTextBrowser" name="postText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -509,9 +509,9 @@
</widget>
<customwidgets>
<customwidget>
<class>LinkTextBrowser</class>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>LineEditClear</class>

View File

@ -135,6 +135,8 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WFlags flags)
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged()));
ui.msgText->setImageBlockWidget(ui.imageBlockWidget);
/* hide the Tree +/- */
ui.msgList->setRootIsDecorated( false );
ui.msgList->setSelectionMode( QAbstractItemView::ExtendedSelection );
@ -452,6 +454,7 @@ void MessageWidget::fill(const std::string &msgId)
ui.subjectText->setText("");
ui.msgList->clear();
ui.msgText->clear();
ui.msgText->resetImagesStatus(false);
clearTagLabels();
@ -557,6 +560,7 @@ void MessageWidget::fill(const std::string &msgId)
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromStdWString(msgInfo.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_REPLACE_LINKS);
ui.msgText->resetImagesStatus(Settings->getMsgLoadEmbeddedImages());
ui.msgText->setHtml(text);
ui.filesText->setText(QString("(%1 %2)").arg(msgInfo.count).arg(msgInfo.count == 1 ? tr("File") : tr("Files")));

View File

@ -37,119 +37,11 @@
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QTextBrowser" name="msgText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="_2">
<item>
<layout class="QGridLayout" name="_3">
<property name="margin">
<number>0</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
<number>2</number>
</property>
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/attachment.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Recommended Files</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="filesText">
<property name="font">
<font>
<pointsize>10</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>351</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="downloadButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Download all Recommended Files</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandFilesButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="_4">
<property name="leftMargin">
<number>6</number>
@ -434,6 +326,127 @@
</item>
</layout>
</item>
<item>
<widget class="RSImageBlockWidget" name="imageBlockWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="RSTextBrowser" name="msgText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="_2">
<item>
<layout class="QGridLayout" name="_3">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/attachment.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Recommended Files</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="filesText">
<property name="font">
<font>
<pointsize>10</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>351</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="downloadButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Download all Recommended Files</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandFilesButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
@ -482,6 +495,19 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>RSImageBlockWidget</class>
<extends>QWidget</extends>
<header>gui/common/RSImageBlockWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>

View File

@ -432,3 +432,11 @@ ProfileManager QTextEdit#textEdit
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}
/* RSImageBlockWidget */
RSImageBlockWidget QFrame#infoFrame {
border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}

View File

@ -44,6 +44,7 @@ ForumPage::save(QString &/*errmsg*/)
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked());
Settings->setForumOpenAllInNewTab(ui.openAllInNewTabCheckBox->isChecked());
Settings->setForumLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
return true;
}
@ -55,4 +56,5 @@ ForumPage::load()
ui.setMsgToReadOnActivate->setChecked(Settings->getForumMsgSetToReadOnActivate());
ui.expandNewMessages->setChecked(Settings->getForumExpandNewMessages());
ui.openAllInNewTabCheckBox->setChecked(Settings->getForumOpenAllInNewTab());
ui.loadEmbeddedImages->setChecked(Settings->getForumLoadEmbeddedImages());
}

View File

@ -31,6 +31,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="loadEmbeddedImages">
<property name="text">
<string>Load embedded images</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -67,6 +67,7 @@ bool
MessagePage::save(QString &/*errmsg*/)
{
Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
@ -95,6 +96,7 @@ void
MessagePage::load()
{
ui.setMsgToReadOnActivate->setChecked(Settings->getMsgSetToReadOnActivate());
ui.loadEmbeddedImages->setChecked(Settings->getMsgLoadEmbeddedImages());
ui.openComboBox->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
ui.encryptedMsgs_CB->setChecked(rsMsgs->distantMessagingEnabled()) ;

View File

@ -30,6 +30,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="loadEmbeddedImages">
<property name="text">
<string>Load embedded images</string>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>

View File

@ -703,6 +703,16 @@ void RshareSettings::setMsgSetToReadOnActivate (bool value)
setValueToGroup("MessageDialog", "SetMsgToReadOnActivate", value);
}
bool RshareSettings::getMsgLoadEmbeddedImages()
{
return valueFromGroup("MessageDialog", "LoadEmbeddedImages", false).toBool();
}
void RshareSettings::setMsgLoadEmbeddedImages(bool value)
{
setValueToGroup("MessageDialog", "LoadEmbeddedImages", value);
}
RshareSettings::enumMsgOpen RshareSettings::getMsgOpen()
{
enumMsgOpen value = (enumMsgOpen) valueFromGroup("MessageDialog", "msgOpen", MSG_OPEN_TAB).toInt();
@ -775,3 +785,13 @@ void RshareSettings::setMaxTimeBeforeIdle(uint nValue)
m_maxTimeBeforeIdle = nValue;
setValue("maxTimeBeforeIdle", nValue);
}
bool RshareSettings::getForumLoadEmbeddedImages()
{
return valueFromGroup("ForumDialog", "LoadEmbeddedImages", false).toBool();
}
void RshareSettings::setForumLoadEmbeddedImages(bool value)
{
setValueToGroup("ForumDialog", "LoadEmbeddedImages", value);
}

View File

@ -238,6 +238,8 @@ public:
/* Messages */
bool getMsgSetToReadOnActivate();
void setMsgSetToReadOnActivate(bool value);
bool getMsgLoadEmbeddedImages();
void setMsgLoadEmbeddedImages(bool value);
enumMsgOpen getMsgOpen();
void setMsgOpen(enumMsgOpen value);
@ -249,6 +251,8 @@ public:
void setForumExpandNewMessages(bool value);
bool getForumOpenAllInNewTab();
void setForumOpenAllInNewTab(bool value);
bool getForumLoadEmbeddedImages();
void setForumLoadEmbeddedImages(bool value);
/* time before idle */
uint getMaxTimeBeforeIdle();

View File

@ -1411,6 +1411,30 @@ Double click lobbies to enter and chat.</source>
<source> &lt;h1&gt;&lt;img width=&quot;32&quot; src=&quot;:/images/64px_help.png&quot;&gt;&amp;nbsp;&amp;nbsp;Chat Lobbies&lt;/h1&gt; &lt;p&gt;Chat lobbies are distributed chat rooms, and work pretty much like IRC. They allow you to talk anonymously with tons of people without the need to make friends.&lt;/p&gt; &lt;p&gt;A chat lobby can be public (your friends see it) or private (your friends can&apos;t see it, unless you invite them with &lt;img src=&quot;:/images/add_24x24.png&quot; width=12/&gt;). Once you have been invited to a private lobby, you will be able to see it when your friends are using it.&lt;/p&gt; &lt;p&gt;The list at left shows chat lobbies your friends are participating in. You can either &lt;ul&gt; &lt;li&gt;Right click to create a new chat lobby&lt;/li&gt; &lt;li&gt;Double click a chat lobby to enter, chat, and show it to your friends&lt;/li&gt; &lt;/ul&gt; Note: For the chat lobbies to work properly, your computer needs be on time. So check your system clock! &lt;/p&gt; </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Subscribed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show </source>
<translation type="unfinished"></translation>
</message>
<message>
<source> Column</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Columns</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatMsgItem</name>
@ -3823,6 +3847,14 @@ p, li { white-space: pre-wrap; }
<source>Add Extra File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Attach a Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Load Picture File</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CreateGroup</name>
@ -5377,6 +5409,10 @@ p, li { white-space: pre-wrap; }
<source>Forum</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Load embedded images</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ForumUserNotify</name>
@ -8918,6 +8954,10 @@ Do you want to save message ?</source>
<source>Accept encrypted distant messages from everyone</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Load embedded images</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MessageToaster</name>
@ -10703,18 +10743,10 @@ p, li { white-space: pre-wrap; }
</context>
<context>
<name>PostedGroupDialog</name>
<message>
<source>Create New Posted Topic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Posted Topic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Edit Posted Topic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Topic Admins</source>
<translation type="unfinished"></translation>
@ -10723,6 +10755,14 @@ p, li { white-space: pre-wrap; }
<source>Select Topic Admins</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Create New Topic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Edit Topic</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PostedItem</name>
@ -10730,10 +10770,6 @@ p, li { white-space: pre-wrap; }
<source>0</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>\/</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don&apos;t you think? Yes it is and should wrap around I hope</source>
<translation type="unfinished"></translation>
@ -10763,11 +10799,11 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<source>Vote Up</source>
<source>I like this</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Vote Down</source>
<source>I dislike this</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -11654,6 +11690,21 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RSImageBlockWidget</name>
<message>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The loading of embedded images is blocked.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Load images</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RSettingsWin</name>
<message>

View File

@ -450,7 +450,8 @@ HEADERS += rshare.h \
gui/common/HashBox.h \
gui/common/LineEditClear.h \
gui/common/DropLineEdit.h \
gui/common/LinkTextBrowser.h \
gui/common/RSTextBrowser.h \
gui/common/RSImageBlockWidget.h \
gui/common/FeedNotify.h \
gui/common/UserNotify.h \
gui/common/HeaderFrame.h \
@ -593,6 +594,7 @@ FORMS += gui/StartDialog.ui \
gui/common/FriendList.ui \
gui/common/FriendSelectionWidget.ui \
gui/common/HashBox.ui \
gui/common/RSImageBlockWidget.ui \
gui/common/RsCollectionDialog.ui \
gui/common/HeaderFrame.ui \
gui/style/StyleDialog.ui \
@ -729,7 +731,8 @@ SOURCES += main.cpp \
gui/common/HashBox.cpp \
gui/common/LineEditClear.cpp \
gui/common/DropLineEdit.cpp \
gui/common/LinkTextBrowser.cpp \
gui/common/RSTextBrowser.cpp \
gui/common/RSImageBlockWidget.cpp \
gui/common/FeedNotify.cpp \
gui/common/UserNotify.cpp \
gui/common/HeaderFrame.cpp \