Some GUI work.

This commit is contained in:
Martin Rotter 2016-01-04 06:30:53 +01:00
parent 3896fbd370
commit 483e8a4076
10 changed files with 27 additions and 13 deletions

View File

@ -1,6 +1,10 @@
3.0.1
3.0.2
—————
Changed:
▪ Some GUI refinements and fixes.
▪ Added more logging entries.
Fixed:
▪ Fixed problem with importing invalid OPML 2.0 files. (bug #145)

View File

@ -677,7 +677,7 @@ void FeedsModel::reloadWholeLayout() {
emit layoutChanged();
}
bool FeedsModel::addServiceAccount(ServiceRoot *root) {
bool FeedsModel::addServiceAccount(ServiceRoot *root, bool freshly_activated) {
int new_row_index = m_rootItem->childCount();
beginInsertRows(indexForItem(m_rootItem), new_row_index, new_row_index);
@ -692,7 +692,7 @@ bool FeedsModel::addServiceAccount(ServiceRoot *root) {
connect(root, SIGNAL(reloadMessageListRequested(bool)), this, SIGNAL(reloadMessageListRequested(bool)));
connect(root, SIGNAL(itemExpandRequested(QList<RootItem*>,bool)), this, SIGNAL(itemExpandRequested(QList<RootItem*>,bool)));
root->start();
root->start(freshly_activated);
return true;
}
@ -731,7 +731,7 @@ void FeedsModel::loadActivatedServiceAccounts() {
QList<ServiceRoot*> roots = entry_point->initializeSubtree();
foreach (ServiceRoot *root, roots) {
addServiceAccount(root);
addServiceAccount(root, false);
}
}

View File

@ -146,7 +146,7 @@ class FeedsModel : public QAbstractItemModel {
void updateFeeds(const QList<Feed*> &feeds);
// Adds given service root account.
bool addServiceAccount(ServiceRoot *root);
bool addServiceAccount(ServiceRoot *root, bool freshly_activated);
// Loads feed/categories from the database.
void loadActivatedServiceAccounts();

View File

@ -56,7 +56,7 @@ void FormAddAccount::addSelectedAccount() {
ServiceRoot *new_root = point->createNewRoot();
if (new_root != NULL) {
m_model->addServiceAccount(new_root);
m_model->addServiceAccount(new_root, true);
}
else {
qCritical("Cannot create new account.");

View File

@ -197,6 +197,14 @@ void FormMain::updateAddItemMenu() {
m_ui->m_menuAddItem->addMenu(root_menu);
}
if (m_ui->m_menuAddItem->isEmpty()) {
QAction *no_action = new QAction(qApp->icons()->fromTheme(QSL("dialog-error")),
tr("No accounts activated"),
m_ui->m_menuAddItem);
no_action->setEnabled(false);
m_ui->m_menuAddItem->addAction(no_action);
}
}
void FormMain::updateRecycleBinMenu() {

View File

@ -78,7 +78,7 @@ class ServiceRoot : public RootItem {
//
// Stop method is called just before application exits OR when
// user explicitly deletes existing service instance.
virtual void start() = 0;
virtual void start(bool freshly_activated) = 0;
virtual void stop() = 0;
// Returns the UNIQUE code of the given service.

View File

@ -61,13 +61,13 @@ StandardServiceRoot::~StandardServiceRoot() {
qDeleteAll(m_feedContextMenu);
}
void StandardServiceRoot::start() {
void StandardServiceRoot::start(bool freshly_activated) {
loadFromDatabase();
if (getSubTree(RootItemKind::Category | RootItemKind::Feed).isEmpty()) {
if (freshly_activated) {
// In other words, if there are no feeds or categories added.
if (MessageBox::show(qApp->mainForm(), QMessageBox::Question, QObject::tr("Load initial set of feeds"),
tr("You started %1 for the first time, now you can load initial set of feeds.").arg(APP_NAME),
tr("This account does not include any feeds. You can now add default set of feeds."),
tr("Do you want to load initial set of feeds?"),
QString(), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
QString target_opml_file = APP_INITIAL_FEEDS_PATH + QDir::separator() + FEED_INITIAL_OPML_PATTERN;

View File

@ -38,7 +38,7 @@ class StandardServiceRoot : public ServiceRoot {
virtual ~StandardServiceRoot();
// Start/stop root.
void start();
void start(bool freshly_activated);
void stop();
QString code();

View File

@ -51,7 +51,9 @@ TtRssServiceRoot::~TtRssServiceRoot() {
delete m_network;
}
void TtRssServiceRoot::start() {
void TtRssServiceRoot::start(bool freshly_activated) {
Q_UNUSED(freshly_activated)
loadFromDatabase();
if (childCount() == 1 && child(0)->kind() == RootItemKind::Bin) {

View File

@ -35,7 +35,7 @@ class TtRssServiceRoot : public ServiceRoot {
explicit TtRssServiceRoot(RootItem *parent = NULL);
virtual ~TtRssServiceRoot();
void start();
void start(bool freshly_activated);
void stop();
QString code();