mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-02 18:36:49 +01:00
Refactoring: string literals, last file done is feedsmodelrecyclebin.cpp.
This commit is contained in:
parent
2204e8b753
commit
8be9c68d14
@ -62,29 +62,29 @@ void FeedsImportExportModel::setRootItem(FeedsModelRootItem *rootItem) {
|
||||
|
||||
bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) {
|
||||
QDomDocument opml_document;
|
||||
QDomProcessingInstruction xml_declaration = opml_document.createProcessingInstruction("xml",
|
||||
"version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"");
|
||||
QDomProcessingInstruction xml_declaration = opml_document.createProcessingInstruction(QSL("xml"),
|
||||
QSL("version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\""));
|
||||
opml_document.appendChild(xml_declaration);
|
||||
|
||||
// Adde OPML 2.0 metadata.
|
||||
opml_document.appendChild(opml_document.createElement("opml"));
|
||||
opml_document.documentElement().setAttribute("version", "2.0");
|
||||
opml_document.appendChild(opml_document.createElement(QSL("opml")));
|
||||
opml_document.documentElement().setAttribute(QSL("version"), QSL("version"));
|
||||
|
||||
QDomElement elem_opml_head = opml_document.createElement("head");
|
||||
QDomElement elem_opml_head = opml_document.createElement(QSL("head"));
|
||||
|
||||
QDomElement elem_opml_title = opml_document.createElement("title");
|
||||
QDomElement elem_opml_title = opml_document.createElement(QSL("title"));
|
||||
QDomText text_opml_title = opml_document.createTextNode(QString(APP_NAME));
|
||||
elem_opml_title.appendChild(text_opml_title);
|
||||
elem_opml_head.appendChild(elem_opml_title);
|
||||
|
||||
QDomElement elem_opml_created = opml_document.createElement("dateCreated");
|
||||
QDomElement elem_opml_created = opml_document.createElement(QSL("dateCreated"));
|
||||
QDomText text_opml_created = opml_document.createTextNode(QLocale::c().toString(QDateTime::currentDateTimeUtc(),
|
||||
"ddd, dd MMM yyyy hh:mm:ss") + " GMT");
|
||||
QSL("ddd, dd MMM yyyy hh:mm:ss")) + QL1S(" GMT"));
|
||||
elem_opml_created.appendChild(text_opml_created);
|
||||
elem_opml_head.appendChild(elem_opml_created);
|
||||
opml_document.documentElement().appendChild(elem_opml_head);
|
||||
|
||||
QDomElement elem_opml_body = opml_document.createElement("body");
|
||||
QDomElement elem_opml_body = opml_document.createElement(QSL("body"));
|
||||
QStack<FeedsModelRootItem*> items_to_process; items_to_process.push(m_rootItem);
|
||||
QStack<QDomElement> elements_to_use; elements_to_use.push(elem_opml_body);
|
||||
|
||||
@ -100,10 +100,10 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) {
|
||||
|
||||
switch (child_item->kind()) {
|
||||
case FeedsModelRootItem::Category: {
|
||||
QDomElement outline_category = opml_document.createElement("outline");
|
||||
outline_category.setAttribute("text", child_item->title());
|
||||
outline_category.setAttribute("description", child_item->description());
|
||||
outline_category.setAttribute("rssguard:icon", QString(qApp->icons()->toByteArray(child_item->icon())));
|
||||
QDomElement outline_category = opml_document.createElement(QSL("outline"));
|
||||
outline_category.setAttribute(QSL("text"), child_item->title());
|
||||
outline_category.setAttribute(QSL("description"), child_item->description());
|
||||
outline_category.setAttribute(QSL("rssguard:icon"), QString(qApp->icons()->toByteArray(child_item->icon())));
|
||||
active_element.appendChild(outline_category);
|
||||
items_to_process.push(child_item);
|
||||
elements_to_use.push(outline_category);
|
||||
@ -113,25 +113,25 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray &result) {
|
||||
case FeedsModelRootItem::Feed: {
|
||||
FeedsModelFeed *child_feed = child_item->toFeed();
|
||||
QDomElement outline_feed = opml_document.createElement("outline");
|
||||
outline_feed.setAttribute("text", child_feed->title());
|
||||
outline_feed.setAttribute("xmlUrl", child_feed->url());
|
||||
outline_feed.setAttribute("description", child_feed->description());
|
||||
outline_feed.setAttribute("encoding", child_feed->encoding());
|
||||
outline_feed.setAttribute("title", child_feed->title());
|
||||
outline_feed.setAttribute("rssguard:icon", QString(qApp->icons()->toByteArray(child_feed->icon())));
|
||||
outline_feed.setAttribute(QSL("text"), child_feed->title());
|
||||
outline_feed.setAttribute(QSL("xmlUrl"), child_feed->url());
|
||||
outline_feed.setAttribute(QSL("description"), child_feed->description());
|
||||
outline_feed.setAttribute(QSL("encoding"), child_feed->encoding());
|
||||
outline_feed.setAttribute(QSL("title"), child_feed->title());
|
||||
outline_feed.setAttribute(QSL("rssguard:icon"), QString(qApp->icons()->toByteArray(child_feed->icon())));
|
||||
|
||||
switch (child_feed->type()) {
|
||||
case FeedsModelFeed::Rss0X:
|
||||
case FeedsModelFeed::Rss2X:
|
||||
outline_feed.setAttribute("version", "RSS");
|
||||
outline_feed.setAttribute(QSL("version"), QSL("RSS"));
|
||||
break;
|
||||
|
||||
case FeedsModelFeed::Rdf:
|
||||
outline_feed.setAttribute("version", "RSS1");
|
||||
outline_feed.setAttribute(QSL("version"), QSL("RSS1"));
|
||||
break;
|
||||
|
||||
case FeedsModelFeed::Atom10:
|
||||
outline_feed.setAttribute("version", "ATOM");
|
||||
outline_feed.setAttribute(QSL("version"), QSL("ATOM"));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -160,15 +160,15 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opml_document.documentElement().isNull() || opml_document.documentElement().tagName() != "opml" ||
|
||||
opml_document.documentElement().elementsByTagName("body").size() != 1) {
|
||||
if (opml_document.documentElement().isNull() || opml_document.documentElement().tagName() != QSL("opml") ||
|
||||
opml_document.documentElement().elementsByTagName(QSL("body")).size() != 1) {
|
||||
// This really is not an OPML file.
|
||||
return false;
|
||||
}
|
||||
|
||||
FeedsModelRootItem *root_item = new FeedsModelRootItem();
|
||||
QStack<FeedsModelRootItem*> model_items; model_items.push(root_item);
|
||||
QStack<QDomElement> elements_to_process; elements_to_process.push(opml_document.documentElement().elementsByTagName("body").at(0).toElement());
|
||||
QStack<QDomElement> elements_to_process; elements_to_process.push(opml_document.documentElement().elementsByTagName(QSL("body")).at(0).toElement());
|
||||
|
||||
while (!elements_to_process.isEmpty()) {
|
||||
FeedsModelRootItem *active_model_item = model_items.pop();
|
||||
@ -182,15 +182,15 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
|
||||
|
||||
// Now analyze if this element is category or feed.
|
||||
// NOTE: All feeds must include xmlUrl attribute and text attribute.
|
||||
if (child_element.attributes().contains("xmlUrl") && child.attributes().contains("text")) {
|
||||
if (child_element.attributes().contains(QSL("xmlUrl")) && child.attributes().contains(QSL("text"))) {
|
||||
// This is FEED.
|
||||
// Add feed and end this iteration.
|
||||
QString feed_title = child_element.attribute("text");
|
||||
QString feed_url = child_element.attribute("xmlUrl");
|
||||
QString feed_encoding = child_element.attribute("encoding", DEFAULT_FEED_ENCODING);
|
||||
QString feed_type = child_element.attribute("version", DEFAULT_FEED_TYPE).toUpper();
|
||||
QString feed_description = child_element.attribute("description");
|
||||
QIcon feed_icon = qApp->icons()->fromByteArray(child_element.attribute("rssguard:icon").toLocal8Bit());
|
||||
QString feed_title = child_element.attribute(QSL("text"));
|
||||
QString feed_url = child_element.attribute(QSL("xmlUrl"));
|
||||
QString feed_encoding = child_element.attribute(QSL("encoding"), DEFAULT_FEED_ENCODING);
|
||||
QString feed_type = child_element.attribute(QSL("version"), DEFAULT_FEED_TYPE).toUpper();
|
||||
QString feed_description = child_element.attribute(QSL("description"));
|
||||
QIcon feed_icon = qApp->icons()->fromByteArray(child_element.attribute(QSL("rssguard:icon")).toLocal8Bit());
|
||||
|
||||
FeedsModelFeed *new_feed = new FeedsModelFeed(active_model_item);
|
||||
new_feed->setTitle(feed_title);
|
||||
@ -198,13 +198,13 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
|
||||
new_feed->setEncoding(feed_encoding);
|
||||
new_feed->setUrl(feed_url);
|
||||
new_feed->setCreationDate(QDateTime::currentDateTime());
|
||||
new_feed->setIcon(feed_icon.isNull() ? qApp->icons()->fromTheme("folder-feed") : feed_icon);
|
||||
new_feed->setIcon(feed_icon.isNull() ? qApp->icons()->fromTheme(QSL("folder-feed")) : feed_icon);
|
||||
new_feed->setAutoUpdateType(FeedsModelFeed::DefaultAutoUpdate);
|
||||
|
||||
if (feed_type == "RSS1") {
|
||||
if (feed_type == QL1S("RSS1")) {
|
||||
new_feed->setType(FeedsModelFeed::Rdf);
|
||||
}
|
||||
else if (feed_type == "ATOM") {
|
||||
else if (feed_type == QL1S("ATOM")) {
|
||||
new_feed->setType(FeedsModelFeed::Atom10);
|
||||
}
|
||||
else {
|
||||
@ -216,14 +216,14 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
|
||||
else {
|
||||
// This must be CATEGORY.
|
||||
// Add category and continue.
|
||||
QString category_title = child_element.attribute("text");
|
||||
QString category_description = child_element.attribute("description");
|
||||
QIcon category_icon = qApp->icons()->fromByteArray(child_element.attribute("rssguard:icon").toLocal8Bit());
|
||||
QString category_title = child_element.attribute(QSL("text"));
|
||||
QString category_description = child_element.attribute(QSL("description"));
|
||||
QIcon category_icon = qApp->icons()->fromByteArray(child_element.attribute(QSL("rssguard:icon")).toLocal8Bit());
|
||||
|
||||
if (category_title.isEmpty()) {
|
||||
qWarning("Given OMPL file provided category without valid text attribute. Using fallback name.");
|
||||
|
||||
category_title = child_element.attribute("title");
|
||||
category_title = child_element.attribute(QSL("title"));
|
||||
|
||||
if (category_title.isEmpty()) {
|
||||
category_title = tr("Category ") + QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||
@ -232,7 +232,7 @@ bool FeedsImportExportModel::importAsOPML20(const QByteArray &data) {
|
||||
|
||||
FeedsModelCategory *new_category = new FeedsModelCategory(active_model_item);
|
||||
new_category->setTitle(category_title);
|
||||
new_category->setIcon(category_icon.isNull() ? qApp->icons()->fromTheme("folder-category") : category_icon);
|
||||
new_category->setIcon(category_icon.isNull() ? qApp->icons()->fromTheme(QSL("folder-category")) : category_icon);
|
||||
new_category->setCreationDate(QDateTime::currentDateTime());
|
||||
new_category->setDescription(category_description);
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
FeedsModel::FeedsModel(QObject *parent)
|
||||
: QAbstractItemModel(parent), m_recycleBin(new FeedsModelRecycleBin()) {
|
||||
setObjectName("FeedsModel");
|
||||
setObjectName(QSL("FeedsModel"));
|
||||
|
||||
// Create root item.
|
||||
m_rootItem = new FeedsModelRootItem();
|
||||
@ -47,10 +47,10 @@ FeedsModel::FeedsModel(QObject *parent)
|
||||
|
||||
//: Name of root item of feed list which can be seen in feed add/edit dialog.
|
||||
m_rootItem->setTitle(tr("Root"));
|
||||
m_rootItem->setIcon(qApp->icons()->fromTheme("folder-root"));
|
||||
m_rootItem->setIcon(qApp->icons()->fromTheme(QSL("folder-root")));
|
||||
|
||||
// Setup icons.
|
||||
m_countsIcon = qApp->icons()->fromTheme("mail-mark-unread");
|
||||
m_countsIcon = qApp->icons()->fromTheme(QSL("mail-mark-unread"));
|
||||
|
||||
//: Title text in the feed list header.
|
||||
m_headerData << tr("Title");
|
||||
@ -283,14 +283,14 @@ bool FeedsModel::addCategory(FeedsModelCategory *category, FeedsModelRootItem *p
|
||||
QSqlQuery query_add(database);
|
||||
|
||||
query_add.setForwardOnly(true);
|
||||
query_add.prepare("INSERT INTO Categories "
|
||||
query_add.prepare(QSL("INSERT INTO Categories "
|
||||
"(parent_id, title, description, date_created, icon) "
|
||||
"VALUES (:parent_id, :title, :description, :date_created, :icon);");
|
||||
query_add.bindValue(":parent_id", parent->id());
|
||||
query_add.bindValue(":title", category->title());
|
||||
query_add.bindValue(":description", category->description());
|
||||
query_add.bindValue(":date_created", category->creationDate().toMSecsSinceEpoch());
|
||||
query_add.bindValue(":icon", qApp->icons()->toByteArray(category->icon()));
|
||||
"VALUES (:parent_id, :title, :description, :date_created, :icon);"));
|
||||
query_add.bindValue(QSL(":parent_id"), parent->id());
|
||||
query_add.bindValue(QSL(":title"), category->title());
|
||||
query_add.bindValue(QSL(":description"), category->description());
|
||||
query_add.bindValue(QSL(":date_created"), category->creationDate().toMSecsSinceEpoch());
|
||||
query_add.bindValue(QSL(":icon"), qApp->icons()->toByteArray(category->icon()));
|
||||
|
||||
if (!query_add.exec()) {
|
||||
qDebug("Failed to add category to database: %s.", qPrintable(query_add.lastError().text()));
|
||||
@ -299,8 +299,8 @@ bool FeedsModel::addCategory(FeedsModelCategory *category, FeedsModelRootItem *p
|
||||
return false;
|
||||
}
|
||||
|
||||
query_add.prepare("SELECT id FROM Categories WHERE title = :title;");
|
||||
query_add.bindValue(":title", category->title());
|
||||
query_add.prepare(QSL("SELECT id FROM Categories WHERE title = :title;"));
|
||||
query_add.bindValue(QSL(":title"), category->title());
|
||||
if (query_add.exec() && query_add.next()) {
|
||||
// New category was added, fetch is primary id
|
||||
// from the database.
|
||||
@ -327,14 +327,14 @@ bool FeedsModel::editCategory(FeedsModelCategory *original_category, FeedsModelC
|
||||
FeedsModelRootItem *new_parent = new_category->parent();
|
||||
|
||||
query_update_category.setForwardOnly(true);
|
||||
query_update_category.prepare("UPDATE Categories "
|
||||
query_update_category.prepare(QSL("UPDATE Categories "
|
||||
"SET title = :title, description = :description, icon = :icon, parent_id = :parent_id "
|
||||
"WHERE id = :id;");
|
||||
query_update_category.bindValue(":title", new_category->title());
|
||||
query_update_category.bindValue(":description", new_category->description());
|
||||
query_update_category.bindValue(":icon", qApp->icons()->toByteArray(new_category->icon()));
|
||||
query_update_category.bindValue(":parent_id", new_parent->id());
|
||||
query_update_category.bindValue(":id", original_category->id());
|
||||
"WHERE id = :id;"));
|
||||
query_update_category.bindValue(QSL(":title"), new_category->title());
|
||||
query_update_category.bindValue(QSL(":description"), new_category->description());
|
||||
query_update_category.bindValue(QSL(":icon"), qApp->icons()->toByteArray(new_category->icon()));
|
||||
query_update_category.bindValue(QSL(":parent_id"), new_parent->id());
|
||||
query_update_category.bindValue(QSL(":id"), original_category->id());
|
||||
|
||||
if (!query_update_category.exec()) {
|
||||
// Persistent storage update failed, no way to continue now.
|
||||
@ -379,22 +379,22 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed, FeedsModelRootItem *parent) {
|
||||
QSqlQuery query_add_feed(database);
|
||||
|
||||
query_add_feed.setForwardOnly(true);
|
||||
query_add_feed.prepare("INSERT INTO Feeds "
|
||||
query_add_feed.prepare(QSL("INSERT INTO Feeds "
|
||||
"(title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type) "
|
||||
"VALUES (:title, :description, :date_created, :icon, :category, :encoding, :url, :protected, :username, :password, :update_type, :update_interval, :type);");
|
||||
query_add_feed.bindValue(":title", feed->title());
|
||||
query_add_feed.bindValue(":description", feed->description());
|
||||
query_add_feed.bindValue(":date_created", feed->creationDate().toMSecsSinceEpoch());
|
||||
query_add_feed.bindValue(":icon", qApp->icons()->toByteArray(feed->icon()));
|
||||
query_add_feed.bindValue(":category", parent->id());
|
||||
query_add_feed.bindValue(":encoding", feed->encoding());
|
||||
query_add_feed.bindValue(":url", feed->url());
|
||||
query_add_feed.bindValue(":protected", (int) feed->passwordProtected());
|
||||
query_add_feed.bindValue(":username", feed->username());
|
||||
query_add_feed.bindValue(":password", feed->password());
|
||||
query_add_feed.bindValue(":update_type", (int) feed->autoUpdateType());
|
||||
query_add_feed.bindValue(":update_interval", feed->autoUpdateInitialInterval());
|
||||
query_add_feed.bindValue(":type", (int) feed->type());
|
||||
"VALUES (:title, :description, :date_created, :icon, :category, :encoding, :url, :protected, :username, :password, :update_type, :update_interval, :type);"));
|
||||
query_add_feed.bindValue(QSL(":title"), feed->title());
|
||||
query_add_feed.bindValue(QSL(":description"), feed->description());
|
||||
query_add_feed.bindValue(QSL(":date_created"), feed->creationDate().toMSecsSinceEpoch());
|
||||
query_add_feed.bindValue(QSL(":icon"), qApp->icons()->toByteArray(feed->icon()));
|
||||
query_add_feed.bindValue(QSL(":category"), parent->id());
|
||||
query_add_feed.bindValue(QSL(":encoding"), feed->encoding());
|
||||
query_add_feed.bindValue(QSL(":url"), feed->url());
|
||||
query_add_feed.bindValue(QSL(":protected"), (int) feed->passwordProtected());
|
||||
query_add_feed.bindValue(QSL(":username"), feed->username());
|
||||
query_add_feed.bindValue(QSL(":password"), feed->password());
|
||||
query_add_feed.bindValue(QSL(":update_type"), (int) feed->autoUpdateType());
|
||||
query_add_feed.bindValue(QSL(":update_interval"), feed->autoUpdateInitialInterval());
|
||||
query_add_feed.bindValue(QSL(":type"), (int) feed->type());
|
||||
|
||||
if (!query_add_feed.exec()) {
|
||||
qDebug("Failed to add feed to database: %s.", qPrintable(query_add_feed.lastError().text()));
|
||||
@ -403,8 +403,8 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed, FeedsModelRootItem *parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
query_add_feed.prepare("SELECT id FROM Feeds WHERE url = :url;");
|
||||
query_add_feed.bindValue(":url", feed->url());
|
||||
query_add_feed.prepare(QSL("SELECT id FROM Feeds WHERE url = :url;"));
|
||||
query_add_feed.bindValue(QSL(":url"), feed->url());
|
||||
if (query_add_feed.exec() && query_add_feed.next()) {
|
||||
// New feed was added, fetch is primary id from the database.
|
||||
feed->setId(query_add_feed.value(0).toInt());
|
||||
@ -429,22 +429,22 @@ bool FeedsModel::editFeed(FeedsModelFeed *original_feed, FeedsModelFeed *new_fee
|
||||
FeedsModelRootItem *new_parent = new_feed->parent();
|
||||
|
||||
query_update_feed.setForwardOnly(true);
|
||||
query_update_feed.prepare("UPDATE Feeds "
|
||||
query_update_feed.prepare(QSL("UPDATE Feeds "
|
||||
"SET title = :title, description = :description, icon = :icon, category = :category, encoding = :encoding, url = :url, protected = :protected, username = :username, password = :password, update_type = :update_type, update_interval = :update_interval, type = :type "
|
||||
"WHERE id = :id;");
|
||||
query_update_feed.bindValue(":title", new_feed->title());
|
||||
query_update_feed.bindValue(":description", new_feed->description());
|
||||
query_update_feed.bindValue(":icon", qApp->icons()->toByteArray(new_feed->icon()));
|
||||
query_update_feed.bindValue(":category", new_parent->id());
|
||||
query_update_feed.bindValue(":encoding", new_feed->encoding());
|
||||
query_update_feed.bindValue(":url", new_feed->url());
|
||||
query_update_feed.bindValue(":protected", (int) new_feed->passwordProtected());
|
||||
query_update_feed.bindValue(":username", new_feed->username());
|
||||
query_update_feed.bindValue(":password", new_feed->password());
|
||||
query_update_feed.bindValue(":update_type", (int) new_feed->autoUpdateType());
|
||||
query_update_feed.bindValue(":update_interval", new_feed->autoUpdateInitialInterval());
|
||||
query_update_feed.bindValue(":type", new_feed->type());
|
||||
query_update_feed.bindValue(":id", original_feed->id());
|
||||
"WHERE id = :id;"));
|
||||
query_update_feed.bindValue(QSL(":title"), new_feed->title());
|
||||
query_update_feed.bindValue(QSL(":description"), new_feed->description());
|
||||
query_update_feed.bindValue(QSL(":icon"), qApp->icons()->toByteArray(new_feed->icon()));
|
||||
query_update_feed.bindValue(QSL(":category"), new_parent->id());
|
||||
query_update_feed.bindValue(QSL(":encoding"), new_feed->encoding());
|
||||
query_update_feed.bindValue(QSL(":url"), new_feed->url());
|
||||
query_update_feed.bindValue(QSL(":protected"), (int) new_feed->passwordProtected());
|
||||
query_update_feed.bindValue(QSL(":username"), new_feed->username());
|
||||
query_update_feed.bindValue(QSL(":password"), new_feed->password());
|
||||
query_update_feed.bindValue(QSL(":update_type"), (int) new_feed->autoUpdateType());
|
||||
query_update_feed.bindValue(QSL(":update_interval"), new_feed->autoUpdateInitialInterval());
|
||||
query_update_feed.bindValue(QSL(":type"), new_feed->type());
|
||||
query_update_feed.bindValue(QSL(":id"), original_feed->id());
|
||||
|
||||
if (!query_update_feed.exec()) {
|
||||
// Persistent storage update failed, no way to continue now.
|
||||
@ -535,12 +535,12 @@ QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed*> &feeds)
|
||||
DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_read_msg(database);
|
||||
query_read_msg.setForwardOnly(true);
|
||||
query_read_msg.prepare("SELECT title, url, author, date_created, contents "
|
||||
query_read_msg.prepare(QSL("SELECT title, url, author, date_created, contents "
|
||||
"FROM Messages "
|
||||
"WHERE is_deleted = 0 AND feed = :feed;");
|
||||
"WHERE is_deleted = 0 AND feed = :feed;"));
|
||||
|
||||
foreach (FeedsModelFeed *feed, feeds) {
|
||||
query_read_msg.bindValue(":feed", feed->id());
|
||||
query_read_msg.bindValue(QSL(":feed"), feed->id());
|
||||
|
||||
if (query_read_msg.exec()) {
|
||||
while (query_read_msg.next()) {
|
||||
@ -749,7 +749,7 @@ void FeedsModel::loadFromDatabase() {
|
||||
QSqlQuery query_categories(database);
|
||||
query_categories.setForwardOnly(true);
|
||||
|
||||
if (!query_categories.exec("SELECT * FROM Categories;") || query_categories.lastError().isValid()) {
|
||||
if (!query_categories.exec(QSL("SELECT * FROM Categories;")) || query_categories.lastError().isValid()) {
|
||||
qFatal("Query for obtaining categories failed. Error message: '%s'.",
|
||||
qPrintable(query_categories.lastError().text()));
|
||||
}
|
||||
@ -766,7 +766,7 @@ void FeedsModel::loadFromDatabase() {
|
||||
QSqlQuery query_feeds(database);
|
||||
query_feeds.setForwardOnly(true);
|
||||
|
||||
if (!query_feeds.exec("SELECT * FROM Feeds;") || query_feeds.lastError().isValid()) {
|
||||
if (!query_feeds.exec(QSL("SELECT * FROM Feeds;")) || query_feeds.lastError().isValid()) {
|
||||
qFatal("Query for obtaining feeds failed. Error message: '%s'.",
|
||||
qPrintable(query_feeds.lastError().text()));
|
||||
}
|
||||
@ -849,15 +849,15 @@ bool FeedsModel::markFeedsRead(const QList<FeedsModelFeed*> &feeds, int read) {
|
||||
QSqlQuery query_read_msg(db_handle);
|
||||
query_read_msg.setForwardOnly(true);
|
||||
|
||||
if (!query_read_msg.prepare(QString("UPDATE Messages SET is_read = :read "
|
||||
"WHERE feed IN (%1) AND is_deleted = 0;").arg(textualFeedIds(feeds).join(", ")))) {
|
||||
if (!query_read_msg.prepare(QString(QSL("UPDATE Messages SET is_read = :read "
|
||||
"WHERE feed IN (%1) AND is_deleted = 0;")).arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
||||
qWarning("Query preparation failed for feeds read change.");
|
||||
|
||||
db_handle.rollback();
|
||||
return false;
|
||||
}
|
||||
|
||||
query_read_msg.bindValue(":read", read);
|
||||
query_read_msg.bindValue(QSL(":read"), read);
|
||||
|
||||
if (!query_read_msg.exec()) {
|
||||
qDebug("Query execution for feeds read change failed.");
|
||||
@ -885,8 +885,8 @@ bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int delet
|
||||
query_delete_msg.setForwardOnly(true);
|
||||
|
||||
if (read_only) {
|
||||
if (!query_delete_msg.prepare(QString("UPDATE Messages SET is_deleted = :deleted "
|
||||
"WHERE feed IN (%1) AND is_deleted = 0 AND is_read = 1;").arg(textualFeedIds(feeds).join(", ")))) {
|
||||
if (!query_delete_msg.prepare(QString(QSL("UPDATE Messages SET is_deleted = :deleted "
|
||||
"WHERE feed IN (%1) AND is_deleted = 0 AND is_read = 1;")).arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
||||
qWarning("Query preparation failed for feeds clearing.");
|
||||
|
||||
db_handle.rollback();
|
||||
@ -894,8 +894,8 @@ bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int delet
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!query_delete_msg.prepare(QString("UPDATE Messages SET is_deleted = :deleted "
|
||||
"WHERE feed IN (%1) AND is_deleted = 0;").arg(textualFeedIds(feeds).join(", ")))) {
|
||||
if (!query_delete_msg.prepare(QString(QSL("UPDATE Messages SET is_deleted = :deleted "
|
||||
"WHERE feed IN (%1) AND is_deleted = 0;")).arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
||||
qWarning("Query preparation failed for feeds clearing.");
|
||||
|
||||
db_handle.rollback();
|
||||
@ -903,7 +903,7 @@ bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int delet
|
||||
}
|
||||
}
|
||||
|
||||
query_delete_msg.bindValue(":deleted", deleted);
|
||||
query_delete_msg.bindValue(QSL(":deleted"), deleted);
|
||||
|
||||
if (!query_delete_msg.exec()) {
|
||||
qDebug("Query execution for feeds clearing failed.");
|
||||
|
@ -133,14 +133,14 @@ bool FeedsModelCategory::removeItself() {
|
||||
}
|
||||
|
||||
// Children are removed, remove this standard category too.
|
||||
QSqlDatabase database = qApp->database()->connection("FeedsModelCategory", DatabaseFactory::FromSettings);
|
||||
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelCategory"), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_remove(database);
|
||||
|
||||
query_remove.setForwardOnly(true);
|
||||
|
||||
// Remove all messages from this standard feed.
|
||||
query_remove.prepare("DELETE FROM Categories WHERE id = :category;");
|
||||
query_remove.bindValue(":category", id());
|
||||
query_remove.prepare(QSL("DELETE FROM Categories WHERE id = :category;"));
|
||||
query_remove.bindValue(QSL(":category"), id());
|
||||
|
||||
return query_remove.exec();
|
||||
}
|
||||
|
@ -103,22 +103,22 @@ int FeedsModelFeed::countOfUnreadMessages() const {
|
||||
QString FeedsModelFeed::typeToString(FeedsModelFeed::Type type) {
|
||||
switch (type) {
|
||||
case Atom10:
|
||||
return "ATOM 1.0";
|
||||
return QSL("ATOM 1.0");
|
||||
|
||||
case Rdf:
|
||||
return "RDF (RSS 1.0)";
|
||||
return QSL("RDF (RSS 1.0)");
|
||||
|
||||
case Rss0X:
|
||||
return "RSS 0.91/0.92/0.93";
|
||||
return QSL("RSS 0.91/0.92/0.93");
|
||||
|
||||
case Rss2X:
|
||||
default:
|
||||
return "RSS 2.0/2.0.1";
|
||||
return QSL("RSS 2.0/2.0.1");
|
||||
}
|
||||
}
|
||||
|
||||
void FeedsModelFeed::updateCounts(bool including_total_count, bool update_feed_statuses) {
|
||||
QSqlDatabase database = qApp->database()->connection("FeedsModelFeed", DatabaseFactory::FromSettings);
|
||||
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_all(database);
|
||||
|
||||
query_all.setForwardOnly(true);
|
||||
@ -161,13 +161,13 @@ QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(co
|
||||
// its encoding before we can read further data.
|
||||
QString xml_schema_encoding;
|
||||
QString xml_contents_encoded;
|
||||
QRegExp encoding_rexp("encoding=\"[^\"]\\S+\"");
|
||||
QRegExp encoding_rexp(QSL("encoding=\"[^\"]\\S+\""));
|
||||
|
||||
if (encoding_rexp.indexIn(feed_contents) != -1 &&
|
||||
!(xml_schema_encoding = encoding_rexp.cap(0)).isEmpty()) {
|
||||
// Some "encoding" attribute was found get the encoding
|
||||
// out of it.
|
||||
encoding_rexp.setPattern("[^\"]\\S+[^\"]");
|
||||
encoding_rexp.setPattern(QSL("[^\"]\\S+[^\"]"));
|
||||
encoding_rexp.indexIn(xml_schema_encoding, 9);
|
||||
xml_schema_encoding = encoding_rexp.cap(0);
|
||||
}
|
||||
@ -217,49 +217,49 @@ QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(co
|
||||
|
||||
icon_possible_locations.append(url);
|
||||
|
||||
if (root_tag_name == "rdf:RDF") {
|
||||
if (root_tag_name == QL1S("rdf:RDF")) {
|
||||
// We found RDF feed.
|
||||
QDomElement channel_element = root_element.namedItem("channel").toElement();
|
||||
QDomElement channel_element = root_element.namedItem(QSL("channel")).toElement();
|
||||
|
||||
result.first->setType(Rdf);
|
||||
result.first->setTitle(channel_element.namedItem("title").toElement().text());
|
||||
result.first->setDescription(channel_element.namedItem("description").toElement().text());
|
||||
result.first->setTitle(channel_element.namedItem(QSL("title")).toElement().text());
|
||||
result.first->setDescription(channel_element.namedItem(QSL("description")).toElement().text());
|
||||
|
||||
QString source_link = channel_element.namedItem("link").toElement().text();
|
||||
QString source_link = channel_element.namedItem(QSL("link")).toElement().text();
|
||||
|
||||
if (!source_link.isEmpty()) {
|
||||
icon_possible_locations.prepend(source_link);
|
||||
}
|
||||
}
|
||||
else if (root_tag_name == "rss") {
|
||||
else if (root_tag_name == QL1S("rss")) {
|
||||
// We found RSS 0.91/0.92/0.93/2.0/2.0.1 feed.
|
||||
QString rss_type = root_element.attribute("version", "2.0");
|
||||
|
||||
if (rss_type == "0.91" || rss_type == "0.92" || rss_type == "0.93") {
|
||||
if (rss_type == QL1S("0.91") || rss_type == QL1S("0.92") || rss_type == QL1S("0.93")) {
|
||||
result.first->setType(Rss0X);
|
||||
}
|
||||
else {
|
||||
result.first->setType(Rss2X);
|
||||
}
|
||||
|
||||
QDomElement channel_element = root_element.namedItem("channel").toElement();
|
||||
QDomElement channel_element = root_element.namedItem(QSL("channel")).toElement();
|
||||
|
||||
result.first->setTitle(channel_element.namedItem("title").toElement().text());
|
||||
result.first->setDescription(channel_element.namedItem("description").toElement().text());
|
||||
result.first->setTitle(channel_element.namedItem(QSL("title")).toElement().text());
|
||||
result.first->setDescription(channel_element.namedItem(QSL("description")).toElement().text());
|
||||
|
||||
QString source_link = channel_element.namedItem("link").toElement().text();
|
||||
QString source_link = channel_element.namedItem(QSL("link")).toElement().text();
|
||||
|
||||
if (!source_link.isEmpty()) {
|
||||
icon_possible_locations.prepend(source_link);
|
||||
}
|
||||
}
|
||||
else if (root_tag_name == "feed") {
|
||||
else if (root_tag_name == QL1S("feed")) {
|
||||
// We found ATOM feed.
|
||||
result.first->setType(Atom10);
|
||||
result.first->setTitle(root_element.namedItem("title").toElement().text());
|
||||
result.first->setDescription(root_element.namedItem("subtitle").toElement().text());
|
||||
result.first->setTitle(root_element.namedItem(QSL("title")).toElement().text());
|
||||
result.first->setDescription(root_element.namedItem(QSL("subtitle")).toElement().text());
|
||||
|
||||
QString source_link = root_element.namedItem("link").toElement().text();
|
||||
QString source_link = root_element.namedItem(QSL("link")).toElement().text();
|
||||
|
||||
if (!source_link.isEmpty()) {
|
||||
icon_possible_locations.prepend(source_link);
|
||||
@ -445,29 +445,29 @@ void FeedsModelFeed::update() {
|
||||
}
|
||||
|
||||
bool FeedsModelFeed::removeItself() {
|
||||
QSqlDatabase database = qApp->database()->connection("FeedsModelFeed", DatabaseFactory::FromSettings);
|
||||
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_remove(database);
|
||||
|
||||
query_remove.setForwardOnly(true);
|
||||
|
||||
// Remove all messages from this standard feed.
|
||||
query_remove.prepare("DELETE FROM Messages WHERE feed = :feed;");
|
||||
query_remove.bindValue(":feed", id());
|
||||
query_remove.prepare(QSL("DELETE FROM Messages WHERE feed = :feed;"));
|
||||
query_remove.bindValue(QSL(":feed"), id());
|
||||
|
||||
if (!query_remove.exec()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove feed itself.
|
||||
query_remove.prepare("DELETE FROM Feeds WHERE id = :feed;");
|
||||
query_remove.bindValue(":feed", id());
|
||||
query_remove.prepare(QSL("DELETE FROM Feeds WHERE id = :feed;"));
|
||||
query_remove.bindValue(QSL(":feed"), id());
|
||||
|
||||
return query_remove.exec();
|
||||
}
|
||||
|
||||
void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||
int feed_id = id();
|
||||
QSqlDatabase database = qApp->database()->connection("FeedsModelFeed", DatabaseFactory::FromSettings);
|
||||
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelFeed"), DatabaseFactory::FromSettings);
|
||||
bool remove_duplicates = qApp->settings()->value(GROUP(Messages), SETTING(Messages::RemoveDuplicates)).toBool();
|
||||
|
||||
// Prepare queries.
|
||||
@ -478,18 +478,18 @@ void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||
// Used to check if given feed contains any message with given title, url and date_created.
|
||||
// WARNING: One feed CANNOT contain two (or more) messages with same AUTHOR AND TITLE AND URL AND DATE_CREATED.
|
||||
query_select.setForwardOnly(true);
|
||||
query_select.prepare("SELECT id, feed, date_created FROM Messages "
|
||||
"WHERE feed = :feed AND title = :title AND url = :url AND author = :author;");
|
||||
query_select.prepare(QSL("SELECT id, feed, date_created FROM Messages "
|
||||
"WHERE feed = :feed AND title = :title AND url = :url AND author = :author;"));
|
||||
|
||||
// Used to insert new messages.
|
||||
query_insert.setForwardOnly(true);
|
||||
query_insert.prepare("INSERT INTO Messages "
|
||||
query_insert.prepare(QSL("INSERT INTO Messages "
|
||||
"(feed, title, url, author, date_created, contents, enclosures) "
|
||||
"VALUES (:feed, :title, :url, :author, :date_created, :contents, :enclosures);");
|
||||
"VALUES (:feed, :title, :url, :author, :date_created, :contents, :enclosures);"));
|
||||
|
||||
if (remove_duplicates) {
|
||||
query_update.setForwardOnly(true);
|
||||
query_update.prepare("UPDATE Messages SET contents = :contents enclosures = :enclosures WHERE id = :id;");
|
||||
query_update.prepare(QSL("UPDATE Messages SET contents = :contents enclosures = :enclosures WHERE id = :id;"));
|
||||
}
|
||||
|
||||
if (!database.transaction()) {
|
||||
@ -500,9 +500,9 @@ void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||
|
||||
foreach (Message message, messages) {
|
||||
// Check if messages contain relative URLs and if they do, then replace them.
|
||||
if (message.m_url.startsWith('/')) {
|
||||
if (message.m_url.startsWith(QL1S("/"))) {
|
||||
QString new_message_url = url();
|
||||
int last_slash = new_message_url.lastIndexOf('/');
|
||||
int last_slash = new_message_url.lastIndexOf(QL1S("/"));
|
||||
|
||||
if (last_slash >= 0) {
|
||||
new_message_url = new_message_url.left(last_slash);
|
||||
@ -512,10 +512,10 @@ void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||
message.m_url = new_message_url;
|
||||
}
|
||||
|
||||
query_select.bindValue(":feed", feed_id);
|
||||
query_select.bindValue(":title", message.m_title);
|
||||
query_select.bindValue(":url", message.m_url);
|
||||
query_select.bindValue(":author", message.m_author);
|
||||
query_select.bindValue(QSL(":feed"), feed_id);
|
||||
query_select.bindValue(QSL(":title"), message.m_title);
|
||||
query_select.bindValue(QSL(":url"), message.m_url);
|
||||
query_select.bindValue(QSL(":author"), message.m_author);
|
||||
query_select.exec();
|
||||
|
||||
QList<qint64> datetime_stamps;
|
||||
@ -530,13 +530,13 @@ void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||
|
||||
if (datetime_stamps.isEmpty()) {
|
||||
// Message is not fetched in this feed yet.
|
||||
query_insert.bindValue(":feed", feed_id);
|
||||
query_insert.bindValue(":title", message.m_title);
|
||||
query_insert.bindValue(":url", message.m_url);
|
||||
query_insert.bindValue(":author", message.m_author);
|
||||
query_insert.bindValue(":date_created", message.m_created.toMSecsSinceEpoch());
|
||||
query_insert.bindValue(":contents", message.m_contents);
|
||||
query_insert.bindValue(":enclosures", Enclosures::encodeEnclosuresToString(message.m_enclosures));
|
||||
query_insert.bindValue(QSL(":feed"), feed_id);
|
||||
query_insert.bindValue(QSL(":title"), message.m_title);
|
||||
query_insert.bindValue(QSL(":url"), message.m_url);
|
||||
query_insert.bindValue(QSL(":author"), message.m_author);
|
||||
query_insert.bindValue(QSL(":date_created"), message.m_created.toMSecsSinceEpoch());
|
||||
query_insert.bindValue(QSL(":contents"), message.m_contents);
|
||||
query_insert.bindValue(QSL(":enclosures"), Enclosures::encodeEnclosuresToString(message.m_enclosures));
|
||||
|
||||
if (query_insert.exec() && query_insert.numRowsAffected() == 1) {
|
||||
setStatus(NewMessages);
|
||||
@ -550,9 +550,9 @@ void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||
if (remove_duplicates && datetime_stamps.size() == 1) {
|
||||
// Message is already in feed and new message has new unique time but user wishes to update existing
|
||||
// messages and there is exactly ONE existing duplicate.
|
||||
query_update.bindValue(":id", ids.at(0));
|
||||
query_update.bindValue(":contents", message.m_contents);
|
||||
query_update.bindValue(":enclosures", Enclosures::encodeEnclosuresToString(message.m_enclosures));
|
||||
query_update.bindValue(QSL(":id"), ids.at(0));
|
||||
query_update.bindValue(QSL(":contents"), message.m_contents);
|
||||
query_update.bindValue(QSL(":enclosures"), Enclosures::encodeEnclosuresToString(message.m_enclosures));
|
||||
query_update.exec();
|
||||
query_update.finish();
|
||||
|
||||
@ -561,13 +561,13 @@ void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
||||
else {
|
||||
// Message with same title, author and url exists, but new message has new unique time and
|
||||
// user does not wish to update duplicates.
|
||||
query_insert.bindValue(":feed", feed_id);
|
||||
query_insert.bindValue(":title", message.m_title);
|
||||
query_insert.bindValue(":url", message.m_url);
|
||||
query_insert.bindValue(":author", message.m_author);
|
||||
query_insert.bindValue(":date_created", message.m_created.toMSecsSinceEpoch());
|
||||
query_insert.bindValue(":contents", message.m_contents);
|
||||
query_insert.bindValue(":enclosures", Enclosures::encodeEnclosuresToString(message.m_enclosures));
|
||||
query_insert.bindValue(QSL(":feed"), feed_id);
|
||||
query_insert.bindValue(QSL(":title"), message.m_title);
|
||||
query_insert.bindValue(QSL(":url"), message.m_url);
|
||||
query_insert.bindValue(QSL(":author"), message.m_author);
|
||||
query_insert.bindValue(QSL(":date_created"), message.m_created.toMSecsSinceEpoch());
|
||||
query_insert.bindValue(QSL(":contents"), message.m_contents);
|
||||
query_insert.bindValue(QSL(":enclosures"), Enclosures::encodeEnclosuresToString(message.m_enclosures));
|
||||
|
||||
if (query_insert.exec() && query_insert.numRowsAffected() == 1) {
|
||||
setStatus(NewMessages);
|
||||
|
@ -26,7 +26,7 @@
|
||||
FeedsModelRecycleBin::FeedsModelRecycleBin(FeedsModelRootItem *parent)
|
||||
: FeedsModelRootItem(parent) {
|
||||
m_kind = FeedsModelRootItem::RecycleBin;
|
||||
m_icon = qApp->icons()->fromTheme("folder-recycle-bin");
|
||||
m_icon = qApp->icons()->fromTheme(QSL("folder-recycle-bin"));
|
||||
m_id = ID_RECYCLE_BIN;
|
||||
m_title = tr("Recycle bin");
|
||||
m_description = tr("Recycle bin contains all deleted messages from all feeds.");
|
||||
@ -109,7 +109,7 @@ QVariant FeedsModelRecycleBin::data(int column, int role) const {
|
||||
}
|
||||
|
||||
bool FeedsModelRecycleBin::empty() {
|
||||
QSqlDatabase db_handle = qApp->database()->connection("FeedsModelRecycleBin", DatabaseFactory::FromSettings);
|
||||
QSqlDatabase db_handle = qApp->database()->connection(QSL("FeedsModelRecycleBin"), DatabaseFactory::FromSettings);
|
||||
|
||||
if (!db_handle.transaction()) {
|
||||
qWarning("Starting transaction for recycle bin emptying.");
|
||||
@ -119,7 +119,7 @@ bool FeedsModelRecycleBin::empty() {
|
||||
QSqlQuery query_empty_bin(db_handle);
|
||||
query_empty_bin.setForwardOnly(true);
|
||||
|
||||
if (!query_empty_bin.exec("UPDATE Messages SET is_pdeleted = 1 WHERE is_deleted = 1;")) {
|
||||
if (!query_empty_bin.exec(QSL("UPDATE Messages SET is_pdeleted = 1 WHERE is_deleted = 1;"))) {
|
||||
qWarning("Query execution failed for recycle bin emptying.");
|
||||
|
||||
db_handle.rollback();
|
||||
@ -136,7 +136,7 @@ bool FeedsModelRecycleBin::empty() {
|
||||
}
|
||||
|
||||
bool FeedsModelRecycleBin::restore() {
|
||||
QSqlDatabase db_handle = qApp->database()->connection("FeedsModelRecycleBin", DatabaseFactory::FromSettings);
|
||||
QSqlDatabase db_handle = qApp->database()->connection(QSL("FeedsModelRecycleBin"), DatabaseFactory::FromSettings);
|
||||
|
||||
if (!db_handle.transaction()) {
|
||||
qWarning("Starting transaction for recycle bin restoring.");
|
||||
@ -146,7 +146,7 @@ bool FeedsModelRecycleBin::restore() {
|
||||
QSqlQuery query_empty_bin(db_handle);
|
||||
query_empty_bin.setForwardOnly(true);
|
||||
|
||||
if (!query_empty_bin.exec("UPDATE Messages SET is_deleted = 0 WHERE is_deleted = 1 AND is_pdeleted = 0;")) {
|
||||
if (!query_empty_bin.exec(QSL("UPDATE Messages SET is_deleted = 0 WHERE is_deleted = 1 AND is_pdeleted = 0;"))) {
|
||||
qWarning("Query execution failed for recycle bin restoring.");
|
||||
|
||||
db_handle.rollback();
|
||||
@ -163,11 +163,11 @@ bool FeedsModelRecycleBin::restore() {
|
||||
}
|
||||
|
||||
void FeedsModelRecycleBin::updateCounts(bool update_total_count) {
|
||||
QSqlDatabase database = qApp->database()->connection("FeedsModelRecycleBin", DatabaseFactory::FromSettings);
|
||||
QSqlDatabase database = qApp->database()->connection(QSL("FeedsModelRecycleBin"), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query_all(database);
|
||||
query_all.setForwardOnly(true);
|
||||
|
||||
if (query_all.exec("SELECT count(*) FROM Messages WHERE is_read = 0 AND is_deleted = 1 AND is_pdeleted = 0;") && query_all.next()) {
|
||||
if (query_all.exec(QSL("SELECT count(*) FROM Messages WHERE is_read = 0 AND is_deleted = 1 AND is_pdeleted = 0;")) && query_all.next()) {
|
||||
m_unreadCount = query_all.value(0).toInt();
|
||||
}
|
||||
else {
|
||||
@ -175,7 +175,7 @@ void FeedsModelRecycleBin::updateCounts(bool update_total_count) {
|
||||
}
|
||||
|
||||
if (update_total_count) {
|
||||
if (query_all.exec("SELECT count(*) FROM Messages WHERE is_deleted = 1 AND is_pdeleted = 0;") && query_all.next()) {
|
||||
if (query_all.exec(QSL("SELECT count(*) FROM Messages WHERE is_deleted = 1 AND is_pdeleted = 0;")) && query_all.next()) {
|
||||
m_totalCount = query_all.value(0).toInt();
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user