mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
FeedReader:
- Recalculate message count of the user notify when a feed with new items is deleted. - Set deleted message to read and !new. - Added test feed item in notify settings. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6072 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6f7c424b1f
commit
ddc4a37a93
11 changed files with 78 additions and 2 deletions
|
@ -20,6 +20,8 @@
|
|||
****************************************************************/
|
||||
|
||||
#include <QMutex>
|
||||
#include <QDateTime>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "FeedReaderFeedNotify.h"
|
||||
#include "FeedReaderNotify.h"
|
||||
|
@ -116,3 +118,24 @@ QWidget *FeedReaderFeedNotify::feedItem(FeedHolder *parent)
|
|||
|
||||
return new FeedReaderFeedItem(mFeedReader, mNotify, parent, feedInfo, msgInfo);
|
||||
}
|
||||
|
||||
QWidget *FeedReaderFeedNotify::testFeedItem(FeedHolder *parent)
|
||||
{
|
||||
FeedInfo feedInfo;
|
||||
feedInfo.name = tr("Test").toUtf8().constData();
|
||||
|
||||
QByteArray faviconData;
|
||||
QBuffer buffer(&faviconData);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
if (QPixmap(":/images/Feed.png").scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation).save(&buffer, "ICO")) {
|
||||
feedInfo.icon = faviconData.toBase64().constData();
|
||||
}
|
||||
buffer.close();
|
||||
|
||||
FeedMsgInfo msgInfo;
|
||||
msgInfo.title = tr("Test message").toUtf8().constData();
|
||||
msgInfo.description = tr("This is a test message.").toUtf8().constData();
|
||||
msgInfo.pubDate = QDateTime::currentDateTime().toTime_t();
|
||||
|
||||
return new FeedReaderFeedItem(mFeedReader, mNotify, parent, feedInfo, msgInfo);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ class QMutex;
|
|||
class FeedReaderFeedNotify : public FeedNotify
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
class FeedItem
|
||||
{
|
||||
|
@ -50,6 +51,7 @@ public:
|
|||
virtual bool notifyEnabled();
|
||||
virtual void setNotifyEnabled(bool enabled);
|
||||
virtual QWidget *feedItem(FeedHolder *parent);
|
||||
virtual QWidget *testFeedItem(FeedHolder *parent);
|
||||
|
||||
private slots:
|
||||
void msgChanged(const QString &feedId, const QString &msgId, int type);
|
||||
|
|
|
@ -26,10 +26,12 @@
|
|||
#include "gui/MainWindow.h"
|
||||
|
||||
#include "interface/rsFeedReader.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
|
||||
FeedReaderUserNotify::FeedReaderUserNotify(FeedReaderDialog *feedReaderDialog, RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent) :
|
||||
UserNotify(parent), mFeedReaderDialog(feedReaderDialog), mFeedReader(feedReader), mNotify(notify)
|
||||
{
|
||||
connect(mNotify, SIGNAL(feedChanged(QString,int)), this, SLOT(feedChanged(QString,int)), Qt::QueuedConnection);
|
||||
connect(mNotify, SIGNAL(msgChanged(QString,QString,int)), this, SLOT(updateIcon()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
@ -86,3 +88,10 @@ void FeedReaderUserNotify::iconClicked()
|
|||
{
|
||||
MainWindow::showWindow(mFeedReaderDialog);
|
||||
}
|
||||
|
||||
void FeedReaderUserNotify::feedChanged(const QString &/*feedId*/, int type)
|
||||
{
|
||||
if (type == NOTIFY_TYPE_DEL) {
|
||||
updateIcon();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
|
||||
private slots:
|
||||
void feedChanged(const QString &feedId, int type);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon();
|
||||
virtual QIcon getMainIcon(bool hasNew);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue