Work on messages/recycle bin handling.
This commit is contained in:
parent
8eb34100a4
commit
b7f6666e62
@ -419,6 +419,7 @@ set(APP_SOURCES
|
|||||||
src/services/abstract/feed.cpp
|
src/services/abstract/feed.cpp
|
||||||
src/services/abstract/category.cpp
|
src/services/abstract/category.cpp
|
||||||
src/services/abstract/serviceroot.cpp
|
src/services/abstract/serviceroot.cpp
|
||||||
|
src/services/abstract/recyclebin.cpp
|
||||||
|
|
||||||
# STANDARD feed service sources.
|
# STANDARD feed service sources.
|
||||||
src/services/standard/gui/formstandardcategorydetails.cpp
|
src/services/standard/gui/formstandardcategorydetails.cpp
|
||||||
@ -535,6 +536,7 @@ set(APP_HEADERS
|
|||||||
src/services/abstract/feed.h
|
src/services/abstract/feed.h
|
||||||
src/services/abstract/category.h
|
src/services/abstract/category.h
|
||||||
src/services/abstract/serviceroot.h
|
src/services/abstract/serviceroot.h
|
||||||
|
src/services/abstract/recyclebin.h
|
||||||
|
|
||||||
# STANDARD service headers.
|
# STANDARD service headers.
|
||||||
src/services/standard/standardfeedsimportexportmodel.h
|
src/services/standard/standardfeedsimportexportmodel.h
|
||||||
|
@ -32,7 +32,7 @@ namespace RootItemKind {
|
|||||||
// Describes the kind of the item.
|
// Describes the kind of the item.
|
||||||
enum Kind {
|
enum Kind {
|
||||||
Root = 1,
|
Root = 1,
|
||||||
Bin = 2,
|
Bin = 2,
|
||||||
Feed = 4,
|
Feed = 4,
|
||||||
Category = 8,
|
Category = 8,
|
||||||
ServiceRoot = 16
|
ServiceRoot = 16
|
||||||
|
43
src/services/abstract/recyclebin.cpp
Normal file
43
src/services/abstract/recyclebin.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// This file is part of RSS Guard.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
|
||||||
|
//
|
||||||
|
// RSS Guard 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 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "services/abstract/recyclebin.h"
|
||||||
|
|
||||||
|
#include "miscellaneous/application.h"
|
||||||
|
#include "miscellaneous/iconfactory.h"
|
||||||
|
|
||||||
|
|
||||||
|
RecycleBin::RecycleBin(RootItem *parent_item) : RootItem(parent_item) {
|
||||||
|
setKind(RootItemKind::Bin);
|
||||||
|
setIcon(qApp->icons()->fromTheme(QSL("folder-recycle-bin")));
|
||||||
|
setTitle(tr("Recycle bin"));
|
||||||
|
setDescription(tr("Recycle bin contains all deleted messages from all feeds."));
|
||||||
|
setCreationDate(QDateTime::currentDateTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
RecycleBin::~RecycleBin() {
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant RecycleBin::data(int column, int role) const {
|
||||||
|
switch (role) {
|
||||||
|
case Qt::ToolTipRole:
|
||||||
|
return tr("Recycle bin\n%1").arg(tr("%n deleted message(s).", 0, countOfAllMessages()));
|
||||||
|
|
||||||
|
default:
|
||||||
|
return RootItem::data(column, role);
|
||||||
|
}
|
||||||
|
}
|
37
src/services/abstract/recyclebin.h
Normal file
37
src/services/abstract/recyclebin.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// This file is part of RSS Guard.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
|
||||||
|
//
|
||||||
|
// RSS Guard 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 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// RSS Guard 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 RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef RECYCLEBIN_H
|
||||||
|
#define RECYCLEBIN_H
|
||||||
|
|
||||||
|
#include "core/rootitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
class RecycleBin : public RootItem {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit RecycleBin(RootItem *parent_item = NULL);
|
||||||
|
virtual ~RecycleBin();
|
||||||
|
|
||||||
|
QVariant data(int column, int role) const;
|
||||||
|
|
||||||
|
virtual bool empty() = 0;
|
||||||
|
virtual bool restore() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RECYCLEBIN_H
|
@ -25,13 +25,8 @@
|
|||||||
|
|
||||||
|
|
||||||
StandardRecycleBin::StandardRecycleBin(RootItem *parent)
|
StandardRecycleBin::StandardRecycleBin(RootItem *parent)
|
||||||
: RootItem(parent) {
|
: RecycleBin(parent) {
|
||||||
setKind(RootItemKind::Bin);
|
|
||||||
setIcon(qApp->icons()->fromTheme(QSL("folder-recycle-bin")));
|
|
||||||
setId(ID_RECYCLE_BIN);
|
setId(ID_RECYCLE_BIN);
|
||||||
setTitle(tr("Recycle bin"));
|
|
||||||
setDescription(tr("Recycle bin contains all deleted messages from all feeds."));
|
|
||||||
setCreationDate(QDateTime::currentDateTime());
|
|
||||||
updateCounts(true);
|
updateCounts(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,14 +38,6 @@ StandardServiceRoot *StandardRecycleBin::serviceRoot() {
|
|||||||
return static_cast<StandardServiceRoot*>(getParentServiceRoot());
|
return static_cast<StandardServiceRoot*>(getParentServiceRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
int StandardRecycleBin::childCount() const {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StandardRecycleBin::appendChild(RootItem *child) {
|
|
||||||
Q_UNUSED(child)
|
|
||||||
}
|
|
||||||
|
|
||||||
int StandardRecycleBin::countOfUnreadMessages() const {
|
int StandardRecycleBin::countOfUnreadMessages() const {
|
||||||
return m_unreadCount;
|
return m_unreadCount;
|
||||||
}
|
}
|
||||||
@ -59,16 +46,6 @@ int StandardRecycleBin::countOfAllMessages() const {
|
|||||||
return m_totalCount;
|
return m_totalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant StandardRecycleBin::data(int column, int role) const {
|
|
||||||
switch (role) {
|
|
||||||
case Qt::ToolTipRole:
|
|
||||||
return tr("Recycle bin\n%1").arg(tr("%n deleted message(s).", 0, countOfAllMessages()));
|
|
||||||
|
|
||||||
default:
|
|
||||||
return RootItem::data(column, role);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool StandardRecycleBin::markAsReadUnread(RootItem::ReadStatus status) {
|
bool StandardRecycleBin::markAsReadUnread(RootItem::ReadStatus status) {
|
||||||
return serviceRoot()->markRecycleBinReadUnread(status);
|
return serviceRoot()->markRecycleBinReadUnread(status);
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,17 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifndef RECYCLEBIN_H
|
#ifndef STANDARDRECYCLEBIN_H
|
||||||
#define RECYCLEBIN_H
|
#define STANDARDRECYCLEBIN_H
|
||||||
|
|
||||||
#include "core/rootitem.h"
|
#include "services/abstract/recyclebin.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
|
||||||
class StandardServiceRoot;
|
class StandardServiceRoot;
|
||||||
|
|
||||||
class StandardRecycleBin : public RootItem {
|
class StandardRecycleBin : public RecycleBin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -34,12 +34,9 @@ class StandardRecycleBin : public RootItem {
|
|||||||
|
|
||||||
StandardServiceRoot *serviceRoot();
|
StandardServiceRoot *serviceRoot();
|
||||||
|
|
||||||
int childCount() const;
|
|
||||||
void appendChild(RootItem *child);
|
|
||||||
int countOfUnreadMessages() const;
|
int countOfUnreadMessages() const;
|
||||||
int countOfAllMessages() const;
|
int countOfAllMessages() const;
|
||||||
QVariant data(int column, int role) const;
|
bool markAsReadUnread(RootItem::ReadStatus status);
|
||||||
bool markAsReadUnread(ReadStatus status);
|
|
||||||
|
|
||||||
bool empty();
|
bool empty();
|
||||||
bool restore();
|
bool restore();
|
||||||
@ -52,4 +49,4 @@ class StandardRecycleBin : public RootItem {
|
|||||||
int m_unreadCount;
|
int m_unreadCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RECYCLEBIN_H
|
#endif // STANDARDRECYCLEBIN_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user