diff --git a/localization/rssguard_en_US.ts b/localization/rssguard_en_US.ts index 9205f46b4..0f4d54809 100644 --- a/localization/rssguard_en_US.ts +++ b/localization/rssguard_en_US.ts @@ -385,7 +385,7 @@ version by clicking this popup notification. Add one of %n feed(s) - + Add one of %n feedAdd one of %n feeds @@ -512,12 +512,12 @@ Click here to open parent directory. %n minutes remaining - + %n minute remaining%n minutes remaining %n seconds remaining - + %n second remaining%n seconds remaining @@ -542,7 +542,7 @@ Click here to open parent directory. Downloading %n file(s)... - + Downloading %n file...Downloading %n files... @@ -612,7 +612,7 @@ Status: %3 uses global settings (%n minute(s) to next auto-fetch of articles) Describes feed auto-update status. - + uses global settings (%n minute to next auto-fetch of articles)uses global settings (%n minutes to next auto-fetch of articles) @@ -623,7 +623,7 @@ Status: %3 uses specific settings (%n minute(s) to next auto-fetching of new articles) Describes feed auto-update status. - + uses specific settings (%n minute to next auto-fetching of new articles)uses specific settings (%n minutes to next auto-fetching of new articles) @@ -664,7 +664,7 @@ Status: %3 I will auto-download new articles for %n feed(s). - + I will auto-download new articles for %n feed.I will auto-download new articles for %n feeds. @@ -3979,27 +3979,27 @@ Login tokens expiration: %2 %n months ago - + %n month ago%n months ago %n weeks ago - + %n week ago%n weeks ago %n days ago - + %n day ago%n days ago %n hours ago - + %n hour ago%n hours ago %n minutes ago - + %n minute ago%n minutes ago @@ -4415,7 +4415,7 @@ Login tokens expiration: %2 Show more articles (%n remaining) - + Show more articles (%n remaining)Show more articles (%n remaining) @@ -4657,7 +4657,11 @@ Login tokens expiration: %2 + %n other feeds. - + + ++ %n other feed. + ++ %n other feeds. @@ -4887,7 +4891,7 @@ List of supported readers: %n deleted article(s). - + %n deleted article.%n deleted articles. @@ -5072,7 +5076,7 @@ Login tokens expiration: %2 %n unread article(s). Tooltip for "unread" column of feed list. - + %n unread article.%n unread articles. @@ -6704,13 +6708,13 @@ Unread news: %2 %n hour(s) - + %n hour%n hours %n minute(s) - + %n minute%n minutes @@ -6721,7 +6725,7 @@ Unread news: %2 %n second(s) - + %n second%n seconds diff --git a/resources/initial_feeds/feeds-en.opml b/resources/initial_feeds/feeds-en_US.opml similarity index 100% rename from resources/initial_feeds/feeds-en.opml rename to resources/initial_feeds/feeds-en_US.opml diff --git a/resources/rssguard.qrc b/resources/rssguard.qrc index 07c5b2768..132537cdd 100644 --- a/resources/rssguard.qrc +++ b/resources/rssguard.qrc @@ -80,7 +80,7 @@ skins/nudus-light/metadata.xml skins/nudus-light/qt_style.qss - initial_feeds/feeds-en.opml + initial_feeds/feeds-en_US.opml desktop/com.github.rssguard.desktop desktop/com.github.rssguard.desktop.autostart diff --git a/src/librssguard/database/databasequeries.cpp b/src/librssguard/database/databasequeries.cpp index 6770f41ca..92e06b588 100644 --- a/src/librssguard/database/databasequeries.cpp +++ b/src/librssguard/database/databasequeries.cpp @@ -2095,6 +2095,30 @@ bool DatabaseQueries::deleteCategory(const QSqlDatabase& db, int id) { return q.exec(); } +void DatabaseQueries::fixupOrders(const QSqlDatabase& db) { + QSqlQuery res = db.exec(QSL("SELECT COUNT(*) FROM Accounts WHERE ordr = 0 " + "UNION ALL " + "SELECT COUNT(*) FROM Categories WHERE ordr = 0 " + "UNION ALL " + "SELECT COUNT(*) FROM Feeds WHERE ordr = 0;")); + bool should_fixup = false; + + while (res.next() && !(should_fixup = (res.value(0).toInt() > 1))) {} + + if (should_fixup) { + // Some orders are messed up, fix. + qCriticalNN << LOGSEC_DB << "Order of items is messed up, fixing."; + + for (const QString& table : { QSL("Accounts"), QSL("Categories"), QSL("Feeds") }) { + QSqlQuery q = db.exec(QSL("UPDATE %1 SET ordr = id;").arg(table)); + + if (q.lastError().isValid()) { + qFatal("Fixup of messed up order failed: '%s'.", qPrintable(q.lastError().text())); + } + } + } +} + void DatabaseQueries::moveItemUp(RootItem* item, const QSqlDatabase& db) {} void DatabaseQueries::moveItemDown(RootItem* item, const QSqlDatabase& db) {} diff --git a/src/librssguard/database/databasequeries.h b/src/librssguard/database/databasequeries.h index 38aeb3487..a4f9e0841 100644 --- a/src/librssguard/database/databasequeries.h +++ b/src/librssguard/database/databasequeries.h @@ -135,6 +135,7 @@ class DatabaseQueries { int account_id, bool* ok = nullptr); // Item order methods. + static void fixupOrders(const QSqlDatabase& db); static void moveItemUp(RootItem* item, const QSqlDatabase& db); static void moveItemDown(RootItem* item, const QSqlDatabase& db); @@ -337,6 +338,9 @@ Assignment DatabaseQueries::getFeeds(const QSqlDatabase& db, template void DatabaseQueries::loadRootFromDatabase(ServiceRoot* root) { QSqlDatabase database = qApp->database()->driver()->connection(root->metaObject()->className()); + + fixupOrders(database); + Assignment categories = DatabaseQueries::getCategories(database, root->accountId()); Assignment feeds = DatabaseQueries::getFeeds(database, qApp->feedReader()->messageFilters(), root->accountId()); auto labels = DatabaseQueries::getLabelsForAccount(database, root->accountId());