Add std acc when no account is active.
This commit is contained in:
parent
a01023629c
commit
c4fec28e56
2071
resources/scripts/uncrustify/uncrustify.cfg
Normal file
2071
resources/scripts/uncrustify/uncrustify.cfg
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,9 @@
|
|||||||
3.4.3
|
3.4.3
|
||||||
—————
|
—————
|
||||||
|
|
||||||
|
Added:
|
||||||
|
▪ Standard account is now automatically added if RSS Guard is started with empty database.
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
▪ Fixed build on some Unit-like operating systems.
|
▪ Fixed build on some Unit-like operating systems.
|
||||||
|
|
||||||
|
@ -187,6 +187,7 @@ win32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DISTFILES += resources/scripts/astyle/.astylerc \
|
DISTFILES += resources/scripts/astyle/.astylerc \
|
||||||
|
resources/scripts/uncrustify/uncrustify.cfg \
|
||||||
resources/scripts/uncrustify/uncrustify.cfg
|
resources/scripts/uncrustify/uncrustify.cfg
|
||||||
|
|
||||||
MOC_DIR = $$OUT_PWD/moc
|
MOC_DIR = $$OUT_PWD/moc
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "services/abstract/serviceroot.h"
|
#include "services/abstract/serviceroot.h"
|
||||||
#include "services/abstract/recyclebin.h"
|
#include "services/abstract/recyclebin.h"
|
||||||
#include "services/abstract/serviceentrypoint.h"
|
#include "services/abstract/serviceentrypoint.h"
|
||||||
|
#include "services/standard/standardserviceentrypoint.h"
|
||||||
#include "services/standard/standardserviceroot.h"
|
#include "services/standard/standardserviceroot.h"
|
||||||
#include "miscellaneous/textfactory.h"
|
#include "miscellaneous/textfactory.h"
|
||||||
#include "miscellaneous/databasefactory.h"
|
#include "miscellaneous/databasefactory.h"
|
||||||
@ -34,6 +35,7 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QStack>
|
#include <QStack>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -42,15 +44,15 @@ FeedsModel::FeedsModel(QObject* parent) : QAbstractItemModel(parent) {
|
|||||||
setObjectName(QSL("FeedsModel"));
|
setObjectName(QSL("FeedsModel"));
|
||||||
// Create root item.
|
// Create root item.
|
||||||
m_rootItem = new RootItem();
|
m_rootItem = new RootItem();
|
||||||
//: Name of root item of feed list which can be seen in feed add/edit dialog.
|
// : Name of root item of feed list which can be seen in feed add/edit dialog.
|
||||||
m_rootItem->setTitle(tr("Root"));
|
m_rootItem->setTitle(tr("Root"));
|
||||||
m_rootItem->setIcon(qApp->icons()->fromTheme(QSL("folder")));
|
m_rootItem->setIcon(qApp->icons()->fromTheme(QSL("folder")));
|
||||||
// Setup icons.
|
// Setup icons.
|
||||||
m_countsIcon = qApp->icons()->fromTheme(QSL("mail-mark-unread"));
|
m_countsIcon = qApp->icons()->fromTheme(QSL("mail-mark-unread"));
|
||||||
//: Title text in the feed list header.
|
// : Title text in the feed list header.
|
||||||
m_headerData << tr("Title");
|
m_headerData << tr("Title");
|
||||||
m_tooltipData << /*: Feed list header "titles" column tooltip.*/ tr("Titles of feeds/categories.") <<
|
m_tooltipData << /*: Feed list header "titles" column tooltip.*/ tr("Titles of feeds/categories.")
|
||||||
/*: Feed list header "counts" column tooltip.*/ tr("Counts of unread/all mesages.");
|
<< /*: Feed list header "counts" column tooltip.*/ tr("Counts of unread/all mesages.");
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedsModel::~FeedsModel() {
|
FeedsModel::~FeedsModel() {
|
||||||
@ -64,7 +66,7 @@ QMimeData* FeedsModel::mimeData(const QModelIndexList& indexes) const {
|
|||||||
QByteArray encoded_data;
|
QByteArray encoded_data;
|
||||||
QDataStream stream(&encoded_data, QIODevice::WriteOnly);
|
QDataStream stream(&encoded_data, QIODevice::WriteOnly);
|
||||||
|
|
||||||
foreach (const QModelIndex& index, indexes) {
|
foreach (const QModelIndex &index, indexes) {
|
||||||
if (index.column() != 0) {
|
if (index.column() != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -72,7 +74,7 @@ QMimeData* FeedsModel::mimeData(const QModelIndexList& indexes) const {
|
|||||||
RootItem* item_for_index = itemForIndex(index);
|
RootItem* item_for_index = itemForIndex(index);
|
||||||
|
|
||||||
if (item_for_index->kind() != RootItemKind::Root) {
|
if (item_for_index->kind() != RootItemKind::Root) {
|
||||||
stream << (quintptr) item_for_index;
|
stream << (quintptr)item_for_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +109,7 @@ bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int
|
|||||||
quintptr pointer_to_item;
|
quintptr pointer_to_item;
|
||||||
stream >> pointer_to_item;
|
stream >> pointer_to_item;
|
||||||
// We have item we want to drag, we also determine the target item.
|
// We have item we want to drag, we also determine the target item.
|
||||||
RootItem* dragged_item = (RootItem*) pointer_to_item;
|
RootItem* dragged_item = (RootItem*)pointer_to_item;
|
||||||
RootItem* target_item = itemForIndex(parent);
|
RootItem* target_item = itemForIndex(parent);
|
||||||
ServiceRoot* dragged_item_root = dragged_item->getParentServiceRoot();
|
ServiceRoot* dragged_item_root = dragged_item->getParentServiceRoot();
|
||||||
ServiceRoot* target_item_root = target_item->getParentServiceRoot();
|
ServiceRoot* target_item_root = target_item->getParentServiceRoot();
|
||||||
@ -403,7 +405,7 @@ QModelIndex FeedsModel::indexForItem(const RootItem* item) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FeedsModel::hasAnyFeedNewMessages() const {
|
bool FeedsModel::hasAnyFeedNewMessages() const {
|
||||||
foreach (const Feed* feed, m_rootItem->getSubTreeFeeds()) {
|
foreach (const Feed * feed, m_rootItem->getSubTreeFeeds()) {
|
||||||
if (feed->status() == Feed::NewMessages) {
|
if (feed->status() == Feed::NewMessages) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -446,7 +448,7 @@ void FeedsModel::onItemDataChanged(const QList<RootItem*>& items) {
|
|||||||
else {
|
else {
|
||||||
qDebug("There is request to reload feed model, reloading the %d items individually.", items.size());
|
qDebug("There is request to reload feed model, reloading the %d items individually.", items.size());
|
||||||
|
|
||||||
foreach (RootItem* item, items) {
|
foreach (RootItem * item, items) {
|
||||||
reloadChangedItem(item);
|
reloadChangedItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,7 +480,7 @@ bool FeedsModel::addServiceAccount(ServiceRoot* root, bool freshly_activated) {
|
|||||||
bool FeedsModel::restoreAllBins() {
|
bool FeedsModel::restoreAllBins() {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
foreach (ServiceRoot* root, serviceRoots()) {
|
foreach (ServiceRoot * root, serviceRoots()) {
|
||||||
RecycleBin* bin_of_root = root->recycleBin();
|
RecycleBin* bin_of_root = root->recycleBin();
|
||||||
|
|
||||||
if (bin_of_root != nullptr) {
|
if (bin_of_root != nullptr) {
|
||||||
@ -492,7 +494,7 @@ bool FeedsModel::restoreAllBins() {
|
|||||||
bool FeedsModel::emptyAllBins() {
|
bool FeedsModel::emptyAllBins() {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
foreach (ServiceRoot* root, serviceRoots()) {
|
foreach (ServiceRoot * root, serviceRoots()) {
|
||||||
RecycleBin* bin_of_root = root->recycleBin();
|
RecycleBin* bin_of_root = root->recycleBin();
|
||||||
|
|
||||||
if (bin_of_root != nullptr) {
|
if (bin_of_root != nullptr) {
|
||||||
@ -513,10 +515,16 @@ void FeedsModel::loadActivatedServiceAccounts() {
|
|||||||
addServiceAccount(root, false);
|
addServiceAccount(root, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (serviceRoots().isEmpty()) {
|
||||||
|
QTimer::singleShot(2000, [this]() {
|
||||||
|
addServiceAccount(StandardServiceEntryPoint().createNewRoot(), true);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::stopServiceAccounts() {
|
void FeedsModel::stopServiceAccounts() {
|
||||||
foreach (ServiceRoot* account, serviceRoots()) {
|
foreach (ServiceRoot * account, serviceRoots()) {
|
||||||
account->stop();
|
account->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ StandardServiceRoot::~StandardServiceRoot() {
|
|||||||
void StandardServiceRoot::start(bool freshly_activated) {
|
void StandardServiceRoot::start(bool freshly_activated) {
|
||||||
loadFromDatabase();
|
loadFromDatabase();
|
||||||
|
|
||||||
if (freshly_activated) {
|
if (freshly_activated && getSubTree(RootItemKind::Feed).isEmpty()) {
|
||||||
// In other words, if there are no feeds or categories added.
|
// In other words, if there are no feeds or categories added.
|
||||||
if (MessageBox::show(qApp->mainFormWidget(), QMessageBox::Question, QObject::tr("Load initial set of feeds"),
|
if (MessageBox::show(qApp->mainFormWidget(), QMessageBox::Question, QObject::tr("Load initial set of feeds"),
|
||||||
tr("This new account does not include any feeds. You can now add default set of feeds."),
|
tr("This new account does not include any feeds. You can now add default set of feeds."),
|
||||||
@ -178,7 +178,7 @@ void StandardServiceRoot::loadFromDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StandardServiceRoot::checkArgumentsForFeedAdding() {
|
void StandardServiceRoot::checkArgumentsForFeedAdding() {
|
||||||
foreach (const QString& arg, qApp->arguments().mid(1)) {
|
foreach (const QString &arg, qApp->arguments().mid(1)) {
|
||||||
checkArgumentForFeedAdding(arg);
|
checkArgumentForFeedAdding(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user