diff --git a/plugins/FeedReader/gui/AddFeedDialog.ui b/plugins/FeedReader/gui/AddFeedDialog.ui index bb50990c6..9cc73e83e 100644 --- a/plugins/FeedReader/gui/AddFeedDialog.ui +++ b/plugins/FeedReader/gui/AddFeedDialog.ui @@ -25,14 +25,7 @@ 0 - - - - 16777215 - 64 - - - + diff --git a/plugins/FeedReader/gui/FeedReaderDialog.cpp b/plugins/FeedReader/gui/FeedReaderDialog.cpp index 16a1f86f9..9cb5418b1 100644 --- a/plugins/FeedReader/gui/FeedReaderDialog.cpp +++ b/plugins/FeedReader/gui/FeedReaderDialog.cpp @@ -68,11 +68,14 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent) connect(mNotify, SIGNAL(notifyMsgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int))); /* connect signals */ - connect(ui->feedTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(feedItemChanged(QTreeWidgetItem*))); + connect(ui->feedTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(feedItemChanged(QTreeWidgetItem*))); connect(ui->messageTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(messageTabCloseRequested(int))); connect(ui->feedTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(feedTreeCustomPopupMenu(QPoint))); + connect(ui->feedAddButton, SIGNAL(clicked()), this, SLOT(newFeed())); + connect(ui->feedProcessButton, SIGNAL(clicked()), this, SLOT(processFeed())); + mFeedCompareRole = new RSTreeWidgetItemCompareRole; mFeedCompareRole->setRole(COLUMN_FEED_NAME, ROLE_FEED_SORT); @@ -98,6 +101,8 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent) ui->feedTreeWidget->sortItems(COLUMN_FEED_NAME, Qt::AscendingOrder); ui->feedTreeWidget->installEventFilter(this); + + feedItemChanged(NULL); } FeedReaderDialog::~FeedReaderDialog() @@ -536,13 +541,20 @@ FeedReaderMessageWidget *FeedReaderDialog::feedMessageWidget(const std::string & void FeedReaderDialog::feedItemChanged(QTreeWidgetItem *item) { if (!item) { + ui->feedAddButton->setEnabled(false); + ui->feedProcessButton->setEnabled(false); return; } + ui->feedProcessButton->setEnabled(true); + if (item->data(COLUMN_FEED_DATA, ROLE_FEED_FOLDER).toBool()) { + ui->feedAddButton->setEnabled(true); return; } + ui->feedAddButton->setEnabled(false); + std::string feedId = item->data(COLUMN_FEED_DATA, ROLE_FEED_ID).toString().toStdString(); /* search exisiting tab */ FeedReaderMessageWidget *messageWidget = feedMessageWidget(feedId); diff --git a/plugins/FeedReader/gui/FeedReaderDialog.ui b/plugins/FeedReader/gui/FeedReaderDialog.ui index cb610e0f7..dc6e82777 100644 --- a/plugins/FeedReader/gui/FeedReaderDialog.ui +++ b/plugins/FeedReader/gui/FeedReaderDialog.ui @@ -82,6 +82,34 @@ + + + + Add new feed + + + + :/images/FeedAdd.png:/images/FeedAdd.png + + + true + + + + + + + Update feed + + + + :/images/FeedProcess.png:/images/FeedProcess.png + + + true + + + diff --git a/plugins/FeedReader/gui/FeedReaderMessageWidget.cpp b/plugins/FeedReader/gui/FeedReaderMessageWidget.cpp index 00aa04cb0..4953a7863 100644 --- a/plugins/FeedReader/gui/FeedReaderMessageWidget.cpp +++ b/plugins/FeedReader/gui/FeedReaderMessageWidget.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "FeedReaderMessageWidget.h" #include "ui_FeedReaderMessageWidget.h" @@ -51,6 +52,18 @@ FeedReaderMessageWidget::FeedReaderMessageWidget(const std::string &feedId, RsFe connect(ui->linkButton, SIGNAL(clicked()), this, SLOT(openLinkMsg())); connect(ui->expandButton, SIGNAL(clicked()), this, SLOT(toggleMsgText())); + connect(ui->msgReadButton, SIGNAL(clicked()), this, SLOT(markAsReadMsg())); + connect(ui->msgUnreadButton, SIGNAL(clicked()), this, SLOT(markAsUnreadMsg())); + connect(ui->msgReadAllButton, SIGNAL(clicked()), this, SLOT(markAllAsReadMsg())); + connect(ui->msgRemoveButton, SIGNAL(clicked()), this, SLOT(removeMsg())); + connect(ui->feedProcessButton, SIGNAL(clicked()), this, SLOT(processFeed())); + + // create timer for navigation + timer = new QTimer(this); + timer->setInterval(300); + timer->setSingleShot(true); + connect(timer, SIGNAL(timeout()), this, SLOT(updateCurrentMessage())); + mMsgCompareRole = new RSTreeWidgetItemCompareRole; mMsgCompareRole->setRole(COLUMN_MSG_TITLE, ROLE_MSG_SORT); mMsgCompareRole->setRole(COLUMN_MSG_READ, ROLE_MSG_SORT); @@ -108,10 +121,15 @@ FeedReaderMessageWidget::FeedReaderMessageWidget(const std::string &feedId, RsFe } updateMsgs(); + updateCurrentMessage(); } FeedReaderMessageWidget::~FeedReaderMessageWidget() { + // stop and delete timer + timer->stop(); + delete(timer); + /* save settings */ processSettings(false); @@ -452,10 +470,21 @@ void FeedReaderMessageWidget::msgItemClicked(QTreeWidgetItem *item, int column) setMsgAsReadUnread(rows, !read); return; } + + // show current message directly + updateCurrentMessage(); } void FeedReaderMessageWidget::msgItemChanged() { + timer->stop(); + timer->start(); +} + +void FeedReaderMessageWidget::updateCurrentMessage() +{ + timer->stop(); + long todo; // show link somewhere std::string msgId = currentMsgId(); @@ -465,6 +494,11 @@ void FeedReaderMessageWidget::msgItemChanged() // ui->msgLink->clear(); ui->msgText->clear(); ui->linkButton->setEnabled(false); + + ui->msgReadButton->setEnabled(false); + ui->msgUnreadButton->setEnabled(false); + ui->msgReadAllButton->setEnabled(false); + ui->msgRemoveButton->setEnabled(false); return; } @@ -475,9 +509,19 @@ void FeedReaderMessageWidget::msgItemChanged() // ui->msgLink->clear(); ui->msgText->clear(); ui->linkButton->setEnabled(false); + + ui->msgReadButton->setEnabled(false); + ui->msgUnreadButton->setEnabled(false); + ui->msgReadAllButton->setEnabled(false); + ui->msgRemoveButton->setEnabled(false); return; } + ui->msgReadButton->setEnabled(true); + ui->msgUnreadButton->setEnabled(true); + ui->msgReadAllButton->setEnabled(true); + ui->msgRemoveButton->setEnabled(true); + /* get msg */ FeedMsgInfo msgInfo; if (!mFeedReader->getMsgInfo(mFeedId, msgId, msgInfo)) { @@ -657,6 +701,15 @@ void FeedReaderMessageWidget::removeMsg() mFeedReader->removeMsgs(mFeedId, msgIds); } +void FeedReaderMessageWidget::processFeed() +{ + if (mFeedId.empty()) { + return; + } + + mFeedReader->processFeed(mFeedId); +} + void FeedReaderMessageWidget::copyLinkMsg() { QTreeWidgetItem *item = ui->msgTreeWidget->currentItem(); diff --git a/plugins/FeedReader/gui/FeedReaderMessageWidget.h b/plugins/FeedReader/gui/FeedReaderMessageWidget.h index 738059dd6..4ff0dd124 100644 --- a/plugins/FeedReader/gui/FeedReaderMessageWidget.h +++ b/plugins/FeedReader/gui/FeedReaderMessageWidget.h @@ -7,6 +7,7 @@ namespace Ui { class FeedReaderMessageWidget; } +class QTimer; class FeedMsgInfo; class QTreeWidgetItem; class RSTreeWidgetItemCompareRole; @@ -34,6 +35,7 @@ signals: private slots: void msgTreeCustomPopupMenu(QPoint point); + void updateCurrentMessage(); void msgItemChanged(); void msgItemClicked(QTreeWidgetItem *item, int column); void filterColumnChanged(int column); @@ -44,6 +46,7 @@ private slots: void markAllAsReadMsg(); void copyLinksMsg(); void removeMsg(); + void processFeed(); void openLinkMsg(); void copyLinkMsg(); @@ -67,6 +70,7 @@ private: std::string mFeedId; QString mFeedName; unsigned int mUnreadCount; + QTimer *timer; // gui interface RsFeedReader *mFeedReader; diff --git a/plugins/FeedReader/gui/FeedReaderMessageWidget.ui b/plugins/FeedReader/gui/FeedReaderMessageWidget.ui index e4b748824..d1868a5a2 100644 --- a/plugins/FeedReader/gui/FeedReaderMessageWidget.ui +++ b/plugins/FeedReader/gui/FeedReaderMessageWidget.ui @@ -39,6 +39,79 @@ 2 + + + + Mark messages as read + + + ... + + + + :/images/FeedMsgRead.png:/images/FeedMsgRead.png + + + true + + + + + + + Mark messages as unread + + + + :/images/FeedMsgUnread.png:/images/FeedMsgUnread.png + + + true + + + + + + + Mark all messages as read + + + + :/images/FeedMsgReadAll.png:/images/FeedMsgReadAll.png + + + true + + + + + + + Remove messages + + + + :/images/FeedMsgDelete.png:/images/FeedMsgDelete.png + + + true + + + + + + + Update feed + + + + :/images/FeedProcess.png:/images/FeedProcess.png + + + true + + + @@ -174,16 +247,16 @@ - - LineEditClear - QLineEdit -
gui/common/LineEditClear.h
-
LinkTextBrowser QTextBrowser
gui/common/LinkTextBrowser.h
+ + LineEditClear + QLineEdit +
gui/common/LineEditClear.h
+
diff --git a/plugins/FeedReader/gui/FeedReader_images.qrc b/plugins/FeedReader/gui/FeedReader_images.qrc index e1a6c5918..5cf82e8b0 100644 --- a/plugins/FeedReader/gui/FeedReader_images.qrc +++ b/plugins/FeedReader/gui/FeedReader_images.qrc @@ -4,6 +4,11 @@ images/Root.png images/Folder.png images/Feed.png + images/FeedMsgDelete.png + images/FeedMsgRead.png + images/FeedMsgReadAll.png + images/FeedMsgUnread.png + images/FeedProcess.png images/FeedProcessOverlay.png images/FeedErrorOverlay.png images/FolderAdd.png diff --git a/plugins/FeedReader/gui/images/FeedMsgDelete.png b/plugins/FeedReader/gui/images/FeedMsgDelete.png new file mode 100644 index 000000000..94608690f Binary files /dev/null and b/plugins/FeedReader/gui/images/FeedMsgDelete.png differ diff --git a/plugins/FeedReader/gui/images/FeedMsgRead.png b/plugins/FeedReader/gui/images/FeedMsgRead.png new file mode 100644 index 000000000..9c60c1ac0 Binary files /dev/null and b/plugins/FeedReader/gui/images/FeedMsgRead.png differ diff --git a/plugins/FeedReader/gui/images/FeedMsgReadAll.png b/plugins/FeedReader/gui/images/FeedMsgReadAll.png new file mode 100644 index 000000000..c8cb08053 Binary files /dev/null and b/plugins/FeedReader/gui/images/FeedMsgReadAll.png differ diff --git a/plugins/FeedReader/gui/images/FeedMsgUnread.png b/plugins/FeedReader/gui/images/FeedMsgUnread.png new file mode 100644 index 000000000..4426d1076 Binary files /dev/null and b/plugins/FeedReader/gui/images/FeedMsgUnread.png differ diff --git a/plugins/FeedReader/gui/images/FeedProcess.png b/plugins/FeedReader/gui/images/FeedProcess.png new file mode 100644 index 000000000..cdbd86b4b Binary files /dev/null and b/plugins/FeedReader/gui/images/FeedProcess.png differ diff --git a/plugins/FeedReader/services/p3FeedReader.cc b/plugins/FeedReader/services/p3FeedReader.cc index 35c62a6a4..6f94b58a4 100644 --- a/plugins/FeedReader/services/p3FeedReader.cc +++ b/plugins/FeedReader/services/p3FeedReader.cc @@ -1241,9 +1241,11 @@ void p3FeedReader::cleanFeeds() if (removedMsgIds.size()) { IndicateConfigChanged(); - std::list >::iterator it; - for (it = removedMsgIds.begin(); it != removedMsgIds.end(); ++it) { - mNotify->msgChanged(it->first, it->second, NOTIFY_TYPE_DEL); + if (mNotify) { + std::list >::iterator it; + for (it = removedMsgIds.begin(); it != removedMsgIds.end(); ++it) { + mNotify->msgChanged(it->first, it->second, NOTIFY_TYPE_DEL); + } } } }