mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
Added new option for GxsForums and FeedReader - Open all forums/feeds in new tab.
Option=on (standard) - no standard tab - new tab by single click - no menu entry "Open in new tab" Option=off: - standard tab (not closeable) - open in standard tab by single click - menu entry "Open in new tab" - open new tab with middle mouse button git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6060 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9cfe660e11
commit
f488dbd15a
30 changed files with 425 additions and 185 deletions
|
@ -50,7 +50,8 @@ 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());
|
||||
ui->setMsgToReadOnActivate->setChecked(FeedReaderSetting_SetMsgToReadOnActivate());
|
||||
ui->openAllInNewTabCheckBox->setChecked(FeedReaderSetting_OpenAllInNewTab());
|
||||
|
||||
std::string proxyAddress;
|
||||
uint16_t proxyPort;
|
||||
|
@ -67,6 +68,7 @@ bool FeedReaderConfig::save(QString &/*errmsg*/)
|
|||
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());
|
||||
Settings->setValueToGroup("FeedReaderDialog", "OpenAllInNewTab", ui->openAllInNewTabCheckBox->isChecked());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ namespace Ui {
|
|||
class FeedReaderConfig;
|
||||
}
|
||||
|
||||
#define FeedReaderSetting_SetMsgToReadOnActivate() Settings->valueFromGroup("FeedReaderDialog", "SetMsgToReadOnActivate", true).toBool()
|
||||
#define FeedReaderSetting_OpenAllInNewTab() Settings->valueFromGroup("FeedReaderDialog", "OpenAllInNewTab", true).toBool()
|
||||
|
||||
class FeedReaderConfig : public ConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -125,6 +125,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="openAllInNewTabCheckBox">
|
||||
<property name="text">
|
||||
<string>Open all feeds in new tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
#include "FeedReaderMessageWidget.h"
|
||||
#include "ui_FeedReaderDialog.h"
|
||||
#include "FeedReaderNotify.h"
|
||||
#include "FeedReaderConfig.h"
|
||||
#include "AddFeedDialog.h"
|
||||
#include "FeedReaderStringDefs.h"
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "FeedReaderUserNotify.h"
|
||||
|
||||
#include "interface/rsFeedReader.h"
|
||||
|
@ -61,11 +63,14 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
|
||||
mProcessSettings = false;
|
||||
mOpenFeedIds = NULL;
|
||||
mMessageWidget = NULL;
|
||||
|
||||
mNotify = new FeedReaderNotify();
|
||||
mFeedReader->setNotify(mNotify);
|
||||
connect(mNotify, SIGNAL(notifyFeedChanged(QString,int)), this, SLOT(feedChanged(QString,int)));
|
||||
connect(mNotify, SIGNAL(notifyMsgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)));
|
||||
connect(mNotify, SIGNAL(feedChanged(QString,int)), this, SLOT(feedChanged(QString,int)));
|
||||
connect(mNotify, SIGNAL(msgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||
|
||||
/* connect signals */
|
||||
connect(ui->feedTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(feedTreeItemActivated(QTreeWidgetItem*)));
|
||||
|
@ -74,6 +79,7 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
connect(ui->feedTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(feedTreeItemActivated(QTreeWidgetItem*)));
|
||||
}
|
||||
connect(ui->feedTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(feedTreeCustomPopupMenu(QPoint)));
|
||||
connect(ui->feedTreeWidget, SIGNAL(signalMouseMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(feedTreeMiddleButtonClicked(QTreeWidgetItem*)));
|
||||
|
||||
connect(ui->messageTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(messageTabCloseRequested(int)));
|
||||
connect(ui->messageTabWidget, SIGNAL(currentChanged(int)), this, SLOT(messageTabChanged(int)));
|
||||
|
@ -94,10 +100,10 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
mRootItem->setData(COLUMN_FEED_DATA, ROLE_FEED_ICON, QIcon(":/images/Root.png"));
|
||||
mRootItem->setExpanded(true);
|
||||
|
||||
/* set initial size the splitter */
|
||||
QList<int> sizes;
|
||||
sizes << 300 << width(); // Qt calculates the right sizes
|
||||
ui->splitter->setSizes(sizes);
|
||||
/* set initial size the splitter */
|
||||
QList<int> sizes;
|
||||
sizes << 300 << width(); // Qt calculates the right sizes
|
||||
ui->splitter->setSizes(sizes);
|
||||
|
||||
/* load settings */
|
||||
processSettings(true);
|
||||
|
@ -107,9 +113,7 @@ FeedReaderDialog::FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent)
|
|||
|
||||
ui->feedTreeWidget->installEventFilter(this);
|
||||
|
||||
mMessageWidget = createMessageWidget("");
|
||||
// remove close button of the the first tab
|
||||
ui->messageTabWidget->hideCloseButton(ui->messageTabWidget->indexOf(mMessageWidget));
|
||||
settingsChanged();
|
||||
|
||||
feedTreeItemActivated(NULL);
|
||||
}
|
||||
|
@ -176,6 +180,22 @@ void FeedReaderDialog::processSettings(bool load)
|
|||
mProcessSettings = false;
|
||||
}
|
||||
|
||||
void FeedReaderDialog::settingsChanged()
|
||||
{
|
||||
if (FeedReaderSetting_OpenAllInNewTab()) {
|
||||
if (mMessageWidget) {
|
||||
delete(mMessageWidget);
|
||||
mMessageWidget = NULL;
|
||||
}
|
||||
} else {
|
||||
if (!mMessageWidget) {
|
||||
mMessageWidget = createMessageWidget("");
|
||||
// remove close button of the the first tab
|
||||
ui->messageTabWidget->hideCloseButton(ui->messageTabWidget->indexOf(mMessageWidget));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FeedReaderDialog::addFeedToExpand(const std::string &feedId)
|
||||
{
|
||||
if (mOpenFeedIds == NULL) {
|
||||
|
@ -279,11 +299,13 @@ void FeedReaderDialog::feedTreeCustomPopupMenu(QPoint /*point*/)
|
|||
action->setEnabled(false);
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
if (!FeedReaderSetting_OpenAllInNewTab()) {
|
||||
contextMnu.addSeparator();
|
||||
|
||||
action = contextMnu.addAction(QIcon(""), tr("Open in new tab"), this, SLOT(openInNewTab()));
|
||||
if (!item || folder || feedMessageWidget(feedId)) {
|
||||
action->setEnabled(false);
|
||||
action = contextMnu.addAction(QIcon(""), tr("Open in new tab"), this, SLOT(openInNewTab()));
|
||||
if (!item || folder || feedMessageWidget(feedId)) {
|
||||
action->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
@ -565,7 +587,7 @@ FeedReaderMessageWidget *FeedReaderDialog::feedMessageWidget(const std::string &
|
|||
int tabCount = ui->messageTabWidget->count();
|
||||
for (int index = 0; index < tabCount; ++index) {
|
||||
FeedReaderMessageWidget *childWidget = dynamic_cast<FeedReaderMessageWidget*>(ui->messageTabWidget->widget(index));
|
||||
if (childWidget == mMessageWidget) {
|
||||
if (mMessageWidget && childWidget == mMessageWidget) {
|
||||
continue;
|
||||
}
|
||||
if (childWidget && childWidget->feedId() == id) {
|
||||
|
@ -607,17 +629,35 @@ void FeedReaderDialog::feedTreeItemActivated(QTreeWidgetItem *item)
|
|||
/* search exisiting tab */
|
||||
FeedReaderMessageWidget *messageWidget = feedMessageWidget(feedId);
|
||||
if (!messageWidget) {
|
||||
/* not found, use standard tab */
|
||||
messageWidget = mMessageWidget;
|
||||
messageWidget->setFeedId(feedId);
|
||||
if (mMessageWidget) {
|
||||
/* not found, use standard tab */
|
||||
messageWidget = mMessageWidget;
|
||||
messageWidget->setFeedId(feedId);
|
||||
} else {
|
||||
/* create new tab */
|
||||
messageWidget = createMessageWidget(feedId);
|
||||
}
|
||||
}
|
||||
|
||||
ui->messageTabWidget->setCurrentWidget(messageWidget);
|
||||
}
|
||||
|
||||
void FeedReaderDialog::feedTreeMiddleButtonClicked(QTreeWidgetItem *item)
|
||||
{
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
openFeedInNewTab(item->data(COLUMN_FEED_DATA, ROLE_FEED_ID).toString().toStdString());
|
||||
}
|
||||
|
||||
void FeedReaderDialog::openInNewTab()
|
||||
{
|
||||
std::string feedId = currentFeedId();
|
||||
openFeedInNewTab(currentFeedId());
|
||||
}
|
||||
|
||||
void FeedReaderDialog::openFeedInNewTab(const std::string &feedId)
|
||||
{
|
||||
if (feedId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -50,8 +50,10 @@ protected:
|
|||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
||||
private slots:
|
||||
void settingsChanged();
|
||||
void feedTreeCustomPopupMenu(QPoint point);
|
||||
void feedTreeItemActivated(QTreeWidgetItem *item);
|
||||
void feedTreeMiddleButtonClicked(QTreeWidgetItem *item);
|
||||
void openInNewTab();
|
||||
void newFolder();
|
||||
void newFeed();
|
||||
|
@ -75,6 +77,7 @@ private:
|
|||
void getExpandedFeedIds(QList<std::string> &feedIds);
|
||||
void updateFeeds(const std::string &parentId, QTreeWidgetItem *parentItem);
|
||||
void updateFeedItem(QTreeWidgetItem *item, FeedInfo &info);
|
||||
void openFeedInNewTab(const std::string &feedId);
|
||||
|
||||
void calculateFeedItems();
|
||||
void calculateFeedItem(QTreeWidgetItem *item, uint32_t &unreadCount, bool &loading);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "FeedReaderMessageWidget.h"
|
||||
#include "ui_FeedReaderMessageWidget.h"
|
||||
#include "FeedReaderNotify.h"
|
||||
#include "FeedReaderConfig.h"
|
||||
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
@ -38,8 +39,8 @@ FeedReaderMessageWidget::FeedReaderMessageWidget(const std::string &feedId, RsFe
|
|||
mUnreadCount = 0;
|
||||
|
||||
/* connect signals */
|
||||
connect(mNotify, SIGNAL(notifyFeedChanged(QString,int)), this, SLOT(feedChanged(QString,int)));
|
||||
connect(mNotify, SIGNAL(notifyMsgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)));
|
||||
connect(mNotify, SIGNAL(feedChanged(QString,int)), this, SLOT(feedChanged(QString,int)));
|
||||
connect(mNotify, SIGNAL(msgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)));
|
||||
|
||||
connect(ui->msgTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(msgItemChanged()));
|
||||
connect(ui->msgTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(msgItemClicked(QTreeWidgetItem*,int)));
|
||||
|
@ -554,7 +555,7 @@ void FeedReaderMessageWidget::updateCurrentMessage()
|
|||
return;
|
||||
}
|
||||
|
||||
bool setToReadOnActive = Settings->valueFromGroup("FeedReaderDialog", "SetMsgToReadOnActivate", true).toBool();
|
||||
bool setToReadOnActive = FeedReaderSetting_SetMsgToReadOnActivate();
|
||||
bool isnew = item->data(COLUMN_MSG_DATA, ROLE_MSG_NEW).toBool();
|
||||
bool read = item->data(COLUMN_MSG_DATA, ROLE_MSG_READ).toBool();
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ FeedReaderNotify::FeedReaderNotify() : QObject()
|
|||
{
|
||||
}
|
||||
|
||||
void FeedReaderNotify::feedChanged(const std::string &feedId, int type)
|
||||
void FeedReaderNotify::notifyFeedChanged(const std::string &feedId, int type)
|
||||
{
|
||||
emit notifyFeedChanged(QString::fromStdString(feedId), type);
|
||||
emit feedChanged(QString::fromStdString(feedId), type);
|
||||
}
|
||||
|
||||
void FeedReaderNotify::msgChanged(const std::string &feedId, const std::string &msgId, int type)
|
||||
void FeedReaderNotify::notifyMsgChanged(const std::string &feedId, const std::string &msgId, int type)
|
||||
{
|
||||
emit notifyMsgChanged(QString::fromStdString(feedId), QString::fromStdString(msgId), type);
|
||||
emit msgChanged(QString::fromStdString(feedId), QString::fromStdString(msgId), type);
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ 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);
|
||||
virtual void notifyFeedChanged(const std::string &feedId, int type);
|
||||
virtual void notifyMsgChanged(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);
|
||||
void feedChanged(const QString &feedId, int type);
|
||||
void msgChanged(const QString &feedId, const QString &msgId, int type);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
FeedReaderUserNotify::FeedReaderUserNotify(FeedReaderDialog *feedReaderDialog, RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent) :
|
||||
UserNotify(parent), mFeedReaderDialog(feedReaderDialog), mFeedReader(feedReader), mNotify(notify)
|
||||
{
|
||||
connect(mNotify, SIGNAL(notifyMsgChanged(QString,QString,int)), this, SLOT(updateIcon()), Qt::QueuedConnection);
|
||||
connect(mNotify, SIGNAL(msgChanged(QString,QString,int)), this, SLOT(updateIcon()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::hasSetting(QString &name)
|
||||
|
|
|
@ -160,8 +160,8 @@ PreviewFeedDialog::PreviewFeedDialog(RsFeedReader *feedReader, FeedReaderNotify
|
|||
connect(ui->xpathUseListWidget->itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), this, SLOT(xpathCloseEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
|
||||
connect(ui->xpathRemoveListWidget->itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), this, SLOT(xpathCloseEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
|
||||
|
||||
connect(mNotify, SIGNAL(notifyFeedChanged(QString,int)), this, SLOT(feedChanged(QString,int)));
|
||||
connect(mNotify, SIGNAL(notifyMsgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)));
|
||||
connect(mNotify, SIGNAL(feedChanged(QString,int)), this, SLOT(feedChanged(QString,int)));
|
||||
connect(mNotify, SIGNAL(msgChanged(QString,QString,int)), this, SLOT(msgChanged(QString,QString,int)));
|
||||
|
||||
// ui->documentTreeWidget->setItemDelegate(new PreviewItemDelegate(ui->documentTreeWidget));
|
||||
ui->structureFrame->hide();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue