Fixed #162.
This commit is contained in:
parent
ee03175eed
commit
ad2b02aba3
4 changed files with 33 additions and 13 deletions
|
@ -9,6 +9,7 @@ http://goo.gl/forms/GcvPYgS2a8
|
||||||
|
|
||||||
Added:
|
Added:
|
||||||
|
|
||||||
|
▪ Recycle bins now have context menu. (issue #162)
|
||||||
▪ User is now able to delete TT-RSS feeds. (issue #151)
|
▪ User is now able to delete TT-RSS feeds. (issue #151)
|
||||||
▪ Added ability to stop running batch feed update. (issue #157)
|
▪ Added ability to stop running batch feed update. (issue #157)
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,7 @@ void FormMain::updateRecycleBinMenu() {
|
||||||
root_menu->setToolTip(activated_root->description());
|
root_menu->setToolTip(activated_root->description());
|
||||||
|
|
||||||
RecycleBin *bin = activated_root->recycleBin();
|
RecycleBin *bin = activated_root->recycleBin();
|
||||||
|
QList<QAction*> context_menu;
|
||||||
|
|
||||||
if (bin == NULL) {
|
if (bin == NULL) {
|
||||||
QAction *no_action = new QAction(qApp->icons()->fromTheme(QSL("dialog-error")),
|
QAction *no_action = new QAction(qApp->icons()->fromTheme(QSL("dialog-error")),
|
||||||
|
@ -247,19 +248,15 @@ void FormMain::updateRecycleBinMenu() {
|
||||||
no_action->setEnabled(false);
|
no_action->setEnabled(false);
|
||||||
root_menu->addAction(no_action);
|
root_menu->addAction(no_action);
|
||||||
}
|
}
|
||||||
|
else if ((context_menu = bin->contextMenu()).isEmpty()) {
|
||||||
|
QAction *no_action = new QAction(qApp->icons()->fromTheme(QSL("dialog-error")),
|
||||||
|
tr("No actions possible"),
|
||||||
|
m_ui->m_menuRecycleBin);
|
||||||
|
no_action->setEnabled(false);
|
||||||
|
root_menu->addAction(no_action);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
QAction *restore_action = new QAction(qApp->icons()->fromTheme(QSL("recycle-bin-restore-all")),
|
root_menu->addActions(context_menu);
|
||||||
tr("Restore recycle bin"),
|
|
||||||
m_ui->m_menuRecycleBin);
|
|
||||||
QAction *empty_action = new QAction(qApp->icons()->fromTheme(QSL("recycle-bin-empty")),
|
|
||||||
tr("Empty recycle bin"),
|
|
||||||
m_ui->m_menuRecycleBin);
|
|
||||||
|
|
||||||
connect(restore_action, SIGNAL(triggered()), bin, SLOT(restore()));
|
|
||||||
connect(empty_action, SIGNAL(triggered()), bin, SLOT(empty()));
|
|
||||||
|
|
||||||
root_menu->addAction(restore_action);
|
|
||||||
root_menu->addAction(empty_action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->m_menuRecycleBin->addMenu(root_menu);
|
m_ui->m_menuRecycleBin->addMenu(root_menu);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
|
|
||||||
|
|
||||||
RecycleBin::RecycleBin(RootItem *parent_item) : RootItem(parent_item) {
|
RecycleBin::RecycleBin(RootItem *parent_item) : RootItem(parent_item), m_contextMenu(QList<QAction*>()) {
|
||||||
setKind(RootItemKind::Bin);
|
setKind(RootItemKind::Bin);
|
||||||
setId(ID_RECYCLE_BIN);
|
setId(ID_RECYCLE_BIN);
|
||||||
setIcon(qApp->icons()->fromTheme(QSL("folder-recycle-bin")));
|
setIcon(qApp->icons()->fromTheme(QSL("folder-recycle-bin")));
|
||||||
|
@ -87,6 +87,25 @@ QVariant RecycleBin::data(int column, int role) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QAction*> RecycleBin::contextMenu() {
|
||||||
|
if (m_contextMenu.isEmpty()) {
|
||||||
|
QAction *restore_action = new QAction(qApp->icons()->fromTheme(QSL("recycle-bin-restore-all")),
|
||||||
|
tr("Restore recycle bin"),
|
||||||
|
this);
|
||||||
|
QAction *empty_action = new QAction(qApp->icons()->fromTheme(QSL("recycle-bin-empty")),
|
||||||
|
tr("Empty recycle bin"),
|
||||||
|
this);
|
||||||
|
|
||||||
|
connect(restore_action, SIGNAL(triggered()), this, SLOT(restore()));
|
||||||
|
connect(empty_action, SIGNAL(triggered()), this, SLOT(empty()));
|
||||||
|
|
||||||
|
m_contextMenu.append(restore_action);
|
||||||
|
m_contextMenu.append(empty_action);
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_contextMenu;
|
||||||
|
}
|
||||||
|
|
||||||
QList<Message> RecycleBin::undeletedMessages() const {
|
QList<Message> RecycleBin::undeletedMessages() const {
|
||||||
QList<Message> messages;
|
QList<Message> messages;
|
||||||
const int account_id = getParentServiceRoot()->accountId();
|
const int account_id = getParentServiceRoot()->accountId();
|
||||||
|
|
|
@ -30,6 +30,7 @@ class RecycleBin : public RootItem {
|
||||||
|
|
||||||
QVariant data(int column, int role) const;
|
QVariant data(int column, int role) const;
|
||||||
|
|
||||||
|
QList<QAction*> contextMenu();
|
||||||
QList<Message> undeletedMessages() const;
|
QList<Message> undeletedMessages() const;
|
||||||
|
|
||||||
bool markAsReadUnread(ReadStatus status);
|
bool markAsReadUnread(ReadStatus status);
|
||||||
|
@ -60,6 +61,8 @@ class RecycleBin : public RootItem {
|
||||||
private:
|
private:
|
||||||
int m_totalCount;
|
int m_totalCount;
|
||||||
int m_unreadCount;
|
int m_unreadCount;
|
||||||
|
|
||||||
|
QList<QAction*> m_contextMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RECYCLEBIN_H
|
#endif // RECYCLEBIN_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue