mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-24 05:49:29 -04:00
Added new action "Load images always for this message" to image blocking.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6760 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0a3419c692
commit
6a9dfed408
16 changed files with 255 additions and 97 deletions
|
@ -139,6 +139,7 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)));
|
||||
|
||||
ui.imageBlockWidget->addButtonAction(tr("Load images always for this message"), this, SLOT(loadImagesAlways()), true);
|
||||
ui.postText->setImageBlockWidget(ui.imageBlockWidget);
|
||||
|
||||
/* Set initial size the splitter */
|
||||
|
@ -481,11 +482,11 @@ void ForumsDialog::togglethreadview()
|
|||
void ForumsDialog::togglethreadview_internal()
|
||||
{
|
||||
if (ui.expandButton->isChecked()) {
|
||||
ui.postText->setVisible(true);
|
||||
ui.postFrame->setVisible(true);
|
||||
ui.expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
ui.expandButton->setToolTip(tr("Hide"));
|
||||
} else {
|
||||
ui.postText->setVisible(false);
|
||||
ui.postFrame->setVisible(false);
|
||||
ui.expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
ui.expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
@ -1210,7 +1211,16 @@ 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());
|
||||
bool loadEmbeddedImages = Settings->getForumLoadEmbeddedImages();
|
||||
if (!loadEmbeddedImages) {
|
||||
uint32_t status = 0;
|
||||
rsForums->getMessageStatus(mCurrForumId, mCurrThreadId, status);
|
||||
if (status & FORUM_MSG_STATUS_LOAD_EMBEDDED_IMAGES) {
|
||||
loadEmbeddedImages = true;
|
||||
}
|
||||
}
|
||||
|
||||
ui.postText->resetImagesStatus(loadEmbeddedImages);
|
||||
ui.postText->setHtml(extraTxt);
|
||||
ui.threadTitle->setText(titleFromInfo(msg));
|
||||
}
|
||||
|
@ -2119,3 +2129,12 @@ void ForumsFillThread::run()
|
|||
std::cerr << "ForumsFillThread::run() stopped: " << (wasStopped() ? "yes" : "no") << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ForumsDialog::loadImagesAlways()
|
||||
{
|
||||
if (mCurrForumId.empty() || mCurrThreadId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
rsForums->setMessageStatus(mCurrForumId, mCurrThreadId, FORUM_MSG_STATUS_LOAD_EMBEDDED_IMAGES, FORUM_MSG_STATUS_LOAD_EMBEDDED_IMAGES);
|
||||
}
|
||||
|
|
|
@ -128,6 +128,8 @@ private slots:
|
|||
|
||||
void shareKey();
|
||||
|
||||
void loadImagesAlways();
|
||||
|
||||
private:
|
||||
void insertForums();
|
||||
void insertThreads();
|
||||
|
|
|
@ -113,8 +113,8 @@
|
|||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="toolBarFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
|
@ -200,7 +200,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
|
@ -278,7 +278,54 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item>
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="progressBarLayOut">
|
||||
<item>
|
||||
<widget class="QLabel" name="progLayOutTxt">
|
||||
|
@ -311,7 +358,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="threadlabel">
|
||||
|
@ -487,60 +534,16 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<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">
|
||||
<widget class="QFrame" name="postFrame">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="RSImageBlockWidget" name="imageBlockWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2013 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "RSImageBlockWidget.h"
|
||||
#include "ui_RSImageBlockWidget.h"
|
||||
|
||||
|
@ -14,3 +37,30 @@ RSImageBlockWidget::~RSImageBlockWidget()
|
|||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RSImageBlockWidget::addButtonAction(const QString &text, const QObject *receiver, const char *member, bool standardAction)
|
||||
{
|
||||
QMenu *menu = ui->loadImagesButton->menu();
|
||||
if (!menu) {
|
||||
/* Set popup mode */
|
||||
ui->loadImagesButton->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
ui->loadImagesButton->setIcon(ui->loadImagesButton->icon()); // Sometimes Qt doesn't recalculate sizeHint
|
||||
|
||||
/* Create popup menu */
|
||||
menu = new QMenu;
|
||||
ui->loadImagesButton->setMenu(menu);
|
||||
|
||||
/* Add 'click' action as action */
|
||||
QAction *action = menu->addAction(ui->loadImagesButton->text(), this, SIGNAL(showImages()));
|
||||
menu->setDefaultAction(action);
|
||||
}
|
||||
|
||||
/* Add new action */
|
||||
QAction *action = menu->addAction(text, receiver, member);
|
||||
ui->loadImagesButton->addAction(action);
|
||||
|
||||
if (standardAction) {
|
||||
/* Connect standard action */
|
||||
connect(action, SIGNAL(triggered()), this, SIGNAL(showImages()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2013 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef RSIMAGEBLOCKWIDGET_H
|
||||
#define RSIMAGEBLOCKWIDGET_H
|
||||
|
||||
|
@ -15,6 +36,8 @@ public:
|
|||
explicit RSImageBlockWidget(QWidget *parent = 0);
|
||||
~RSImageBlockWidget();
|
||||
|
||||
void addButtonAction(const QString &text, const QObject *receiver, const char *member, bool standardAction);
|
||||
|
||||
signals:
|
||||
void showImages();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>476</width>
|
||||
<height>37</height>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -110,14 +110,14 @@
|
|||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>162</width>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="loadImagesButton">
|
||||
<widget class="QToolButton" name="loadImagesButton">
|
||||
<property name="text">
|
||||
<string>Load images</string>
|
||||
</property>
|
||||
|
|
|
@ -135,6 +135,7 @@ 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.imageBlockWidget->addButtonAction(tr("Load images always for this message"), this, SLOT(loadImagesAlways()), true);
|
||||
ui.msgText->setImageBlockWidget(ui.imageBlockWidget);
|
||||
|
||||
/* hide the Tree +/- */
|
||||
|
@ -560,7 +561,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->resetImagesStatus(Settings->getMsgLoadEmbeddedImages() || (msgInfo.msgflags & RS_MSG_LOAD_EMBEDDED_IMAGES));
|
||||
ui.msgText->setHtml(text);
|
||||
|
||||
ui.filesText->setText(QString("(%1 %2)").arg(msgInfo.count).arg(msgInfo.count == 1 ? tr("File") : tr("Files")));
|
||||
|
@ -713,3 +714,12 @@ void MessageWidget::anchorClicked(const QUrl &url)
|
|||
links.append(link);
|
||||
RetroShareLink::process(links);
|
||||
}
|
||||
|
||||
void MessageWidget::loadImagesAlways()
|
||||
{
|
||||
if (currMsgId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
rsMsgs->MessageLoadEmbeddedImages(currMsgId, true);
|
||||
}
|
||||
|
|
|
@ -78,6 +78,8 @@ private slots:
|
|||
|
||||
void anchorClicked(const QUrl &url);
|
||||
|
||||
void loadImagesAlways();
|
||||
|
||||
private:
|
||||
void clearTagLabels();
|
||||
void showTagLabels();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue