Add std acc when no account is active.

This commit is contained in:
Martin Rotter 2017-09-09 09:21:30 +02:00
parent a01023629c
commit c4fec28e56
5 changed files with 2153 additions and 70 deletions

File diff suppressed because it is too large Load diff

View file

@ -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.

View file

@ -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

View file

@ -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>
@ -49,8 +51,8 @@ FeedsModel::FeedsModel(QObject* parent) : QAbstractItemModel(parent) {
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() {
@ -513,6 +515,12 @@ 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() {

View file

@ -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."),