mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-10 15:20:25 -04:00
Added new button to open the link of the message in browser or copy the link of the message.
Added "RSS: " for the forum feeds. Parse the feedburner:origLink in the rss feed. Moved download functions to a new class CURLWrapper for easy use. Added two new functions (currently only for local feeds for testing): - embed images into the message (works for Qt 4.7 and higher) - save complete web page git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5399 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8f2ff3eaf5
commit
148d1310a2
17 changed files with 806 additions and 237 deletions
|
@ -46,12 +46,17 @@ AddFeedDialog::AddFeedDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
connect(ui->useStandardProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useStandardProxyToggled()));
|
||||
connect(ui->typeForumRadio, SIGNAL(toggled(bool)), this, SLOT(typeForumToggled()));
|
||||
|
||||
/* currently only for loacl feeds */
|
||||
connect(ui->saveCompletePageCheckBox, SIGNAL(toggled(bool)), this, SLOT(denyForumToggled()));
|
||||
connect(ui->embedImagesCheckBox, SIGNAL(toggled(bool)), this, SLOT(denyForumToggled()));
|
||||
|
||||
connect(ui->urlLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(ui->nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(ui->useInfoFromFeedCheckBox, SIGNAL(toggled(bool)), this, SLOT(validate()));
|
||||
connect(ui->typeLocalRadio, SIGNAL(toggled(bool)), this, SLOT(validate()));
|
||||
connect(ui->typeForumRadio, SIGNAL(toggled(bool)), this, SLOT(validate()));
|
||||
|
||||
ui->activatedCheckBox->setChecked(true);
|
||||
ui->typeLocalRadio->setChecked(true);
|
||||
ui->forumComboBox->setEnabled(false);
|
||||
ui->useInfoFromFeedCheckBox->setChecked(true);
|
||||
ui->updateForumInfoCheckBox->setEnabled(false);
|
||||
|
@ -124,6 +129,16 @@ void AddFeedDialog::typeForumToggled()
|
|||
ui->updateForumInfoCheckBox->setEnabled(checked);
|
||||
}
|
||||
|
||||
void AddFeedDialog::denyForumToggled()
|
||||
{
|
||||
if (ui->saveCompletePageCheckBox->isChecked() || ui->embedImagesCheckBox->isChecked()) {
|
||||
ui->typeForumRadio->setEnabled(false);
|
||||
ui->typeLocalRadio->setChecked(true);
|
||||
} else {
|
||||
ui->typeForumRadio->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AddFeedDialog::validate()
|
||||
{
|
||||
bool ok = true;
|
||||
|
@ -134,6 +149,9 @@ void AddFeedDialog::validate()
|
|||
if (ui->nameLineEdit->text().isEmpty() && !ui->useInfoFromFeedCheckBox->isChecked()) {
|
||||
ok = false;
|
||||
}
|
||||
if (!ui->typeLocalRadio->isChecked() && !ui->typeForumRadio->isChecked()) {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok);
|
||||
}
|
||||
|
@ -196,6 +214,8 @@ bool AddFeedDialog::fillFeed(const std::string &feedId)
|
|||
ui->useInfoFromFeedCheckBox->setChecked(feedInfo.flag.infoFromFeed);
|
||||
ui->updateForumInfoCheckBox->setChecked(feedInfo.flag.updateForumInfo);
|
||||
ui->activatedCheckBox->setChecked(!feedInfo.flag.deactivated);
|
||||
ui->embedImagesCheckBox->setChecked(feedInfo.flag.embedImages);
|
||||
ui->saveCompletePageCheckBox->setChecked(feedInfo.flag.saveCompletePage);
|
||||
|
||||
ui->descriptionPlainTextEdit->setPlainText(QString::fromUtf8(feedInfo.description.c_str()));
|
||||
|
||||
|
@ -206,6 +226,8 @@ bool AddFeedDialog::fillFeed(const std::string &feedId)
|
|||
|
||||
if (feedInfo.flag.forum) {
|
||||
ui->typeForumRadio->setChecked(true);
|
||||
ui->saveCompletePageCheckBox->setEnabled(false);
|
||||
ui->embedImagesCheckBox->setEnabled(false);
|
||||
|
||||
if (feedInfo.forumId.empty()) {
|
||||
ui->forumNameLabel->setText(tr("Not yet created"));
|
||||
|
@ -259,13 +281,17 @@ void AddFeedDialog::createFeed()
|
|||
feedInfo.flag.infoFromFeed = ui->useInfoFromFeedCheckBox->isChecked();
|
||||
feedInfo.flag.updateForumInfo = ui->updateForumInfoCheckBox->isChecked() && ui->updateForumInfoCheckBox->isEnabled();
|
||||
feedInfo.flag.deactivated = !ui->activatedCheckBox->isChecked();
|
||||
feedInfo.flag.embedImages = ui->embedImagesCheckBox->isChecked();
|
||||
feedInfo.flag.saveCompletePage = ui->saveCompletePageCheckBox->isChecked();
|
||||
|
||||
feedInfo.description = ui->descriptionPlainTextEdit->toPlainText().toUtf8().constData();
|
||||
|
||||
feedInfo.flag.forum = ui->typeForumRadio->isChecked();
|
||||
if (mFeedId.empty()) {
|
||||
/* set forum (only when create a new feed) */
|
||||
feedInfo.forumId = ui->forumComboBox->itemData(ui->forumComboBox->currentIndex()).toString().toStdString();
|
||||
if (feedInfo.flag.forum) {
|
||||
/* set forum (only when create a new feed) */
|
||||
feedInfo.forumId = ui->forumComboBox->itemData(ui->forumComboBox->currentIndex()).toString().toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
feedInfo.flag.authentication = ui->useAuthenticationCheckBox->isChecked();
|
||||
|
|
|
@ -50,6 +50,7 @@ private slots:
|
|||
void useStandardUpdateIntervalToggled();
|
||||
void useStandardProxyToggled();
|
||||
void typeForumToggled();
|
||||
void denyForumToggled();
|
||||
void validate();
|
||||
void createFeed();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>715</width>
|
||||
<height>559</height>
|
||||
<height>605</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -289,13 +289,6 @@ p, li { white-space: pre-wrap; }
|
|||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="typeLocalRadio">
|
||||
<property name="text">
|
||||
<string>Local Feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
@ -323,6 +316,13 @@ p, li { white-space: pre-wrap; }
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="typeLocalRadio">
|
||||
<property name="text">
|
||||
<string>Local Feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -366,6 +366,20 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="embedImagesCheckBox">
|
||||
<property name="text">
|
||||
<string>Embed images (experimental for local feeds)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="saveCompletePageCheckBox">
|
||||
<property name="text">
|
||||
<string>Save complete web page (experimental for local feeds)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -416,7 +430,6 @@ p, li { white-space: pre-wrap; }
|
|||
<tabstop>urlLineEdit</tabstop>
|
||||
<tabstop>nameLineEdit</tabstop>
|
||||
<tabstop>descriptionPlainTextEdit</tabstop>
|
||||
<tabstop>typeLocalRadio</tabstop>
|
||||
<tabstop>typeForumRadio</tabstop>
|
||||
<tabstop>forumComboBox</tabstop>
|
||||
<tabstop>activatedCheckBox</tabstop>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QPainter>
|
||||
#include <QMessageBox>
|
||||
#include <QClipboard>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "FeedReaderDialog.h"
|
||||
#include "ui_FeedReaderDialog.h"
|
||||
|
@ -118,6 +119,7 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||
connect(ui->filterColumnComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterColumnChanged()));
|
||||
|
||||
connect(ui->linkButton, SIGNAL(clicked()), this, SLOT(openLinkMsg()));
|
||||
connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(toggleMsgText()));
|
||||
|
||||
mFeedCompareRole = new RSTreeWidgetItemCompareRole;
|
||||
|
@ -168,6 +170,18 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
/* initialize feed list */
|
||||
ui->feedTreeWidget->sortItems(COLUMN_FEED_NAME, Qt::AscendingOrder);
|
||||
|
||||
/* build menu for link button */
|
||||
QMenu *menu = new QMenu(this);
|
||||
QAction *action = menu->addAction(tr("Open link in browser"), this, SLOT(openLinkMsg()));
|
||||
menu->addAction(tr("Copy link to clipboard"), this, SLOT(copyLinkMsg()));
|
||||
|
||||
QFont font = action->font();
|
||||
font.setBold(true);
|
||||
action->setFont(font);
|
||||
|
||||
ui->linkButton->setMenu(menu);
|
||||
ui->linkButton->setEnabled(false);
|
||||
|
||||
ui->msgTreeWidget->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
@ -351,7 +365,7 @@ void FeedReaderDialog::msgTreeCustomPopupMenu(QPoint /*point*/)
|
|||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
action = contextMnu.addAction(QIcon(""), tr("Copy link"), this, SLOT(copyLinkMsg()));
|
||||
action = contextMnu.addAction(QIcon(""), tr("Copy link"), this, SLOT(copyLinskMsg()));
|
||||
action->setEnabled(!selectedItems.empty());
|
||||
|
||||
action = contextMnu.addAction(QIcon(""), tr("Remove"), this, SLOT(removeMsg()));
|
||||
|
@ -522,10 +536,14 @@ void FeedReaderDialog::updateFeedItem(QTreeWidgetItem *item, FeedInfo &info)
|
|||
case FeedInfo::WAITING:
|
||||
break;
|
||||
case FeedInfo::WAITING_TO_DOWNLOAD:
|
||||
workState = tr("waiting for download");
|
||||
break;
|
||||
case FeedInfo::DOWNLOADING:
|
||||
workState = tr("loading");
|
||||
workState = tr("downloading");
|
||||
break;
|
||||
case FeedInfo::WAITING_TO_PROCESS:
|
||||
workState = tr("waiting for process");
|
||||
break;
|
||||
case FeedInfo::PROCESSING:
|
||||
workState = tr("processing");
|
||||
break;
|
||||
|
@ -791,6 +809,7 @@ void FeedReaderDialog::msgItemChanged()
|
|||
ui->msgTitle->clear();
|
||||
// ui->msgLink->clear();
|
||||
ui->msgText->clear();
|
||||
ui->linkButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -800,6 +819,7 @@ void FeedReaderDialog::msgItemChanged()
|
|||
ui->msgTitle->clear();
|
||||
// ui->msgLink->clear();
|
||||
ui->msgText->clear();
|
||||
ui->linkButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -809,6 +829,7 @@ void FeedReaderDialog::msgItemChanged()
|
|||
ui->msgTitle->clear();
|
||||
// ui->msgLink->clear();
|
||||
ui->msgText->clear();
|
||||
ui->linkButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -832,7 +853,8 @@ void FeedReaderDialog::msgItemChanged()
|
|||
|
||||
ui->msgText->setHtml(msgTxt);
|
||||
ui->msgTitle->setText(QString::fromUtf8(msgInfo.title.c_str()));
|
||||
// ui->msgLink->setHtml(RsHtml().formatText(NULL, QString::fromUtf8(msgInfo.link.c_str()), RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
ui->linkButton->setEnabled(!msgInfo.link.empty());
|
||||
}
|
||||
|
||||
void FeedReaderDialog::setMsgAsReadUnread(QList<QTreeWidgetItem *> &rows, bool read)
|
||||
|
@ -1049,7 +1071,7 @@ void FeedReaderDialog::markAllAsReadMsg()
|
|||
setMsgAsReadUnread(items, true);
|
||||
}
|
||||
|
||||
void FeedReaderDialog::copyLinkMsg()
|
||||
void FeedReaderDialog::copyLinksMsg()
|
||||
{
|
||||
QString links;
|
||||
|
||||
|
@ -1086,3 +1108,33 @@ void FeedReaderDialog::removeMsg()
|
|||
}
|
||||
mFeedReader->removeMsgs(feedId, msgIds);
|
||||
}
|
||||
|
||||
void FeedReaderDialog::copyLinkMsg()
|
||||
{
|
||||
QTreeWidgetItem *item = ui->msgTreeWidget->currentItem();
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString link = item->data(COLUMN_MSG_DATA, ROLE_MSG_LINK).toString();
|
||||
if (link.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QApplication::clipboard()->setText(link);
|
||||
}
|
||||
|
||||
void FeedReaderDialog::openLinkMsg()
|
||||
{
|
||||
QTreeWidgetItem *item = ui->msgTreeWidget->currentItem();
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString link = item->data(COLUMN_MSG_DATA, ROLE_MSG_LINK).toString();
|
||||
if (link.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
}
|
||||
|
|
|
@ -64,8 +64,10 @@ private slots:
|
|||
void markAsReadMsg();
|
||||
void markAsUnreadMsg();
|
||||
void markAllAsReadMsg();
|
||||
void copyLinkMsg();
|
||||
void copyLinksMsg();
|
||||
void removeMsg();
|
||||
void openLinkMsg();
|
||||
void copyLinkMsg();
|
||||
|
||||
/* FeedReaderNotify */
|
||||
void feedChanged(const QString &feedId, int type);
|
||||
|
|
|
@ -268,8 +268,8 @@ border: 1px solid #CCCCCC;}</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<layout class="QGridLayout" name="navFrame">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="msgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
|
@ -289,7 +289,7 @@ border: 1px solid #CCCCCC;}</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item>
|
||||
<widget class="QLabel" name="msgTitle">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel#msgTitle{
|
||||
|
@ -305,7 +305,21 @@ background: white;}</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item>
|
||||
<widget class="QToolButton" name="linkButton">
|
||||
<property name="icon">
|
||||
<iconset resource="FeedReader_images.qrc">
|
||||
<normaloff>:/images/Link.png</normaloff>:/images/Link.png</iconset>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::MenuButtonPopup</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<file>images/FeedErrorOverlay.png</file>
|
||||
<file>images/FolderAdd.png</file>
|
||||
<file>images/FeedAdd.png</file>
|
||||
<file>images/Link.png</file>
|
||||
<file>images/Update.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
plugins/FeedReader/gui/images/Link.png
Normal file
BIN
plugins/FeedReader/gui/images/Link.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Loading…
Add table
Add a link
Reference in a new issue