Fixes for Latin1Strings literals.
This commit is contained in:
parent
8be9c68d14
commit
aaa12e9183
@ -2,13 +2,14 @@
|
|||||||
<center><h2>2.4.1</h2></center>
|
<center><h2>2.4.1</h2></center>
|
||||||
Added:
|
Added:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Experimental support for lighter version of <b>Adblock</b> component. It is configurable via status bar icon in bottom-right corner of main application window. It supports Adblock Plus filters. It is disabled by default. DO NOT user Adblock component if you wish to have LOW memory footprint or use very limited set of rules. Bug set of rules makes RSS Guard more RAM hungry. (issue #7)</li>
|
<li>Experimental support for lighter version of <b>Adblock</b> component. It is configurable via status bar icon in bottom-right corner of main application window. It supports Adblock Plus filters. It is disabled by default. DO NOT user Adblock component if you wish to have LOW memory footprint or use very limited set of rules. Big set of rules makes RSS Guard more RAM hungry. (issue #7)</li>
|
||||||
<li>Unavailable actions in menus are automatically disabled when such a situation arises. (issue #28)</li>
|
<li>Unavailable actions in menus are automatically disabled when such a situation arises. (issue #28)</li>
|
||||||
<li><b>Added support for Google auto-suggest API.</b> Just type your phrase in internal web browser location text box and Google will help you out.</li>
|
<li><b>Added support for Google auto-suggest API.</b> Just type your phrase in internal web browser location text box and Google will help you out.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Source code now uses QStringLiteral/QLatin1String class for character literals.</li>
|
||||||
<li>Internal message previewer is now cleared only once when switching feeds.</li>
|
<li>Internal message previewer is now cleared only once when switching feeds.</li>
|
||||||
<li>Database cleanup tools now do support "shrinking" in in-memory databases, althouth it is bit hacky.</li>
|
<li>Database cleanup tools now do support "shrinking" in in-memory databases, althouth it is bit hacky.</li>
|
||||||
<li>Google suggest API now prevents completion if ENTER in address textbox is hit.</li>
|
<li>Google suggest API now prevents completion if ENTER in address textbox is hit.</li>
|
||||||
|
@ -283,9 +283,9 @@ bool FeedsModel::addCategory(FeedsModelCategory *category, FeedsModelRootItem *p
|
|||||||
QSqlQuery query_add(database);
|
QSqlQuery query_add(database);
|
||||||
|
|
||||||
query_add.setForwardOnly(true);
|
query_add.setForwardOnly(true);
|
||||||
query_add.prepare(QSL("INSERT INTO Categories "
|
query_add.prepare("INSERT INTO Categories "
|
||||||
"(parent_id, title, description, date_created, icon) "
|
"(parent_id, title, description, date_created, icon) "
|
||||||
"VALUES (:parent_id, :title, :description, :date_created, :icon);"));
|
"VALUES (:parent_id, :title, :description, :date_created, :icon);");
|
||||||
query_add.bindValue(QSL(":parent_id"), parent->id());
|
query_add.bindValue(QSL(":parent_id"), parent->id());
|
||||||
query_add.bindValue(QSL(":title"), category->title());
|
query_add.bindValue(QSL(":title"), category->title());
|
||||||
query_add.bindValue(QSL(":description"), category->description());
|
query_add.bindValue(QSL(":description"), category->description());
|
||||||
@ -327,9 +327,9 @@ bool FeedsModel::editCategory(FeedsModelCategory *original_category, FeedsModelC
|
|||||||
FeedsModelRootItem *new_parent = new_category->parent();
|
FeedsModelRootItem *new_parent = new_category->parent();
|
||||||
|
|
||||||
query_update_category.setForwardOnly(true);
|
query_update_category.setForwardOnly(true);
|
||||||
query_update_category.prepare(QSL("UPDATE Categories "
|
query_update_category.prepare("UPDATE Categories "
|
||||||
"SET title = :title, description = :description, icon = :icon, parent_id = :parent_id "
|
"SET title = :title, description = :description, icon = :icon, parent_id = :parent_id "
|
||||||
"WHERE id = :id;"));
|
"WHERE id = :id;");
|
||||||
query_update_category.bindValue(QSL(":title"), new_category->title());
|
query_update_category.bindValue(QSL(":title"), new_category->title());
|
||||||
query_update_category.bindValue(QSL(":description"), new_category->description());
|
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(":icon"), qApp->icons()->toByteArray(new_category->icon()));
|
||||||
@ -379,9 +379,9 @@ bool FeedsModel::addFeed(FeedsModelFeed *feed, FeedsModelRootItem *parent) {
|
|||||||
QSqlQuery query_add_feed(database);
|
QSqlQuery query_add_feed(database);
|
||||||
|
|
||||||
query_add_feed.setForwardOnly(true);
|
query_add_feed.setForwardOnly(true);
|
||||||
query_add_feed.prepare(QSL("INSERT INTO Feeds "
|
query_add_feed.prepare("INSERT INTO Feeds "
|
||||||
"(title, description, date_created, icon, category, encoding, url, protected, username, password, update_type, update_interval, type) "
|
"(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);"));
|
"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(":title"), feed->title());
|
||||||
query_add_feed.bindValue(QSL(":description"), feed->description());
|
query_add_feed.bindValue(QSL(":description"), feed->description());
|
||||||
query_add_feed.bindValue(QSL(":date_created"), feed->creationDate().toMSecsSinceEpoch());
|
query_add_feed.bindValue(QSL(":date_created"), feed->creationDate().toMSecsSinceEpoch());
|
||||||
@ -429,9 +429,9 @@ bool FeedsModel::editFeed(FeedsModelFeed *original_feed, FeedsModelFeed *new_fee
|
|||||||
FeedsModelRootItem *new_parent = new_feed->parent();
|
FeedsModelRootItem *new_parent = new_feed->parent();
|
||||||
|
|
||||||
query_update_feed.setForwardOnly(true);
|
query_update_feed.setForwardOnly(true);
|
||||||
query_update_feed.prepare(QSL("UPDATE Feeds "
|
query_update_feed.prepare("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 "
|
"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;"));
|
"WHERE id = :id;");
|
||||||
query_update_feed.bindValue(QSL(":title"), new_feed->title());
|
query_update_feed.bindValue(QSL(":title"), new_feed->title());
|
||||||
query_update_feed.bindValue(QSL(":description"), new_feed->description());
|
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(":icon"), qApp->icons()->toByteArray(new_feed->icon()));
|
||||||
@ -535,9 +535,9 @@ QList<Message> FeedsModel::messagesForFeeds(const QList<FeedsModelFeed*> &feeds)
|
|||||||
DatabaseFactory::FromSettings);
|
DatabaseFactory::FromSettings);
|
||||||
QSqlQuery query_read_msg(database);
|
QSqlQuery query_read_msg(database);
|
||||||
query_read_msg.setForwardOnly(true);
|
query_read_msg.setForwardOnly(true);
|
||||||
query_read_msg.prepare(QSL("SELECT title, url, author, date_created, contents "
|
query_read_msg.prepare("SELECT title, url, author, date_created, contents "
|
||||||
"FROM Messages "
|
"FROM Messages "
|
||||||
"WHERE is_deleted = 0 AND feed = :feed;"));
|
"WHERE is_deleted = 0 AND feed = :feed;");
|
||||||
|
|
||||||
foreach (FeedsModelFeed *feed, feeds) {
|
foreach (FeedsModelFeed *feed, feeds) {
|
||||||
query_read_msg.bindValue(QSL(":feed"), feed->id());
|
query_read_msg.bindValue(QSL(":feed"), feed->id());
|
||||||
@ -849,8 +849,8 @@ bool FeedsModel::markFeedsRead(const QList<FeedsModelFeed*> &feeds, int read) {
|
|||||||
QSqlQuery query_read_msg(db_handle);
|
QSqlQuery query_read_msg(db_handle);
|
||||||
query_read_msg.setForwardOnly(true);
|
query_read_msg.setForwardOnly(true);
|
||||||
|
|
||||||
if (!query_read_msg.prepare(QString(QSL("UPDATE Messages SET is_read = :read "
|
if (!query_read_msg.prepare(QString("UPDATE Messages SET is_read = :read "
|
||||||
"WHERE feed IN (%1) AND is_deleted = 0;")).arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
"WHERE feed IN (%1) AND is_deleted = 0;").arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
||||||
qWarning("Query preparation failed for feeds read change.");
|
qWarning("Query preparation failed for feeds read change.");
|
||||||
|
|
||||||
db_handle.rollback();
|
db_handle.rollback();
|
||||||
@ -885,8 +885,8 @@ bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int delet
|
|||||||
query_delete_msg.setForwardOnly(true);
|
query_delete_msg.setForwardOnly(true);
|
||||||
|
|
||||||
if (read_only) {
|
if (read_only) {
|
||||||
if (!query_delete_msg.prepare(QString(QSL("UPDATE Messages SET is_deleted = :deleted "
|
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(QSL(", "))))) {
|
"WHERE feed IN (%1) AND is_deleted = 0 AND is_read = 1;").arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
||||||
qWarning("Query preparation failed for feeds clearing.");
|
qWarning("Query preparation failed for feeds clearing.");
|
||||||
|
|
||||||
db_handle.rollback();
|
db_handle.rollback();
|
||||||
@ -894,8 +894,8 @@ bool FeedsModel::markFeedsDeleted(const QList<FeedsModelFeed*> &feeds, int delet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!query_delete_msg.prepare(QString(QSL("UPDATE Messages SET is_deleted = :deleted "
|
if (!query_delete_msg.prepare(QString("UPDATE Messages SET is_deleted = :deleted "
|
||||||
"WHERE feed IN (%1) AND is_deleted = 0;")).arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
"WHERE feed IN (%1) AND is_deleted = 0;").arg(textualFeedIds(feeds).join(QSL(", "))))) {
|
||||||
qWarning("Query preparation failed for feeds clearing.");
|
qWarning("Query preparation failed for feeds clearing.");
|
||||||
|
|
||||||
db_handle.rollback();
|
db_handle.rollback();
|
||||||
|
@ -478,14 +478,14 @@ void FeedsModelFeed::updateMessages(const QList<Message> &messages) {
|
|||||||
// Used to check if given feed contains any message with given title, url and date_created.
|
// 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.
|
// 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.setForwardOnly(true);
|
||||||
query_select.prepare(QSL("SELECT id, feed, date_created FROM Messages "
|
query_select.prepare("SELECT id, feed, date_created FROM Messages "
|
||||||
"WHERE feed = :feed AND title = :title AND url = :url AND author = :author;"));
|
"WHERE feed = :feed AND title = :title AND url = :url AND author = :author;");
|
||||||
|
|
||||||
// Used to insert new messages.
|
// Used to insert new messages.
|
||||||
query_insert.setForwardOnly(true);
|
query_insert.setForwardOnly(true);
|
||||||
query_insert.prepare(QSL("INSERT INTO Messages "
|
query_insert.prepare("INSERT INTO Messages "
|
||||||
"(feed, title, url, author, date_created, contents, enclosures) "
|
"(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) {
|
if (remove_duplicates) {
|
||||||
query_update.setForwardOnly(true);
|
query_update.setForwardOnly(true);
|
||||||
|
@ -28,7 +28,7 @@ FeedsProxyModel::FeedsProxyModel(QObject *parent)
|
|||||||
: QSortFilterProxyModel(parent) {
|
: QSortFilterProxyModel(parent) {
|
||||||
m_sourceModel = new FeedsModel(this);
|
m_sourceModel = new FeedsModel(this);
|
||||||
|
|
||||||
setObjectName("FeedsProxyModel");
|
setObjectName(QSL("FeedsProxyModel"));
|
||||||
setSortRole(Qt::EditRole);
|
setSortRole(Qt::EditRole);
|
||||||
setSortCaseSensitivity(Qt::CaseInsensitive);
|
setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
3
src/core/feedsselection.cpp
Normal file → Executable file
3
src/core/feedsselection.cpp
Normal file → Executable file
@ -20,6 +20,7 @@
|
|||||||
#include "core/feedsmodelrootitem.h"
|
#include "core/feedsmodelrootitem.h"
|
||||||
#include "core/feedsmodelcategory.h"
|
#include "core/feedsmodelcategory.h"
|
||||||
#include "core/feedsmodelfeed.h"
|
#include "core/feedsmodelfeed.h"
|
||||||
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
|
|
||||||
FeedsSelection::FeedsSelection(FeedsModelRootItem *root_of_selection) : m_selectedItem(root_of_selection) {
|
FeedsSelection::FeedsSelection(FeedsModelRootItem *root_of_selection) : m_selectedItem(root_of_selection) {
|
||||||
@ -66,7 +67,7 @@ QString FeedsSelection::generateListOfIds() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return stringy_ids.join(", ");
|
return stringy_ids.join(QSL(", "));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
|
|
||||||
|
|
||||||
MessagesModel::MessagesModel(QObject *parent)
|
MessagesModel::MessagesModel(QObject *parent)
|
||||||
: QSqlTableModel(parent, qApp->database()->connection("MessagesModel", DatabaseFactory::FromSettings)),
|
: QSqlTableModel(parent, qApp->database()->connection(QSL("MessagesModel"), DatabaseFactory::FromSettings)),
|
||||||
m_messageFilter(NoHighlighting), m_customDateFormat(QString()) {
|
m_messageFilter(NoHighlighting), m_customDateFormat(QString()) {
|
||||||
setObjectName("MessagesModel");
|
setObjectName(QSL("MessagesModel"));
|
||||||
setupFonts();
|
setupFonts();
|
||||||
setupIcons();
|
setupIcons();
|
||||||
setupHeaderData();
|
setupHeaderData();
|
||||||
@ -41,7 +41,7 @@ MessagesModel::MessagesModel(QObject *parent)
|
|||||||
// NOTE: Changes to the database are actually NOT submitted
|
// NOTE: Changes to the database are actually NOT submitted
|
||||||
// via model, but via DIRECT SQL calls are used to do persistent messages.
|
// via model, but via DIRECT SQL calls are used to do persistent messages.
|
||||||
setEditStrategy(QSqlTableModel::OnManualSubmit);
|
setEditStrategy(QSqlTableModel::OnManualSubmit);
|
||||||
setTable("Messages");
|
setTable(QSL("Messages"));
|
||||||
loadMessages(FeedsSelection());
|
loadMessages(FeedsSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,9 +50,9 @@ MessagesModel::~MessagesModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessagesModel::setupIcons() {
|
void MessagesModel::setupIcons() {
|
||||||
m_favoriteIcon = qApp->icons()->fromTheme("mail-mark-favorite");
|
m_favoriteIcon = qApp->icons()->fromTheme(QSL("mail-mark-favorite"));
|
||||||
m_readIcon = qApp->icons()->fromTheme("mail-mark-read");
|
m_readIcon = qApp->icons()->fromTheme(QSL("mail-mark-read"));
|
||||||
m_unreadIcon = qApp->icons()->fromTheme("mail-mark-unread");
|
m_unreadIcon = qApp->icons()->fromTheme(QSL("mail-mark-unread"));
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedsSelection MessagesModel::loadedSelection() const {
|
FeedsSelection MessagesModel::loadedSelection() const {
|
||||||
@ -75,12 +75,12 @@ void MessagesModel::loadMessages(const FeedsSelection &selection) {
|
|||||||
m_currentSelection = selection;
|
m_currentSelection = selection;
|
||||||
|
|
||||||
if (m_currentSelection.mode() == FeedsSelection::MessagesFromRecycleBin) {
|
if (m_currentSelection.mode() == FeedsSelection::MessagesFromRecycleBin) {
|
||||||
setFilter("is_deleted = 1 AND is_pdeleted = 0");
|
setFilter(QSL("is_deleted = 1 AND is_pdeleted = 0"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString assembled_ids = m_currentSelection.generateListOfIds();
|
QString assembled_ids = m_currentSelection.generateListOfIds();
|
||||||
|
|
||||||
setFilter(QString("feed IN (%1) AND is_deleted = 0").arg(assembled_ids));
|
setFilter(QString(QSL("feed IN (%1) AND is_deleted = 0")).arg(assembled_ids));
|
||||||
qDebug("Loading messages from feeds: %s.", qPrintable(assembled_ids));
|
qDebug("Loading messages from feeds: %s.", qPrintable(assembled_ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ bool MessagesModel::setMessageRead(int row_index, int read) {
|
|||||||
QSqlQuery query_read_msg(db_handle);
|
QSqlQuery query_read_msg(db_handle);
|
||||||
query_read_msg.setForwardOnly(true);
|
query_read_msg.setForwardOnly(true);
|
||||||
|
|
||||||
if (!query_read_msg.prepare("UPDATE Messages SET is_read = :read WHERE id = :id;")) {
|
if (!query_read_msg.prepare(QSL("UPDATE Messages SET is_read = :read WHERE id = :id;"))) {
|
||||||
qWarning("Query preparation failed for message read change.");
|
qWarning("Query preparation failed for message read change.");
|
||||||
|
|
||||||
db_handle.rollback();
|
db_handle.rollback();
|
||||||
@ -264,8 +264,8 @@ bool MessagesModel::setMessageRead(int row_index, int read) {
|
|||||||
|
|
||||||
// Rewrite the actual data in the database itself.
|
// Rewrite the actual data in the database itself.
|
||||||
message_id = messageId(row_index);
|
message_id = messageId(row_index);
|
||||||
query_read_msg.bindValue(":id", message_id);
|
query_read_msg.bindValue(QSL(":id"), message_id);
|
||||||
query_read_msg.bindValue(":read", read);
|
query_read_msg.bindValue(QSL(":read"), read);
|
||||||
query_read_msg.exec();
|
query_read_msg.exec();
|
||||||
|
|
||||||
// Commit changes.
|
// Commit changes.
|
||||||
@ -309,7 +309,7 @@ bool MessagesModel::switchMessageImportance(int row_index) {
|
|||||||
QSqlQuery query_importance_msg(db_handle);
|
QSqlQuery query_importance_msg(db_handle);
|
||||||
query_importance_msg.setForwardOnly(true);
|
query_importance_msg.setForwardOnly(true);
|
||||||
|
|
||||||
if (!query_importance_msg.prepare("UPDATE Messages SET is_important = :important WHERE id = :id;")) {
|
if (!query_importance_msg.prepare(QSL("UPDATE Messages SET is_important = :important WHERE id = :id;"))) {
|
||||||
qWarning("Query preparation failed for message importance switch.");
|
qWarning("Query preparation failed for message importance switch.");
|
||||||
|
|
||||||
db_handle.rollback();
|
db_handle.rollback();
|
||||||
@ -317,8 +317,8 @@ bool MessagesModel::switchMessageImportance(int row_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message_id = messageId(row_index);
|
message_id = messageId(row_index);
|
||||||
query_importance_msg.bindValue(":id", message_id);
|
query_importance_msg.bindValue(QSL(":id"), message_id);
|
||||||
query_importance_msg.bindValue(":important", current_importance == 1 ? 0 : 1);
|
query_importance_msg.bindValue(QSL(":important"), current_importance == 1 ? 0 : 1);
|
||||||
query_importance_msg.exec();
|
query_importance_msg.exec();
|
||||||
|
|
||||||
// Commit changes.
|
// Commit changes.
|
||||||
@ -345,8 +345,8 @@ bool MessagesModel::switchBatchMessageImportance(const QModelIndexList &messages
|
|||||||
message_ids.append(QString::number(messageId(message.row())));
|
message_ids.append(QString::number(messageId(message.row())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query_read_msg.exec(QString("UPDATE Messages SET is_important = NOT is_important "
|
if (query_read_msg.exec(QString(QSL("UPDATE Messages SET is_important = NOT is_important WHERE id IN (%1);"))
|
||||||
"WHERE id IN (%1);").arg(message_ids.join(", ")))) {
|
.arg(message_ids.join(QSL(", "))))) {
|
||||||
select();
|
select();
|
||||||
fetchAll();
|
fetchAll();
|
||||||
|
|
||||||
@ -373,12 +373,12 @@ bool MessagesModel::setBatchMessagesDeleted(const QModelIndexList &messages, int
|
|||||||
QString sql_delete_query;
|
QString sql_delete_query;
|
||||||
|
|
||||||
if (m_currentSelection.mode() == FeedsSelection::MessagesFromFeeds) {
|
if (m_currentSelection.mode() == FeedsSelection::MessagesFromFeeds) {
|
||||||
sql_delete_query = QString("UPDATE Messages SET is_deleted = %2 WHERE id IN (%1);").arg(message_ids.join(", "),
|
sql_delete_query = QString(QSL("UPDATE Messages SET is_deleted = %2 WHERE id IN (%1);")).arg(message_ids.join(QSL(", ")),
|
||||||
QString::number(deleted));
|
QString::number(deleted));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sql_delete_query = QString("UPDATE Messages SET is_pdeleted = %2 WHERE id IN (%1);").arg(message_ids.join(", "),
|
sql_delete_query = QString(QSL("UPDATE Messages SET is_pdeleted = %2 WHERE id IN (%1);")).arg(message_ids.join(QSL(", ")),
|
||||||
QString::number(deleted));
|
QString::number(deleted));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query_read_msg.exec(sql_delete_query)) {
|
if (query_read_msg.exec(sql_delete_query)) {
|
||||||
@ -405,8 +405,8 @@ bool MessagesModel::setBatchMessagesRead(const QModelIndexList &messages, int re
|
|||||||
message_ids.append(QString::number(messageId(message.row())));
|
message_ids.append(QString::number(messageId(message.row())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query_read_msg.exec(QString("UPDATE Messages SET is_read = %2 "
|
if (query_read_msg.exec(QString(QSL("UPDATE Messages SET is_read = %2 WHERE id IN (%1);")).arg(message_ids.join(QSL(", ")),
|
||||||
"WHERE id IN (%1);").arg(message_ids.join(", "), QString::number(read)))) {
|
QString::number(read)))) {
|
||||||
select();
|
select();
|
||||||
fetchAll();
|
fetchAll();
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ bool MessagesModel::setBatchMessagesRestored(const QModelIndexList &messages) {
|
|||||||
message_ids.append(QString::number(messageId(message.row())));
|
message_ids.append(QString::number(messageId(message.row())));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString sql_delete_query = QString("UPDATE Messages SET is_deleted = 0 WHERE id IN (%1);").arg(message_ids.join(", "));
|
QString sql_delete_query = QString(QSL("UPDATE Messages SET is_deleted = 0 WHERE id IN (%1);")).arg(message_ids.join(QSL(", ")));
|
||||||
|
|
||||||
if (query_read_msg.exec(sql_delete_query)) {
|
if (query_read_msg.exec(sql_delete_query)) {
|
||||||
select();
|
select();
|
||||||
|
2
src/core/messagesproxymodel.cpp
Normal file → Executable file
2
src/core/messagesproxymodel.cpp
Normal file → Executable file
@ -24,7 +24,7 @@ MessagesProxyModel::MessagesProxyModel(QObject *parent)
|
|||||||
: QSortFilterProxyModel(parent) {
|
: QSortFilterProxyModel(parent) {
|
||||||
m_sourceModel = new MessagesModel(this);
|
m_sourceModel = new MessagesModel(this);
|
||||||
|
|
||||||
setObjectName("MessagesProxyModel");
|
setObjectName(QSL("MessagesProxyModel"));
|
||||||
setSortRole(Qt::EditRole);
|
setSortRole(Qt::EditRole);
|
||||||
setSortCaseSensitivity(Qt::CaseInsensitive);
|
setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
@ -35,18 +35,18 @@ QList<Message> ParsingFactory::parseAsATOM10(const QString &data) {
|
|||||||
xml_file.setContent(data, true);
|
xml_file.setContent(data, true);
|
||||||
|
|
||||||
// Pull out all messages.
|
// Pull out all messages.
|
||||||
QDomNodeList messages_in_xml = xml_file.elementsByTagName("entry");
|
QDomNodeList messages_in_xml = xml_file.elementsByTagName(QSL("entry"));
|
||||||
|
|
||||||
for (int i = 0; i < messages_in_xml.size(); i++) {
|
for (int i = 0; i < messages_in_xml.size(); i++) {
|
||||||
QDomNode message_item = messages_in_xml.item(i);
|
QDomNode message_item = messages_in_xml.item(i);
|
||||||
Message new_message;
|
Message new_message;
|
||||||
|
|
||||||
// Deal with titles & descriptions.
|
// Deal with titles & descriptions.
|
||||||
QString elem_title = message_item.namedItem("title").toElement().text().simplified();
|
QString elem_title = message_item.namedItem(QSL("title")).toElement().text().simplified();
|
||||||
QString elem_summary = message_item.namedItem("summary").toElement().text();
|
QString elem_summary = message_item.namedItem(QSL("summary")).toElement().text();
|
||||||
|
|
||||||
if (elem_summary.isEmpty()) {
|
if (elem_summary.isEmpty()) {
|
||||||
elem_summary = message_item.namedItem("content").toElement().text();
|
elem_summary = message_item.namedItem(QSL("content")).toElement().text();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we obtained maximum of information for title & description.
|
// Now we obtained maximum of information for title & description.
|
||||||
@ -68,18 +68,18 @@ QList<Message> ParsingFactory::parseAsATOM10(const QString &data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deal with link.
|
// Deal with link.
|
||||||
QDomNodeList elem_links = message_item.toElement().elementsByTagName("link");
|
QDomNodeList elem_links = message_item.toElement().elementsByTagName(QSL("link"));
|
||||||
|
|
||||||
for (int i = 0; i < elem_links.size(); i++) {
|
for (int i = 0; i < elem_links.size(); i++) {
|
||||||
QDomElement link = elem_links.at(i).toElement();
|
QDomElement link = elem_links.at(i).toElement();
|
||||||
|
|
||||||
if (link.attribute("rel") == "enclosure") {
|
if (link.attribute(QSL("rel")) == QL1S("enclosure")) {
|
||||||
new_message.m_enclosures.append(Enclosure(link.attribute("href"), link.attribute("type")));
|
new_message.m_enclosures.append(Enclosure(link.attribute(QSL("href")), link.attribute(QSL("type"))));
|
||||||
|
|
||||||
qDebug("Adding enclosure '%s' for the message.", qPrintable(new_message.m_enclosures.last().m_url));
|
qDebug("Adding enclosure '%s' for the message.", qPrintable(new_message.m_enclosures.last().m_url));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new_message.m_url = link.attribute("href");
|
new_message.m_url = link.attribute(QSL("href"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,10 +88,10 @@ QList<Message> ParsingFactory::parseAsATOM10(const QString &data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deal with authors.
|
// Deal with authors.
|
||||||
new_message.m_author = WebFactory::instance()->escapeHtml(message_item.namedItem("author").namedItem("name").toElement().text());
|
new_message.m_author = WebFactory::instance()->escapeHtml(message_item.namedItem(QSL("author")).namedItem(QSL("name")).toElement().text());
|
||||||
|
|
||||||
// Deal with creation date.
|
// Deal with creation date.
|
||||||
new_message.m_created = TextFactory::parseDateTime(message_item.namedItem("updated").toElement().text());
|
new_message.m_created = TextFactory::parseDateTime(message_item.namedItem(QSL("updated")).toElement().text());
|
||||||
new_message.m_createdFromFeed = !new_message.m_created.isNull();
|
new_message.m_createdFromFeed = !new_message.m_created.isNull();
|
||||||
|
|
||||||
if (!new_message.m_createdFromFeed) {
|
if (!new_message.m_createdFromFeed) {
|
||||||
@ -124,15 +124,15 @@ QList<Message> ParsingFactory::parseAsRDF(const QString &data) {
|
|||||||
xml_file.setContent(data, true);
|
xml_file.setContent(data, true);
|
||||||
|
|
||||||
// Pull out all messages.
|
// Pull out all messages.
|
||||||
QDomNodeList messages_in_xml = xml_file.elementsByTagName("item");
|
QDomNodeList messages_in_xml = xml_file.elementsByTagName(QSL("item"));
|
||||||
|
|
||||||
for (int i = 0; i < messages_in_xml.size(); i++) {
|
for (int i = 0; i < messages_in_xml.size(); i++) {
|
||||||
QDomNode message_item = messages_in_xml.item(i);
|
QDomNode message_item = messages_in_xml.item(i);
|
||||||
Message new_message;
|
Message new_message;
|
||||||
|
|
||||||
// Deal with title and description.
|
// Deal with title and description.
|
||||||
QString elem_title = message_item.namedItem("title").toElement().text().simplified();
|
QString elem_title = message_item.namedItem(QSL("title")).toElement().text().simplified();
|
||||||
QString elem_description = message_item.namedItem("description").toElement().text();
|
QString elem_description = message_item.namedItem(QSL("description")).toElement().text();
|
||||||
|
|
||||||
// Now we obtained maximum of information for title & description.
|
// Now we obtained maximum of information for title & description.
|
||||||
if (elem_title.isEmpty()) {
|
if (elem_title.isEmpty()) {
|
||||||
@ -154,14 +154,14 @@ QList<Message> ParsingFactory::parseAsRDF(const QString &data) {
|
|||||||
|
|
||||||
|
|
||||||
// Deal with link and author.
|
// Deal with link and author.
|
||||||
new_message.m_url = message_item.namedItem("link").toElement().text();
|
new_message.m_url = message_item.namedItem(QSL("link")).toElement().text();
|
||||||
new_message.m_author = message_item.namedItem("creator").toElement().text();
|
new_message.m_author = message_item.namedItem(QSL("creator")).toElement().text();
|
||||||
|
|
||||||
// Deal with creation date.
|
// Deal with creation date.
|
||||||
QString elem_updated = message_item.namedItem("date").toElement().text();
|
QString elem_updated = message_item.namedItem(QSL("date")).toElement().text();
|
||||||
|
|
||||||
if (elem_updated.isEmpty()) {
|
if (elem_updated.isEmpty()) {
|
||||||
elem_updated = message_item.namedItem("dc:date").toElement().text();
|
elem_updated = message_item.namedItem(QSL("dc:date")).toElement().text();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal with creation date.
|
// Deal with creation date.
|
||||||
@ -195,20 +195,20 @@ QList<Message> ParsingFactory::parseAsRSS20(const QString &data) {
|
|||||||
xml_file.setContent(data, true);
|
xml_file.setContent(data, true);
|
||||||
|
|
||||||
// Pull out all messages.
|
// Pull out all messages.
|
||||||
QDomNodeList messages_in_xml = xml_file.elementsByTagName("item");
|
QDomNodeList messages_in_xml = xml_file.elementsByTagName(QSL("item"));
|
||||||
|
|
||||||
for (int i = 0; i < messages_in_xml.size(); i++) {
|
for (int i = 0; i < messages_in_xml.size(); i++) {
|
||||||
QDomNode message_item = messages_in_xml.item(i);
|
QDomNode message_item = messages_in_xml.item(i);
|
||||||
Message new_message;
|
Message new_message;
|
||||||
|
|
||||||
// Deal with titles & descriptions.
|
// Deal with titles & descriptions.
|
||||||
QString elem_title = message_item.namedItem("title").toElement().text().simplified();
|
QString elem_title = message_item.namedItem(QSL("title")).toElement().text().simplified();
|
||||||
QString elem_description = message_item.namedItem("description").toElement().text();
|
QString elem_description = message_item.namedItem(QSL("description")).toElement().text();
|
||||||
QString elem_enclosure = message_item.namedItem("enclosure").toElement().attribute("url");
|
QString elem_enclosure = message_item.namedItem(QSL("enclosure")).toElement().attribute(QSL("url"));
|
||||||
QString elem_enclosure_type = message_item.namedItem("enclosure").toElement().attribute("type");
|
QString elem_enclosure_type = message_item.namedItem(QSL("enclosure")).toElement().attribute(QSL("type"));
|
||||||
|
|
||||||
if (elem_description.isEmpty()) {
|
if (elem_description.isEmpty()) {
|
||||||
elem_description = message_item.namedItem("encoded").toElement().text();
|
elem_description = message_item.namedItem(QSL("encoded")).toElement().text();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we obtained maximum of information for title & description.
|
// Now we obtained maximum of information for title & description.
|
||||||
@ -236,23 +236,23 @@ QList<Message> ParsingFactory::parseAsRSS20(const QString &data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deal with link and author.
|
// Deal with link and author.
|
||||||
new_message.m_url = message_item.namedItem("link").toElement().text();
|
new_message.m_url = message_item.namedItem(QSL("link")).toElement().text();
|
||||||
|
|
||||||
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
|
if (new_message.m_url.isEmpty() && !new_message.m_enclosures.isEmpty()) {
|
||||||
new_message.m_url = new_message.m_enclosures.first().m_url;
|
new_message.m_url = new_message.m_enclosures.first().m_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_message.m_author = message_item.namedItem("author").toElement().text();
|
new_message.m_author = message_item.namedItem(QSL("author")).toElement().text();
|
||||||
|
|
||||||
if (new_message.m_author.isEmpty()) {
|
if (new_message.m_author.isEmpty()) {
|
||||||
new_message.m_author = message_item.namedItem("creator").toElement().text();
|
new_message.m_author = message_item.namedItem(QSL("creator")).toElement().text();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal with creation date.
|
// Deal with creation date.
|
||||||
new_message.m_created = TextFactory::parseDateTime(message_item.namedItem("pubDate").toElement().text());
|
new_message.m_created = TextFactory::parseDateTime(message_item.namedItem(QSL("pubDate")).toElement().text());
|
||||||
|
|
||||||
if (new_message.m_created.isNull()) {
|
if (new_message.m_created.isNull()) {
|
||||||
new_message.m_created = TextFactory::parseDateTime(message_item.namedItem("date").toElement().text());
|
new_message.m_created = TextFactory::parseDateTime(message_item.namedItem(QSL("date")).toElement().text());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(new_message.m_createdFromFeed = !new_message.m_created.isNull())) {
|
if (!(new_message.m_createdFromFeed = !new_message.m_created.isNull())) {
|
||||||
|
4
src/dynamic-shortcuts/dynamicshortcutswidget.cpp
Normal file → Executable file
4
src/dynamic-shortcuts/dynamicshortcutswidget.cpp
Normal file → Executable file
@ -86,7 +86,7 @@ void DynamicShortcutsWidget::populate(QList<QAction*> actions) {
|
|||||||
|
|
||||||
// Add new catcher to our control.
|
// Add new catcher to our control.
|
||||||
QLabel *action_label = new QLabel(this);
|
QLabel *action_label = new QLabel(this);
|
||||||
action_label->setText(action->text().remove('&'));
|
action_label->setText(action->text().remove(QSL("&")));
|
||||||
action_label->setToolTip(action->toolTip());
|
action_label->setToolTip(action->toolTip());
|
||||||
action_label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
action_label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
|
|
||||||
@ -107,5 +107,5 @@ void DynamicShortcutsWidget::populate(QList<QAction*> actions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicShortcutsWidget::lessThan(QAction *lhs, QAction *rhs) {
|
bool DynamicShortcutsWidget::lessThan(QAction *lhs, QAction *rhs) {
|
||||||
return QString::localeAwareCompare(lhs->text().replace("&", ""), rhs->text().replace("&", "")) < 0;
|
return QString::localeAwareCompare(lhs->text().replace(QL1S("&"), QString()), rhs->text().replace(QL1S("&"), QString())) < 0;
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@ ShortcutCatcher::ShortcutCatcher(QWidget *parent)
|
|||||||
|
|
||||||
// Create reset button.
|
// Create reset button.
|
||||||
m_btnReset = new PlainToolButton(this);
|
m_btnReset = new PlainToolButton(this);
|
||||||
m_btnReset->setIcon(qApp->icons()->fromTheme("edit-revert"));
|
m_btnReset->setIcon(qApp->icons()->fromTheme(QSL("edit-revert")));
|
||||||
m_btnReset->setFocusPolicy(Qt::NoFocus);
|
m_btnReset->setFocusPolicy(Qt::NoFocus);
|
||||||
m_btnReset->setToolTip(tr("Reset to original shortcut."));
|
m_btnReset->setToolTip(tr("Reset to original shortcut."));
|
||||||
|
|
||||||
// Create clear button.
|
// Create clear button.
|
||||||
m_btnClear = new PlainToolButton(this);
|
m_btnClear = new PlainToolButton(this);
|
||||||
m_btnClear->setIcon(qApp->icons()->fromTheme("item-remove"));
|
m_btnClear->setIcon(qApp->icons()->fromTheme(QSL("item-remove")));
|
||||||
m_btnClear->setFocusPolicy(Qt::NoFocus);
|
m_btnClear->setFocusPolicy(Qt::NoFocus);
|
||||||
m_btnClear->setToolTip(tr("Clear current shortcut."));
|
m_btnClear->setToolTip(tr("Clear current shortcut."));
|
||||||
|
|
||||||
@ -109,24 +109,24 @@ void ShortcutCatcher::controlModifierlessTimout() {
|
|||||||
|
|
||||||
void ShortcutCatcher::updateDisplayShortcut() {
|
void ShortcutCatcher::updateDisplayShortcut() {
|
||||||
QString str = m_currentSequence.toString(QKeySequence::NativeText);
|
QString str = m_currentSequence.toString(QKeySequence::NativeText);
|
||||||
str.replace('&', QLatin1String("&&"));
|
str.replace(QL1S("&"), QL1S("&&"));
|
||||||
|
|
||||||
if (m_isRecording) {
|
if (m_isRecording) {
|
||||||
if (m_modifierKeys) {
|
if (m_modifierKeys) {
|
||||||
if (!str.isEmpty()) {
|
if (!str.isEmpty()) {
|
||||||
str.append(",");
|
str.append(QSL(","));
|
||||||
}
|
}
|
||||||
if (m_modifierKeys & Qt::META) {
|
if (m_modifierKeys & Qt::META) {
|
||||||
str += "Meta + ";
|
str += QL1S("Meta + ");
|
||||||
}
|
}
|
||||||
if (m_modifierKeys & Qt::CTRL) {
|
if (m_modifierKeys & Qt::CTRL) {
|
||||||
str += "Ctrl + ";
|
str += QL1S("Ctrl + ");
|
||||||
}
|
}
|
||||||
if (m_modifierKeys & Qt::ALT) {
|
if (m_modifierKeys & Qt::ALT) {
|
||||||
str += "Alt + ";
|
str += QL1S("Alt + ");
|
||||||
}
|
}
|
||||||
if (m_modifierKeys & Qt::SHIFT) {
|
if (m_modifierKeys & Qt::SHIFT) {
|
||||||
str += "Shift + ";
|
str += QL1S("Shift + ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
src/gui/basetoolbar.cpp
Normal file → Executable file
3
src/gui/basetoolbar.cpp
Normal file → Executable file
@ -24,8 +24,7 @@
|
|||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
|
|
||||||
|
|
||||||
BaseToolBar::BaseToolBar(const QString &title, QWidget *parent)
|
BaseToolBar::BaseToolBar(const QString &title, QWidget *parent) : QToolBar(title, parent) {
|
||||||
: QToolBar(title, parent) {
|
|
||||||
// Update right margin of filter textbox.
|
// Update right margin of filter textbox.
|
||||||
QMargins margins = contentsMargins();
|
QMargins margins = contentsMargins();
|
||||||
margins.setRight(margins.right() + FILTER_RIGHT_MARGIN);
|
margins.setRight(margins.right() + FILTER_RIGHT_MARGIN);
|
||||||
|
@ -455,7 +455,7 @@ void FeedMessageViewer::initializeViews() {
|
|||||||
m_messagesView->setFrameStyle(QFrame::NoFrame);
|
m_messagesView->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
// Setup message splitter.
|
// Setup message splitter.
|
||||||
m_messageSplitter->setObjectName("MessageSplitter");
|
m_messageSplitter->setObjectName(QSL("MessageSplitter"));
|
||||||
m_messageSplitter->setHandleWidth(1);
|
m_messageSplitter->setHandleWidth(1);
|
||||||
m_messageSplitter->setOpaqueResize(false);
|
m_messageSplitter->setOpaqueResize(false);
|
||||||
m_messageSplitter->setChildrenCollapsible(false);
|
m_messageSplitter->setChildrenCollapsible(false);
|
||||||
|
@ -41,7 +41,7 @@ QList<QAction*> FeedsToolBar::changeableActions() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedsToolBar::saveChangeableActions(const QStringList &actions) {
|
void FeedsToolBar::saveChangeableActions(const QStringList &actions) {
|
||||||
qApp->settings()->setValue(GROUP(GUI), GUI::FeedsToolbarActions, actions.join(","));
|
qApp->settings()->setValue(GROUP(GUI), GUI::FeedsToolbarActions, actions.join(QSL(",")));
|
||||||
loadChangeableActions(actions);
|
loadChangeableActions(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ void FeedsToolBar::loadChangeableActions(const QStringList &actions) {
|
|||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
QAction *action = addWidget(spacer);
|
QAction *action = addWidget(spacer);
|
||||||
action->setIcon(qApp->icons()->fromTheme("application-search"));
|
action->setIcon(qApp->icons()->fromTheme(QSL("application-search")));
|
||||||
action->setProperty("type", SPACER_ACTION_NAME);
|
action->setProperty("type", SPACER_ACTION_NAME);
|
||||||
action->setProperty("name", tr("Toolbar spacer"));
|
action->setProperty("name", tr("Toolbar spacer"));
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ FeedsView::FeedsView(QWidget *parent)
|
|||||||
m_contextMenuEmptySpace(NULL),
|
m_contextMenuEmptySpace(NULL),
|
||||||
m_contextMenuRecycleBin(NULL),
|
m_contextMenuRecycleBin(NULL),
|
||||||
m_autoUpdateTimer(new QTimer(this)) {
|
m_autoUpdateTimer(new QTimer(this)) {
|
||||||
setObjectName("FeedsView");
|
setObjectName(QSL("FeedsView"));
|
||||||
|
|
||||||
// Allocate models.
|
// Allocate models.
|
||||||
m_proxyModel = new FeedsProxyModel(this);
|
m_proxyModel = new FeedsProxyModel(this);
|
||||||
|
@ -34,7 +34,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||||
setWindowIcon(qApp->icons()->fromTheme("application-about"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("application-about")));
|
||||||
|
|
||||||
//: About RSS Guard dialog title.
|
//: About RSS Guard dialog title.
|
||||||
setWindowTitle(tr("About %1").arg(APP_NAME));
|
setWindowTitle(tr("About %1").arg(APP_NAME));
|
||||||
@ -81,7 +81,7 @@ void FormAbout::loadLicenseAndInformation() {
|
|||||||
QFile file;
|
QFile file;
|
||||||
text_stream.setDevice(&file);
|
text_stream.setDevice(&file);
|
||||||
|
|
||||||
file.setFileName(APP_INFO_PATH + "/COPYING_GNU_GPL_HTML");
|
file.setFileName(APP_INFO_PATH + QL1S("/COPYING_GNU_GPL_HTML"));
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
m_ui->m_txtLicenseGnu->setText(text_stream.readAll());
|
m_ui->m_txtLicenseGnu->setText(text_stream.readAll());
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ void FormAbout::loadLicenseAndInformation() {
|
|||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
file.setFileName(APP_INFO_PATH + "/COPYING_BSD");
|
file.setFileName(APP_INFO_PATH + QL1S("/COPYING_BSD"));
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
m_ui->m_txtLicenseBsd->setText(text_stream.readAll());
|
m_ui->m_txtLicenseBsd->setText(text_stream.readAll());
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ void FormAbout::loadLicenseAndInformation() {
|
|||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
file.setFileName(APP_INFO_PATH + "/CHANGELOG");
|
file.setFileName(APP_INFO_PATH + QL1S("/CHANGELOG"));
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
m_ui->m_txtChangelog->setText(text_stream.readAll());
|
m_ui->m_txtChangelog->setText(text_stream.readAll());
|
||||||
}
|
}
|
||||||
|
4
src/gui/formbackupdatabasesettings.cpp
Normal file → Executable file
4
src/gui/formbackupdatabasesettings.cpp
Normal file → Executable file
@ -32,7 +32,7 @@ FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget *parent) : QDialo
|
|||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->m_txtBackupName->lineEdit()->setPlaceholderText(tr("Common name for backup files"));
|
m_ui->m_txtBackupName->lineEdit()->setPlaceholderText(tr("Common name for backup files"));
|
||||||
|
|
||||||
setWindowIcon(qApp->icons()->fromTheme("document-export"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("document-export")));
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||||
|
|
||||||
connect(m_ui->m_checkBackupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
connect(m_ui->m_checkBackupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
||||||
@ -43,7 +43,7 @@ FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget *parent) : QDialo
|
|||||||
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
|
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
|
||||||
|
|
||||||
selectFolder(qApp->documentsFolderPath());
|
selectFolder(qApp->documentsFolderPath());
|
||||||
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + "_" + QDateTime::currentDateTime().toString("yyyyMMddHHmm"));
|
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + QL1S("_") + QDateTime::currentDateTime().toString(QSL("yyyyMMddHHmm")));
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
||||||
|
|
||||||
if (qApp->database()->activeDatabaseDriver() != DatabaseFactory::SQLITE &&
|
if (qApp->database()->activeDatabaseDriver() != DatabaseFactory::SQLITE &&
|
||||||
|
@ -175,7 +175,7 @@ void FormCategoryDetails::onLoadIconFromFile() {
|
|||||||
QFileDialog dialog(this, tr("Select icon file for the category"),
|
QFileDialog dialog(this, tr("Select icon file for the category"),
|
||||||
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
dialog.setWindowIcon(qApp->icons()->fromTheme("image-generic"));
|
dialog.setWindowIcon(qApp->icons()->fromTheme(QSL("image-generic")));
|
||||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||||
dialog.setViewMode(QFileDialog::Detail);
|
dialog.setViewMode(QFileDialog::Detail);
|
||||||
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
||||||
@ -191,7 +191,7 @@ void FormCategoryDetails::onLoadIconFromFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormCategoryDetails::onUseDefaultIcon() {
|
void FormCategoryDetails::onUseDefaultIcon() {
|
||||||
m_ui->m_btnIcon->setIcon(qApp->icons()->fromTheme("folder-category"));
|
m_ui->m_btnIcon->setIcon(qApp->icons()->fromTheme(QSL("folder-category")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormCategoryDetails::initialize() {
|
void FormCategoryDetails::initialize() {
|
||||||
@ -207,7 +207,7 @@ void FormCategoryDetails::initialize() {
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(qApp->icons()->fromTheme("folder-category"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("folder-category")));
|
||||||
|
|
||||||
// Setup button box.
|
// Setup button box.
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
@ -218,13 +218,13 @@ void FormCategoryDetails::initialize() {
|
|||||||
|
|
||||||
// Setup menu & actions for icon selection.
|
// Setup menu & actions for icon selection.
|
||||||
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
||||||
m_actionLoadIconFromFile = new QAction(qApp->icons()->fromTheme("image-generic"),
|
m_actionLoadIconFromFile = new QAction(qApp->icons()->fromTheme(QSL("image-generic")),
|
||||||
tr("Load icon from file..."),
|
tr("Load icon from file..."),
|
||||||
this);
|
this);
|
||||||
m_actionNoIcon = new QAction(qApp->icons()->fromTheme("dialog-cancel"),
|
m_actionNoIcon = new QAction(qApp->icons()->fromTheme(QSL("dialog-cancel")),
|
||||||
tr("Do not use icon"),
|
tr("Do not use icon"),
|
||||||
this);
|
this);
|
||||||
m_actionUseDefaultIcon = new QAction(qApp->icons()->fromTheme("folder-category"),
|
m_actionUseDefaultIcon = new QAction(qApp->icons()->fromTheme(QSL("folder-category")),
|
||||||
tr("Use default icon"),
|
tr("Use default icon"),
|
||||||
this);
|
this);
|
||||||
m_iconMenu->addAction(m_actionLoadIconFromFile);
|
m_iconMenu->addAction(m_actionLoadIconFromFile);
|
||||||
|
@ -29,7 +29,7 @@ FormDatabaseCleanup::FormDatabaseCleanup(QWidget *parent) : QDialog(parent), m_u
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(qApp->icons()->fromTheme("cleanup-database"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("cleanup-database")));
|
||||||
|
|
||||||
connect(m_ui->m_spinDays, SIGNAL(valueChanged(int)), this, SLOT(updateDaysSuffix(int)));
|
connect(m_ui->m_spinDays, SIGNAL(valueChanged(int)), this, SLOT(updateDaysSuffix(int)));
|
||||||
m_ui->m_spinDays->setValue(DEFAULT_DAYS_TO_DELETE_MSG);
|
m_ui->m_spinDays->setValue(DEFAULT_DAYS_TO_DELETE_MSG);
|
||||||
@ -122,10 +122,10 @@ void FormDatabaseCleanup::loadDatabaseInfo() {
|
|||||||
qint64 db_size = qApp->database()->getDatabaseSize();
|
qint64 db_size = qApp->database()->getDatabaseSize();
|
||||||
|
|
||||||
if (db_size > 0) {
|
if (db_size > 0) {
|
||||||
m_ui->m_txtFileSize->setText(QString::number(db_size / 1000000.0) + " MB");
|
m_ui->m_txtFileSize->setText(QString::number(db_size / 1000000.0) + QL1S(" MB"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_txtFileSize->setText("-");
|
m_ui->m_txtFileSize->setText(QSL("-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->m_txtDatabaseType->setText(qApp->database()->humanDriverName(qApp->database()->activeDatabaseDriver()));
|
m_ui->m_txtDatabaseType->setText(qApp->database()->humanDriverName(qApp->database()->activeDatabaseDriver()));
|
||||||
|
@ -199,7 +199,7 @@ void FormFeedDetails::onLoadIconFromFile() {
|
|||||||
QFileDialog dialog(this, tr("Select icon file for the feed"),
|
QFileDialog dialog(this, tr("Select icon file for the feed"),
|
||||||
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
dialog.setWindowIcon(qApp->icons()->fromTheme("image-generic"));
|
dialog.setWindowIcon(qApp->icons()->fromTheme(QSL("image-generic")));
|
||||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||||
dialog.setViewMode(QFileDialog::Detail);
|
dialog.setViewMode(QFileDialog::Detail);
|
||||||
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
dialog.setLabelText(QFileDialog::Accept, tr("Select icon"));
|
||||||
@ -215,7 +215,7 @@ void FormFeedDetails::onLoadIconFromFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::onUseDefaultIcon() {
|
void FormFeedDetails::onUseDefaultIcon() {
|
||||||
m_ui->m_btnIcon->setIcon(qApp->icons()->fromTheme("folder-feed"));
|
m_ui->m_btnIcon->setIcon(qApp->icons()->fromTheme(QSL("folder-feed")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::apply() {
|
void FormFeedDetails::apply() {
|
||||||
@ -379,7 +379,7 @@ void FormFeedDetails::initialize() {
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(qApp->icons()->fromTheme("folder-feed"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("folder-feed")));
|
||||||
|
|
||||||
// Setup button box.
|
// Setup button box.
|
||||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
@ -424,16 +424,16 @@ void FormFeedDetails::initialize() {
|
|||||||
|
|
||||||
// Setup menu & actions for icon selection.
|
// Setup menu & actions for icon selection.
|
||||||
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
m_iconMenu = new QMenu(tr("Icon selection"), this);
|
||||||
m_actionLoadIconFromFile = new QAction(qApp->icons()->fromTheme("image-generic"),
|
m_actionLoadIconFromFile = new QAction(qApp->icons()->fromTheme(QSL("image-generic")),
|
||||||
tr("Load icon from file..."),
|
tr("Load icon from file..."),
|
||||||
this);
|
this);
|
||||||
m_actionNoIcon = new QAction(qApp->icons()->fromTheme("dialog-cancel"),
|
m_actionNoIcon = new QAction(qApp->icons()->fromTheme(QSL("dialog-cancel")),
|
||||||
tr("Do not use icon"),
|
tr("Do not use icon"),
|
||||||
this);
|
this);
|
||||||
m_actionUseDefaultIcon = new QAction(qApp->icons()->fromTheme("folder-feed"),
|
m_actionUseDefaultIcon = new QAction(qApp->icons()->fromTheme(QSL("folder-feed")),
|
||||||
tr("Use default icon"),
|
tr("Use default icon"),
|
||||||
this);
|
this);
|
||||||
m_actionFetchIcon = new QAction(qApp->icons()->fromTheme("document-download"),
|
m_actionFetchIcon = new QAction(qApp->icons()->fromTheme(QSL("document-download")),
|
||||||
tr("Fetch icon from feed"),
|
tr("Fetch icon from feed"),
|
||||||
this);
|
this);
|
||||||
m_iconMenu->addAction(m_actionFetchIcon);
|
m_iconMenu->addAction(m_actionFetchIcon);
|
||||||
|
8
src/gui/formimportexport.cpp
Normal file → Executable file
8
src/gui/formimportexport.cpp
Normal file → Executable file
@ -60,7 +60,7 @@ void FormImportExport::setMode(const FeedsImportExportModel::Mode &mode) {
|
|||||||
m_ui->m_groupFile->setTitle(tr("Destination file"));
|
m_ui->m_groupFile->setTitle(tr("Destination file"));
|
||||||
m_ui->m_groupFeeds->setTitle(tr("Source feeds && categories"));
|
m_ui->m_groupFeeds->setTitle(tr("Source feeds && categories"));
|
||||||
setWindowTitle(tr("Export feeds"));
|
setWindowTitle(tr("Export feeds"));
|
||||||
setWindowIcon(qApp->icons()->fromTheme("document-export"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("document-export")));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ void FormImportExport::setMode(const FeedsImportExportModel::Mode &mode) {
|
|||||||
m_ui->m_groupFeeds->setTitle(tr("Target feeds && categories"));
|
m_ui->m_groupFeeds->setTitle(tr("Target feeds && categories"));
|
||||||
m_ui->m_groupFeeds->setDisabled(true);
|
m_ui->m_groupFeeds->setDisabled(true);
|
||||||
setWindowTitle(tr("Import feeds"));
|
setWindowTitle(tr("Import feeds"));
|
||||||
setWindowIcon(qApp->icons()->fromTheme("document-import"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,8 +112,8 @@ void FormImportExport::selectExportFile() {
|
|||||||
if (selected_filter == filter_opml20) {
|
if (selected_filter == filter_opml20) {
|
||||||
m_conversionType = OPML20;
|
m_conversionType = OPML20;
|
||||||
|
|
||||||
if (!selected_file.endsWith(".opml")) {
|
if (!selected_file.endsWith(QL1S(".opml"))) {
|
||||||
selected_file += ".opml";
|
selected_file += QL1S(".opml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// NOTE: Add other types here.
|
// NOTE: Add other types here.
|
||||||
|
@ -208,73 +208,73 @@ void FormMain::setupIcons() {
|
|||||||
IconFactory *icon_theme_factory = qApp->icons();
|
IconFactory *icon_theme_factory = qApp->icons();
|
||||||
|
|
||||||
// Setup icons of this main window.
|
// Setup icons of this main window.
|
||||||
m_ui->m_actionDownloadManager->setIcon(icon_theme_factory->fromTheme("download-manager"));
|
m_ui->m_actionDownloadManager->setIcon(icon_theme_factory->fromTheme(QSL("download-manager")));
|
||||||
m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme("application-settings"));
|
m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme(QSL("application-settings")));
|
||||||
m_ui->m_actionQuit->setIcon(icon_theme_factory->fromTheme("application-exit"));
|
m_ui->m_actionQuit->setIcon(icon_theme_factory->fromTheme(QSL("application-exit")));
|
||||||
m_ui->m_actionRestart->setIcon(icon_theme_factory->fromTheme("go-refresh"));
|
m_ui->m_actionRestart->setIcon(icon_theme_factory->fromTheme(QSL("go-refresh")));
|
||||||
m_ui->m_actionAboutGuard->setIcon(icon_theme_factory->fromTheme("application-about"));
|
m_ui->m_actionAboutGuard->setIcon(icon_theme_factory->fromTheme(QSL("application-about")));
|
||||||
m_ui->m_actionCheckForUpdates->setIcon(icon_theme_factory->fromTheme("check-for-updates"));
|
m_ui->m_actionCheckForUpdates->setIcon(icon_theme_factory->fromTheme(QSL("check-for-updates")));
|
||||||
m_ui->m_actionCleanupDatabase->setIcon(icon_theme_factory->fromTheme("cleanup-database"));
|
m_ui->m_actionCleanupDatabase->setIcon(icon_theme_factory->fromTheme(QSL("cleanup-database")));
|
||||||
m_ui->m_actionReportBugGitHub->setIcon(icon_theme_factory->fromTheme("application-report-bug"));
|
m_ui->m_actionReportBugGitHub->setIcon(icon_theme_factory->fromTheme(QSL("application-report-bug")));
|
||||||
m_ui->m_actionReportBugBitBucket->setIcon(icon_theme_factory->fromTheme("application-report-bug"));
|
m_ui->m_actionReportBugBitBucket->setIcon(icon_theme_factory->fromTheme(QSL("application-report-bug")));
|
||||||
m_ui->m_actionExportFeeds->setIcon(icon_theme_factory->fromTheme("document-export"));
|
m_ui->m_actionExportFeeds->setIcon(icon_theme_factory->fromTheme(QSL("document-export")));
|
||||||
m_ui->m_actionImportFeeds->setIcon(icon_theme_factory->fromTheme("document-import"));
|
m_ui->m_actionImportFeeds->setIcon(icon_theme_factory->fromTheme(QSL("document-import")));
|
||||||
m_ui->m_actionBackupDatabaseSettings->setIcon(icon_theme_factory->fromTheme("document-export"));
|
m_ui->m_actionBackupDatabaseSettings->setIcon(icon_theme_factory->fromTheme(QSL("document-export")));
|
||||||
m_ui->m_actionRestoreDatabaseSettings->setIcon(icon_theme_factory->fromTheme("document-import"));
|
m_ui->m_actionRestoreDatabaseSettings->setIcon(icon_theme_factory->fromTheme(QSL("document-import")));
|
||||||
m_ui->m_actionDonate->setIcon(icon_theme_factory->fromTheme("application-donate"));
|
m_ui->m_actionDonate->setIcon(icon_theme_factory->fromTheme(QSL("application-donate")));
|
||||||
m_ui->m_actionDisplayWiki->setIcon(icon_theme_factory->fromTheme("application-wiki"));
|
m_ui->m_actionDisplayWiki->setIcon(icon_theme_factory->fromTheme(QSL("application-wiki")));
|
||||||
|
|
||||||
// View.
|
// View.
|
||||||
m_ui->m_actionSwitchMainWindow->setIcon(icon_theme_factory->fromTheme("view-switch-window"));
|
m_ui->m_actionSwitchMainWindow->setIcon(icon_theme_factory->fromTheme(QSL("view-switch-window")));
|
||||||
m_ui->m_actionFullscreen->setIcon(icon_theme_factory->fromTheme("view-fullscreen"));
|
m_ui->m_actionFullscreen->setIcon(icon_theme_factory->fromTheme(QSL("view-fullscreen")));
|
||||||
m_ui->m_actionSwitchFeedsList->setIcon(icon_theme_factory->fromTheme("view-switch-list"));
|
m_ui->m_actionSwitchFeedsList->setIcon(icon_theme_factory->fromTheme(QSL("view-switch-list")));
|
||||||
m_ui->m_actionSwitchMainMenu->setIcon(icon_theme_factory->fromTheme("view-switch-menu"));
|
m_ui->m_actionSwitchMainMenu->setIcon(icon_theme_factory->fromTheme(QSL("view-switch-menu")));
|
||||||
m_ui->m_actionSwitchToolBars->setIcon(icon_theme_factory->fromTheme("view-switch-list"));
|
m_ui->m_actionSwitchToolBars->setIcon(icon_theme_factory->fromTheme(QSL("view-switch-list")));
|
||||||
m_ui->m_actionSwitchListHeaders->setIcon(icon_theme_factory->fromTheme("view-switch-list"));
|
m_ui->m_actionSwitchListHeaders->setIcon(icon_theme_factory->fromTheme(QSL("view-switch-list")));
|
||||||
m_ui->m_actionSwitchMessageListOrientation->setIcon(icon_theme_factory->fromTheme("view-switch-layout-direction"));
|
m_ui->m_actionSwitchMessageListOrientation->setIcon(icon_theme_factory->fromTheme(QSL("view-switch-layout-direction")));
|
||||||
m_ui->m_menuShowHide->setIcon(icon_theme_factory->fromTheme("view-switch"));
|
m_ui->m_menuShowHide->setIcon(icon_theme_factory->fromTheme(QSL("view-switch")));
|
||||||
|
|
||||||
// Recycle bin.
|
// Recycle bin.
|
||||||
m_ui->m_actionEmptyRecycleBin->setIcon(icon_theme_factory->fromTheme("recycle-bin-empty"));
|
m_ui->m_actionEmptyRecycleBin->setIcon(icon_theme_factory->fromTheme(QSL("recycle-bin-empty")));
|
||||||
m_ui->m_actionRestoreRecycleBin->setIcon(icon_theme_factory->fromTheme("recycle-bin-restore-all"));
|
m_ui->m_actionRestoreRecycleBin->setIcon(icon_theme_factory->fromTheme(QSL("recycle-bin-restore-all")));
|
||||||
m_ui->m_actionRestoreSelectedMessagesFromRecycleBin->setIcon(icon_theme_factory->fromTheme("recycle-bin-restore-one"));
|
m_ui->m_actionRestoreSelectedMessagesFromRecycleBin->setIcon(icon_theme_factory->fromTheme(QSL("recycle-bin-restore-one")));
|
||||||
|
|
||||||
// Web browser.
|
// Web browser.
|
||||||
m_ui->m_actionAddBrowser->setIcon(icon_theme_factory->fromTheme("list-add"));
|
m_ui->m_actionAddBrowser->setIcon(icon_theme_factory->fromTheme(QSL("list-add")));
|
||||||
m_ui->m_actionCloseCurrentTab->setIcon(icon_theme_factory->fromTheme("list-remove"));
|
m_ui->m_actionCloseCurrentTab->setIcon(icon_theme_factory->fromTheme(QSL("list-remove")));
|
||||||
m_ui->m_actionCloseAllTabs->setIcon(icon_theme_factory->fromTheme("list-remove"));
|
m_ui->m_actionCloseAllTabs->setIcon(icon_theme_factory->fromTheme(QSL("list-remove")));
|
||||||
m_ui->m_menuCurrentTab->setIcon(icon_theme_factory->fromTheme("list-current"));
|
m_ui->m_menuCurrentTab->setIcon(icon_theme_factory->fromTheme(QSL("list-current")));
|
||||||
m_ui->m_menuWebSettings->setIcon(icon_theme_factory->fromTheme("application-settings"));
|
m_ui->m_menuWebSettings->setIcon(icon_theme_factory->fromTheme(QSL("application-settings")));
|
||||||
m_ui->m_actionWebAutoloadImages->setIcon(icon_theme_factory->fromTheme("image-generic"));
|
m_ui->m_actionWebAutoloadImages->setIcon(icon_theme_factory->fromTheme(QSL("image-generic")));
|
||||||
m_ui->m_actionWebEnableExternalPlugins->setIcon(icon_theme_factory->fromTheme("web-flash"));
|
m_ui->m_actionWebEnableExternalPlugins->setIcon(icon_theme_factory->fromTheme(QSL("web-flash")));
|
||||||
m_ui->m_actionWebEnableJavascript->setIcon(icon_theme_factory->fromTheme("web-javascript"));
|
m_ui->m_actionWebEnableJavascript->setIcon(icon_theme_factory->fromTheme(QSL("web-javascript")));
|
||||||
|
|
||||||
// Feeds/messages.
|
// Feeds/messages.
|
||||||
m_ui->m_menuAddItem->setIcon(icon_theme_factory->fromTheme("item-new"));
|
m_ui->m_menuAddItem->setIcon(icon_theme_factory->fromTheme(QSL("item-new")));
|
||||||
m_ui->m_actionUpdateAllFeeds->setIcon(icon_theme_factory->fromTheme("item-update-all"));
|
m_ui->m_actionUpdateAllFeeds->setIcon(icon_theme_factory->fromTheme(QSL("item-update-all")));
|
||||||
m_ui->m_actionUpdateSelectedFeeds->setIcon(icon_theme_factory->fromTheme("item-update-selected"));
|
m_ui->m_actionUpdateSelectedFeeds->setIcon(icon_theme_factory->fromTheme(QSL("item-update-selected")));
|
||||||
m_ui->m_actionClearSelectedFeeds->setIcon(icon_theme_factory->fromTheme("mail-remove"));
|
m_ui->m_actionClearSelectedFeeds->setIcon(icon_theme_factory->fromTheme(QSL("mail-remove")));
|
||||||
m_ui->m_actionClearAllFeeds->setIcon(icon_theme_factory->fromTheme("mail-remove"));
|
m_ui->m_actionClearAllFeeds->setIcon(icon_theme_factory->fromTheme(QSL("mail-remove")));
|
||||||
m_ui->m_actionDeleteSelectedFeedCategory->setIcon(icon_theme_factory->fromTheme("item-remove"));
|
m_ui->m_actionDeleteSelectedFeedCategory->setIcon(icon_theme_factory->fromTheme(QSL("item-remove")));
|
||||||
m_ui->m_actionDeleteSelectedMessages->setIcon(icon_theme_factory->fromTheme("mail-remove"));
|
m_ui->m_actionDeleteSelectedMessages->setIcon(icon_theme_factory->fromTheme(QSL("mail-remove")));
|
||||||
m_ui->m_actionAddCategory->setIcon(icon_theme_factory->fromTheme("folder-category"));
|
m_ui->m_actionAddCategory->setIcon(icon_theme_factory->fromTheme(QSL("folder-category")));
|
||||||
m_ui->m_actionAddFeed->setIcon(icon_theme_factory->fromTheme("folder-feed"));
|
m_ui->m_actionAddFeed->setIcon(icon_theme_factory->fromTheme(QSL("folder-feed")));
|
||||||
m_ui->m_actionEditSelectedFeedCategory->setIcon(icon_theme_factory->fromTheme("item-edit"));
|
m_ui->m_actionEditSelectedFeedCategory->setIcon(icon_theme_factory->fromTheme(QSL("item-edit")));
|
||||||
m_ui->m_actionMarkAllFeedsRead->setIcon(icon_theme_factory->fromTheme("mail-mark-read"));
|
m_ui->m_actionMarkAllFeedsRead->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-read")));
|
||||||
m_ui->m_actionMarkSelectedFeedsAsRead->setIcon(icon_theme_factory->fromTheme("mail-mark-read"));
|
m_ui->m_actionMarkSelectedFeedsAsRead->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-read")));
|
||||||
m_ui->m_actionMarkSelectedFeedsAsUnread->setIcon(icon_theme_factory->fromTheme("mail-mark-unread"));
|
m_ui->m_actionMarkSelectedFeedsAsUnread->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-unread")));
|
||||||
m_ui->m_actionMarkSelectedMessagesAsRead->setIcon(icon_theme_factory->fromTheme("mail-mark-read"));
|
m_ui->m_actionMarkSelectedMessagesAsRead->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-read")));
|
||||||
m_ui->m_actionMarkSelectedMessagesAsUnread->setIcon(icon_theme_factory->fromTheme("mail-mark-unread"));
|
m_ui->m_actionMarkSelectedMessagesAsUnread->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-unread")));
|
||||||
m_ui->m_actionSwitchImportanceOfSelectedMessages->setIcon(icon_theme_factory->fromTheme("mail-mark-favorite"));
|
m_ui->m_actionSwitchImportanceOfSelectedMessages->setIcon(icon_theme_factory->fromTheme(QSL("mail-mark-favorite")));
|
||||||
m_ui->m_actionOpenSelectedSourceArticlesInternally->setIcon(icon_theme_factory->fromTheme("item-open-internal"));
|
m_ui->m_actionOpenSelectedSourceArticlesInternally->setIcon(icon_theme_factory->fromTheme(QSL("item-open-internal")));
|
||||||
m_ui->m_actionOpenSelectedSourceArticlesExternally->setIcon(icon_theme_factory->fromTheme("item-open-external"));
|
m_ui->m_actionOpenSelectedSourceArticlesExternally->setIcon(icon_theme_factory->fromTheme(QSL("item-open-external")));
|
||||||
m_ui->m_actionOpenSelectedMessagesInternally->setIcon(icon_theme_factory->fromTheme("item-open-internal"));
|
m_ui->m_actionOpenSelectedMessagesInternally->setIcon(icon_theme_factory->fromTheme(QSL("item-open-internal")));
|
||||||
m_ui->m_actionSendMessageViaEmail->setIcon(icon_theme_factory->fromTheme("item-send-email"));
|
m_ui->m_actionSendMessageViaEmail->setIcon(icon_theme_factory->fromTheme(QSL("item-send-email")));
|
||||||
m_ui->m_actionViewSelectedItemsNewspaperMode->setIcon(icon_theme_factory->fromTheme("item-newspaper"));
|
m_ui->m_actionViewSelectedItemsNewspaperMode->setIcon(icon_theme_factory->fromTheme(QSL("item-newspaper")));
|
||||||
m_ui->m_actionSelectNextFeedCategory->setIcon(icon_theme_factory->fromTheme("go-down"));
|
m_ui->m_actionSelectNextFeedCategory->setIcon(icon_theme_factory->fromTheme(QSL("go-down")));
|
||||||
m_ui->m_actionSelectPreviousFeedCategory->setIcon(icon_theme_factory->fromTheme("go-up"));
|
m_ui->m_actionSelectPreviousFeedCategory->setIcon(icon_theme_factory->fromTheme(QSL("go-up")));
|
||||||
m_ui->m_actionSelectNextMessage->setIcon(icon_theme_factory->fromTheme("go-down"));
|
m_ui->m_actionSelectNextMessage->setIcon(icon_theme_factory->fromTheme(QSL("go-down")));
|
||||||
m_ui->m_actionSelectPreviousMessage->setIcon(icon_theme_factory->fromTheme("go-up"));
|
m_ui->m_actionSelectPreviousMessage->setIcon(icon_theme_factory->fromTheme(QSL("go-up")));
|
||||||
|
|
||||||
// Setup icons for underlying components: opened web browsers...
|
// Setup icons for underlying components: opened web browsers...
|
||||||
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
|
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
|
||||||
|
2
src/gui/formrestoredatabasesettings.cpp
Normal file → Executable file
2
src/gui/formrestoredatabasesettings.cpp
Normal file → Executable file
@ -32,7 +32,7 @@ FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent)
|
|||||||
m_btnRestart = m_ui->m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole);
|
m_btnRestart = m_ui->m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole);
|
||||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
||||||
|
|
||||||
setWindowIcon(qApp->icons()->fromTheme("document-import"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||||
|
|
||||||
connect(m_btnRestart, SIGNAL(clicked()), qApp, SLOT(restart()));
|
connect(m_btnRestart, SIGNAL(clicked()), qApp, SLOT(restart()));
|
||||||
|
@ -56,7 +56,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(qApp->icons()->fromTheme("application-settings"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("application-settings")));
|
||||||
|
|
||||||
m_ui->m_editorMessagesToolbar->activeItemsWidget()->viewport()->installEventFilter(this);
|
m_ui->m_editorMessagesToolbar->activeItemsWidget()->viewport()->installEventFilter(this);
|
||||||
m_ui->m_editorFeedsToolbar->activeItemsWidget()->viewport()->installEventFilter(this);
|
m_ui->m_editorFeedsToolbar->activeItemsWidget()->viewport()->installEventFilter(this);
|
||||||
@ -257,9 +257,9 @@ void FormSettings::loadFeedsMessages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FormSettings::initializeMessageDateFormats() {
|
void FormSettings::initializeMessageDateFormats() {
|
||||||
QStringList best_formats; best_formats << "d/M/yyyy hh:mm:ss" << "ddd, d. M. yy hh:mm:ss" <<
|
QStringList best_formats; best_formats << QSL("d/M/yyyy hh:mm:ss") << QSL("ddd, d. M. yy hh:mm:ss") <<
|
||||||
"yyyy-MM-dd HH:mm:ss.z" << "yyyy-MM-ddThh:mm:ss" <<
|
QSL("yyyy-MM-dd HH:mm:ss.z") << QSL("yyyy-MM-ddThh:mm:ss") <<
|
||||||
"MMM d yyyy hh:mm:ss";;
|
QSL("MMM d yyyy hh:mm:ss");;
|
||||||
QLocale current_locale = qApp->localization()->loadedLocale();
|
QLocale current_locale = qApp->localization()->loadedLocale();
|
||||||
QDateTime current_dt = QDateTime::currentDateTime();
|
QDateTime current_dt = QDateTime::currentDateTime();
|
||||||
|
|
||||||
@ -312,20 +312,20 @@ bool FormSettings::doSaveCheck() {
|
|||||||
// properties.
|
// properties.
|
||||||
if (m_ui->m_grpCustomExternalBrowser->isChecked() &&
|
if (m_ui->m_grpCustomExternalBrowser->isChecked() &&
|
||||||
(m_ui->m_txtExternalBrowserExecutable->text().simplified().isEmpty() ||
|
(m_ui->m_txtExternalBrowserExecutable->text().simplified().isEmpty() ||
|
||||||
!m_ui->m_txtExternalBrowserArguments->text().simplified().contains("%1"))) {
|
!m_ui->m_txtExternalBrowserArguments->text().simplified().contains(QL1S("%1")))) {
|
||||||
everything_ok = false;
|
everything_ok = false;
|
||||||
resulting_information.append(tr("custom external browser is not set correctly"));
|
resulting_information.append(tr("custom external browser is not set correctly"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!everything_ok) {
|
if (!everything_ok) {
|
||||||
resulting_information.replaceInStrings(QRegExp("^"), QString::fromUtf8(" • "));
|
resulting_information.replaceInStrings(QRegExp(QSL("^")), QString::fromUtf8(" • "));
|
||||||
|
|
||||||
MessageBox::show(this,
|
MessageBox::show(this,
|
||||||
QMessageBox::Critical,
|
QMessageBox::Critical,
|
||||||
tr("Cannot save settings"),
|
tr("Cannot save settings"),
|
||||||
tr("Some critical settings are not set. You must fix these settings in order confirm new settings."),
|
tr("Some critical settings are not set. You must fix these settings in order confirm new settings."),
|
||||||
QString(),
|
QString(),
|
||||||
tr("List of errors:\n%1.").arg(resulting_information.join(",\n")));
|
tr("List of errors:\n%1.").arg(resulting_information.join(QSL(",\n"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return everything_ok;
|
return everything_ok;
|
||||||
@ -333,7 +333,7 @@ bool FormSettings::doSaveCheck() {
|
|||||||
|
|
||||||
void FormSettings::promptForRestart() {
|
void FormSettings::promptForRestart() {
|
||||||
if (!m_changedDataTexts.isEmpty()) {
|
if (!m_changedDataTexts.isEmpty()) {
|
||||||
QStringList changed_settings_description = m_changedDataTexts.replaceInStrings(QRegExp("^"), QString::fromUtf8(" • "));
|
QStringList changed_settings_description = m_changedDataTexts.replaceInStrings(QRegExp(QSL("^")), QString::fromUtf8(" • "));
|
||||||
|
|
||||||
QMessageBox::StandardButton clicked_button = MessageBox::show(this,
|
QMessageBox::StandardButton clicked_button = MessageBox::show(this,
|
||||||
QMessageBox::Question,
|
QMessageBox::Question,
|
||||||
@ -341,7 +341,7 @@ void FormSettings::promptForRestart() {
|
|||||||
tr("Some critical settings were changed and will be applied after the application gets restarted. "
|
tr("Some critical settings were changed and will be applied after the application gets restarted. "
|
||||||
"\n\nYou have to restart manually."),
|
"\n\nYou have to restart manually."),
|
||||||
tr("Do you want to restart now?"),
|
tr("Do you want to restart now?"),
|
||||||
tr("List of changes:\n%1.").arg(changed_settings_description .join(",\n")),
|
tr("List of changes:\n%1.").arg(changed_settings_description .join(QSL(",\n"))),
|
||||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
|
|
||||||
if (clicked_button == QMessageBox::Yes) {
|
if (clicked_button == QMessageBox::Yes) {
|
||||||
@ -395,7 +395,7 @@ void FormSettings::loadBrowser() {
|
|||||||
// Load settings of web browser GUI.
|
// Load settings of web browser GUI.
|
||||||
m_ui->m_checkMouseGestures->setChecked(settings->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool());
|
m_ui->m_checkMouseGestures->setChecked(settings->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool());
|
||||||
m_ui->m_checkQueueTabs->setChecked(settings->value(GROUP(Browser), SETTING(Browser::QueueTabs)).toBool());
|
m_ui->m_checkQueueTabs->setChecked(settings->value(GROUP(Browser), SETTING(Browser::QueueTabs)).toBool());
|
||||||
m_ui->m_cmbExternalBrowserPreset->addItem(tr("Opera 12 or older"), "-nosession %1");
|
m_ui->m_cmbExternalBrowserPreset->addItem(tr("Opera 12 or older"), QSL("-nosession %1"));
|
||||||
m_ui->m_txtExternalBrowserExecutable->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString());
|
m_ui->m_txtExternalBrowserExecutable->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString());
|
||||||
m_ui->m_txtExternalBrowserArguments->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString());
|
m_ui->m_txtExternalBrowserArguments->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString());
|
||||||
m_ui->m_grpCustomExternalBrowser->setChecked(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool());
|
m_ui->m_grpCustomExternalBrowser->setChecked(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool());
|
||||||
@ -404,7 +404,7 @@ void FormSettings::loadBrowser() {
|
|||||||
m_ui->m_checkEnablePlugins->setChecked(WebFactory::instance()->pluginsEnabled());
|
m_ui->m_checkEnablePlugins->setChecked(WebFactory::instance()->pluginsEnabled());
|
||||||
|
|
||||||
// Load settings of e-mail.
|
// Load settings of e-mail.
|
||||||
m_ui->m_cmbExternalEmailPreset->addItem(tr("Mozilla Thunderbird"), "-compose \"subject='%1',body='%2'\"");
|
m_ui->m_cmbExternalEmailPreset->addItem(tr("Mozilla Thunderbird"), QSL("-compose \"subject='%1',body='%2'\""));
|
||||||
m_ui->m_txtExternalEmailExecutable->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString());
|
m_ui->m_txtExternalEmailExecutable->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString());
|
||||||
m_ui->m_txtExternalEmailArguments->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString());
|
m_ui->m_txtExternalEmailArguments->setText(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString());
|
||||||
m_ui->m_grpCustomExternalEmail->setChecked(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailEnabled)).toBool());
|
m_ui->m_grpCustomExternalEmail->setChecked(settings->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailEnabled)).toBool());
|
||||||
@ -733,7 +733,7 @@ void FormSettings::loadInterface() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark active theme.
|
// Mark active theme.
|
||||||
if (current_theme == APP_NO_THEME) {
|
if (current_theme == QSL(APP_NO_THEME)) {
|
||||||
// Because "no icon theme" lies at the index 0.
|
// Because "no icon theme" lies at the index 0.
|
||||||
m_ui->m_cmbIconTheme->setCurrentIndex(0);
|
m_ui->m_cmbIconTheme->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ FormUpdate::FormUpdate(QWidget *parent)
|
|||||||
|
|
||||||
// Set flags and attributes.
|
// Set flags and attributes.
|
||||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
|
||||||
setWindowIcon(qApp->icons()->fromTheme("application-about"));
|
setWindowIcon(qApp->icons()->fromTheme(QSL("application-about")));
|
||||||
|
|
||||||
m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
|
m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
|
||||||
m_btnUpdate->setToolTip(tr("Download new installation files."));
|
m_btnUpdate->setToolTip(tr("Download new installation files."));
|
||||||
|
@ -29,7 +29,6 @@ LocationLineEdit::LocationLineEdit(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LocationLineEdit::~LocationLineEdit() {
|
LocationLineEdit::~LocationLineEdit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationLineEdit::focusOutEvent(QFocusEvent *event) {
|
void LocationLineEdit::focusOutEvent(QFocusEvent *event) {
|
||||||
|
@ -52,22 +52,22 @@ void MessageBox::iconify(QDialogButtonBox *button_box) {
|
|||||||
QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
|
QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case QMessageBox::Ok:
|
case QMessageBox::Ok:
|
||||||
return qApp->icons()->fromTheme("dialog-ok");
|
return qApp->icons()->fromTheme(QSL("dialog-ok"));
|
||||||
|
|
||||||
case QMessageBox::Cancel:
|
case QMessageBox::Cancel:
|
||||||
case QMessageBox::Close:
|
case QMessageBox::Close:
|
||||||
return qApp->icons()->fromTheme("dialog-cancel");
|
return qApp->icons()->fromTheme(QSL("dialog-cancel"));
|
||||||
|
|
||||||
case QMessageBox::Yes:
|
case QMessageBox::Yes:
|
||||||
case QMessageBox::YesToAll:
|
case QMessageBox::YesToAll:
|
||||||
return qApp->icons()->fromTheme("dialog-yes");
|
return qApp->icons()->fromTheme(QSL("dialog-yes"));
|
||||||
|
|
||||||
case QMessageBox::No:
|
case QMessageBox::No:
|
||||||
case QMessageBox::NoToAll:
|
case QMessageBox::NoToAll:
|
||||||
return qApp->icons()->fromTheme("dialog-no");
|
return qApp->icons()->fromTheme(QSL("dialog-no"));
|
||||||
|
|
||||||
case QMessageBox::Help:
|
case QMessageBox::Help:
|
||||||
return qApp->icons()->fromTheme("dialog-question");
|
return qApp->icons()->fromTheme(QSL("dialog-question"));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QIcon();
|
return QIcon();
|
||||||
@ -78,16 +78,16 @@ QIcon MessageBox::iconForRole(QDialogButtonBox::StandardButton button) {
|
|||||||
QIcon MessageBox::iconForStatus(QMessageBox::Icon status) {
|
QIcon MessageBox::iconForStatus(QMessageBox::Icon status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case QMessageBox::Information:
|
case QMessageBox::Information:
|
||||||
return qApp->icons()->fromTheme("dialog-information");
|
return qApp->icons()->fromTheme(QSL("dialog-information"));
|
||||||
|
|
||||||
case QMessageBox::Warning:
|
case QMessageBox::Warning:
|
||||||
return qApp->icons()->fromTheme("dialog-warning");
|
return qApp->icons()->fromTheme(QSL("dialog-warning"));
|
||||||
|
|
||||||
case QMessageBox::Critical:
|
case QMessageBox::Critical:
|
||||||
return qApp->icons()->fromTheme("dialog-error");
|
return qApp->icons()->fromTheme(QSL("dialog-error"));
|
||||||
|
|
||||||
case QMessageBox::Question:
|
case QMessageBox::Question:
|
||||||
return qApp->icons()->fromTheme("dialog-question");
|
return qApp->icons()->fromTheme(QSL("dialog-question"));
|
||||||
|
|
||||||
case QMessageBox::NoIcon:
|
case QMessageBox::NoIcon:
|
||||||
default:
|
default:
|
||||||
|
@ -52,7 +52,7 @@ QList<QAction*> MessagesToolBar::changeableActions() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessagesToolBar::saveChangeableActions(const QStringList& actions) {
|
void MessagesToolBar::saveChangeableActions(const QStringList& actions) {
|
||||||
qApp->settings()->setValue(GROUP(GUI), GUI::MessagesToolbarDefaultButtons, actions.join(","));
|
qApp->settings()->setValue(GROUP(GUI), GUI::MessagesToolbarDefaultButtons, actions.join(QSL(",")));
|
||||||
loadChangeableActions(actions);
|
loadChangeableActions(actions);
|
||||||
|
|
||||||
// If user hidden search messages box, then remove the filter.
|
// If user hidden search messages box, then remove the filter.
|
||||||
@ -92,7 +92,7 @@ void MessagesToolBar::loadChangeableActions(const QStringList& actions) {
|
|||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
QAction *action = addWidget(spacer);
|
QAction *action = addWidget(spacer);
|
||||||
action->setIcon(qApp->icons()->fromTheme("view-spacer"));
|
action->setIcon(qApp->icons()->fromTheme(QSL("view-spacer")));
|
||||||
action->setProperty("type", SPACER_ACTION_NAME);
|
action->setProperty("type", SPACER_ACTION_NAME);
|
||||||
action->setProperty("name", tr("Toolbar spacer"));
|
action->setProperty("name", tr("Toolbar spacer"));
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ void MessagesToolBar::initializeSearchBox() {
|
|||||||
// Setup wrapping action for search box.
|
// Setup wrapping action for search box.
|
||||||
m_actionSearchMessages = new QWidgetAction(this);
|
m_actionSearchMessages = new QWidgetAction(this);
|
||||||
m_actionSearchMessages->setDefaultWidget(m_txtSearchMessages);
|
m_actionSearchMessages->setDefaultWidget(m_txtSearchMessages);
|
||||||
m_actionSearchMessages->setIcon(qApp->icons()->fromTheme("item-search"));
|
m_actionSearchMessages->setIcon(qApp->icons()->fromTheme(QSL("item-search")));
|
||||||
m_actionSearchMessages->setProperty("type", SEACRH_MESSAGES_ACTION_NAME);
|
m_actionSearchMessages->setProperty("type", SEACRH_MESSAGES_ACTION_NAME);
|
||||||
m_actionSearchMessages->setProperty("name", tr("Message search box"));
|
m_actionSearchMessages->setProperty("name", tr("Message search box"));
|
||||||
|
|
||||||
@ -124,18 +124,18 @@ void MessagesToolBar::initializeSearchBox() {
|
|||||||
|
|
||||||
void MessagesToolBar::initializeHighlighter() {
|
void MessagesToolBar::initializeHighlighter() {
|
||||||
m_menuMessageHighlighter = new QMenu(tr("Menu for highlighting messages"), this);
|
m_menuMessageHighlighter = new QMenu(tr("Menu for highlighting messages"), this);
|
||||||
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme("mail-mark-read"),
|
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme(QSL("mail-mark-read")),
|
||||||
tr("No extra highlighting"))->setData(QVariant::fromValue(MessagesModel::NoHighlighting));
|
tr("No extra highlighting"))->setData(QVariant::fromValue(MessagesModel::NoHighlighting));
|
||||||
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme("mail-mark-unread"),
|
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme(QSL("mail-mark-unread")),
|
||||||
tr("Highlight unread messages"))->setData(QVariant::fromValue(MessagesModel::HighlightUnread));
|
tr("Highlight unread messages"))->setData(QVariant::fromValue(MessagesModel::HighlightUnread));
|
||||||
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme("mail-mark-favorite"),
|
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme(QSL("mail-mark-favorite")),
|
||||||
tr("Highlight important messages"))->setData(QVariant::fromValue(MessagesModel::HighlightImportant));
|
tr("Highlight important messages"))->setData(QVariant::fromValue(MessagesModel::HighlightImportant));
|
||||||
|
|
||||||
m_btnMessageHighlighter = new QToolButton(this);
|
m_btnMessageHighlighter = new QToolButton(this);
|
||||||
m_btnMessageHighlighter->setToolTip(tr("Display all messages"));
|
m_btnMessageHighlighter->setToolTip(tr("Display all messages"));
|
||||||
m_btnMessageHighlighter->setMenu(m_menuMessageHighlighter);
|
m_btnMessageHighlighter->setMenu(m_menuMessageHighlighter);
|
||||||
m_btnMessageHighlighter->setPopupMode(QToolButton::MenuButtonPopup);
|
m_btnMessageHighlighter->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
m_btnMessageHighlighter->setIcon(qApp->icons()->fromTheme("mail-mark-read"));
|
m_btnMessageHighlighter->setIcon(qApp->icons()->fromTheme(QSL("mail-mark-read")));
|
||||||
|
|
||||||
m_actionMessageHighlighter = new QWidgetAction(this);
|
m_actionMessageHighlighter = new QWidgetAction(this);
|
||||||
m_actionMessageHighlighter->setDefaultWidget(m_btnMessageHighlighter);
|
m_actionMessageHighlighter->setDefaultWidget(m_btnMessageHighlighter);
|
||||||
|
@ -241,6 +241,14 @@ void MessagesView::loadFeeds(const FeedsSelection &selection) {
|
|||||||
Qt::SortOrder ord = static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderMessages)).toInt());
|
Qt::SortOrder ord = static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderMessages)).toInt());
|
||||||
|
|
||||||
sortByColumn(col, ord);
|
sortByColumn(col, ord);
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
// Messages are loaded, make sure that previously
|
||||||
|
// active message is not shown in browser.
|
||||||
|
// BUG: Qt 5 is probably bugged here. Selections
|
||||||
|
// should be cleared automatically when SQL model is reset.
|
||||||
|
emit currentMessagesRemoved();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesView::openSelectedSourceMessagesExternally() {
|
void MessagesView::openSelectedSourceMessagesExternally() {
|
||||||
|
@ -39,7 +39,7 @@ StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
|||||||
// Initializations of widgets for status bar.
|
// Initializations of widgets for status bar.
|
||||||
m_fullscreenSwitcher = new PlainToolButton(this);
|
m_fullscreenSwitcher = new PlainToolButton(this);
|
||||||
m_fullscreenSwitcher->setCheckable(true);
|
m_fullscreenSwitcher->setCheckable(true);
|
||||||
m_fullscreenSwitcher->setIcon(qApp->icons()->fromTheme("view-fullscreen"));
|
m_fullscreenSwitcher->setIcon(qApp->icons()->fromTheme(QSL("view-fullscreen")));
|
||||||
m_fullscreenSwitcher->setText(tr("Fullscreen mode"));
|
m_fullscreenSwitcher->setText(tr("Fullscreen mode"));
|
||||||
m_fullscreenSwitcher->setToolTip(tr("Switch application between fulscreen/normal states right from this status bar icon."));
|
m_fullscreenSwitcher->setToolTip(tr("Switch application between fulscreen/normal states right from this status bar icon."));
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ bool TrayIconMenu::event(QEvent *event) {
|
|||||||
if (Application::activeModalWidget() != NULL &&
|
if (Application::activeModalWidget() != NULL &&
|
||||||
event->type() == QEvent::Show) {
|
event->type() == QEvent::Show) {
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
qApp->trayIcon()->showMessage(APP_LONG_NAME,
|
qApp->trayIcon()->showMessage(QSL(APP_LONG_NAME),
|
||||||
tr("Close opened modal dialogs first."),
|
tr("Close opened modal dialogs first."),
|
||||||
QSystemTrayIcon::Warning);
|
QSystemTrayIcon::Warning);
|
||||||
}
|
}
|
||||||
@ -118,11 +118,11 @@ void SystemTrayIcon::show() {
|
|||||||
|
|
||||||
void SystemTrayIcon::setNumber(int number, bool any_unread_message) {
|
void SystemTrayIcon::setNumber(int number, bool any_unread_message) {
|
||||||
if (number <= 0) {
|
if (number <= 0) {
|
||||||
setToolTip(APP_LONG_NAME);
|
setToolTip(QSL(APP_LONG_NAME));
|
||||||
QSystemTrayIcon::setIcon(QIcon(m_normalIcon));
|
QSystemTrayIcon::setIcon(QIcon(m_normalIcon));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setToolTip(tr("%1\nUnread news: %2").arg(APP_LONG_NAME, QString::number(number)));
|
setToolTip(tr("%1\nUnread news: %2").arg(QSL(APP_LONG_NAME), QString::number(number)));
|
||||||
|
|
||||||
QPixmap background(m_plainPixmap);
|
QPixmap background(m_plainPixmap);
|
||||||
QPainter tray_painter;
|
QPainter tray_painter;
|
||||||
@ -179,6 +179,5 @@ void SystemTrayIcon::showMessage(const QString &title, const QString &message, Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: If connections do not work, then use QMetaObject::invokeMethod(...).
|
// NOTE: If connections do not work, then use QMetaObject::invokeMethod(...).
|
||||||
|
|
||||||
QSystemTrayIcon::showMessage(title, message, icon, milliseconds_timeout_hint);
|
QSystemTrayIcon::showMessage(title, message, icon, milliseconds_timeout_hint);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ void TabBar::setTabType(int index, const TabBar::TabType &type) {
|
|||||||
case TabBar::Closable: {
|
case TabBar::Closable: {
|
||||||
PlainToolButton *close_button = new PlainToolButton(this);
|
PlainToolButton *close_button = new PlainToolButton(this);
|
||||||
|
|
||||||
close_button->setIcon(qApp->icons()->fromTheme("application-exit"));
|
close_button->setIcon(qApp->icons()->fromTheme(QSL("application-exit")));
|
||||||
close_button->setToolTip(tr("Close this tab."));
|
close_button->setToolTip(tr("Close this tab."));
|
||||||
close_button->setText(tr("Close tab"));
|
close_button->setText(tr("Close tab"));
|
||||||
close_button->setFixedSize(iconSize());
|
close_button->setFixedSize(iconSize());
|
||||||
|
@ -48,7 +48,7 @@ void TabWidget::setupCornerButton() {
|
|||||||
m_btnAddTab->setAutoRaise(true);
|
m_btnAddTab->setAutoRaise(true);
|
||||||
m_btnAddTab->setPadding(3);
|
m_btnAddTab->setPadding(3);
|
||||||
m_btnAddTab->setToolTip(tr("Open new web browser tab."));
|
m_btnAddTab->setToolTip(tr("Open new web browser tab."));
|
||||||
m_btnAddTab->setIcon(qApp->icons()->fromTheme("list-add"));
|
m_btnAddTab->setIcon(qApp->icons()->fromTheme(QSL("list-add")));
|
||||||
|
|
||||||
connect(m_btnAddTab, SIGNAL(clicked()), this, SLOT(addEmptyBrowser()));
|
connect(m_btnAddTab, SIGNAL(clicked()), this, SLOT(addEmptyBrowser()));
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ void TabWidget::setupMainMenuButton() {
|
|||||||
m_btnMainMenu->setAutoRaise(true);
|
m_btnMainMenu->setAutoRaise(true);
|
||||||
m_btnMainMenu->setPadding(3);
|
m_btnMainMenu->setPadding(3);
|
||||||
m_btnMainMenu->setToolTip(tr("Displays main menu."));
|
m_btnMainMenu->setToolTip(tr("Displays main menu."));
|
||||||
m_btnMainMenu->setIcon(qApp->icons()->fromTheme("application-menu"));
|
m_btnMainMenu->setIcon(qApp->icons()->fromTheme(QSL("application-menu")));
|
||||||
m_btnMainMenu->setPopupMode(QToolButton::InstantPopup);
|
m_btnMainMenu->setPopupMode(QToolButton::InstantPopup);
|
||||||
|
|
||||||
connect(m_btnMainMenu, SIGNAL(clicked()), this, SLOT(openMainMenu()));
|
connect(m_btnMainMenu, SIGNAL(clicked()), this, SLOT(openMainMenu()));
|
||||||
@ -96,7 +96,7 @@ void TabWidget::showDownloadManager() {
|
|||||||
|
|
||||||
// Download manager is not opened. Create tab with it.
|
// Download manager is not opened. Create tab with it.
|
||||||
qApp->downloadManager()->setParent(this);
|
qApp->downloadManager()->setParent(this);
|
||||||
addTab(qApp->downloadManager(), qApp->icons()->fromTheme("download-manager"), tr("Downloads"), TabBar::DownloadManager);
|
addTab(qApp->downloadManager(), qApp->icons()->fromTheme(QSL("download-manager")), tr("Downloads"), TabBar::DownloadManager);
|
||||||
setCurrentIndex(count() - 1);
|
setCurrentIndex(count() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ void TabWidget::setupIcons() {
|
|||||||
for (int index = 0; index < count(); index++) {
|
for (int index = 0; index < count(); index++) {
|
||||||
// Index 0 usually contains widget which displays feeds & messages.
|
// Index 0 usually contains widget which displays feeds & messages.
|
||||||
if (tabBar()->tabType(index) == TabBar::FeedReader) {
|
if (tabBar()->tabType(index) == TabBar::FeedReader) {
|
||||||
setTabIcon(index, qApp->icons()->fromTheme("folder-feed"));
|
setTabIcon(index, qApp->icons()->fromTheme(QSL("folder-feed")));
|
||||||
}
|
}
|
||||||
// Other indexes probably contain WebBrowsers.
|
// Other indexes probably contain WebBrowsers.
|
||||||
else {
|
else {
|
||||||
@ -175,13 +175,13 @@ void TabWidget::setupIcons() {
|
|||||||
if (active_browser != NULL && active_browser->icon().isNull()) {
|
if (active_browser != NULL && active_browser->icon().isNull()) {
|
||||||
// We found WebBrowser instance of this tab page, which
|
// We found WebBrowser instance of this tab page, which
|
||||||
// has no suitable icon, load a new one from the icon theme.
|
// has no suitable icon, load a new one from the icon theme.
|
||||||
setTabIcon(index, qApp->icons()->fromTheme("text-html"));
|
setTabIcon(index, qApp->icons()->fromTheme(QSL("text-html")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup corner button icon.
|
// Setup corner button icon.
|
||||||
m_btnAddTab->setIcon(qApp->icons()->fromTheme("list-add"));
|
m_btnAddTab->setIcon(qApp->icons()->fromTheme(QSL("list-add")));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabWidget::closeTab(int index) {
|
bool TabWidget::closeTab(int index) {
|
||||||
@ -301,12 +301,12 @@ int TabWidget::addBrowser(bool move_after_current, bool make_active, const QUrl
|
|||||||
|
|
||||||
if (move_after_current) {
|
if (move_after_current) {
|
||||||
// Insert web browser after current tab.
|
// Insert web browser after current tab.
|
||||||
final_index = insertTab(currentIndex() + 1, browser, qApp->icons()->fromTheme("text-html"),
|
final_index = insertTab(currentIndex() + 1, browser, qApp->icons()->fromTheme(QSL("text-html")),
|
||||||
tr("Web browser"), TabBar::Closable);
|
tr("Web browser"), TabBar::Closable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Add new browser as the last tab.
|
// Add new browser as the last tab.
|
||||||
final_index = addTab(browser, qApp->icons()->fromTheme("text-html"),
|
final_index = addTab(browser, qApp->icons()->fromTheme(QSL("text-html")),
|
||||||
//: Web browser default tab title.
|
//: Web browser default tab title.
|
||||||
tr("Web browser"),
|
tr("Web browser"),
|
||||||
TabBar::Closable);
|
TabBar::Closable);
|
||||||
|
@ -60,7 +60,7 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
|
|||||||
|
|
||||||
if (action->isSeparator()) {
|
if (action->isSeparator()) {
|
||||||
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
||||||
action_item->setIcon(qApp->icons()->fromTheme("view-separator"));
|
action_item->setIcon(qApp->icons()->fromTheme(QSL("view-separator")));
|
||||||
action_item->setText(tr("Separator"));
|
action_item->setText(tr("Separator"));
|
||||||
action_item->setToolTip(tr("Separator"));
|
action_item->setToolTip(tr("Separator"));
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
|
|||||||
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
||||||
action_item->setText(tr("Separator"));
|
action_item->setText(tr("Separator"));
|
||||||
action_item->setToolTip(tr("Separator"));
|
action_item->setToolTip(tr("Separator"));
|
||||||
action_item->setIcon(qApp->icons()->fromTheme("view-separator"));
|
action_item->setIcon(qApp->icons()->fromTheme(QSL("view-separator")));
|
||||||
}
|
}
|
||||||
else if (action->property("type").isValid()) {
|
else if (action->property("type").isValid()) {
|
||||||
action_item->setData(Qt::UserRole, action->property("type").toString());
|
action_item->setData(Qt::UserRole, action->property("type").toString());
|
||||||
@ -149,7 +149,7 @@ void ToolBarEditor::insertSpacer() {
|
|||||||
int current_row = m_ui->m_listActivatedActions->currentRow();
|
int current_row = m_ui->m_listActivatedActions->currentRow();
|
||||||
QListWidgetItem *item = new QListWidgetItem(tr("Toolbar spacer"));
|
QListWidgetItem *item = new QListWidgetItem(tr("Toolbar spacer"));
|
||||||
|
|
||||||
item->setIcon(qApp->icons()->fromTheme("view-spacer"));
|
item->setIcon(qApp->icons()->fromTheme(QSL("view-spacer")));
|
||||||
item->setData(Qt::UserRole, SPACER_ACTION_NAME);
|
item->setData(Qt::UserRole, SPACER_ACTION_NAME);
|
||||||
|
|
||||||
m_ui->m_listActivatedActions->insertItem(current_row + 1, item);
|
m_ui->m_listActivatedActions->insertItem(current_row + 1, item);
|
||||||
@ -162,7 +162,7 @@ void ToolBarEditor::insertSeparator() {
|
|||||||
|
|
||||||
item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
|
||||||
item->setToolTip(tr("Separator"));
|
item->setToolTip(tr("Separator"));
|
||||||
item->setIcon(qApp->icons()->fromTheme("view-separator"));
|
item->setIcon(qApp->icons()->fromTheme(QSL("view-separator")));
|
||||||
|
|
||||||
m_ui->m_listActivatedActions->insertItem(current_row + 1, item);
|
m_ui->m_listActivatedActions->insertItem(current_row + 1, item);
|
||||||
m_ui->m_listActivatedActions->setCurrentRow(current_row + 1);
|
m_ui->m_listActivatedActions->setCurrentRow(current_row + 1);
|
||||||
|
@ -29,10 +29,10 @@ WidgetWithStatus::WidgetWithStatus(QWidget *parent)
|
|||||||
m_btnStatus = new PlainToolButton(this);
|
m_btnStatus = new PlainToolButton(this);
|
||||||
m_btnStatus->setFocusPolicy(Qt::NoFocus);
|
m_btnStatus->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
m_iconInformation = qApp->icons()->fromTheme("dialog-information");
|
m_iconInformation = qApp->icons()->fromTheme(QSL("dialog-information"));
|
||||||
m_iconWarning = qApp->icons()->fromTheme("dialog-warning");
|
m_iconWarning = qApp->icons()->fromTheme(QSL("dialog-warning"));
|
||||||
m_iconError = qApp->icons()->fromTheme("dialog-error");
|
m_iconError = qApp->icons()->fromTheme(QSL("dialog-error"));
|
||||||
m_iconOk = qApp->icons()->fromTheme("dialog-yes");
|
m_iconOk = qApp->icons()->fromTheme(QSL("dialog-yes"));
|
||||||
|
|
||||||
// Set layout properties.
|
// Set layout properties.
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
|
@ -95,8 +95,8 @@ bool DatabaseCleaner::purgeStarredMessages(const QSqlDatabase &database) {
|
|||||||
QSqlQuery query = QSqlQuery(database);
|
QSqlQuery query = QSqlQuery(database);
|
||||||
|
|
||||||
query.setForwardOnly(true);
|
query.setForwardOnly(true);
|
||||||
query.prepare("DELETE FROM Messages WHERE is_important = :is_important;");
|
query.prepare(QSL("DELETE FROM Messages WHERE is_important = :is_important;"));
|
||||||
query.bindValue(":is_important", 1);
|
query.bindValue(QSL(":is_important"), 1);
|
||||||
|
|
||||||
return query.exec();
|
return query.exec();
|
||||||
}
|
}
|
||||||
@ -105,14 +105,14 @@ bool DatabaseCleaner::purgeReadMessages(const QSqlDatabase &database) {
|
|||||||
QSqlQuery query = QSqlQuery(database);
|
QSqlQuery query = QSqlQuery(database);
|
||||||
|
|
||||||
query.setForwardOnly(true);
|
query.setForwardOnly(true);
|
||||||
query.prepare("DELETE FROM Messages WHERE is_important = :is_important AND is_deleted = :is_deleted AND is_read = :is_read;");
|
query.prepare(QSL("DELETE FROM Messages WHERE is_important = :is_important AND is_deleted = :is_deleted AND is_read = :is_read;"));
|
||||||
query.bindValue(":is_read", 1);
|
query.bindValue(QSL(":is_read"), 1);
|
||||||
|
|
||||||
// Remove only messages which are NOT in recycle bin.
|
// Remove only messages which are NOT in recycle bin.
|
||||||
query.bindValue(":is_deleted", 0);
|
query.bindValue(QSL(":is_deleted"), 0);
|
||||||
|
|
||||||
// Remove only messages which are NOT starred.
|
// Remove only messages which are NOT starred.
|
||||||
query.bindValue(":is_important", 0);
|
query.bindValue(QSL(":is_important"), 0);
|
||||||
|
|
||||||
return query.exec();
|
return query.exec();
|
||||||
}
|
}
|
||||||
@ -122,11 +122,11 @@ bool DatabaseCleaner::purgeOldMessages(const QSqlDatabase &database, int days) {
|
|||||||
qint64 since_epoch = QDateTime::currentDateTimeUtc().addDays(-days).toMSecsSinceEpoch();
|
qint64 since_epoch = QDateTime::currentDateTimeUtc().addDays(-days).toMSecsSinceEpoch();
|
||||||
|
|
||||||
query.setForwardOnly(true);
|
query.setForwardOnly(true);
|
||||||
query.prepare("DELETE FROM Messages WHERE is_important = :is_important AND date_created < :date_created;");
|
query.prepare(QSL("DELETE FROM Messages WHERE is_important = :is_important AND date_created < :date_created;"));
|
||||||
query.bindValue(":date_created", since_epoch);
|
query.bindValue(QSL(":date_created"), since_epoch);
|
||||||
|
|
||||||
// Remove only messages which are NOT starred.
|
// Remove only messages which are NOT starred.
|
||||||
query.bindValue(":is_important", 0);
|
query.bindValue(QSL(":is_important"), 0);
|
||||||
|
|
||||||
return query.exec();
|
return query.exec();
|
||||||
}
|
}
|
||||||
@ -135,11 +135,11 @@ bool DatabaseCleaner::purgeRecycleBin(const QSqlDatabase &database) {
|
|||||||
QSqlQuery query = QSqlQuery(database);
|
QSqlQuery query = QSqlQuery(database);
|
||||||
|
|
||||||
query.setForwardOnly(true);
|
query.setForwardOnly(true);
|
||||||
query.prepare("DELETE FROM Messages WHERE is_important = :is_important AND is_deleted = :is_deleted;");
|
query.prepare(QSL("DELETE FROM Messages WHERE is_important = :is_important AND is_deleted = :is_deleted;"));
|
||||||
query.bindValue(":is_deleted", 1);
|
query.bindValue(QSL(":is_deleted"), 1);
|
||||||
|
|
||||||
// Remove only messages which are NOT starred.
|
// Remove only messages which are NOT starred.
|
||||||
query.bindValue(":is_important", 0);
|
query.bindValue(QSL(":is_important"), 0);
|
||||||
|
|
||||||
return query.exec();
|
return query.exec();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ DatabaseFactory::DatabaseFactory(QObject *parent)
|
|||||||
m_mysqlDatabaseInitialized(false),
|
m_mysqlDatabaseInitialized(false),
|
||||||
m_sqliteFileBasedDatabaseinitialized(false),
|
m_sqliteFileBasedDatabaseinitialized(false),
|
||||||
m_sqliteInMemoryDatabaseInitialized(false) {
|
m_sqliteInMemoryDatabaseInitialized(false) {
|
||||||
setObjectName("DatabaseFactory");
|
setObjectName(QSL("DatabaseFactory"));
|
||||||
determineDriver();
|
determineDriver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ void DatabaseFactory::sqliteAssemblyDatabaseFilePath() {
|
|||||||
QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
||||||
QSqlDatabase database = QSqlDatabase::addDatabase(APP_DB_SQLITE_DRIVER);
|
QSqlDatabase database = QSqlDatabase::addDatabase(APP_DB_SQLITE_DRIVER);
|
||||||
|
|
||||||
database.setDatabaseName(":memory:");
|
database.setDatabaseName(QSL(":memory:"));
|
||||||
|
|
||||||
if (!database.open()) {
|
if (!database.open()) {
|
||||||
qFatal("In-memory SQLite database was NOT opened. Delivered error message: '%s'", qPrintable(database.lastError().text()));
|
qFatal("In-memory SQLite database was NOT opened. Delivered error message: '%s'", qPrintable(database.lastError().text()));
|
||||||
@ -150,16 +150,16 @@ QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
|||||||
QSqlQuery query_db(database);
|
QSqlQuery query_db(database);
|
||||||
|
|
||||||
query_db.setForwardOnly(true);
|
query_db.setForwardOnly(true);
|
||||||
query_db.exec("PRAGMA encoding = \"UTF-8\"");
|
query_db.exec(QSL("PRAGMA encoding = \"UTF-8\""));
|
||||||
query_db.exec("PRAGMA synchronous = OFF");
|
query_db.exec(QSL("PRAGMA synchronous = OFF"));
|
||||||
query_db.exec("PRAGMA journal_mode = MEMORY");
|
query_db.exec(QSL("PRAGMA journal_mode = MEMORY"));
|
||||||
query_db.exec("PRAGMA page_size = 4096");
|
query_db.exec(QSL("PRAGMA page_size = 4096"));
|
||||||
query_db.exec("PRAGMA cache_size = 16384");
|
query_db.exec(QSL("PRAGMA cache_size = 16384"));
|
||||||
query_db.exec("PRAGMA count_changes = OFF");
|
query_db.exec(QSL("PRAGMA count_changes = OFF"));
|
||||||
query_db.exec("PRAGMA temp_store = MEMORY");
|
query_db.exec(QSL("PRAGMA temp_store = MEMORY"));
|
||||||
|
|
||||||
// Sample query which checks for existence of tables.
|
// Sample query which checks for existence of tables.
|
||||||
query_db.exec("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'");
|
query_db.exec(QSL("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'"));
|
||||||
|
|
||||||
if (query_db.lastError().isValid()) {
|
if (query_db.lastError().isValid()) {
|
||||||
qWarning("Error occurred. In-memory SQLite database is not initialized. Initializing now.");
|
qWarning("Error occurred. In-memory SQLite database is not initialized. Initializing now.");
|
||||||
@ -202,7 +202,7 @@ QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
|||||||
copy_contents.exec(QString("ATTACH DATABASE '%1' AS 'storage';").arg(file_database.databaseName()));
|
copy_contents.exec(QString("ATTACH DATABASE '%1' AS 'storage';").arg(file_database.databaseName()));
|
||||||
|
|
||||||
// Copy all stuff.
|
// Copy all stuff.
|
||||||
QStringList tables; tables << "Information" << "Categories" << "Feeds" << "FeedsData" << "Messages";
|
QStringList tables; tables << QSL("Information") << QSL("Categories") << QSL("Feeds") << QSL("FeedsData") << QSL("Messages");
|
||||||
|
|
||||||
foreach (const QString &table, tables) {
|
foreach (const QString &table, tables) {
|
||||||
copy_contents.exec(QString("INSERT INTO main.%1 SELECT * FROM storage.%1;").arg(table));
|
copy_contents.exec(QString("INSERT INTO main.%1 SELECT * FROM storage.%1;").arg(table));
|
||||||
@ -211,7 +211,7 @@ QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
|||||||
qDebug("Copying data from file-based database into working in-memory database.");
|
qDebug("Copying data from file-based database into working in-memory database.");
|
||||||
|
|
||||||
// Detach database and finish.
|
// Detach database and finish.
|
||||||
copy_contents.exec("DETACH 'storage'");
|
copy_contents.exec(QSL("DETACH 'storage'"));
|
||||||
copy_contents.finish();
|
copy_contents.finish();
|
||||||
|
|
||||||
query_db.finish();
|
query_db.finish();
|
||||||
@ -255,16 +255,16 @@ QSqlDatabase DatabaseFactory::sqliteInitializeFileBasedDatabase(const QString &c
|
|||||||
QSqlQuery query_db(database);
|
QSqlQuery query_db(database);
|
||||||
|
|
||||||
query_db.setForwardOnly(true);
|
query_db.setForwardOnly(true);
|
||||||
query_db.exec("PRAGMA encoding = \"UTF-8\"");
|
query_db.exec(QSL("PRAGMA encoding = \"UTF-8\""));
|
||||||
query_db.exec("PRAGMA synchronous = OFF");
|
query_db.exec(QSL("PRAGMA synchronous = OFF"));
|
||||||
query_db.exec("PRAGMA journal_mode = MEMORY");
|
query_db.exec(QSL("PRAGMA journal_mode = MEMORY"));
|
||||||
query_db.exec("PRAGMA page_size = 4096");
|
query_db.exec(QSL("PRAGMA page_size = 4096"));
|
||||||
query_db.exec("PRAGMA cache_size = 16384");
|
query_db.exec(QSL("PRAGMA cache_size = 16384"));
|
||||||
query_db.exec("PRAGMA count_changes = OFF");
|
query_db.exec(QSL("PRAGMA count_changes = OFF"));
|
||||||
query_db.exec("PRAGMA temp_store = MEMORY");
|
query_db.exec(QSL("PRAGMA temp_store = MEMORY"));
|
||||||
|
|
||||||
// Sample query which checks for existence of tables.
|
// Sample query which checks for existence of tables.
|
||||||
if (!query_db.exec("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'")) {
|
if (!query_db.exec(QSL("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'"))) {
|
||||||
qWarning("Error occurred. File-based SQLite database is not initialized. Initializing now.");
|
qWarning("Error occurred. File-based SQLite database is not initialized. Initializing now.");
|
||||||
|
|
||||||
QFile file_init(APP_MISC_PATH + QDir::separator() + APP_DB_SQLITE_INIT);
|
QFile file_init(APP_MISC_PATH + QDir::separator() + APP_DB_SQLITE_INIT);
|
||||||
@ -346,7 +346,7 @@ bool DatabaseFactory::sqliteUpdateDatabaseSchema(QSqlDatabase database, const QS
|
|||||||
|
|
||||||
while (working_version != current_version) {
|
while (working_version != current_version) {
|
||||||
QString update_file_name = QString(APP_MISC_PATH) + QDir::separator() +
|
QString update_file_name = QString(APP_MISC_PATH) + QDir::separator() +
|
||||||
QString(APP_DB_UPDATE_FILE_PATTERN).arg("sqlite",
|
QString(APP_DB_UPDATE_FILE_PATTERN).arg(QSL("sqlite"),
|
||||||
QString::number(working_version),
|
QString::number(working_version),
|
||||||
QString::number(working_version + 1));
|
QString::number(working_version + 1));
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ bool DatabaseFactory::mysqlUpdateDatabaseSchema(QSqlDatabase database, const QSt
|
|||||||
|
|
||||||
while (working_version != current_version) {
|
while (working_version != current_version) {
|
||||||
QString update_file_name = QString(APP_MISC_PATH) + QDir::separator() +
|
QString update_file_name = QString(APP_MISC_PATH) + QDir::separator() +
|
||||||
QString(APP_DB_UPDATE_FILE_PATTERN).arg("mysql",
|
QString(APP_DB_UPDATE_FILE_PATTERN).arg(QSL("mysql"),
|
||||||
QString::number(working_version),
|
QString::number(working_version),
|
||||||
QString::number(working_version + 1));
|
QString::number(working_version + 1));
|
||||||
|
|
||||||
@ -465,19 +465,19 @@ void DatabaseFactory::sqliteSaveMemoryDatabase() {
|
|||||||
QSqlQuery copy_contents(database);
|
QSqlQuery copy_contents(database);
|
||||||
|
|
||||||
// Attach database.
|
// Attach database.
|
||||||
copy_contents.exec(QString("ATTACH DATABASE '%1' AS 'storage';").arg(file_database.databaseName()));
|
copy_contents.exec(QString(QSL("ATTACH DATABASE '%1' AS 'storage';")).arg(file_database.databaseName()));
|
||||||
|
|
||||||
// Copy all stuff.
|
// Copy all stuff.
|
||||||
QStringList tables; tables << "Categories" << "Feeds" << "FeedsData" <<
|
QStringList tables; tables << QSL("Categories") << QSL("Feeds") << QSL("FeedsData") <<
|
||||||
"Messages";
|
QSL("Messages");
|
||||||
|
|
||||||
foreach (const QString &table, tables) {
|
foreach (const QString &table, tables) {
|
||||||
copy_contents.exec(QString("DELETE FROM storage.%1;").arg(table));
|
copy_contents.exec(QString(QSL("DELETE FROM storage.%1;")).arg(table));
|
||||||
copy_contents.exec(QString("INSERT INTO storage.%1 SELECT * FROM main.%1;").arg(table));
|
copy_contents.exec(QString(QSL("INSERT INTO storage.%1 SELECT * FROM main.%1;")).arg(table));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detach database and finish.
|
// Detach database and finish.
|
||||||
copy_contents.exec("DETACH 'storage'");
|
copy_contents.exec(QSL("DETACH 'storage'"));
|
||||||
copy_contents.finish();
|
copy_contents.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
|
|||||||
QSqlQuery query_db(database);
|
QSqlQuery query_db(database);
|
||||||
query_db.setForwardOnly(true);
|
query_db.setForwardOnly(true);
|
||||||
|
|
||||||
if (!query_db.exec(QString("USE %1").arg(database_name)) || !query_db.exec("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'")) {
|
if (!query_db.exec(QString("USE %1").arg(database_name)) || !query_db.exec(QSL("SELECT inf_value FROM Information WHERE inf_key = 'schema_version'"))) {
|
||||||
// If no "rssguard" database exists or schema version is wrong, then initialize it.
|
// If no "rssguard" database exists or schema version is wrong, then initialize it.
|
||||||
qWarning("Error occurred. MySQL database is not initialized. Initializing now.");
|
qWarning("Error occurred. MySQL database is not initialized. Initializing now.");
|
||||||
|
|
||||||
@ -633,7 +633,7 @@ bool DatabaseFactory::mysqlVacuumDatabase() {
|
|||||||
QSqlDatabase database = mysqlConnection(objectName());
|
QSqlDatabase database = mysqlConnection(objectName());
|
||||||
QSqlQuery query_vacuum(database);
|
QSqlQuery query_vacuum(database);
|
||||||
|
|
||||||
return query_vacuum.exec("OPTIMIZE TABLE rssguard.feeds;") && query_vacuum.exec("OPTIMIZE TABLE rssguard.messages;");
|
return query_vacuum.exec(QSL("OPTIMIZE TABLE rssguard.feeds;")) && query_vacuum.exec(QSL("OPTIMIZE TABLE rssguard.messages;"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QSqlDatabase DatabaseFactory::sqliteConnection(const QString &connection_name, DatabaseFactory::DesiredType desired_type) {
|
QSqlDatabase DatabaseFactory::sqliteConnection(const QString &connection_name, DatabaseFactory::DesiredType desired_type) {
|
||||||
@ -648,7 +648,7 @@ QSqlDatabase DatabaseFactory::sqliteConnection(const QString &connection_name, D
|
|||||||
else {
|
else {
|
||||||
QSqlDatabase database = QSqlDatabase::database();
|
QSqlDatabase database = QSqlDatabase::database();
|
||||||
|
|
||||||
database.setDatabaseName(":memory:");
|
database.setDatabaseName(QSL(":memory:"));
|
||||||
|
|
||||||
if (!database.isOpen() && !database.open()) {
|
if (!database.isOpen() && !database.open()) {
|
||||||
qFatal("In-memory SQLite database was NOT opened. Delivered error message: '%s'.",
|
qFatal("In-memory SQLite database was NOT opened. Delivered error message: '%s'.",
|
||||||
@ -720,7 +720,7 @@ bool DatabaseFactory::sqliteVacuumDatabase() {
|
|||||||
|
|
||||||
QSqlQuery query_vacuum(database);
|
QSqlQuery query_vacuum(database);
|
||||||
|
|
||||||
return query_vacuum.exec("VACUUM");
|
return query_vacuum.exec(QSL("VACUUM"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseFactory::saveDatabase() {
|
void DatabaseFactory::saveDatabase() {
|
||||||
|
@ -59,8 +59,8 @@ void IconFactory::setupSearchPaths() {
|
|||||||
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
|
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
|
||||||
qDebug("Available icon theme paths: %s.",
|
qDebug("Available icon theme paths: %s.",
|
||||||
qPrintable(QIcon::themeSearchPaths()
|
qPrintable(QIcon::themeSearchPaths()
|
||||||
.replaceInStrings(QRegExp("^|$"), "\'")
|
.replaceInStrings(QRegExp(QSL("^|$")), QSL("\'"))
|
||||||
.replaceInStrings(QRegExp("/"), QDir::separator()).join(", ")));
|
.replaceInStrings(QRegExp(QSL("/")), QDir::separator()).join(QSL(", "))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconFactory::setCurrentIconTheme(const QString &theme_name) {
|
void IconFactory::setCurrentIconTheme(const QString &theme_name) {
|
||||||
@ -78,7 +78,7 @@ void IconFactory::loadCurrentIconTheme() {
|
|||||||
|
|
||||||
// Display list of installed themes.
|
// Display list of installed themes.
|
||||||
qDebug("Installed icon themes are: %s.",
|
qDebug("Installed icon themes are: %s.",
|
||||||
qPrintable(QStringList(installed_themes).replaceInStrings(QRegExp("^|$"), "\'").join(", ")));
|
qPrintable(QStringList(installed_themes).replaceInStrings(QRegExp(QSL("^|$")), QSL("\'")).join(QSL(", "))));
|
||||||
|
|
||||||
if (installed_themes.contains(theme_name_from_settings)) {
|
if (installed_themes.contains(theme_name_from_settings)) {
|
||||||
// Desired icon theme is installed and can be loaded.
|
// Desired icon theme is installed and can be loaded.
|
||||||
|
@ -41,7 +41,7 @@ void Localization::loadActiveLanguage() {
|
|||||||
QTranslator *app_translator = new QTranslator(qApp);
|
QTranslator *app_translator = new QTranslator(qApp);
|
||||||
QString desired_localization = desiredLanguage();
|
QString desired_localization = desiredLanguage();
|
||||||
|
|
||||||
if (app_translator->load(QString("rssguard-%1.qm").arg(desired_localization), APP_LANG_PATH, "-")) {
|
if (app_translator->load(QString("rssguard-%1.qm").arg(desired_localization), APP_LANG_PATH, QSL("-"))) {
|
||||||
Application::installTranslator(app_translator);
|
Application::installTranslator(app_translator);
|
||||||
qDebug("Application localization '%s' loaded successfully.", qPrintable(desired_localization));
|
qDebug("Application localization '%s' loaded successfully.", qPrintable(desired_localization));
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ void Localization::loadActiveLanguage() {
|
|||||||
desired_localization = DEFAULT_LOCALE;
|
desired_localization = DEFAULT_LOCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qt_translator->load(QString("qtbase-%1.qm").arg(desired_localization), APP_LANG_PATH, "-")) {
|
if (qt_translator->load(QString("qtbase-%1.qm").arg(desired_localization), APP_LANG_PATH, QSL("-"))) {
|
||||||
Application::installTranslator(qt_translator);
|
Application::installTranslator(qt_translator);
|
||||||
qDebug("Qt localization '%s' loaded successfully.", qPrintable(desired_localization));
|
qDebug("Qt localization '%s' loaded successfully.", qPrintable(desired_localization));
|
||||||
}
|
}
|
||||||
|
@ -179,13 +179,13 @@ DKEY Proxy::Type = "proxy_type";
|
|||||||
DVALUE(QNetworkProxy::ProxyType) Proxy::TypeDef = QNetworkProxy::NoProxy;
|
DVALUE(QNetworkProxy::ProxyType) Proxy::TypeDef = QNetworkProxy::NoProxy;
|
||||||
|
|
||||||
DKEY Proxy::Host = "host";
|
DKEY Proxy::Host = "host";
|
||||||
DVALUE(char*) Proxy::HostDef = "";
|
DVALUE(QString) Proxy::HostDef = QString();
|
||||||
|
|
||||||
DKEY Proxy::Username = "username";
|
DKEY Proxy::Username = "username";
|
||||||
DVALUE(char*) Proxy::UsernameDef = "";
|
DVALUE(QString) Proxy::UsernameDef = QString();
|
||||||
|
|
||||||
DKEY Proxy::Password = "password";
|
DKEY Proxy::Password = "password";
|
||||||
DVALUE(char*) Proxy::PasswordDef = "";
|
DVALUE(QString) Proxy::PasswordDef = QString();
|
||||||
|
|
||||||
DKEY Proxy::Port = "port";
|
DKEY Proxy::Port = "port";
|
||||||
DVALUE(int) Proxy::PortDef = 80;
|
DVALUE(int) Proxy::PortDef = 80;
|
||||||
@ -197,13 +197,13 @@ DKEY Database::UseInMemory = "use_in_memory_db";
|
|||||||
DVALUE(bool) Database::UseInMemoryDef = false;
|
DVALUE(bool) Database::UseInMemoryDef = false;
|
||||||
|
|
||||||
DKEY Database::MySQLHostname = "mysql_hostname";
|
DKEY Database::MySQLHostname = "mysql_hostname";
|
||||||
DVALUE(char*) Database::MySQLHostnameDef = "";
|
DVALUE(QString) Database::MySQLHostnameDef = QString();
|
||||||
|
|
||||||
DKEY Database::MySQLUsername = "mysql_username";
|
DKEY Database::MySQLUsername = "mysql_username";
|
||||||
DVALUE(char*) Database::MySQLUsernameDef = "";
|
DVALUE(QString) Database::MySQLUsernameDef = QString();
|
||||||
|
|
||||||
DKEY Database::MySQLPassword = "mysql_password";
|
DKEY Database::MySQLPassword = "mysql_password";
|
||||||
DVALUE(char*) Database::MySQLPasswordDef = "";
|
DVALUE(QString) Database::MySQLPasswordDef = QString();
|
||||||
|
|
||||||
DKEY Database::MySQLDatabase = "mysql_database";
|
DKEY Database::MySQLDatabase = "mysql_database";
|
||||||
DVALUE(char*) Database::MySQLDatabaseDef = APP_LOW_NAME;
|
DVALUE(char*) Database::MySQLDatabaseDef = APP_LOW_NAME;
|
||||||
@ -251,7 +251,7 @@ DKEY Browser::CustomExternalBrowserEnabled = "custom_external_bro
|
|||||||
DVALUE(bool) Browser::CustomExternalBrowserEnabledDef = false;
|
DVALUE(bool) Browser::CustomExternalBrowserEnabledDef = false;
|
||||||
|
|
||||||
DKEY Browser::CustomExternalBrowserExecutable = "external_browser_executable";
|
DKEY Browser::CustomExternalBrowserExecutable = "external_browser_executable";
|
||||||
DVALUE(char*) Browser::CustomExternalBrowserExecutableDef = "";
|
DVALUE(QString) Browser::CustomExternalBrowserExecutableDef = QString();
|
||||||
|
|
||||||
DKEY Browser::CustomExternalBrowserArguments = "external_browser_arguments";
|
DKEY Browser::CustomExternalBrowserArguments = "external_browser_arguments";
|
||||||
DVALUE(char*) Browser::CustomExternalBrowserArgumentsDef = "%1";
|
DVALUE(char*) Browser::CustomExternalBrowserArgumentsDef = "%1";
|
||||||
@ -260,7 +260,7 @@ DKEY Browser::CustomExternalEmailEnabled = "custom_external_ema
|
|||||||
DVALUE(bool) Browser::CustomExternalEmailEnabledDef = false;
|
DVALUE(bool) Browser::CustomExternalEmailEnabledDef = false;
|
||||||
|
|
||||||
DKEY Browser::CustomExternalEmailExecutable = "external_email_executable";
|
DKEY Browser::CustomExternalEmailExecutable = "external_email_executable";
|
||||||
DVALUE(char*) Browser::CustomExternalEmailExecutableDef = "";
|
DVALUE(QString) Browser::CustomExternalEmailExecutableDef = QString();
|
||||||
|
|
||||||
DKEY Browser::CustomExternalEmailArguments = "external_email_arguments";
|
DKEY Browser::CustomExternalEmailArguments = "external_email_arguments";
|
||||||
DVALUE(char*) Browser::CustomExternalEmailArgumentsDef = "";
|
DVALUE(char*) Browser::CustomExternalEmailArgumentsDef = "";
|
||||||
|
@ -197,13 +197,13 @@ namespace Proxy {
|
|||||||
VALUE(QNetworkProxy::ProxyType) TypeDef;
|
VALUE(QNetworkProxy::ProxyType) TypeDef;
|
||||||
|
|
||||||
KEY Host;
|
KEY Host;
|
||||||
VALUE(char*) HostDef;
|
VALUE(QString) HostDef;
|
||||||
|
|
||||||
KEY Username;
|
KEY Username;
|
||||||
VALUE(char*) UsernameDef;
|
VALUE(QString) UsernameDef;
|
||||||
|
|
||||||
KEY Password;
|
KEY Password;
|
||||||
VALUE(char*) PasswordDef;
|
VALUE(QString) PasswordDef;
|
||||||
|
|
||||||
KEY Port;
|
KEY Port;
|
||||||
VALUE(int) PortDef;
|
VALUE(int) PortDef;
|
||||||
@ -217,13 +217,13 @@ namespace Database {
|
|||||||
VALUE(bool) UseInMemoryDef;
|
VALUE(bool) UseInMemoryDef;
|
||||||
|
|
||||||
KEY MySQLHostname;
|
KEY MySQLHostname;
|
||||||
VALUE(char*) MySQLHostnameDef;
|
VALUE(QString) MySQLHostnameDef;
|
||||||
|
|
||||||
KEY MySQLUsername;
|
KEY MySQLUsername;
|
||||||
VALUE(char*) MySQLUsernameDef;
|
VALUE(QString) MySQLUsernameDef;
|
||||||
|
|
||||||
KEY MySQLPassword;
|
KEY MySQLPassword;
|
||||||
VALUE(char*) MySQLPasswordDef;
|
VALUE(QString) MySQLPasswordDef;
|
||||||
|
|
||||||
KEY MySQLPort;
|
KEY MySQLPort;
|
||||||
VALUE(int) MySQLPortDef;
|
VALUE(int) MySQLPortDef;
|
||||||
@ -277,7 +277,7 @@ namespace Browser {
|
|||||||
VALUE(bool) CustomExternalBrowserEnabledDef;
|
VALUE(bool) CustomExternalBrowserEnabledDef;
|
||||||
|
|
||||||
KEY CustomExternalBrowserExecutable;
|
KEY CustomExternalBrowserExecutable;
|
||||||
VALUE(char*) CustomExternalBrowserExecutableDef;
|
VALUE(QString) CustomExternalBrowserExecutableDef;
|
||||||
|
|
||||||
KEY CustomExternalBrowserArguments;
|
KEY CustomExternalBrowserArguments;
|
||||||
VALUE(char*) CustomExternalBrowserArgumentsDef;
|
VALUE(char*) CustomExternalBrowserArgumentsDef;
|
||||||
@ -286,7 +286,7 @@ namespace Browser {
|
|||||||
VALUE(bool) CustomExternalEmailEnabledDef;
|
VALUE(bool) CustomExternalEmailEnabledDef;
|
||||||
|
|
||||||
KEY CustomExternalEmailExecutable;
|
KEY CustomExternalEmailExecutable;
|
||||||
VALUE(char*) CustomExternalEmailExecutableDef;
|
VALUE(QString) CustomExternalEmailExecutableDef;
|
||||||
|
|
||||||
KEY CustomExternalEmailArguments;
|
KEY CustomExternalEmailArguments;
|
||||||
VALUE(char*) CustomExternalEmailArgumentsDef;
|
VALUE(char*) CustomExternalEmailArgumentsDef;
|
||||||
|
@ -50,7 +50,7 @@ void SkinFactory::loadCurrentSkin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkinFactory::loadSkinFromData(const Skin &skin) {
|
bool SkinFactory::loadSkinFromData(const Skin &skin) {
|
||||||
QStringList skin_parts = skin.m_baseName.split('/', QString::SkipEmptyParts);
|
QStringList skin_parts = skin.m_baseName.split(QL1C('/'), QString::SkipEmptyParts);
|
||||||
|
|
||||||
// Skin does not contain leading folder name or the actual skin file name.
|
// Skin does not contain leading folder name or the actual skin file name.
|
||||||
if (skin_parts.size() != 2) {
|
if (skin_parts.size() != 2) {
|
||||||
@ -85,7 +85,7 @@ bool SkinFactory::loadSkinFromData(const Skin &skin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!raw_data.isEmpty()) {
|
if (!raw_data.isEmpty()) {
|
||||||
QString parsed_data = raw_data.replace("##", APP_SKIN_PATH + '/' + skin_folder);
|
QString parsed_data = raw_data.replace(QSL("##"), APP_SKIN_PATH + QL1S("/") + skin_folder);
|
||||||
qApp->setStyleSheet(parsed_data);
|
qApp->setStyleSheet(parsed_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,38 +114,38 @@ Skin SkinFactory::skinInfo(const QString &skin_name, bool *ok) {
|
|||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomNode skin_node = dokument.namedItem("skin");
|
QDomNode skin_node = dokument.namedItem(QSL("skin"));
|
||||||
|
|
||||||
// Obtain visible skin name.
|
// Obtain visible skin name.
|
||||||
skin.m_visibleName = skin_node.namedItem("name").toElement().text();
|
skin.m_visibleName = skin_node.namedItem(QSL("name")).toElement().text();
|
||||||
|
|
||||||
// Obtain skin raw data.
|
// Obtain skin raw data.
|
||||||
skin.m_rawData = skin_node.namedItem("data").toElement().text();
|
skin.m_rawData = skin_node.namedItem(QSL("data")).toElement().text();
|
||||||
skin.m_rawData = QByteArray::fromBase64(skin.m_rawData.toLocal8Bit());
|
skin.m_rawData = QByteArray::fromBase64(skin.m_rawData.toLocal8Bit());
|
||||||
|
|
||||||
// Obtain style name.
|
// Obtain style name.
|
||||||
styles = skin_node.namedItem("style").toElement().text();
|
styles = skin_node.namedItem(QSL("style")).toElement().text();
|
||||||
skin.m_stylesNames = styles.split(',', QString::SkipEmptyParts);
|
skin.m_stylesNames = styles.split(',', QString::SkipEmptyParts);
|
||||||
|
|
||||||
// Obtain author.
|
// Obtain author.
|
||||||
skin.m_author = skin_node.namedItem("author").namedItem("name").toElement().text();
|
skin.m_author = skin_node.namedItem(QSL("author")).namedItem(QSL("name")).toElement().text();
|
||||||
|
|
||||||
// Obtain email.
|
// Obtain email.
|
||||||
skin.m_email = skin_node.namedItem("author").namedItem("email").toElement().text();
|
skin.m_email = skin_node.namedItem(QSL("author")).namedItem(QSL("email")).toElement().text();
|
||||||
|
|
||||||
// Obtain version.
|
// Obtain version.
|
||||||
skin.m_version = skin_node.attributes().namedItem("version").toAttr().value();
|
skin.m_version = skin_node.attributes().namedItem(QSL("version")).toAttr().value();
|
||||||
|
|
||||||
// Obtain layout markup wrapper.
|
// Obtain layout markup wrapper.
|
||||||
skin.m_layoutMarkupWrapper = skin_node.namedItem("markup_wrapper").toElement().text();
|
skin.m_layoutMarkupWrapper = skin_node.namedItem(QSL("markup_wrapper")).toElement().text();
|
||||||
skin.m_layoutMarkupWrapper = QByteArray::fromBase64(skin.m_layoutMarkupWrapper.toLocal8Bit());
|
skin.m_layoutMarkupWrapper = QByteArray::fromBase64(skin.m_layoutMarkupWrapper.toLocal8Bit());
|
||||||
|
|
||||||
// Obtain layout markup.
|
// Obtain layout markup.
|
||||||
skin.m_layoutMarkup = skin_node.namedItem("markup").toElement().text();
|
skin.m_layoutMarkup = skin_node.namedItem(QSL("markup")).toElement().text();
|
||||||
skin.m_layoutMarkup = QByteArray::fromBase64(skin.m_layoutMarkup.toLocal8Bit());
|
skin.m_layoutMarkup = QByteArray::fromBase64(skin.m_layoutMarkup.toLocal8Bit());
|
||||||
|
|
||||||
// Obtain enclosure hyperlink wrapper.
|
// Obtain enclosure hyperlink wrapper.
|
||||||
skin.m_enclosureMarkup = skin_node.namedItem("markup_enclosure").toElement().text();
|
skin.m_enclosureMarkup = skin_node.namedItem(QSL("markup_enclosure")).toElement().text();
|
||||||
skin.m_enclosureMarkup = QByteArray::fromBase64(skin.m_enclosureMarkup.toLocal8Bit());
|
skin.m_enclosureMarkup = QByteArray::fromBase64(skin.m_enclosureMarkup.toLocal8Bit());
|
||||||
|
|
||||||
// Obtain other information.
|
// Obtain other information.
|
||||||
@ -174,7 +174,7 @@ QList<Skin> SkinFactory::installedSkins() {
|
|||||||
|
|
||||||
foreach (const QString &base_directory, skin_directories) {
|
foreach (const QString &base_directory, skin_directories) {
|
||||||
// Check skins installed in this base directory.
|
// Check skins installed in this base directory.
|
||||||
QStringList skin_files = QDir(APP_SKIN_PATH + QDir::separator() + base_directory).entryList(QStringList() << "*.xml",
|
QStringList skin_files = QDir(APP_SKIN_PATH + QDir::separator() + base_directory).entryList(QStringList() << QSL("*.xml"),
|
||||||
QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
||||||
|
|
||||||
foreach (const QString &skin_file, skin_files) {
|
foreach (const QString &skin_file, skin_files) {
|
||||||
|
@ -52,9 +52,12 @@ SystemFactory::~SystemFactory() {
|
|||||||
SystemFactory::AutoStartStatus SystemFactory::getAutoStartStatus() {
|
SystemFactory::AutoStartStatus SystemFactory::getAutoStartStatus() {
|
||||||
// User registry way to auto-start the application on Windows.
|
// User registry way to auto-start the application on Windows.
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
QSettings registry_key("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
|
QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
|
||||||
QSettings::NativeFormat);
|
QSettings::NativeFormat);
|
||||||
bool autostart_enabled = registry_key.value(APP_LOW_NAME, "").toString().replace('\\', '/') == Application::applicationFilePath();
|
bool autostart_enabled = registry_key.value(QSL(APP_LOW_NAME),
|
||||||
|
QString()).toString().replace(QL1C('\\'),
|
||||||
|
QL1C('/')) ==
|
||||||
|
Application::applicationFilePath();
|
||||||
|
|
||||||
if (autostart_enabled) {
|
if (autostart_enabled) {
|
||||||
return SystemFactory::Enabled;
|
return SystemFactory::Enabled;
|
||||||
@ -96,7 +99,7 @@ QString SystemFactory::getAutostartDesktopFileLocation() {
|
|||||||
if (!xdg_config_path.isEmpty()) {
|
if (!xdg_config_path.isEmpty()) {
|
||||||
// XDG_CONFIG_HOME variable is specified. Look for .desktop file
|
// XDG_CONFIG_HOME variable is specified. Look for .desktop file
|
||||||
// in 'autostart' subdirectory.
|
// in 'autostart' subdirectory.
|
||||||
desktop_file_location = xdg_config_path + "/autostart/" + APP_DESKTOP_ENTRY_FILE;
|
desktop_file_location = xdg_config_path + QSL("/autostart/") + APP_DESKTOP_ENTRY_FILE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Desired variable is not set, look for the default 'autostart' subdirectory.
|
// Desired variable is not set, look for the default 'autostart' subdirectory.
|
||||||
@ -104,7 +107,7 @@ QString SystemFactory::getAutostartDesktopFileLocation() {
|
|||||||
if (!home_directory.isEmpty()) {
|
if (!home_directory.isEmpty()) {
|
||||||
// Home directory exists. Check if target .desktop file exists and
|
// Home directory exists. Check if target .desktop file exists and
|
||||||
// return according status.
|
// return according status.
|
||||||
desktop_file_location = home_directory + "/.config/autostart/" + APP_DESKTOP_ENTRY_FILE;
|
desktop_file_location = home_directory + QSL("/.config/autostart/") + APP_DESKTOP_ENTRY_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,11 +125,11 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
QSettings registry_key("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"), QSettings::NativeFormat);
|
||||||
switch (new_status) {
|
switch (new_status) {
|
||||||
case SystemFactory::Enabled:
|
case SystemFactory::Enabled:
|
||||||
registry_key.setValue(APP_LOW_NAME,
|
registry_key.setValue(APP_LOW_NAME,
|
||||||
Application::applicationFilePath().replace('/', '\\'));
|
Application::applicationFilePath().replace(QL1C('/'), QL1C('\\')));
|
||||||
return true;
|
return true;
|
||||||
case SystemFactory::Disabled:
|
case SystemFactory::Disabled:
|
||||||
registry_key.remove(APP_LOW_NAME);
|
registry_key.remove(APP_LOW_NAME);
|
||||||
@ -156,9 +159,9 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
|
|||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
bool SystemFactory::removeTrolltechJunkRegistryKeys() {
|
bool SystemFactory::removeTrolltechJunkRegistryKeys() {
|
||||||
if (qApp->settings()->value(GROUP(General), SETTING(General::RemoveTrolltechJunk)).toBool()) {
|
if (qApp->settings()->value(GROUP(General), SETTING(General::RemoveTrolltechJunk)).toBool()) {
|
||||||
QSettings registry_key("HKEY_CURRENT_USER\\Software\\TrollTech", QSettings::NativeFormat);
|
QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\TrollTech"), QSettings::NativeFormat);
|
||||||
|
|
||||||
registry_key.remove("");
|
registry_key.remove(QSL(""));
|
||||||
registry_key.sync();
|
registry_key.sync();
|
||||||
|
|
||||||
return registry_key.status() == QSettings::NoError;
|
return registry_key.status() == QSettings::NoError;
|
||||||
@ -185,8 +188,8 @@ QPair<UpdateInfo, QNetworkReply::NetworkError> SystemFactory::checkForUpdates()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SystemFactory::isUpdateNewer(const QString &update_version) {
|
bool SystemFactory::isUpdateNewer(const QString &update_version) {
|
||||||
QStringList current_version_tkn = QString(APP_VERSION).split('.');
|
QStringList current_version_tkn = QString(APP_VERSION).split(QL1C('.'));
|
||||||
QStringList new_version_tkn = update_version.split('.');
|
QStringList new_version_tkn = update_version.split(QL1C('.'));
|
||||||
|
|
||||||
while (!current_version_tkn.isEmpty() && !new_version_tkn.isEmpty()) {
|
while (!current_version_tkn.isEmpty() && !new_version_tkn.isEmpty()) {
|
||||||
int current_number = current_version_tkn.takeFirst().toInt();
|
int current_number = current_version_tkn.takeFirst().toInt();
|
||||||
@ -211,7 +214,7 @@ bool SystemFactory::isUpdateNewer(const QString &update_version) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return new_version_tkn.join("").toInt() > 0;
|
return new_version_tkn.join(QString()).toInt() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,23 +222,23 @@ bool SystemFactory::isUpdateNewer(const QString &update_version) {
|
|||||||
UpdateInfo SystemFactory::parseUpdatesFile(const QByteArray &updates_file, const QByteArray &changelog) {
|
UpdateInfo SystemFactory::parseUpdatesFile(const QByteArray &updates_file, const QByteArray &changelog) {
|
||||||
UpdateInfo update;
|
UpdateInfo update;
|
||||||
QDomDocument document; document.setContent(updates_file, false);
|
QDomDocument document; document.setContent(updates_file, false);
|
||||||
QDomNodeList releases = document.elementsByTagName("release");
|
QDomNodeList releases = document.elementsByTagName(QSL("release"));
|
||||||
|
|
||||||
if (releases.size() == 1) {
|
if (releases.size() == 1) {
|
||||||
QDomElement rel_elem = releases.at(0).toElement();
|
QDomElement rel_elem = releases.at(0).toElement();
|
||||||
|
|
||||||
update.m_availableVersion = rel_elem.attributes().namedItem("version").toAttr().value();
|
update.m_availableVersion = rel_elem.attributes().namedItem(QSL("version")).toAttr().value();
|
||||||
update.m_changes = changelog;
|
update.m_changes = changelog;
|
||||||
|
|
||||||
QDomNodeList urls = rel_elem.elementsByTagName("url");
|
QDomNodeList urls = rel_elem.elementsByTagName(QSL("url"));
|
||||||
|
|
||||||
for (int j = 0; j < urls.size(); j++) {
|
for (int j = 0; j < urls.size(); j++) {
|
||||||
UpdateUrl url;
|
UpdateUrl url;
|
||||||
QDomElement url_elem = urls.at(j).toElement();
|
QDomElement url_elem = urls.at(j).toElement();
|
||||||
|
|
||||||
url.m_fileUrl = url_elem.text();
|
url.m_fileUrl = url_elem.text();
|
||||||
url.m_os = url_elem.attributes().namedItem("os").toAttr().value();
|
url.m_os = url_elem.attributes().namedItem(QSL("os")).toAttr().value();
|
||||||
url.m_platform = url_elem.attributes().namedItem("platform").toAttr().value();
|
url.m_platform = url_elem.attributes().namedItem(QSL("platform")).toAttr().value();
|
||||||
|
|
||||||
update.m_urls.insert(url.m_os, url);
|
update.m_urls.insert(url.m_os, url);
|
||||||
}
|
}
|
||||||
|
17
src/miscellaneous/textfactory.cpp
Normal file → Executable file
17
src/miscellaneous/textfactory.cpp
Normal file → Executable file
@ -34,20 +34,21 @@ QDateTime TextFactory::parseDateTime(const QString &date_time) {
|
|||||||
QLocale locale(QLocale::C);
|
QLocale locale(QLocale::C);
|
||||||
bool positive_time_zone_offset = false;
|
bool positive_time_zone_offset = false;
|
||||||
|
|
||||||
QStringList date_patterns; date_patterns << "yyyy-MM-ddTHH:mm:ss" << "MMM dd yyyy hh:mm:ss" <<
|
QStringList date_patterns; date_patterns << QSL("yyyy-MM-ddTHH:mm:ss") << QSL("MMM dd yyyy hh:mm:ss") <<
|
||||||
"MMM d yyyy hh:mm:ss" << "ddd, dd MMM yyyy HH:mm:ss" <<
|
QSL("MMM d yyyy hh:mm:ss") << QSL("ddd, dd MMM yyyy HH:mm:ss") <<
|
||||||
"dd MMM yyyy" << "yyyy-MM-dd HH:mm:ss.z" << "yyyy-MM-dd" <<
|
QSL("dd MMM yyyy") << QSL("yyyy-MM-dd HH:mm:ss.z") << QSL("yyyy-MM-dd") <<
|
||||||
"yyyy" << "yyyy-MM" << "yyyy-MM-dd" << "yyyy-MM-ddThh:mm" <<
|
QSL("yyyy") << QSL("yyyy-MM") << QSL("yyyy-MM-dd") << QSL("yyyy-MM-ddThh:mm") <<
|
||||||
"yyyy-MM-ddThh:mm:ss";
|
QSL("yyyy-MM-ddThh:mm:ss");
|
||||||
|
|
||||||
QStringList timezone_offset_patterns; timezone_offset_patterns << "+hh:mm" << "-hh:mm" << "+hhmm" << "-hhmm" << "+hh" << "-hh";
|
QStringList timezone_offset_patterns; timezone_offset_patterns << QSL("+hh:mm") << QSL("-hh:mm") << QSL("+hhmm")
|
||||||
|
<< QSL("-hhmm") << QSL("+hh") << QSL("-hh");
|
||||||
|
|
||||||
if (input_date.size() >= TIMEZONE_OFFSET_LIMIT) {
|
if (input_date.size() >= TIMEZONE_OFFSET_LIMIT) {
|
||||||
foreach (const QString &pattern, timezone_offset_patterns) {
|
foreach (const QString &pattern, timezone_offset_patterns) {
|
||||||
time_zone_offset = QTime::fromString(input_date.right(pattern.size()), pattern);
|
time_zone_offset = QTime::fromString(input_date.right(pattern.size()), pattern);
|
||||||
|
|
||||||
if (time_zone_offset.isValid()) {
|
if (time_zone_offset.isValid()) {
|
||||||
positive_time_zone_offset = pattern.at(0) == '+';
|
positive_time_zone_offset = pattern.at(0) == QL1C('+');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +90,7 @@ QDateTime TextFactory::parseDateTime(qint64 milis_from_epoch) {
|
|||||||
|
|
||||||
QString TextFactory::shorten(const QString &input, int text_length_limit) {
|
QString TextFactory::shorten(const QString &input, int text_length_limit) {
|
||||||
if (input.size() > text_length_limit) {
|
if (input.size() > text_length_limit) {
|
||||||
return input.left(text_length_limit - ELLIPSIS_LENGTH) + QString(ELLIPSIS_LENGTH, '.');
|
return input.left(text_length_limit - ELLIPSIS_LENGTH) + QString(ELLIPSIS_LENGTH, QL1C('.'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return input;
|
return input;
|
||||||
|
@ -111,7 +111,7 @@ void AdBlockSubscription::loadSubscription(const QStringList &disabled_rules) {
|
|||||||
textStream.readLine(1024);
|
textStream.readLine(1024);
|
||||||
QString header = textStream.readLine(1024);
|
QString header = textStream.readLine(1024);
|
||||||
|
|
||||||
if (!header.startsWith(QLatin1String("[Adblock")) || m_title.isEmpty()) {
|
if (!header.startsWith(QL1S("[Adblock")) || m_title.isEmpty()) {
|
||||||
qWarning("Invalid format of subscription file '%s'.", qPrintable(QDir::toNativeSeparators(m_filePath)));
|
qWarning("Invalid format of subscription file '%s'.", qPrintable(QDir::toNativeSeparators(m_filePath)));
|
||||||
file.close();
|
file.close();
|
||||||
QTimer::singleShot(0, this, SLOT(updateSubscription()));
|
QTimer::singleShot(0, this, SLOT(updateSubscription()));
|
||||||
@ -201,8 +201,8 @@ bool AdBlockSubscription::saveDownloadedData(const QByteArray &data) {
|
|||||||
// So we are ignoring it for keeping good performance
|
// So we are ignoring it for keeping good performance
|
||||||
// But we will use whitelist rules at the end of list
|
// But we will use whitelist rules at the end of list
|
||||||
|
|
||||||
QByteArray part1 = data.left(data.indexOf(QLatin1String("!-----------------------------Third-party adverts-----------------------------!")));
|
QByteArray part1 = data.left(data.indexOf(QL1S("!-----------------------------Third-party adverts-----------------------------!")));
|
||||||
QByteArray part2 = data.mid(data.indexOf(QLatin1String("!---------------------------------Whitelists----------------------------------!")));
|
QByteArray part2 = data.mid(data.indexOf(QL1S("!---------------------------------Whitelists----------------------------------!")));
|
||||||
|
|
||||||
file.write(part1);
|
file.write(part1);
|
||||||
file.write(part2);
|
file.write(part2);
|
||||||
|
2
src/network-web/discoverfeedsbutton.cpp
Normal file → Executable file
2
src/network-web/discoverfeedsbutton.cpp
Normal file → Executable file
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
DiscoverFeedsButton::DiscoverFeedsButton(QWidget *parent) : QToolButton(parent) {
|
DiscoverFeedsButton::DiscoverFeedsButton(QWidget *parent) : QToolButton(parent) {
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
setIcon(qApp->icons()->fromTheme("folder-feed"));
|
setIcon(qApp->icons()->fromTheme(QSL("folder-feed")));
|
||||||
setPopupMode(QToolButton::InstantPopup);
|
setPopupMode(QToolButton::InstantPopup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void Downloader::finished() {
|
|||||||
QNetworkRequest request = reply->request();
|
QNetworkRequest request = reply->request();
|
||||||
|
|
||||||
if (redirection_url.host().isEmpty()) {
|
if (redirection_url.host().isEmpty()) {
|
||||||
request.setUrl(QUrl(reply->request().url().scheme() + "://" + reply->request().url().host() + redirection_url.toString()));
|
request.setUrl(QUrl(reply->request().url().scheme() + QSL("://") + reply->request().url().host() + redirection_url.toString()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
request.setUrl(redirection_url);
|
request.setUrl(redirection_url);
|
||||||
|
14
src/network-web/downloadmanager.cpp
Normal file → Executable file
14
src/network-web/downloadmanager.cpp
Normal file → Executable file
@ -151,12 +151,12 @@ QString DownloadItem::saveFileName(const QString &directory) const {
|
|||||||
|
|
||||||
if (m_reply->hasRawHeader("Content-Disposition")) {
|
if (m_reply->hasRawHeader("Content-Disposition")) {
|
||||||
QString value = QLatin1String(m_reply->rawHeader("Content-Disposition"));
|
QString value = QLatin1String(m_reply->rawHeader("Content-Disposition"));
|
||||||
int pos = value.indexOf(QLatin1String("filename="));
|
int pos = value.indexOf(QL1S("filename="));
|
||||||
|
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
QString name = value.mid(pos + 9);
|
QString name = value.mid(pos + 9);
|
||||||
|
|
||||||
if (name.startsWith(QLatin1Char('"')) && name.endsWith(QLatin1Char('"'))) {
|
if (name.startsWith(QL1C('"')) && name.endsWith(QL1C('"'))) {
|
||||||
name = name.mid(1, name.size() - 2);
|
name = name.mid(1, name.size() - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,11 +173,11 @@ QString DownloadItem::saveFileName(const QString &directory) const {
|
|||||||
QString end_name = info.suffix();
|
QString end_name = info.suffix();
|
||||||
|
|
||||||
if (base_name.isEmpty()) {
|
if (base_name.isEmpty()) {
|
||||||
base_name = QLatin1String("unnamed_download");
|
base_name = QSL("unnamed_download");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!end_name.isEmpty()) {
|
if (!end_name.isEmpty()) {
|
||||||
end_name = QLatin1Char('.') + end_name;
|
end_name = QL1C('.') + end_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString name = directory + base_name + end_name;
|
QString name = directory + base_name + end_name;
|
||||||
@ -186,7 +186,7 @@ QString DownloadItem::saveFileName(const QString &directory) const {
|
|||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
name = directory + base_name + QLatin1Char('-') + QString::number(i++) + end_name;
|
name = directory + base_name + QL1C('-') + QString::number(i++) + end_name;
|
||||||
} while (QFile::exists(name));
|
} while (QFile::exists(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ void DownloadItem::updateInfoLabel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info = QString(tr("%1 of %2 (%3 per second) - %4")).arg(DownloadManager::dataString(m_bytesReceived),
|
info = QString(tr("%1 of %2 (%3 per second) - %4")).arg(DownloadManager::dataString(m_bytesReceived),
|
||||||
bytesTotal == 0 ? "?" : DownloadManager::dataString(bytesTotal),
|
bytesTotal == 0 ? QSL("?") : DownloadManager::dataString(bytesTotal),
|
||||||
DownloadManager::dataString((int)speed),
|
DownloadManager::dataString((int)speed),
|
||||||
remaining);
|
remaining);
|
||||||
}
|
}
|
||||||
@ -736,7 +736,7 @@ QString DownloadManager::dataString(qint64 size) {
|
|||||||
unit = tr("GB");
|
unit = tr("GB");
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString(QLatin1String("%1 %2")).arg(newSize, 0, 'f', 1).arg(unit);
|
return QString(QL1S("%1 %2")).arg(newSize, 0, 'f', 1).arg(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadModel::DownloadModel(DownloadManager *download_manager, QObject *parent)
|
DownloadModel::DownloadModel(DownloadManager *download_manager, QObject *parent)
|
||||||
|
@ -186,13 +186,13 @@ void GoogleSuggest::handleNetworkData() {
|
|||||||
QTextCodec *c = QTextCodec::codecForUtfText(response);
|
QTextCodec *c = QTextCodec::codecForUtfText(response);
|
||||||
xml.setContent(c->toUnicode(response));
|
xml.setContent(c->toUnicode(response));
|
||||||
|
|
||||||
QDomNodeList suggestions = xml.elementsByTagName("suggestion");
|
QDomNodeList suggestions = xml.elementsByTagName(QSL("suggestion"));
|
||||||
|
|
||||||
for (int i = 0; i < suggestions.size(); i++) {
|
for (int i = 0; i < suggestions.size(); i++) {
|
||||||
QDomElement element = suggestions.at(i).toElement();
|
QDomElement element = suggestions.at(i).toElement();
|
||||||
|
|
||||||
if (element.attributes().contains("data")) {
|
if (element.attributes().contains(QSL("data"))) {
|
||||||
choices.append(element.attribute("data"));
|
choices.append(element.attribute(QSL("data")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ QStringList NetworkFactory::extractFeedLinksFromHtmlPage(const QUrl &url, const
|
|||||||
QString href_attribute = rx_href.capturedTexts().at(0);
|
QString href_attribute = rx_href.capturedTexts().at(0);
|
||||||
QString feed_link = href_attribute.mid(6, href_attribute.size() - 7);
|
QString feed_link = href_attribute.mid(6, href_attribute.size() - 7);
|
||||||
|
|
||||||
if (feed_link.startsWith('/')) {
|
if (feed_link.startsWith(QL1C('/'))) {
|
||||||
feed_link = url.toString(QUrl::RemovePath | QUrl::RemoveQuery | QUrl::StripTrailingSlash) + feed_link;
|
feed_link = url.toString(QUrl::RemovePath | QUrl::RemoveQuery | QUrl::StripTrailingSlash) + feed_link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,11 +77,11 @@ void WebBrowser::initializeZoomWidget() {
|
|||||||
QToolButton *button_increase = new QToolButton(m_zoomButtons);
|
QToolButton *button_increase = new QToolButton(m_zoomButtons);
|
||||||
|
|
||||||
// Set texts.
|
// Set texts.
|
||||||
button_decrease->setText("-");
|
button_decrease->setText(QSL("-"));
|
||||||
button_decrease->setToolTip(tr("Decrease zoom."));
|
button_decrease->setToolTip(tr("Decrease zoom."));
|
||||||
m_btnResetZoom->setText("100%");
|
m_btnResetZoom->setText(QSL("100%"));
|
||||||
m_btnResetZoom->setToolTip(tr("Reset zoom to default."));
|
m_btnResetZoom->setToolTip(tr("Reset zoom to default."));
|
||||||
button_increase->setText("+");
|
button_increase->setText(QSL("+"));
|
||||||
button_increase->setToolTip(tr("Increase zoom."));
|
button_increase->setToolTip(tr("Increase zoom."));
|
||||||
|
|
||||||
// Setup layout.
|
// Setup layout.
|
||||||
@ -163,7 +163,7 @@ void WebBrowser::onLoadingStarted() {
|
|||||||
|
|
||||||
void WebBrowser::onLoadingProgress(int progress) {
|
void WebBrowser::onLoadingProgress(int progress) {
|
||||||
m_loadingProgress->setValue(progress);
|
m_loadingProgress->setValue(progress);
|
||||||
m_lblProgress->setText(QString(" %1 kB / %2 kB").arg(m_webView->page()->bytesReceived() / 1000).arg(m_webView->page()->totalBytes() / 1000));
|
m_lblProgress->setText(QString(QSL(" %1 kB / %2 kB")).arg(m_webView->page()->bytesReceived() / 1000).arg(m_webView->page()->totalBytes() / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::onLoadingFinished(bool success) {
|
void WebBrowser::onLoadingFinished(bool success) {
|
||||||
@ -248,14 +248,14 @@ void WebBrowser::navigateToMessages(const QList<Message> &messages) {
|
|||||||
enclosures += skin.m_enclosureMarkup.arg(enclosure.m_url);
|
enclosures += skin.m_enclosureMarkup.arg(enclosure.m_url);
|
||||||
|
|
||||||
if (!enclosure.m_mimeType.isEmpty()) {
|
if (!enclosure.m_mimeType.isEmpty()) {
|
||||||
enclosures += " [" + enclosure.m_mimeType + "]";
|
enclosures += QL1S(" [") + enclosure.m_mimeType + QL1S("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
enclosures += "<br>";
|
enclosures += QL1S("<br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enclosures.isEmpty()) {
|
if (!enclosures.isEmpty()) {
|
||||||
enclosures = enclosures.prepend("<br>");
|
enclosures = enclosures.prepend(QSL("<br>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
messages_layout.append(single_message_layout.arg(message.m_title,
|
messages_layout.append(single_message_layout.arg(message.m_title,
|
||||||
@ -271,11 +271,11 @@ void WebBrowser::navigateToMessages(const QList<Message> &messages) {
|
|||||||
QString layout_wrapper = skin.m_layoutMarkupWrapper.arg(messages.size() == 1 ? messages.at(0).m_title : tr("Newspaper view"), messages_layout);
|
QString layout_wrapper = skin.m_layoutMarkupWrapper.arg(messages.size() == 1 ? messages.at(0).m_title : tr("Newspaper view"), messages_layout);
|
||||||
|
|
||||||
m_webView->setHtml(layout_wrapper, QUrl(INTERNAL_URL_NEWSPAPER));
|
m_webView->setHtml(layout_wrapper, QUrl(INTERNAL_URL_NEWSPAPER));
|
||||||
emit iconChanged(m_index, qApp->icons()->fromTheme("item-newspaper"));
|
emit iconChanged(m_index, qApp->icons()->fromTheme(QSL("item-newspaper")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::updateZoomGui() {
|
void WebBrowser::updateZoomGui() {
|
||||||
m_btnResetZoom->setText(QString("%1%").arg(QString::number(m_webView->zoomFactor() * 100, 'f', 0)));
|
m_btnResetZoom->setText(QString(QSL("%1%")).arg(QString::number(m_webView->zoomFactor() * 100, 'f', 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::increaseZoom() {
|
void WebBrowser::increaseZoom() {
|
||||||
@ -296,7 +296,7 @@ void WebBrowser::resetZoom() {
|
|||||||
void WebBrowser::navigateToUrl(const QString &textual_url) {
|
void WebBrowser::navigateToUrl(const QString &textual_url) {
|
||||||
// Prepare input url.
|
// Prepare input url.
|
||||||
QString better_url = textual_url;
|
QString better_url = textual_url;
|
||||||
better_url = better_url.replace('\\', '/');
|
better_url = better_url.replace(QL1C('\\'), QL1C('/'));
|
||||||
|
|
||||||
navigateToUrl(QUrl::fromUserInput(better_url));
|
navigateToUrl(QUrl::fromUserInput(better_url));
|
||||||
}
|
}
|
||||||
@ -314,9 +314,9 @@ WebBrowser::~WebBrowser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::setupIcons() {
|
void WebBrowser::setupIcons() {
|
||||||
m_actionBack->setIcon(qApp->icons()->fromTheme("go-previous"));
|
m_actionBack->setIcon(qApp->icons()->fromTheme(QSL("go-previous")));
|
||||||
m_actionForward->setIcon(qApp->icons()->fromTheme("go-next"));
|
m_actionForward->setIcon(qApp->icons()->fromTheme(QSL("go-next")));
|
||||||
m_actionReload->setIcon(qApp->icons()->fromTheme("go-refresh"));
|
m_actionReload->setIcon(qApp->icons()->fromTheme(QSL("go-refresh")));
|
||||||
m_actionStop->setIcon(qApp->icons()->fromTheme("go-stop"));
|
m_actionStop->setIcon(qApp->icons()->fromTheme(QSL("go-stop")));
|
||||||
m_webView->setupIcons();
|
m_webView->setupIcons();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ bool WebFactory::sendMessageViaEmail(const Message &message) {
|
|||||||
QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
|
QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
|
||||||
QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
|
QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
|
||||||
|
|
||||||
return QProcess::startDetached(QString("\"") + browser + "\" " + arguments.arg(message.m_title,
|
return QProcess::startDetached(QString("\"") + browser + QSL("\" ") + arguments.arg(message.m_title,
|
||||||
stripTags(message.m_contents)));
|
stripTags(message.m_contents)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -49,7 +49,7 @@ bool WebFactory::openUrlInExternalBrowser(const QString &url) {
|
|||||||
QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
|
QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
|
||||||
QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
|
QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
|
||||||
|
|
||||||
return QProcess::startDetached(QString("\"") + browser + "\"", QStringList() << arguments.arg(url));
|
return QProcess::startDetached(QString("\"") + browser + QSL("\""), QStringList() << arguments.arg(url));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return QDesktopServices::openUrl(url);
|
return QDesktopServices::openUrl(url);
|
||||||
@ -104,7 +104,7 @@ bool WebFactory::autoloadImages() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString WebFactory::stripTags(QString text) {
|
QString WebFactory::stripTags(QString text) {
|
||||||
return text.remove(QRegExp("<[^>]*>"));
|
return text.remove(QRegExp(QSL("<[^>]*>")));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WebFactory::escapeHtml(const QString &html) {
|
QString WebFactory::escapeHtml(const QString &html) {
|
||||||
@ -171,22 +171,22 @@ QString WebFactory::toSecondLevelDomain(const QUrl &url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebFactory::generetaEscapes() {
|
void WebFactory::generetaEscapes() {
|
||||||
m_escapes["<"] = '<';
|
m_escapes[QSL("<")] = QL1C('<');
|
||||||
m_escapes[">"] = '>';
|
m_escapes[QSL(">")] = QL1C('>');
|
||||||
m_escapes["&"] = '&';
|
m_escapes[QSL("&")] = QL1C('&');
|
||||||
m_escapes["""] = '\"';
|
m_escapes[QSL(""")] = QL1C('\"');
|
||||||
m_escapes[" "] = ' ';
|
m_escapes[QSL(" ")] = QL1C(' ');
|
||||||
m_escapes["±"] = "±";
|
m_escapes[QSL("±")] = QSL("±");
|
||||||
m_escapes["×"] = "×";
|
m_escapes[QSL("×")] = QSL("×");
|
||||||
m_escapes["'"] = '\'';
|
m_escapes[QSL("'")] = QL1C('\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebFactory::generateDeescapes() {
|
void WebFactory::generateDeescapes() {
|
||||||
m_deEscapes["<"] = "<";
|
m_deEscapes[QSL("<")] = QSL("<");
|
||||||
m_deEscapes[">"] = ">";
|
m_deEscapes[QSL(">")] = QSL(">");
|
||||||
m_deEscapes["&"] = "&";
|
m_deEscapes[QSL("&")] = QSL("&");
|
||||||
m_deEscapes["\""] = """;
|
m_deEscapes[QSL("\"")] = QSL(""");
|
||||||
m_deEscapes["±"] = "±";
|
m_deEscapes[QSL("±")] = QSL("±");
|
||||||
m_deEscapes["×"] = "×";
|
m_deEscapes[QSL("×")] = QSL("×");
|
||||||
m_deEscapes["\'"] = "'";
|
m_deEscapes[QSL("\'")] = QSL("'");
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
#include <QWebFrame>
|
#include <QWebFrame>
|
||||||
|
|
||||||
|
|
||||||
QList<WebPage*> WebPage::livingPages_;
|
QList<WebPage*> WebPage::s_livingPages;
|
||||||
|
|
||||||
WebPage::WebPage(QObject *parent)
|
WebPage::WebPage(QObject *parent)
|
||||||
: QWebPage(parent), loadProgress_(-1) {
|
: QWebPage(parent), m_loadProgress(-1) {
|
||||||
// Setup global network access manager.
|
// Setup global network access manager.
|
||||||
// NOTE: This makes network settings easy for all web browsers.
|
// NOTE: This makes network settings easy for all web browsers.
|
||||||
setNetworkAccessManager(new WebBrowserNetworkAccessManager(this, this));
|
setNetworkAccessManager(new WebBrowserNetworkAccessManager(this, this));
|
||||||
@ -41,80 +41,74 @@ WebPage::WebPage(QObject *parent)
|
|||||||
connect(this, SIGNAL(loadProgress(int)), this, SLOT(progress(int)));
|
connect(this, SIGNAL(loadProgress(int)), this, SLOT(progress(int)));
|
||||||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finished()));
|
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finished()));
|
||||||
|
|
||||||
livingPages_.append(this);
|
s_livingPages.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPage::~WebPage() {
|
WebPage::~WebPage() {
|
||||||
livingPages_.removeOne(this);
|
s_livingPages.removeOne(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebPage::isLoading() const
|
bool WebPage::isLoading() const {
|
||||||
{
|
return m_loadProgress < 100;
|
||||||
return loadProgress_ < 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::progress(int prog)
|
void WebPage::progress(int prog) {
|
||||||
{
|
m_loadProgress = prog;
|
||||||
loadProgress_ = prog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::finished()
|
void WebPage::finished() {
|
||||||
{
|
|
||||||
progress(100);
|
progress(100);
|
||||||
|
|
||||||
// AdBlock
|
|
||||||
cleanBlockedObjects();
|
cleanBlockedObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::cleanBlockedObjects()
|
void WebPage::cleanBlockedObjects() {
|
||||||
{
|
AdBlockManager *manager = AdBlockManager::instance();
|
||||||
AdBlockManager* manager = AdBlockManager::instance();
|
|
||||||
if (!manager->isEnabled()) {
|
if (!manager->isEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QWebElement docElement = mainFrame()->documentElement();
|
const QWebElement doc_element = mainFrame()->documentElement();
|
||||||
|
|
||||||
foreach (const AdBlockedEntry &entry, adBlockedEntries_) {
|
foreach (const AdBlockedEntry &entry, m_adBlockedEntries) {
|
||||||
const QString urlString = entry.url.toString();
|
const QString url_string = entry.url.toString();
|
||||||
if (urlString.endsWith(QLatin1String(".js")) || urlString.endsWith(QLatin1String(".css"))) {
|
if (url_string.endsWith(QL1S(".js")) || url_string.endsWith(QL1S(".css"))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString urlEnd;
|
QString url_end;
|
||||||
|
|
||||||
int pos = urlString.lastIndexOf(QLatin1Char('/'));
|
int pos = url_string.lastIndexOf(QL1C('/'));
|
||||||
if (pos > 8) {
|
if (pos > 8) {
|
||||||
urlEnd = urlString.mid(pos + 1);
|
url_end = url_string.mid(pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (urlString.endsWith(QLatin1Char('/'))) {
|
if (url_string.endsWith(QL1C('/'))) {
|
||||||
urlEnd = urlString.left(urlString.size() - 1);
|
url_end = url_string.left(url_string.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString selector("img[src$=\"%1\"], iframe[src$=\"%1\"],embed[src$=\"%1\"]");
|
QString selector(QSL("img[src$=\"%1\"], iframe[src$=\"%1\"],embed[src$=\"%1\"]"));
|
||||||
QWebElementCollection elements = docElement.findAll(selector.arg(urlEnd));
|
QWebElementCollection elements = doc_element.findAll(selector.arg(url_end));
|
||||||
|
|
||||||
foreach (QWebElement element, elements) {
|
foreach (QWebElement element, elements) {
|
||||||
QString src = element.attribute("src");
|
QString src = element.attribute(QSL("src"));
|
||||||
src.remove(QLatin1String("../"));
|
src.remove(QL1S("../"));
|
||||||
|
|
||||||
if (urlString.contains(src)) {
|
if (url_string.contains(src)) {
|
||||||
element.setStyleProperty("display", "none");
|
element.setStyleProperty(QSL("display"), QSL("none"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply domain-specific element hiding rules
|
// Apply domain-specific element hiding rules
|
||||||
QString elementHiding = manager->elementHidingRulesForDomain(mainFrame()->url());
|
QString element_hiding = manager->elementHidingRulesForDomain(mainFrame()->url());
|
||||||
if (elementHiding.isEmpty()) {
|
if (element_hiding.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
elementHiding.append(QLatin1String("\n</style>"));
|
element_hiding.append(QL1S("\n</style>"));
|
||||||
|
|
||||||
QWebElement bodyElement = docElement.findFirst("body");
|
QWebElement body_element = doc_element.findFirst(QSL("body"));
|
||||||
bodyElement.appendInside("<style type=\"text/css\">\n/* AdBlock for QupZilla */\n" + elementHiding);
|
body_element.appendInside(QSL("<style type=\"text/css\">\n/* AdBlock for RSS Guard */\n") + element_hiding);
|
||||||
|
|
||||||
// When hiding some elements, scroll position of page will change
|
// When hiding some elements, scroll position of page will change
|
||||||
// If user loaded anchor link in background tab (and didn't show it yet), fix the scroll position
|
// If user loaded anchor link in background tab (and didn't show it yet), fix the scroll position
|
||||||
@ -123,79 +117,66 @@ void WebPage::cleanBlockedObjects()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::urlChanged(const QUrl &url)
|
void WebPage::urlChanged(const QUrl &url) {
|
||||||
{
|
|
||||||
Q_UNUSED(url)
|
Q_UNUSED(url)
|
||||||
|
|
||||||
if (isLoading()) {
|
if (isLoading()) {
|
||||||
adBlockedEntries_.clear();
|
m_adBlockedEntries.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::addAdBlockRule(const AdBlockRule* rule, const QUrl &url)
|
void WebPage::addAdBlockRule(const AdBlockRule *rule, const QUrl &url) {
|
||||||
{
|
|
||||||
AdBlockedEntry entry;
|
AdBlockedEntry entry;
|
||||||
|
|
||||||
entry.rule = rule;
|
entry.rule = rule;
|
||||||
entry.url = url;
|
entry.url = url;
|
||||||
|
|
||||||
if (!adBlockedEntries_.contains(entry)) {
|
if (!m_adBlockedEntries.contains(entry)) {
|
||||||
adBlockedEntries_.append(entry);
|
m_adBlockedEntries.append(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<WebPage::AdBlockedEntry> WebPage::adBlockedEntries() const
|
QVector<WebPage::AdBlockedEntry> WebPage::adBlockedEntries() const {
|
||||||
{
|
return m_adBlockedEntries;
|
||||||
return adBlockedEntries_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebPage::isPointerSafeToUse(WebPage* page)
|
bool WebPage::isPointerSafeToUse(WebPage *page) {
|
||||||
{
|
|
||||||
// Pointer to WebPage is passed with every QNetworkRequest casted to void*
|
// Pointer to WebPage is passed with every QNetworkRequest casted to void*
|
||||||
// So there is no way to test whether pointer is still valid or not, except
|
// So there is no way to test whether pointer is still valid or not, except
|
||||||
// this hack.
|
// this hack.
|
||||||
|
|
||||||
return page == 0 ? false : livingPages_.contains(page);
|
return page == 0 ? false : s_livingPages.contains(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WebPage::toPlainText() const {
|
QString WebPage::toPlainText() const {
|
||||||
return mainFrame()->toPlainText();
|
return mainFrame()->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::populateNetworkRequest(QNetworkRequest &request)
|
void WebPage::populateNetworkRequest(QNetworkRequest &request) {
|
||||||
{
|
WebPage *page_pointer = this;
|
||||||
WebPage* pagePointer = this;
|
|
||||||
|
|
||||||
QVariant variant = QVariant::fromValue((void*) pagePointer);
|
QVariant variant = QVariant::fromValue((void*) page_pointer);
|
||||||
request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), variant);
|
request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), variant);
|
||||||
/*
|
|
||||||
if (lastRequestUrl_ == request.url()) {
|
|
||||||
request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 101), lastRequestType_);
|
|
||||||
if (lastRequestType_ == NavigationTypeLinkClicked) {
|
|
||||||
request.setRawHeader("X-QuiteRSS-UserLoadAction", QByteArray("1"));
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::handleUnsupportedContent(QNetworkReply *reply) {
|
void WebPage::handleUnsupportedContent(QNetworkReply *reply) {
|
||||||
if (!reply) {
|
if (reply != NULL) {
|
||||||
return;
|
QUrl reply_url = reply->url();
|
||||||
}
|
|
||||||
|
|
||||||
QUrl replyUrl = reply->url();
|
if (reply_url.scheme() == QL1S("abp")) {
|
||||||
|
|
||||||
if (replyUrl.scheme() == QLatin1String("abp")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (reply->error()) {
|
|
||||||
case QNetworkReply::NoError:
|
|
||||||
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
|
|
||||||
qApp->downloadManager()->handleUnsupportedContent(reply);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (reply->error()) {
|
||||||
|
case QNetworkReply::NoError:
|
||||||
|
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
|
||||||
|
qApp->downloadManager()->handleUnsupportedContent(reply);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,14 +189,11 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame,
|
|||||||
QWebPage::NavigationType type) {
|
QWebPage::NavigationType type) {
|
||||||
QString scheme = request.url().scheme();
|
QString scheme = request.url().scheme();
|
||||||
|
|
||||||
if (scheme == "mailto" || scheme == "ftp") {
|
if (scheme == QL1S("mailto") || scheme == QL1S("ftp")) {
|
||||||
qWarning("Received request with scheme '%s', blocking it.", qPrintable(scheme));
|
qWarning("Received request with scheme '%s', blocking it.", qPrintable(scheme));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastRequestType_ = type;
|
|
||||||
lastRequestUrl_ = request.url();
|
|
||||||
|
|
||||||
if (type == QWebPage::NavigationTypeLinkClicked &&
|
if (type == QWebPage::NavigationTypeLinkClicked &&
|
||||||
frame == mainFrame()) {
|
frame == mainFrame()) {
|
||||||
// Make sure that appropriate signal is emitted even if
|
// Make sure that appropriate signal is emitted even if
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <QWebPage>
|
#include <QWebPage>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QSslCertificate>
|
|
||||||
|
|
||||||
|
|
||||||
class AdBlockRule;
|
class AdBlockRule;
|
||||||
@ -30,12 +29,12 @@ class WebPage : public QWebPage {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct AdBlockedEntry {
|
struct AdBlockedEntry {
|
||||||
const AdBlockRule* rule;
|
const AdBlockRule *rule;
|
||||||
QUrl url;
|
QUrl url;
|
||||||
|
|
||||||
bool operator==(const AdBlockedEntry &other) const {
|
bool operator==(const AdBlockedEntry &other) const {
|
||||||
return (this->rule == other.rule && this->url == other.url);
|
return (this->rule == other.rule && this->url == other.url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
@ -45,12 +44,12 @@ class WebPage : public QWebPage {
|
|||||||
QString toHtml() const;
|
QString toHtml() const;
|
||||||
QString toPlainText() const;
|
QString toPlainText() const;
|
||||||
|
|
||||||
void populateNetworkRequest(QNetworkRequest &request);
|
void populateNetworkRequest(QNetworkRequest &request);
|
||||||
|
|
||||||
bool isLoading() const;
|
bool isLoading() const;
|
||||||
|
|
||||||
static bool isPointerSafeToUse(WebPage* page);
|
static bool isPointerSafeToUse(WebPage *page);
|
||||||
void addAdBlockRule(const AdBlockRule* rule, const QUrl &url);
|
void addAdBlockRule(const AdBlockRule *rule, const QUrl &url);
|
||||||
QVector<AdBlockedEntry> adBlockedEntries() const;
|
QVector<AdBlockedEntry> adBlockedEntries() const;
|
||||||
|
|
||||||
|
|
||||||
@ -66,14 +65,10 @@ class WebPage : public QWebPage {
|
|||||||
bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type);
|
bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWebPage::NavigationType lastRequestType_;
|
QVector<AdBlockedEntry> m_adBlockedEntries;
|
||||||
QUrl lastRequestUrl_;
|
int m_loadProgress;
|
||||||
|
|
||||||
bool adjustingScheduled_;
|
static QList<WebPage*> s_livingPages;
|
||||||
static QList<WebPage*> livingPages_;
|
|
||||||
QVector<AdBlockedEntry> adBlockedEntries_;
|
|
||||||
|
|
||||||
int loadProgress_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BASEWEBPAGE_H
|
#endif // WEBPAGE_H
|
||||||
|
@ -93,7 +93,7 @@ void WebView::saveCurrentPageToFile() {
|
|||||||
QString filter;
|
QString filter;
|
||||||
QString selected_filter;
|
QString selected_filter;
|
||||||
QString filename_for_prompt = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetExplicitDirectory)).toString() +
|
QString filename_for_prompt = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetExplicitDirectory)).toString() +
|
||||||
QDir::separator() + implicit_file_base_name + ".html";
|
QDir::separator() + implicit_file_base_name + QL1S(".html");
|
||||||
|
|
||||||
// Add more filters here.
|
// Add more filters here.
|
||||||
filter += filter_html;
|
filter += filter_html;
|
||||||
@ -112,14 +112,14 @@ void WebView::saveCurrentPageToFile() {
|
|||||||
base_folder += QDir::separator();
|
base_folder += QDir::separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
selected_file = base_folder + implicit_file_base_name + ".html";
|
selected_file = base_folder + implicit_file_base_name + QL1S(".html");
|
||||||
|
|
||||||
if (QFile::exists(selected_file)) {
|
if (QFile::exists(selected_file)) {
|
||||||
int file_suffix = 0;
|
int file_suffix = 0;
|
||||||
QString subsequent_file_name;
|
QString subsequent_file_name;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
subsequent_file_name = base_folder + QString(implicit_file_base_name + "-%1.html").arg(file_suffix++);
|
subsequent_file_name = base_folder + QString(implicit_file_base_name + QL1S("-%1.html")).arg(file_suffix++);
|
||||||
} while (QFile::exists(subsequent_file_name));
|
} while (QFile::exists(subsequent_file_name));
|
||||||
|
|
||||||
selected_file = subsequent_file_name;
|
selected_file = subsequent_file_name;
|
||||||
@ -158,24 +158,24 @@ void WebView::createConnections() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebView::setupIcons() {
|
void WebView::setupIcons() {
|
||||||
m_actionPrint->setIcon(qApp->icons()->fromTheme("print-web-page"));
|
m_actionPrint->setIcon(qApp->icons()->fromTheme(QSL("print-web-page")));
|
||||||
m_actionReload->setIcon(qApp->icons()->fromTheme("go-refresh"));
|
m_actionReload->setIcon(qApp->icons()->fromTheme(QSL("go-refresh")));
|
||||||
m_actionCopySelectedItem->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
m_actionCopySelectedItem->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
|
||||||
m_actionCopyLink->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
m_actionCopyLink->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
|
||||||
m_actionCopyImage->setIcon(qApp->icons()->fromTheme("edit-copy-image"));
|
m_actionCopyImage->setIcon(qApp->icons()->fromTheme(QSL("edit-copy-image")));
|
||||||
m_actionSaveHyperlinkAs->setIcon(qApp->icons()->fromTheme("document-download"));
|
m_actionSaveHyperlinkAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
|
||||||
m_actionSaveImageAs->setIcon(qApp->icons()->fromTheme("document-download"));
|
m_actionSaveImageAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
#if QT_VERSION >= 0x040800
|
||||||
m_actionCopyImageUrl->setIcon(qApp->icons()->fromTheme("edit-copy"));
|
m_actionCopyImageUrl->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_actionOpenLinkThisTab->setIcon(qApp->icons()->fromTheme("item-open-internal"));
|
m_actionOpenLinkThisTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
|
||||||
m_actionOpenLinkNewTab->setIcon(qApp->icons()->fromTheme("item-open-internal"));
|
m_actionOpenLinkNewTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
|
||||||
m_actionOpenLinkExternally->setIcon(qApp->icons()->fromTheme("item-open-external"));
|
m_actionOpenLinkExternally->setIcon(qApp->icons()->fromTheme(QSL("item-open-external")));
|
||||||
m_actionOpenImageNewTab->setIcon(qApp->icons()->fromTheme("edit-copy-image"));
|
m_actionOpenImageNewTab->setIcon(qApp->icons()->fromTheme(QSL("edit-copy-image")));
|
||||||
|
|
||||||
m_actionLookupText->setIcon(qApp->icons()->fromTheme("item-search-google"));
|
m_actionLookupText->setIcon(qApp->icons()->fromTheme(QSL("item-search-google")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::initializeActions() {
|
void WebView::initializeActions() {
|
||||||
@ -206,7 +206,7 @@ void WebView::initializeActions() {
|
|||||||
m_actionSaveImageAs = pageAction(QWebPage::DownloadImageToDisk);
|
m_actionSaveImageAs = pageAction(QWebPage::DownloadImageToDisk);
|
||||||
m_actionSaveImageAs->setParent(this);
|
m_actionSaveImageAs->setParent(this);
|
||||||
|
|
||||||
m_actionSavePageAs = new QAction(qApp->icons()->fromTheme("document-download"), tr("Save page as..."), this);
|
m_actionSavePageAs = new QAction(qApp->icons()->fromTheme(QSL("document-download")), tr("Save page as..."), this);
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040800
|
#if QT_VERSION >= 0x040800
|
||||||
m_actionCopyImageUrl = pageAction(QWebPage::CopyImageUrlToClipboard);
|
m_actionCopyImageUrl = pageAction(QWebPage::CopyImageUrlToClipboard);
|
||||||
@ -279,8 +279,8 @@ void WebView::popupContextMenu(const QPoint &pos) {
|
|||||||
QMenu link_submenu(tr("Hyperlink"), this);
|
QMenu link_submenu(tr("Hyperlink"), this);
|
||||||
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos);
|
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos);
|
||||||
|
|
||||||
image_submenu.setIcon(qApp->icons()->fromTheme("image-generic"));
|
image_submenu.setIcon(qApp->icons()->fromTheme(QSL("image-generic")));
|
||||||
link_submenu.setIcon(qApp->icons()->fromTheme("text-html"));
|
link_submenu.setIcon(qApp->icons()->fromTheme(QSL("text-html")));
|
||||||
|
|
||||||
// Assemble the menu from actions.
|
// Assemble the menu from actions.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user