Added the first version of the FeedReader plugin.

Added a new method to RsPlugInInterfaces to stop the plugins at shutdown of RetroShare.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5372 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-08-02 13:17:53 +00:00
parent ebc8fa3212
commit 09b5d7a8c6
42 changed files with 7004 additions and 7 deletions

View File

@ -134,6 +134,21 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
std::cerr << "Loaded a total of " << _plugins.size() << " plugins." << std::endl;
}
void RsPluginManager::stopPlugins()
{
std::cerr << " Stopping plugins." << std::endl;
for (uint32_t i = 0; i < _plugins.size(); ++i)
{
if (_plugins[i].plugin != NULL)
{
_plugins[i].plugin->stop();
// delete _plugins[i].plugin;
// _plugins[i].plugin = NULL;
}
}
}
void RsPluginManager::getPluginStatus(int i,uint32_t& status,std::string& file_name,std::string& hash,std::string& error_string) const
{
if((uint32_t)i >= _plugins.size())

View File

@ -78,6 +78,8 @@ class RsPluginManager: public RsPluginHandler, public p3Config
//
void loadPlugins(const std::vector<RsPlugin*>& explicit_plugin_entries) ;
void stopPlugins();
void registerCacheServices() ;
void registerClientServices(p3ServiceServer *pqih) ;

View File

@ -94,6 +94,9 @@ class RsPlugin
virtual RsPQIService *rs_pqi_service() const { return NULL ; }
virtual uint16_t rs_service_id() const { return 0 ; }
// Shutdown
virtual void stop() {}
// Filename used for saving the specific plugin configuration. Both RsCacheService and RsPQIService
// derive from p3Config, which means that the service provided by the plugin can load/save its own
// config by deriving loadList() and saveList() from p3Config.

View File

@ -31,6 +31,7 @@
#include "pqi/authssl.h"
#include "pqi/authgpg.h"
#include "retroshare/rsinit.h"
#include "plugins/pluginmanager.h"
#include "util/rsdebug.h"
const int p3facemsgzone = 11453;
@ -182,6 +183,8 @@ void RsServer::rsGlobalShutDown()
join();
ftserver->StopThreads();
mPluginsManager->stopPlugins();
// stop the p3distrib threads
mForums->join();
mChannels->join();

View File

@ -62,6 +62,8 @@ RsServer::RsServer(RsIface &i, NotifyBase &callback)
pqih = NULL;
mPluginsManager = NULL;
/* services */
ad = NULL;
msgSrv = NULL;

View File

@ -49,6 +49,7 @@ class p3PeerMgrIMPL;
class p3LinkMgrIMPL;
class p3NetMgrIMPL;
class p3HistoryMgr;
class RsPluginManager;
/* The Main Interface Class - for controlling the server */
@ -161,6 +162,8 @@ class RsServer: public RsControl, public RsThread
pqipersongrp *pqih;
RsPluginManager *mPluginsManager;
//sslroot *sslr;
/* services */

View File

@ -2177,7 +2177,7 @@ int RsServer::StartupRetroShare()
// possible entries include: /usr/lib/retroshare, ~/.retroshare/extensions/, etc.
#endif
RsPluginManager *mPluginsManager = new RsPluginManager ;
mPluginsManager = new RsPluginManager ;
rsPlugins = mPluginsManager ;
mConfigMgr->addConfiguration("plugins.cfg", mPluginsManager);

View File

@ -0,0 +1,43 @@
!include("../Common/retroshare_plugin.pri"): error("Could not include file ../Common/retroshare_plugin.pri")
CONFIG += qt uic qrc resources
SOURCES = FeedReaderPlugin.cpp \
services/p3FeedReader.cc \
services/p3FeedReaderThread.cc \
services/rsFeedReaderItems.cc \
gui/FeedReaderDialog.cpp \
gui/AddFeedDialog.cpp \
gui/FeedReaderNotify.cpp \
gui/FeedReaderConfig.cpp
HEADERS = FeedReaderPlugin.h \
interface/rsFeedReader.h \
services/p3FeedReader.h \
services/p3FeedReaderThread.h \
services/rsFeedReaderItems.h \
gui/FeedReaderDialog.h \
gui/AddFeedDialog.h \
gui/FeedReaderNotify.h \
gui/FeedReaderConfig.h
FORMS = gui/FeedReaderDialog.ui \
gui/AddFeedDialog.ui \
gui/FeedReaderConfig.ui
TARGET = FeedReader
RESOURCES = gui/FeedReader_images.qrc \
lang/lang.qrc
win32 {
DEFINES += CURL_STATICLIB
CURL_DIR = ../../../curl-7.26.0
LIBXML2_DIR = ../../../libxml2-2.8.0
LIBICONV_DIR = ../../../libiconv-1.14
INCLUDEPATH += $${CURL_DIR}/include $${LIBXML2_DIR}/include $${LIBICONV_DIR}/include
LIBS += -lcurl -lxml2 -lws2_32 -lwldap32
}

View File

@ -0,0 +1,138 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 <QApplication>
#include <QIcon>
#include <retroshare/rsplugin.h>
#include <QTranslator>
#include "FeedReaderPlugin.h"
#include "gui/FeedReaderDialog.h"
#include "gui/FeedReaderConfig.h"
#include "services/p3FeedReader.h"
#define IMAGE_FEEDREADER ":/images/FeedReader.png"
static void *inited = new FeedReaderPlugin();
extern "C" {
#ifdef WIN32
__declspec(dllexport)
#endif
void *RETROSHARE_PLUGIN_provide()
{
static FeedReaderPlugin *p = new FeedReaderPlugin();
return (void*)p;
}
}
void FeedReaderPlugin::getPluginVersion(int& major,int& minor,int& svn_rev) const
{
major = 5;
minor = 1;
svn_rev = 4350;
}
FeedReaderPlugin::FeedReaderPlugin()
{
mainpage = NULL ;
mIcon = NULL ;
mPlugInHandler = NULL;
mFeedReader = NULL;
}
void FeedReaderPlugin::setInterfaces(RsPlugInInterfaces &/*interfaces*/)
{
}
ConfigPage *FeedReaderPlugin::qt_config_page() const
{
return new FeedReaderConfig();
}
MainPage *FeedReaderPlugin::qt_page() const
{
if (mainpage == NULL) {
mainpage = new FeedReaderDialog(mFeedReader);
}
return mainpage;
}
RsPQIService *FeedReaderPlugin::rs_pqi_service() const
{
if (mFeedReader == NULL) {
mFeedReader = new p3FeedReader(mPlugInHandler);
rsFeedReader = mFeedReader;
}
return mFeedReader;
}
void FeedReaderPlugin::stop()
{
if (mFeedReader) {
mFeedReader->stop();
}
}
void FeedReaderPlugin::setPlugInHandler(RsPluginHandler *pgHandler)
{
mPlugInHandler = pgHandler;
}
QIcon *FeedReaderPlugin::qt_icon() const
{
if (mIcon == NULL) {
Q_INIT_RESOURCE(FeedReader_images);
mIcon = new QIcon(IMAGE_FEEDREADER);
}
return mIcon;
}
std::string FeedReaderPlugin::getShortPluginDescription() const
{
return QApplication::translate("FeedReaderPlugin", "This plugin provides a Feedreader.").toUtf8().constData();
}
std::string FeedReaderPlugin::getPluginName() const
{
return QApplication::translate("FeedReaderPlugin", "FeedReader").toUtf8().constData();
}
QTranslator* FeedReaderPlugin::qt_translator(QApplication */*app*/, const QString& languageCode) const
{
if (languageCode == "en") {
return NULL;
}
QTranslator* translator = new QTranslator();
if (translator->load(":/lang/FeedReader_" + languageCode + ".qm")) {
return translator;
}
delete(translator);
return NULL;
}

View File

@ -0,0 +1,60 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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.
****************************************************************/
#pragma once
#include <retroshare/rsplugin.h>
#include <retroshare-gui/mainpage.h>
#include "services/p3FeedReader.h"
class p3FeedReader;
class RsForums;
class FeedReaderPlugin: public RsPlugin
{
public:
FeedReaderPlugin();
virtual uint16_t rs_service_id() const { return RS_PKT_TYPE_FEEDREADER_CONFIG; }
virtual RsPQIService *rs_pqi_service() const;
virtual void stop();
virtual MainPage *qt_page() const;
virtual QIcon *qt_icon() const;
virtual QTranslator *qt_translator(QApplication *app, const QString &languageCode) const;
virtual void getPluginVersion(int &major, int &minor, int &svn_rev) const;
virtual void setPlugInHandler(RsPluginHandler *pgHandler);
virtual std::string configurationFileName() const { return "feedreader.cfg" ; }
virtual std::string getShortPluginDescription() const;
virtual std::string getPluginName() const;
virtual void setInterfaces(RsPlugInInterfaces& interfaces);
virtual ConfigPage *qt_config_page() const;
private:
mutable p3FeedReader *mFeedReader;
mutable RsPluginHandler *mPlugInHandler;
mutable MainPage *mainpage;
mutable QIcon *mIcon;
};

View File

@ -0,0 +1,299 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 <QMessageBox>
#include <QDateTime>
#include <QPushButton>
#include "AddFeedDialog.h"
#include "ui_AddFeedDialog.h"
#include "retroshare/rsforums.h"
bool sortForumInfo(const ForumInfo& info1, const ForumInfo& info2)
{
return QString::fromStdWString(info1.forumName).compare(QString::fromStdWString(info2.forumName), Qt::CaseInsensitive);
}
AddFeedDialog::AddFeedDialog(RsFeedReader *feedReader, QWidget *parent)
: QDialog(parent), mFeedReader(feedReader), ui(new Ui::AddFeedDialog)
{
ui->setupUi(this);
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(createFeed()));
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->useAuthenticationCheckBox, SIGNAL(toggled(bool)), this, SLOT(authenticationToggled()));
connect(ui->useStandardStorageTimeCheckBox, SIGNAL(toggled(bool)), this, SLOT(useStandardStorageTimeToggled()));
connect(ui->useStandardUpdateInterval, SIGNAL(toggled(bool)), this, SLOT(useStandardUpdateIntervalToggled()));
connect(ui->useStandardProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useStandardProxyToggled()));
connect(ui->typeForumRadio, SIGNAL(toggled(bool)), this, SLOT(typeForumToggled()));
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()));
ui->activatedCheckBox->setChecked(true);
ui->typeLocalRadio->setChecked(true);
ui->forumComboBox->setEnabled(false);
ui->useInfoFromFeedCheckBox->setChecked(true);
ui->updateForumInfoCheckBox->setEnabled(false);
ui->updateForumInfoCheckBox->setChecked(true);
ui->forumNameLabel->hide();
ui->useAuthenticationCheckBox->setChecked(false);
ui->useStandardStorageTimeCheckBox->setChecked(true);
ui->useStandardUpdateInterval->setChecked(true);
ui->useStandardProxyCheckBox->setChecked(true);
/* not yet supported */
ui->authenticationGroupBox->setEnabled(false);
/* fill own forums */
std::list<ForumInfo> forumList;
if (rsForums->getForumList(forumList)) {
forumList.sort(sortForumInfo);
for (std::list<ForumInfo>::iterator it = forumList.begin(); it != forumList.end(); ++it) {
ForumInfo &forumInfo = *it;
/* show only own anonymous forums */
if ((forumInfo.subscribeFlags & RS_DISTRIB_ADMIN) && (forumInfo.forumFlags & RS_DISTRIB_AUTHEN_ANON)) {
ui->forumComboBox->addItem(QString::fromStdWString(forumInfo.forumName), QString::fromStdString(forumInfo.forumId));
}
}
}
/* insert item to create a new forum */
ui->forumComboBox->insertItem(0, tr("Create a new anonymous public forum"), "");
ui->forumComboBox->setCurrentIndex(0);
validate();
ui->urlLineEdit->setFocus();
}
AddFeedDialog::~AddFeedDialog()
{
delete ui;
}
void AddFeedDialog::authenticationToggled()
{
bool checked = ui->useAuthenticationCheckBox->isChecked();
ui->userLineEdit->setEnabled(checked);
ui->passwordLineEdit->setEnabled(checked);
}
void AddFeedDialog::useStandardStorageTimeToggled()
{
bool checked = ui->useStandardStorageTimeCheckBox->isChecked();
ui->storageTimeSpinBox->setEnabled(!checked);
}
void AddFeedDialog::useStandardUpdateIntervalToggled()
{
bool checked = ui->useStandardUpdateInterval->isChecked();
ui->updateIntervalSpinBox->setEnabled(!checked);
}
void AddFeedDialog::useStandardProxyToggled()
{
bool checked = ui->useStandardProxyCheckBox->isChecked();
ui->proxyAddressLineEdit->setEnabled(!checked);
ui->proxyPortSpinBox->setEnabled(!checked);
}
void AddFeedDialog::typeForumToggled()
{
bool checked = ui->typeForumRadio->isChecked();
ui->forumComboBox->setEnabled(checked);
ui->updateForumInfoCheckBox->setEnabled(checked);
}
void AddFeedDialog::validate()
{
bool ok = true;
if (ui->urlLineEdit->text().isEmpty()) {
ok = false;
}
if (ui->nameLineEdit->text().isEmpty() && !ui->useInfoFromFeedCheckBox->isChecked()) {
ok = false;
}
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok);
}
bool AddFeedDialog::showError(QWidget *parent, RsFeedAddResult result, const QString &title, const QString &text)
{
QString error;
switch (result) {
case RS_FEED_ADD_RESULT_SUCCESS:
/* no error */
return false;
case RS_FEED_ADD_RESULT_FEED_NOT_FOUND:
error = tr("Feed not found.");
break;
case RS_FEED_ADD_RESULT_PARENT_NOT_FOUND:
error = tr("Parent not found.");
break;
case RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER:
error = tr("Parent is no folder.");
break;
case RS_FEED_ADD_RESULT_FEED_IS_FOLDER:
error = tr("Feed is a folder.");
break;
case RS_FEED_ADD_RESULT_FEED_IS_NO_FOLDER:
error = tr("Feed is no folder.");
break;
default:
error = tr("Unknown error occured.");
}
QMessageBox::critical(parent, title, text + "\n" + error);
return true;
}
void AddFeedDialog::setParent(const std::string &parentId)
{
mParentId = parentId;
}
bool AddFeedDialog::fillFeed(const std::string &feedId)
{
mFeedId = feedId;
if (!mFeedId.empty()) {
FeedInfo feedInfo;
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
mFeedId.clear();
return false;
}
setWindowTitle(tr("Edit feed"));
ui->typeGroupBox->setEnabled(false);
mParentId = feedInfo.parentId;
ui->nameLineEdit->setText(QString::fromUtf8(feedInfo.name.c_str()));
ui->urlLineEdit->setText(QString::fromUtf8(feedInfo.url.c_str()));
ui->useInfoFromFeedCheckBox->setChecked(feedInfo.flag.infoFromFeed);
ui->updateForumInfoCheckBox->setChecked(feedInfo.flag.updateForumInfo);
ui->activatedCheckBox->setChecked(!feedInfo.flag.deactivated);
ui->descriptionPlainTextEdit->setPlainText(QString::fromUtf8(feedInfo.description.c_str()));
ui->typeGroupBox->setEnabled(false);
ui->forumComboBox->hide();
ui->forumNameLabel->clear();
ui->forumNameLabel->show();
if (feedInfo.flag.forum) {
ui->typeForumRadio->setChecked(true);
if (feedInfo.forumId.empty()) {
ui->forumNameLabel->setText(tr("Not yet created"));
} else {
ForumInfo forumInfo;
if (rsForums->getForumInfo(feedInfo.forumId, forumInfo)) {
ui->forumNameLabel->setText(QString::fromStdWString(forumInfo.forumName));
} else {
ui->forumNameLabel->setText(tr("Unknown forum"));
}
}
} else {
ui->typeLocalRadio->setChecked(true);
}
ui->useAuthenticationCheckBox->setChecked(feedInfo.flag.authentication);
ui->userLineEdit->setText(QString::fromUtf8(feedInfo.user.c_str()));
ui->passwordLineEdit->setText(QString::fromUtf8(feedInfo.password.c_str()));
ui->useStandardProxyCheckBox->setChecked(feedInfo.flag.standardProxy);
ui->proxyAddressLineEdit->setText(QString::fromUtf8(feedInfo.proxyAddress.c_str()));
ui->proxyPortSpinBox->setValue(feedInfo.proxyPort);
ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval);
ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60);
QDateTime dateTime;
dateTime.setTime_t(feedInfo.lastUpdate);
ui->lastUpdate->setText(dateTime.toString());
ui->useStandardStorageTimeCheckBox->setChecked(feedInfo.flag.standardStorageTime);
ui->storageTimeSpinBox->setValue(feedInfo.storageTime / (60 * 60 *24));
}
return true;
}
void AddFeedDialog::createFeed()
{
FeedInfo feedInfo;
if (!mFeedId.empty()) {
if (!mFeedReader->getFeedInfo(mFeedId, feedInfo)) {
QMessageBox::critical(this, tr("Edit feed"), tr("Can't edit feed. Feed does not exist."));
return;
}
}
feedInfo.parentId = mParentId;
feedInfo.name = ui->nameLineEdit->text().toUtf8().constData();
feedInfo.url = ui->urlLineEdit->text().toUtf8().constData();
feedInfo.flag.infoFromFeed = ui->useInfoFromFeedCheckBox->isChecked();
feedInfo.flag.updateForumInfo = ui->updateForumInfoCheckBox->isChecked() && ui->updateForumInfoCheckBox->isEnabled();
feedInfo.flag.deactivated = !ui->activatedCheckBox->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();
}
feedInfo.flag.authentication = ui->useAuthenticationCheckBox->isChecked();
feedInfo.user = ui->userLineEdit->text().toUtf8().constData();
feedInfo.password = ui->passwordLineEdit->text().toUtf8().constData();
feedInfo.flag.standardProxy = ui->useStandardProxyCheckBox->isChecked();
feedInfo.proxyAddress = ui->proxyAddressLineEdit->text().toUtf8().constData();
feedInfo.proxyPort = ui->proxyPortSpinBox->value();
feedInfo.flag.standardUpdateInterval = ui->useStandardUpdateInterval->isChecked();
feedInfo.updateInterval = ui->updateIntervalSpinBox->value() * 60;
feedInfo.flag.standardStorageTime = ui->useStandardStorageTimeCheckBox->isChecked();
feedInfo.storageTime = ui->storageTimeSpinBox->value() * 60 *60 * 24;
if (mFeedId.empty()) {
/* add new feed */
RsFeedAddResult result = mFeedReader->addFeed(feedInfo, mFeedId);
if (showError(this, result, tr("Create feed"), tr("Cannot create feed."))) {
return;
}
} else {
RsFeedAddResult result = mFeedReader->setFeed(mFeedId, feedInfo);
if (showError(this, result, tr("Edit feed"), tr("Cannot change feed."))) {
return;
}
}
close();
}

View File

@ -0,0 +1,64 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 ADDFEEDDIALOG_H
#define ADDFEEDDIALOG_H
#include <QDialog>
#include "interface/rsFeedReader.h"
namespace Ui {
class AddFeedDialog;
}
class RsFeedReader;
class AddFeedDialog : public QDialog
{
Q_OBJECT
public:
AddFeedDialog(RsFeedReader *feedReader, QWidget *parent);
~AddFeedDialog();
static bool showError(QWidget *parent, RsFeedAddResult result, const QString &title, const QString &text);
void setParent(const std::string &parentId);
bool fillFeed(const std::string &feedId);
private slots:
void authenticationToggled();
void useStandardStorageTimeToggled();
void useStandardUpdateIntervalToggled();
void useStandardProxyToggled();
void typeForumToggled();
void validate();
void createFeed();
private:
RsFeedReader *mFeedReader;
std::string mFeedId;
std::string mParentId;
Ui::AddFeedDialog *ui;
};
#endif // ADDFEEDDIALOG_H

View File

@ -0,0 +1,442 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddFeedDialog</class>
<widget class="QDialog" name="AddFeedDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>715</width>
<height>559</height>
</rect>
</property>
<property name="windowTitle">
<string>Create new feed</string>
</property>
<property name="windowIcon">
<iconset resource="../../../retroshare-gui/src/gui/images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="headerFrame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#headerFrame{background-image: url(:/images/connect/connectFriendBanner.png);}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="headerIcon">
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="FeedReader_images.qrc">:/images/FeedReader.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="headerLabel">
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&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; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;&quot;&gt;Feed Details&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="7" column="0">
<widget class="QGroupBox" name="authenticationGroupBox">
<property name="title">
<string>Authentication (not yet supported)</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="useAuthenticationCheckBox">
<property name="text">
<string>Feed needs authentication</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="userLabel">
<property name="text">
<string>User</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="passwordLabel">
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="userLineEdit"/>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="passwordLineEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="8" column="0">
<widget class="QGroupBox" name="updateInteralGroupBox">
<property name="title">
<string>Update interval</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="useStandardUpdateInterval">
<property name="text">
<string>Use standard update interval</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="updateIntervalLabel">
<property name="text">
<string>Interval in minutes (0 = manual)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="updateIntervalSpinBox">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="lastUpdateLayout">
<item>
<widget class="QLabel" name="lastUpdateLabel">
<property name="text">
<string>Last update</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lastUpdate">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Never</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="7" column="1">
<widget class="QGroupBox" name="storageTimeGroupBox">
<property name="title">
<string>Storage time</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="useStandardStorageTimeCheckBox">
<property name="text">
<string>Use standard storage time</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="storageTimeLabel">
<property name="text">
<string>Days (0 = off)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="storageTimeSpinBox">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="8" column="1">
<widget class="QGroupBox" name="proxyGroupBox">
<property name="title">
<string>Proxy</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="useStandardProxyCheckBox">
<property name="text">
<string>Use standard proxy</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="serverLabel">
<property name="text">
<string>Server</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="proxyPortSpinBox">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="11" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="typeGroupBox">
<property name="title">
<string>Type</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<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>
<widget class="QRadioButton" name="typeForumRadio">
<property name="text">
<string>Forum</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="forumComboBox"/>
</item>
<item>
<widget class="QLabel" name="forumNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Forum name</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="1">
<widget class="QGroupBox" name="flagGroupBox">
<property name="title">
<string>Misc</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="activatedCheckBox">
<property name="text">
<string>Activated</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useInfoFromFeedCheckBox">
<property name="text">
<string>Use name and description from feed</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="updateForumInfoCheckBox">
<property name="text">
<string>Update forum information</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QVBoxLayout" name="descriptionLayout">
<item>
<widget class="QLabel" name="descriptionLabel">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="descriptionPlainTextEdit"/>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="nameLayout">
<item row="0" column="0">
<widget class="QLabel" name="urlLabel">
<property name="text">
<string>RSS-Feed-URL:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="urlLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="nameLineEdit"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>urlLineEdit</tabstop>
<tabstop>nameLineEdit</tabstop>
<tabstop>descriptionPlainTextEdit</tabstop>
<tabstop>typeLocalRadio</tabstop>
<tabstop>typeForumRadio</tabstop>
<tabstop>forumComboBox</tabstop>
<tabstop>activatedCheckBox</tabstop>
<tabstop>useInfoFromFeedCheckBox</tabstop>
<tabstop>updateForumInfoCheckBox</tabstop>
<tabstop>useAuthenticationCheckBox</tabstop>
<tabstop>userLineEdit</tabstop>
<tabstop>passwordLineEdit</tabstop>
<tabstop>useStandardStorageTimeCheckBox</tabstop>
<tabstop>storageTimeSpinBox</tabstop>
<tabstop>useStandardUpdateInterval</tabstop>
<tabstop>updateIntervalSpinBox</tabstop>
<tabstop>useStandardProxyCheckBox</tabstop>
<tabstop>proxyAddressLineEdit</tabstop>
<tabstop>proxyPortSpinBox</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="FeedReader_images.qrc"/>
<include location="../../../retroshare-gui/src/gui/images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,80 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 "FeedReaderConfig.h"
#include "ui_FeedReaderConfig.h"
#include "gui/settings/rsharesettings.h"
#include "interface/rsFeedReader.h"
/** Constructor */
FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WFlags flags)
: ConfigPage(parent, flags), ui(new Ui::FeedReaderConfig)
{
/* Invoke the Qt Designer generated object setup routine */
ui->setupUi(this);
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
ui->proxyAddressLineEdit->setEnabled(false);
ui->proxyPortSpinBox->setEnabled(false);
loaded = false;
}
/** Destructor */
FeedReaderConfig::~FeedReaderConfig()
{
delete(ui);
}
/** Loads the settings for this page */
void FeedReaderConfig::load()
{
ui->updateIntervalSpinBox->setValue(rsFeedReader->getStandardUpdateInterval() / 60);
ui->storageTimeSpinBox->setValue(rsFeedReader->getStandardStorageTime() / (60 * 60 *24));
ui->setMsgToReadOnActivate->setChecked(Settings->valueFromGroup("FeedReaderDialog", "SetMsgToReadOnActivate", true).toBool());
std::string proxyAddress;
uint16_t proxyPort;
ui->useProxyCheckBox->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
ui->proxyAddressLineEdit->setText(QString::fromUtf8(proxyAddress.c_str()));
ui->proxyPortSpinBox->setValue(proxyPort);
loaded = true;
}
bool FeedReaderConfig::save(QString &/*errmsg*/)
{
rsFeedReader->setStandardUpdateInterval(ui->updateIntervalSpinBox->value() * 60);
rsFeedReader->setStandardStorageTime(ui->storageTimeSpinBox->value() * 60 *60 * 24);
rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyAddressLineEdit->text().toUtf8().constData(), ui->proxyPortSpinBox->value());
Settings->setValueToGroup("FeedReaderDialog", "SetMsgToReadOnActivate", ui->setMsgToReadOnActivate->isChecked());
return true;
}
void FeedReaderConfig::useProxyToggled()
{
bool enabled = ui->useProxyCheckBox->isChecked();
ui->proxyAddressLineEdit->setEnabled(enabled);
ui->proxyPortSpinBox->setEnabled(enabled);
}

View File

@ -0,0 +1,57 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 _FEEDREADERCONFIG_H
#define _FEEDREADERCONFIG_H
#include "retroshare-gui/configpage.h"
namespace Ui {
class FeedReaderConfig;
}
class FeedReaderConfig : public ConfigPage
{
Q_OBJECT
public:
/** Default Constructor */
FeedReaderConfig(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
virtual ~FeedReaderConfig();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
virtual QPixmap iconPixmap() const { return QPixmap(":/images/FeedReader.png") ; }
virtual QString pageName() const { return tr("FeedReader") ; }
private slots:
void useProxyToggled();
private:
Ui::FeedReaderConfig *ui;
bool loaded;
};
#endif

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FeedReaderConfig</class>
<widget class="QWidget" name="FeedReaderConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<height>378</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="updateGroupBox">
<property name="title">
<string>Update</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="updateIntervalLabel">
<property name="text">
<string>Interval in minutes (0 = manual)</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="updateIntervalSpinBox">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="storageTimeGroupBox">
<property name="title">
<string>Storage time</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="storageTimeLabel">
<property name="text">
<string>Days (0 = off)</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="storageTimeSpinBox">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="proxyGroupBox">
<property name="title">
<string>Proxy</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="4">
<widget class="QCheckBox" name="useProxyCheckBox">
<property name="text">
<string>Use proxy</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="serverLabel">
<property name="text">
<string>Server</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="proxyPortSpinBox">
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="potLabel">
<property name="text">
<string>:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="miscGroupBox">
<property name="title">
<string>Misc</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="setMsgToReadOnActivate">
<property name="text">
<string>Set message to read on activate</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>301</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,105 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 _FEEDREADERDIALOG_H
#define _FEEDREADERDIALOG_H
#include <retroshare-gui/mainpage.h>
#include "interface/rsFeedReader.h"
namespace Ui {
class FeedReaderDialog;
}
class QTreeWidgetItem;
class RsFeedReader;
class RSTreeWidgetItemCompareRole;
class FeedReaderNotify;
class FeedReaderDialog : public MainPage
{
Q_OBJECT
public:
FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent = 0);
~FeedReaderDialog();
protected:
virtual void showEvent(QShowEvent *e);
bool eventFilter(QObject *obj, QEvent *ev);
private slots:
void feedTreeCustomPopupMenu(QPoint point);
void msgTreeCustomPopupMenu(QPoint point);
void feedItemChanged(QTreeWidgetItem *item);
void msgItemChanged();
void msgItemClicked(QTreeWidgetItem *item, int column);
void filterColumnChanged();
void filterItems(const QString &text);
void toggleMsgText();
void newFolder();
void newFeed();
void removeFeed();
void editFeed();
void activateFeed();
void processFeed();
void markAsReadMsg();
void markAsUnreadMsg();
void markAllAsReadMsg();
void copyLinkMsg();
void removeMsg();
/* FeedReaderNotify */
void feedChanged(const QString &feedId, int type);
void msgChanged(const QString &feedId, const QString &msgId, int type);
private:
std::string currentFeedId();
std::string currentMsgId();
void processSettings(bool load);
void updateFeeds(const std::string &parentId, QTreeWidgetItem *parentItem);
void updateFeedItem(QTreeWidgetItem *item, FeedInfo &info);
void updateMsgs(const std::string &feedId);
void calculateMsgIconsAndFonts(QTreeWidgetItem *item);
void updateMsgItem(QTreeWidgetItem *item, FeedMsgInfo &info);
void setMsgAsReadUnread(QList<QTreeWidgetItem*> &rows, bool read);
void filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
void filterItem(QTreeWidgetItem *item);
void toggleMsgText_internal();
void calculateFeedItems();
void calculateFeedItem(QTreeWidgetItem *item, uint32_t &unreadCount, bool &loading);
bool mProcessSettings;
QTreeWidgetItem *mRootItem;
RSTreeWidgetItemCompareRole *mFeedCompareRole;
RSTreeWidgetItemCompareRole *mMsgCompareRole;
// gui interface
RsFeedReader *mFeedReader;
FeedReaderNotify *mNotify;
/** Qt Designer generated object */
Ui::FeedReaderDialog *ui;
};
#endif

View File

@ -0,0 +1,373 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FeedReaderDialog</class>
<widget class="QWidget" name="FeedReaderDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>738</width>
<height>583</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QFrame" name="feedFrame">
<property name="baseSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{border: none;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="feedsHeaderFrame">
<property name="styleSheet">
<string notr="true"> QFrame#feedsHeaderFrame{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}
</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="feedsIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="FeedReader_images.qrc">:/images/Feed.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="feedsLabel">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&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; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:10pt; font-weight:600;&quot;&gt;Feeds&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="feedTreeWidget">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<column>
<property name="text">
<string notr="true"/>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QSplitter" name="msgSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="msgFrame">
<item row="1" column="0">
<widget class="QFrame" name="filterFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"> QFrame#frame_2{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="_7">
<property name="margin">
<number>2</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="filterLabel">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../retroshare-gui/src/gui/images.qrc">:/images/find-16.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit">
<property name="toolTip">
<string>Search forums</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="filterColumnComboBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>MS Shell Dlg 2</family>
</font>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Title</string>
</property>
</item>
<item>
<property name="text">
<string>Date</string>
</property>
</item>
<item>
<property name="text">
<string>Author</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QTreeWidget" name="msgTreeWidget">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</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="../../../retroshare-gui/src/gui/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>
</widget>
</item>
<item row="4" column="0">
<layout class="QGridLayout" name="navFrame">
<item row="0" column="0">
<widget class="QLabel" name="msgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Message:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="msgTitle">
<property name="styleSheet">
<string notr="true">QLabel#msgTitle{
border: 2px solid #CCCCCC;
border-radius: 6px;
background: white;}</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="expandButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../retroshare-gui/src/gui/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 class="LinkTextBrowser" name="msgText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>LinkTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="FeedReader_images.qrc"/>
<include location="../../../retroshare-gui/src/gui/images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,36 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 "FeedReaderNotify.h"
FeedReaderNotify::FeedReaderNotify() : QObject()
{
}
void FeedReaderNotify::feedChanged(const std::string &feedId, int type)
{
emit notifyFeedChanged(QString::fromStdString(feedId), type);
}
void FeedReaderNotify::msgChanged(const std::string &feedId, const std::string &msgId, int type)
{
emit notifyMsgChanged(QString::fromStdString(feedId), QString::fromStdString(msgId), type);
}

View File

@ -0,0 +1,45 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 _FEEDREADERNOTIFY_H
#define _FEEDREADERNOTIFY_H
#include <QObject>
#include "interface/rsFeedReader.h"
class FeedReaderNotify : public QObject, public RsFeedReaderNotify
{
Q_OBJECT
public:
FeedReaderNotify();
/* RsFeedReaderNotify */
virtual void feedChanged(const std::string &feedId, int type);
virtual void msgChanged(const std::string &feedId, const std::string &msgId, int type);
signals:
void notifyFeedChanged(const QString &feedId, int type);
void notifyMsgChanged(const QString &feedId, const QString &msgId, int type);
};
#endif

View File

@ -0,0 +1,13 @@
<RCC>
<qresource prefix="/" >
<file>images/FeedReader.png</file>
<file>images/Root.png</file>
<file>images/Folder.png</file>
<file>images/Feed.png</file>
<file>images/FeedProcessOverlay.png</file>
<file>images/FeedErrorOverlay.png</file>
<file>images/FolderAdd.png</file>
<file>images/FeedAdd.png</file>
<file>images/Update.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,181 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 RETROSHARE_FEEDREADER_GUI_INTERFACE_H
#define RETROSHARE_FEEDREADER_GUI_INTERFACE_H
#include <inttypes.h>
#include <string>
#include <list>
class RsFeedReader;
extern RsFeedReader *rsFeedReader;
enum RsFeedAddResult
{
RS_FEED_ADD_RESULT_SUCCESS,
RS_FEED_ADD_RESULT_FEED_NOT_FOUND,
RS_FEED_ADD_RESULT_PARENT_NOT_FOUND,
RS_FEED_ADD_RESULT_PARENT_IS_NO_FOLDER,
RS_FEED_ADD_RESULT_FEED_IS_FOLDER,
RS_FEED_ADD_RESULT_FEED_IS_NO_FOLDER
};
class FeedInfo
{
public:
enum WorkState
{
WAITING,
WAITING_TO_DOWNLOAD,
DOWNLOADING,
WAITING_TO_PROCESS,
PROCESSING
};
public:
FeedInfo()
{
proxyPort = 0;
updateInterval = 0;
lastUpdate = 0;
storageTime = 0;
error = false;
flag.folder = false;
flag.infoFromFeed = false;
flag.standardStorageTime = false;
flag.standardUpdateInterval = false;
flag.standardProxy = false;
flag.authentication = false;
flag.deactivated = false;
flag.forum = false;
flag.updateForumInfo = false;
}
std::string feedId;
std::string parentId;
std::string url;
std::string name;
std::string description;
std::string icon;
std::string user;
std::string password;
std::string proxyAddress;
uint16_t proxyPort;
uint32_t updateInterval;
time_t lastUpdate;
uint32_t storageTime;
std::string forumId;
WorkState workstate;
bool error;
std::string errorString;
struct {
bool folder : 1;
bool infoFromFeed : 1;
bool standardStorageTime : 1;
bool standardUpdateInterval : 1;
bool standardProxy : 1;
bool authentication : 1;
bool deactivated : 1;
bool forum : 1;
bool updateForumInfo : 1;
} flag;
};
class FeedMsgInfo
{
public:
FeedMsgInfo()
{
pubDate = 0;
flag.isnew = false;
flag.read = false;
}
std::string msgId;
std::string feedId;
std::string title;
std::string link;
std::string author;
std::string description;
time_t pubDate;
struct {
bool isnew : 1;
bool read : 1;
} flag;
};
class RsFeedReaderNotify
{
public:
RsFeedReaderNotify() {}
virtual void feedChanged(const std::string &/*feedId*/, int /*type*/) {}
virtual void msgChanged(const std::string &/*feedId*/, const std::string &/*msgId*/, int /*type*/) {}
};
class RsFeedReader
{
public:
RsFeedReader() {}
virtual ~RsFeedReader() {}
virtual void stop() = 0;
virtual void setNotify(RsFeedReaderNotify *notify) = 0;
virtual uint32_t getStandardStorageTime() = 0;
virtual void setStandardStorageTime(uint32_t storageTime) = 0;
virtual uint32_t getStandardUpdateInterval() = 0;
virtual void setStandardUpdateInterval(uint32_t updateInterval) = 0;
virtual bool getStandardProxy(std::string &proxyAddress, uint16_t &proxyPort) = 0;
virtual void setStandardProxy(bool useProxy, const std::string &proxyAddress, uint16_t proxyPort) = 0;
virtual RsFeedAddResult addFolder(const std::string parentId, const std::string &name, std::string &feedId) = 0;
virtual RsFeedAddResult setFolder(const std::string &feedId, const std::string &name) = 0;
virtual RsFeedAddResult addFeed(const FeedInfo &feedInfo, std::string &feedId) = 0;
virtual RsFeedAddResult setFeed(const std::string &feedId, const FeedInfo &feedInfo) = 0;
virtual bool removeFeed(const std::string &feedId) = 0;
virtual void getFeedList(const std::string &parentId, std::list<FeedInfo> &feedInfos) = 0;
virtual bool getFeedInfo(const std::string &feedId, FeedInfo &feedInfo) = 0;
virtual bool getMsgInfo(const std::string &feedId, const std::string &msgId, FeedMsgInfo &msgInfo) = 0;
virtual bool removeMsg(const std::string &feedId, const std::string &msgId) = 0;
virtual bool removeMsgs(const std::string &feedId, const std::list<std::string> &msgIds) = 0;
virtual bool getMessageCount(const std::string &feedId, uint32_t *msgCount, uint32_t *newCount, uint32_t *unreadCount) = 0;
virtual bool getFeedMsgList(const std::string &feedId, std::list<FeedMsgInfo> &msgInfos) = 0;
virtual bool processFeed(const std::string &feedId) = 0;
virtual bool setMessageRead(const std::string &feedId, const std::string &msgId, bool read) = 0;
/* get Ids */
// virtual uint32_t getRankingsCount() = 0;
// virtual float getMaxRank() = 0;
// virtual bool getRankings(uint32_t first, uint32_t count, std::list<std::string> &rids) = 0;
// virtual bool getRankDetails(std::string rid, RsRankDetails &details) = 0;
/* Add New Comment / Msg */
// virtual std::string newRankMsg(std::wstring link, std::wstring title, std::wstring comment, int32_t score) = 0;
// virtual bool updateComment(std::string rid, std::wstring comment, int32_t score) = 0;
// virtual std::string anonRankMsg(std::string rid, std::wstring link, std::wstring title) = 0;
};
#endif

View File

@ -0,0 +1,339 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="de_DE">
<context>
<name>AddLinksDialog</name>
<message>
<location filename="../AddLinksDialog.ui" line="+14"/>
<location line="+81"/>
<source>Add Link</source>
<translation>Link hinzufügen</translation>
</message>
<message>
<location line="-30"/>
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&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:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;DejaVu Sans&apos;; font-size:18pt; font-weight:600; color:#ffffff;&quot;&gt;Add Link to Cloud&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&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:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;DejaVu Sans&apos;; font-size:18pt; font-weight:600; color:#ffffff;&quot;&gt;Link zur Wolke hinzufügen&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location line="+23"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
<message>
<location line="+33"/>
<source>Add a new Link</source>
<translation>Neuen Link hinzufügen</translation>
</message>
<message>
<location line="+13"/>
<source>Title:</source>
<translation>Titel:</translation>
</message>
<message>
<location line="+7"/>
<source>Url:</source>
<translation>Url:</translation>
</message>
<message>
<location line="+50"/>
<source>Add Anonymous Link</source>
<translation>Anonym hinzufügen</translation>
</message>
<message>
<location line="+8"/>
<source>+2 Great!</source>
<translation>+2 Großartig!</translation>
</message>
<message>
<location line="+9"/>
<source>+1 Good</source>
<translation>+1 Gut</translation>
</message>
<message>
<location line="+9"/>
<source>0 Okay</source>
<translation>0 In Ordnung</translation>
</message>
<message>
<location line="+9"/>
<source>-1 Sux</source>
<translation>-1 Nervt</translation>
</message>
<message>
<location line="+9"/>
<source>-2 Bad Link</source>
<translation>-2 Schlechter Link</translation>
</message>
<message>
<location filename="../AddLinksDialog.cpp" line="+58"/>
<source>New Link</source>
<translation>Neuer Link</translation>
</message>
<message>
<location line="+28"/>
<source>Add Link Failure</source>
<translation>Link hinzufügen fehlgeschlagen</translation>
</message>
<message>
<location line="+0"/>
<source>Missing Link and/or Title</source>
<translation>Titel und/oder Url fehlt</translation>
</message>
</context>
<context>
<name>LinksCloudPlugin</name>
<message>
<location filename="../LinksCloudPlugin.cpp" line="+81"/>
<source>This plugin provides a set of cached links, and a voting system to promote them.</source>
<translation>Das Plugin stellt Links und ein Wahlsystem zur Verfügung, um sie zu verbreiten.</translation>
</message>
<message>
<location line="+5"/>
<source>LinksCloud</source>
<translation>Verknüpfungswolke</translation>
</message>
</context>
<context>
<name>LinksDialog</name>
<message>
<location filename="../LinksDialog.ui" line="+48"/>
<source>Title / Comment</source>
<translation>Titel / Kommentar</translation>
</message>
<message>
<location line="+5"/>
<source>Score</source>
<translation>Punkte</translation>
</message>
<message>
<location line="+5"/>
<source>Peer / Link</source>
<translation>Nachbar / Link</translation>
</message>
<message>
<location line="+38"/>
<source>Sort by</source>
<translation>Sortiere nach</translation>
</message>
<message>
<location line="+8"/>
<source>Combo</source>
<translation>Kombiniert</translation>
</message>
<message>
<location line="+5"/>
<source>Time</source>
<translation>Zeit</translation>
</message>
<message>
<location line="+9"/>
<source>Ranking</source>
<translation>Platzierung</translation>
</message>
<message>
<location line="+31"/>
<source>In last</source>
<translation>Im letzten</translation>
</message>
<message>
<location line="+8"/>
<source>Month</source>
<translation>Monat</translation>
</message>
<message>
<location line="+9"/>
<source>Week</source>
<translation>Woche</translation>
</message>
<message>
<location line="+9"/>
<source>Day</source>
<translatorcomment>Tag</translatorcomment>
<translation></translation>
</message>
<message>
<location line="+31"/>
<source>From</source>
<translation>Von</translation>
</message>
<message>
<location line="+8"/>
<source>All Peers</source>
<translation>Alle Nachbarn</translation>
</message>
<message>
<location line="+9"/>
<source>Own Links</source>
<translation>Eigene Links</translation>
</message>
<message>
<location line="+31"/>
<source>Show</source>
<translation>Zeige</translation>
</message>
<message>
<location line="+8"/>
<source>Top 100</source>
<translation>Top 100</translation>
</message>
<message>
<location line="+9"/>
<source>101-200</source>
<translation></translation>
</message>
<message>
<location line="+5"/>
<source>201-300</source>
<translation></translation>
</message>
<message>
<location line="+5"/>
<source>301-400</source>
<translation></translation>
</message>
<message>
<location line="+5"/>
<source>401-500</source>
<translation></translation>
</message>
<message>
<location line="+5"/>
<source>Bottom 100</source>
<translation>Letzten 100</translation>
</message>
<message>
<location line="+35"/>
<source>Link:</source>
<translation>Link:</translation>
</message>
<message>
<location line="+32"/>
<source>Add Anonymous Link</source>
<translation>Anonym hinzufügen</translation>
</message>
<message>
<location line="+7"/>
<source>Add Link/Comment</source>
<translation>Link/Kommentar hinzufügen</translation>
</message>
<message>
<location line="+11"/>
<source>Title:</source>
<translation>Titel:</translation>
</message>
<message>
<location line="+16"/>
<source>Score:</source>
<translation>Punkte:</translation>
</message>
<message>
<location line="+8"/>
<source>+2 Great!</source>
<translation>+2 Großartig!</translation>
</message>
<message>
<location line="+9"/>
<source>+1 Good</source>
<translation>+1 Gut</translation>
</message>
<message>
<location line="+9"/>
<source>0 Okay</source>
<translation>0 In Ordnung</translation>
</message>
<message>
<location line="+9"/>
<source>-1 Sux</source>
<translation>-1 Nervt</translation>
</message>
<message>
<location line="+9"/>
<source>-2 Bad Link</source>
<translation>-2 Schlechter Link</translation>
</message>
<message>
<location line="+16"/>
<source>Url:</source>
<translation>Url:</translation>
</message>
<message>
<location line="+87"/>
<source>&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:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; 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;span style=&quot; font-weight:600;&quot;&gt;Links Cloud&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&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:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; 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;span style=&quot; font-weight:600;&quot;&gt;Verknüpfungswolke&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location line="+28"/>
<source>Add new link</source>
<translation>Neuen Link hinzufügen</translation>
</message>
<message>
<location filename="../LinksDialog.cpp" line="+139"/>
<source>Share Link Anonymously</source>
<translation>Link anonym verteilen</translation>
</message>
<message>
<location line="+4"/>
<source>Vote on Link</source>
<translation>Wähle für Link</translation>
</message>
<message>
<location line="+19"/>
<source>Download</source>
<translation>Herunterladen</translation>
</message>
<message>
<location line="+655"/>
<source>Expand</source>
<translation>Erweitern</translation>
</message>
<message>
<location line="+7"/>
<source>Hide</source>
<translation>Verbergen</translation>
</message>
<message>
<location line="+195"/>
<source>File Request Confirmation</source>
<translation>Bestätigung der Dateianforderung</translation>
</message>
<message>
<location line="+0"/>
<source>The file has been added to your download list.</source>
<translation>Die Datei wurde zur Downloadliste hinzugefügt.</translation>
</message>
<message>
<location line="+6"/>
<source>File Request canceled</source>
<translation>Dateianforderung abgebrochen</translation>
</message>
<message>
<location line="+0"/>
<source>The file has not been added to your download list, because you already have it.</source>
<translation>Die folgende Datei wurde nicht zur Downloadliste hinzugefügt, da Du diese schon hast.</translation>
</message>
<message>
<location line="+6"/>
<source>File Request Error</source>
<translation>Fehler bei der Dateianforderung</translation>
</message>
<message>
<location line="+0"/>
<source>The file link is malformed.</source>
<translation>Link ist fehlerhaft.</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/lang">
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 P3_FEEDREADER
#define P3_FEEDREADER
#include "retroshare/rsplugin.h"
#include "plugins/rspqiservice.h"
#include "interface/rsFeedReader.h"
#include "p3FeedReaderThread.h"
class RsFeedReaderFeed;
//TODO: get new id's
const uint8_t RS_PKT_TYPE_FEEDREADER_CONFIG = 0xf0;
const uint32_t CONFIG_TYPE_FEEDREADER = 0x0001;
class p3FeedReader : public RsPQIService, public RsFeedReader
{
public:
p3FeedReader(RsPluginHandler *pgHandler);
/****************** FeedReader Interface *************/
virtual void stop();
virtual void setNotify(RsFeedReaderNotify *notify);
virtual uint32_t getStandardStorageTime();
virtual void setStandardStorageTime(uint32_t storageTime);
virtual uint32_t getStandardUpdateInterval();
virtual void setStandardUpdateInterval(uint32_t updateInterval);
virtual bool getStandardProxy(std::string &proxyAddress, uint16_t &proxyPort);
virtual void setStandardProxy(bool useProxy, const std::string &proxyAddress, uint16_t proxyPort);
virtual RsFeedAddResult addFolder(const std::string parentId, const std::string &name, std::string &feedId);
virtual RsFeedAddResult setFolder(const std::string &feedId, const std::string &name);
virtual RsFeedAddResult addFeed(const FeedInfo &feedInfo, std::string &feedId);
virtual RsFeedAddResult setFeed(const std::string &feedId, const FeedInfo &feedInfo);
virtual bool removeFeed(const std::string &feedId);
virtual void getFeedList(const std::string &parentId, std::list<FeedInfo> &feedInfos);
virtual bool getFeedInfo(const std::string &feedId, FeedInfo &feedInfo);
virtual bool getMsgInfo(const std::string &feedId, const std::string &msgId, FeedMsgInfo &msgInfo);
virtual bool removeMsg(const std::string &feedId, const std::string &msgId);
virtual bool removeMsgs(const std::string &feedId, const std::list<std::string> &msgIds);
virtual bool getMessageCount(const std::string &feedId, uint32_t *msgCount, uint32_t *newCount, uint32_t *unreadCount);
virtual bool getFeedMsgList(const std::string &feedId, std::list<FeedMsgInfo> &msgInfos);
virtual bool processFeed(const std::string &feedId);
virtual bool setMessageRead(const std::string &feedId, const std::string &msgId, bool read);
/****************** p3Service STUFF ******************/
virtual int tick();
/****************** internal STUFF *******************/
bool getFeedToDownload(RsFeedReaderFeed &feed);
void onDownloadSuccess(const std::string &feedId, const std::string &content, std::string &icon);
void onDownloadError(const std::string &feedId, p3FeedReaderThread::DownloadResult result, const std::string &error);
void onProcessSuccess(const std::string &feedId, std::list<RsFeedReaderMsg*> &msgs);
void onProcessError(const std::string &feedId, p3FeedReaderThread::ProcessResult result);
bool getFeedToProcess(RsFeedReaderFeed &feed);
void setFeedInfo(const std::string &feedId, const std::string &name, const std::string &description);
protected:
/****************** p3Config STUFF *******************/
virtual RsSerialiser *setupSerialiser();
virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *>& load);
virtual void saveDone();
private:
void cleanFeeds();
void deleteAllMsgs_locked(RsFeedReaderFeed *fi);
std::list<p3FeedReaderThread*> mThreads;
uint32_t mNextFeedId;
uint32_t mNextMsgId;
time_t mLastClean;
RsFeedReaderNotify *mNotify;
RsMutex mFeedReaderMtx;
uint32_t mStandardUpdateInterval;
uint32_t mStandardStorageTime;
bool mStandardUseProxy;
std::string mStandardProxyAddress;
uint16_t mStandardProxyPort;
std::map<std::string, RsFeedReaderFeed*> mFeeds;
RsMutex mDownloadMutex;
std::list<std::string> mDownloadFeeds;
RsMutex mProcessMutex;
std::list<std::string> mProcessFeeds;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 P3_FEEDREADERTHREAD
#define P3_FEEDREADERTHREAD
#include "util/rsthreads.h"
#include <list>
class p3FeedReader;
class RsFeedReaderFeed;
class RsFeedReaderMsg;
class p3FeedReaderThread : public RsThread
{
public:
enum Type
{
DOWNLOAD,
PROCESS
};
enum DownloadResult
{
DOWNLOAD_SUCCESS,
DOWNLOAD_ERROR_INIT,
DOWNLOAD_ERROR,
DOWNLOAD_UNKNOWN_CONTENT_TYPE,
DOWNLOAD_NOT_FOUND,
DOWNLOAD_UNKOWN_RESPONSE_CODE,
DOWNLOAD_INTERNAL_ERROR
};
enum ProcessResult
{
PROCESS_SUCCESS,
PROCESS_ERROR_INIT,
PROCESS_UNKNOWN_FORMAT
};
public:
p3FeedReaderThread(p3FeedReader *feedReader, Type type);
private:
virtual void run();
DownloadResult download(const RsFeedReaderFeed &feed, std::string &content, std::string &icon, std::string &error);
ProcessResult process(const RsFeedReaderFeed &feed, std::list<RsFeedReaderMsg*> &entries, std::string &error);
p3FeedReader *mFeedReader;
Type mType;
/*xmlCharEncodingHandlerPtr*/ void *mCharEncodingHandler;
};
#endif

View File

@ -0,0 +1,388 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 "serialiser/rsbaseserial.h"
#include "serialiser/rstlvbase.h"
#include "rsFeedReaderItems.h"
/*************************************************************************/
RsFeedReaderFeed::RsFeedReaderFeed() : RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_FEEDREADER_CONFIG, RS_PKT_SUBTYPE_FEEDREADER_FEED)
{
clear();
}
void RsFeedReaderFeed::clear()
{
feedId.clear();
parentId.clear();
name.clear();
url.clear();
user.clear();
password.clear();
proxyAddress.clear();
proxyPort = 0;
updateInterval = 0;
lastUpdate = 0;
storageTime = 0;
flag = 0;
forumId.clear();
description.clear();
icon.clear();
errorState = RS_FEED_ERRORSTATE_OK;
errorString.clear();
workstate = WAITING;
content.clear();
}
std::ostream &RsFeedReaderFeed::print(std::ostream &out, uint16_t /*indent*/)
{
return out;
}
uint32_t RsFeedReaderSerialiser::sizeFeed(RsFeedReaderFeed *item)
{
uint32_t s = 8; /* header */
s += GetTlvStringSize(item->feedId);
s += GetTlvStringSize(item->parentId);
s += GetTlvStringSize(item->url);
s += GetTlvStringSize(item->name);
s += GetTlvStringSize(item->description);
s += GetTlvStringSize(item->icon);
s += GetTlvStringSize(item->user);
s += GetTlvStringSize(item->password);
s += GetTlvStringSize(item->proxyAddress);
s += sizeof(uint16_t); /* proxyPort */
s += sizeof(uint32_t); /* updateInterval */
s += sizeof(time_t); /* lastscan */
s += sizeof(uint32_t); /* storageTime */
s += sizeof(uint32_t); /* flag */
s += GetTlvStringSize(item->forumId);
s += sizeof(uint32_t); /* errorstate */
s += GetTlvStringSize(item->errorString);
return s;
}
/* serialise the data to the buffer */
bool RsFeedReaderSerialiser::serialiseFeed(RsFeedReaderFeed *item, void *data, uint32_t *pktsize)
{
uint32_t tlvsize = sizeFeed(item);
uint32_t offset = 0;
if (*pktsize < tlvsize)
return false; /* not enough space */
*pktsize = tlvsize;
bool ok = true;
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
/* skip the header */
offset += 8;
/* add values */
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GENID, item->feedId);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->parentId);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_LINK, item->url);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->name);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->description);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->icon);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->user);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->password);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->proxyAddress);
ok &= setRawUInt16(data, tlvsize, &offset, item->proxyPort);
ok &= setRawUInt32(data, tlvsize, &offset, item->updateInterval);
ok &= setRawUInt32(data, tlvsize, &offset, item->lastUpdate);
ok &= setRawUInt32(data, tlvsize, &offset, item->storageTime);
ok &= setRawUInt32(data, tlvsize, &offset, item->flag);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->forumId);
ok &= setRawUInt32(data, tlvsize, &offset, item->errorState);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->errorString);
if (offset != tlvsize)
{
ok = false;
std::cerr << "RsFeedReaderSerialiser::serialiseFeed() Size Error! " << std::endl;
}
return ok;
}
RsFeedReaderFeed *RsFeedReaderSerialiser::deserialiseFeed(void *data, uint32_t *pktsize)
{
/* get the type and size */
uint32_t rstype = getRsItemId(data);
uint32_t rssize = getRsItemSize(data);
uint32_t offset = 0;
if ((RS_PKT_VERSION1 != getRsItemVersion(rstype)) ||
(RS_PKT_CLASS_CONFIG != getRsItemClass(rstype)) ||
(RS_PKT_TYPE_FEEDREADER_CONFIG != getRsItemType(rstype)) ||
(RS_PKT_SUBTYPE_FEEDREADER_FEED != getRsItemSubType(rstype)))
{
return NULL; /* wrong type */
}
if (*pktsize < rssize) /* check size */
return NULL; /* not enough data */
/* set the packet length */
*pktsize = rssize;
bool ok = true;
/* ready to load */
RsFeedReaderFeed *item = new RsFeedReaderFeed();
item->clear();
/* skip the header */
offset += 8;
/* get values */
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_GENID, item->feedId);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->parentId);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_LINK, item->url);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, item->name);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->description);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->icon);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->user);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->password);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->proxyAddress);
ok &= getRawUInt16(data, rssize, &offset, &(item->proxyPort));
ok &= getRawUInt32(data, rssize, &offset, &(item->updateInterval));
ok &= getRawUInt32(data, rssize, &offset, (uint32_t*) &(item->lastUpdate));
ok &= getRawUInt32(data, rssize, &offset, &(item->storageTime));
ok &= getRawUInt32(data, rssize, &offset, &(item->flag));
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->forumId);
ok &= getRawUInt32(data, rssize, &offset, &(item->errorState));
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->errorString);
if (offset != rssize)
{
/* error */
delete item;
return NULL;
}
if (!ok)
{
delete item;
return NULL;
}
return item;
}
/*************************************************************************/
RsFeedReaderMsg::RsFeedReaderMsg() : RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_FEEDREADER_CONFIG, RS_PKT_SUBTYPE_FEEDREADER_MSG)
{
clear();
}
void RsFeedReaderMsg::clear()
{
msgId.clear();
feedId.clear();
title.clear();
link.clear();
author.clear();
description.clear();
pubDate = 0;
flag = 0;
}
std::ostream &RsFeedReaderMsg::print(std::ostream &out, uint16_t /*indent*/)
{
return out;
}
uint32_t RsFeedReaderSerialiser::sizeMsg(RsFeedReaderMsg *item)
{
uint32_t s = 8; /* header */
s += GetTlvStringSize(item->msgId);
s += GetTlvStringSize(item->feedId);
s += GetTlvStringSize(item->title);
s += GetTlvStringSize(item->link);
s += GetTlvStringSize(item->author);
s += GetTlvStringSize(item->description);
s += sizeof(time_t); /* pubDate */
s += sizeof(uint32_t); /* flag */
return s;
}
/* serialise the data to the buffer */
bool RsFeedReaderSerialiser::serialiseMsg(RsFeedReaderMsg *item, void *data, uint32_t *pktsize)
{
uint32_t tlvsize = sizeMsg(item);
uint32_t offset = 0;
if (*pktsize < tlvsize)
return false; /* not enough space */
*pktsize = tlvsize;
bool ok = true;
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
/* skip the header */
offset += 8;
/* add values */
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GENID, item->msgId);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->feedId);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_NAME, item->title);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_LINK, item->link);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_VALUE, item->author);
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_COMMENT, item->description);
ok &= setRawUInt32(data, tlvsize, &offset, item->pubDate);
ok &= setRawUInt32(data, tlvsize, &offset, item->flag);
if (offset != tlvsize)
{
ok = false;
std::cerr << "RsFeedReaderSerialiser::serialiseMsg() Size Error! " << std::endl;
}
return ok;
}
RsFeedReaderMsg *RsFeedReaderSerialiser::deserialiseMsg(void *data, uint32_t *pktsize)
{
/* get the type and size */
uint32_t rstype = getRsItemId(data);
uint32_t rssize = getRsItemSize(data);
uint32_t offset = 0;
if ((RS_PKT_VERSION1 != getRsItemVersion(rstype)) ||
(RS_PKT_CLASS_CONFIG != getRsItemClass(rstype)) ||
(RS_PKT_TYPE_FEEDREADER_CONFIG != getRsItemType(rstype)) ||
(RS_PKT_SUBTYPE_FEEDREADER_MSG != getRsItemSubType(rstype)))
{
return NULL; /* wrong type */
}
if (*pktsize < rssize) /* check size */
return NULL; /* not enough data */
/* set the packet length */
*pktsize = rssize;
bool ok = true;
/* ready to load */
RsFeedReaderMsg *item = new RsFeedReaderMsg();
item->clear();
/* skip the header */
offset += 8;
/* get values */
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_GENID, item->msgId);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->feedId);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_NAME, item->title);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_LINK, item->link);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_VALUE, item->author);
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_COMMENT, item->description);
ok &= getRawUInt32(data, rssize, &offset, (uint32_t*) &(item->pubDate));
ok &= getRawUInt32(data, rssize, &offset, &(item->flag));
if (offset != rssize)
{
/* error */
delete item;
return NULL;
}
if (!ok)
{
delete item;
return NULL;
}
return item;
}
/*************************************************************************/
uint32_t RsFeedReaderSerialiser::size(RsItem *item)
{
RsFeedReaderFeed *fi;
RsFeedReaderMsg *ei;
if (NULL != (fi = dynamic_cast<RsFeedReaderFeed*>(item)))
{
return sizeFeed((RsFeedReaderFeed*) item);
}
if (NULL != (ei = dynamic_cast<RsFeedReaderMsg*>(item)))
{
return sizeMsg((RsFeedReaderMsg*) item);
}
return 0;
}
bool RsFeedReaderSerialiser::serialise(RsItem *item, void *data, uint32_t *pktsize)
{
RsFeedReaderFeed *fi;
RsFeedReaderMsg *ei;
if (NULL != (fi = dynamic_cast<RsFeedReaderFeed*>(item)))
{
return serialiseFeed((RsFeedReaderFeed*) item, data, pktsize);
}
if (NULL != (ei = dynamic_cast<RsFeedReaderMsg*>(item)))
{
return serialiseMsg((RsFeedReaderMsg*) item, data, pktsize);
}
return false;
}
RsItem *RsFeedReaderSerialiser::deserialise(void *data, uint32_t *pktsize)
{
/* get the type and size */
uint32_t rstype = getRsItemId(data);
if ((RS_PKT_VERSION1 != getRsItemVersion(rstype)) ||
(RS_PKT_CLASS_CONFIG != getRsItemClass(rstype)) ||
(RS_PKT_TYPE_FEEDREADER_CONFIG != getRsItemType(rstype)))
{
return NULL; /* wrong type */
}
switch (getRsItemSubType(rstype))
{
case RS_PKT_SUBTYPE_FEEDREADER_FEED:
return deserialiseFeed(data, pktsize);
case RS_PKT_SUBTYPE_FEEDREADER_MSG:
return deserialiseMsg(data, pktsize);
}
return NULL;
}

View File

@ -0,0 +1,149 @@
/****************************************************************
* RetroShare GUI is distributed under the following license:
*
* Copyright (C) 2012 by Thunder
*
* 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 RS_FEEDREADER_ITEMS_H
#define RS_FEEDREADER_ITEMS_H
#include "serialiser/rsserial.h"
#include "serialiser/rstlvtypes.h"
#include "p3FeedReader.h"
const uint8_t RS_PKT_SUBTYPE_FEEDREADER_FEED = 0x02;
const uint8_t RS_PKT_SUBTYPE_FEEDREADER_MSG = 0x03;
/**************************************************************************/
#define RS_FEED_ERRORSTATE_OK 0
#define RS_FEED_ERRORSTATE_DOWNLOAD_INTERNAL_ERROR 1
#define RS_FEED_ERRORSTATE_DOWNLOAD_ERROR 2
#define RS_FEED_ERRORSTATE_DOWNLOAD_UNKNOWN_CONTENT_TYPE 3
#define RS_FEED_ERRORSTATE_DOWNLOAD_NOT_FOUND 4
#define RS_FEED_ERRORSTATE_DOWNLOAD_UNKOWN_RESPONSE_CODE 5
#define RS_FEED_ERRORSTATE_PROCESS_INTERNAL_ERROR 50
#define RS_FEED_ERRORSTATE_FORUM_CREATE 100
#define RS_FEED_ERRORSTATE_FORUM_NOT_FOUND 101
#define RS_FEED_ERRORSTATE_FORUM_NO_ADMIN 102
#define RS_FEED_ERRORSTATE_FORUM_NO_ANONYMOUS_FORUM 103
#define RS_FEED_FLAG_FOLDER 0x001
#define RS_FEED_FLAG_INFO_FROM_FEED 0x002
#define RS_FEED_FLAG_STANDARD_STORAGE_TIME 0x004
#define RS_FEED_FLAG_STANDARD_UPDATE_INTERVAL 0x008
#define RS_FEED_FLAG_STANDARD_PROXY 0x010
#define RS_FEED_FLAG_AUTHENTICATION 0x020
#define RS_FEED_FLAG_DEACTIVATED 0x040
#define RS_FEED_FLAG_FORUM 0x080
#define RS_FEED_FLAG_UPDATE_FORUM_INFO 0x100
class RsFeedReaderFeed : public RsItem
{
public:
enum WorkState {
WAITING,
WAITING_TO_DOWNLOAD,
DOWNLOADING,
WAITING_TO_PROCESS,
PROCESSING
};
public:
RsFeedReaderFeed();
virtual ~RsFeedReaderFeed() {}
virtual void clear();
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
std::string feedId;
std::string parentId;
std::string name;
std::string url;
std::string user;
std::string password;
std::string proxyAddress;
uint16_t proxyPort;
uint32_t updateInterval;
time_t lastUpdate;
uint32_t flag; // RS_FEED_FLAG_...
std::string forumId;
uint32_t storageTime;
std::string description;
std::string icon;
uint32_t errorState;
std::string errorString;
/* Not Serialised */
WorkState workstate;
std::string content;
std::map<std::string, RsFeedReaderMsg*> mMsgs;
};
#define RS_FEEDMSG_FLAG_DELETED 1
#define RS_FEEDMSG_FLAG_NEW 2
#define RS_FEEDMSG_FLAG_READ 4
class RsFeedReaderMsg : public RsItem
{
public:
RsFeedReaderMsg();
virtual ~RsFeedReaderMsg() {}
virtual void clear();
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
std::string msgId;
std::string feedId;
std::string title;
std::string link;
std::string author;
std::string description;
time_t pubDate;
uint32_t flag; // RS_FEEDMSG_FLAG_...
};
class RsFeedReaderSerialiser: public RsSerialType
{
public:
RsFeedReaderSerialiser() : RsSerialType(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_FEEDREADER_CONFIG) {}
virtual ~RsFeedReaderSerialiser() {}
virtual uint32_t size(RsItem *item);
virtual bool serialise(RsItem *item, void *data, uint32_t *size);
virtual RsItem *deserialise(void *data, uint32_t *size);
private:
/* For RS_PKT_SUBTYPE_FEEDREADER_FEED */
virtual uint32_t sizeFeed(RsFeedReaderFeed *item);
virtual bool serialiseFeed(RsFeedReaderFeed *item, void *data, uint32_t *size);
virtual RsFeedReaderFeed *deserialiseFeed(void *data, uint32_t *size);
/* For RS_PKT_SUBTYPE_FEEDREADER_MSG */
virtual uint32_t sizeMsg(RsFeedReaderMsg *item);
virtual bool serialiseMsg(RsFeedReaderMsg *item, void *data, uint32_t *size);
virtual RsFeedReaderMsg *deserialiseMsg(void *data, uint32_t *size);
};
/**************************************************************************/
#endif

View File

@ -2,4 +2,5 @@ TEMPLATE = subdirs
SUBDIRS += \
LinksCloud \
VOIP
VOIP \
FeedReader

View File

@ -323,10 +323,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
#endif
if (activatePage((Page) Settings->getLastPageInMainWindow()) == false) {
/* Select the first action */
grp->actions()[0]->setChecked(true);
}
ui.stackPages->setCurrentIndex(Settings->getLastPageInMainWindow());
/** StatusBar section ********/
/* initialize combobox in status bar */
@ -388,7 +385,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/** Destructor. */
MainWindow::~MainWindow()
{
Settings->setLastPageInMainWindow(getActivatePage());
Settings->setLastPageInMainWindow(ui.stackPages->currentIndex());
delete peerstatus;
delete natstatus;