Removed obsolete code, some refactorings.
This commit is contained in:
parent
8862b70638
commit
032fccc387
@ -40,6 +40,10 @@ else {
|
|||||||
DEFINES *= DEBUG=1
|
DEFINES *= DEBUG=1
|
||||||
gcc:QMAKE_CXXFLAGS_DEBUG *= -Wall
|
gcc:QMAKE_CXXFLAGS_DEBUG *= -Wall
|
||||||
clang:QMAKE_CXXFLAGS_DEBUG *= -Wall
|
clang:QMAKE_CXXFLAGS_DEBUG *= -Wall
|
||||||
|
msvc:QMAKE_CXXFLAGS_DEBUG *= /W4 /wd4127
|
||||||
|
msvc:QMAKE_CXXFLAGS_WARN_ON = ""
|
||||||
|
msvc:QMAKE_CXXFLAGS_DEBUG -= /W3
|
||||||
|
msvc:QMAKE_CXXFLAGS -= /W3
|
||||||
}
|
}
|
||||||
|
|
||||||
MOC_DIR = $$OUT_PWD/moc
|
MOC_DIR = $$OUT_PWD/moc
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<file>./graphics/Faenza/actions/64/application-exit.png</file>
|
<file>./graphics/Faenza/actions/64/application-exit.png</file>
|
||||||
<file>./graphics/Faenza/actions/64/back.png</file>
|
<file>./graphics/Faenza/actions/64/back.png</file>
|
||||||
<file>./graphics/Faenza/actions/64/call-start.png</file>
|
<file>./graphics/Faenza/actions/64/call-start.png</file>
|
||||||
|
<file>./graphics/Faenza/actions/64/dialog-no.png</file>
|
||||||
<file>./graphics/Faenza/actions/64/dialog-yes.png</file>
|
<file>./graphics/Faenza/actions/64/dialog-yes.png</file>
|
||||||
<file>./graphics/Faenza/actions/64/document-edit.png</file>
|
<file>./graphics/Faenza/actions/64/document-edit.png</file>
|
||||||
<file>./graphics/Faenza/actions/64/document-export.png</file>
|
<file>./graphics/Faenza/actions/64/document-export.png</file>
|
||||||
|
@ -14,7 +14,12 @@ Enclosure::Enclosure(QString url, QString mime) : m_url(std::move(url)), m_mimeT
|
|||||||
QList<Enclosure> Enclosures::decodeEnclosuresFromString(const QString& enclosures_data) {
|
QList<Enclosure> Enclosures::decodeEnclosuresFromString(const QString& enclosures_data) {
|
||||||
QList<Enclosure> enclosures;
|
QList<Enclosure> enclosures;
|
||||||
|
|
||||||
for (const QString& single_enclosure : enclosures_data.split(ENCLOSURES_OUTER_SEPARATOR, QString::SkipEmptyParts)) {
|
for (const QString& single_enclosure : enclosures_data.split(ENCLOSURES_OUTER_SEPARATOR,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts)) {
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts)) {
|
||||||
|
#endif
|
||||||
Enclosure enclosure;
|
Enclosure enclosure;
|
||||||
|
|
||||||
if (single_enclosure.contains(ECNLOSURES_INNER_SEPARATOR)) {
|
if (single_enclosure.contains(ECNLOSURES_INNER_SEPARATOR)) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <QSqlField>
|
#include <QSqlField>
|
||||||
|
|
||||||
MessagesModel::MessagesModel(QObject* parent)
|
MessagesModel::MessagesModel(QObject* parent)
|
||||||
: QSqlQueryModel(parent), m_cache(new MessagesModelCache(this)), m_messageHighlighter(NoHighlighting),
|
: QSqlQueryModel(parent), m_cache(new MessagesModelCache(this)), m_messageHighlighter(MessageHighlighter::NoHighlighting),
|
||||||
m_customDateFormat(QString()), m_selectedItem(nullptr), m_itemHeight(-1) {
|
m_customDateFormat(QString()), m_selectedItem(nullptr), m_itemHeight(-1) {
|
||||||
setupFonts();
|
setupFonts();
|
||||||
setupIcons();
|
setupIcons();
|
||||||
@ -286,21 +286,21 @@ QVariant MessagesModel::data(const QModelIndex& idx, int role) const {
|
|||||||
|
|
||||||
case Qt::ForegroundRole:
|
case Qt::ForegroundRole:
|
||||||
switch (m_messageHighlighter) {
|
switch (m_messageHighlighter) {
|
||||||
case HighlightImportant: {
|
case MessageHighlighter::HighlightImportant: {
|
||||||
QModelIndex idx_important = index(idx.row(), MSG_DB_IMPORTANT_INDEX);
|
QModelIndex idx_important = index(idx.row(), MSG_DB_IMPORTANT_INDEX);
|
||||||
QVariant dta = m_cache->containsData(idx_important.row()) ? m_cache->data(idx_important) : QSqlQueryModel::data(idx_important);
|
QVariant dta = m_cache->containsData(idx_important.row()) ? m_cache->data(idx_important) : QSqlQueryModel::data(idx_important);
|
||||||
|
|
||||||
return dta.toInt() == 1 ? qApp->skins()->currentSkin().m_colorPalette[Skin::PaletteColors::Highlight] : QVariant();
|
return dta.toInt() == 1 ? qApp->skins()->currentSkin().m_colorPalette[Skin::PaletteColors::Highlight] : QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
case HighlightUnread: {
|
case MessageHighlighter::HighlightUnread: {
|
||||||
QModelIndex idx_read = index(idx.row(), MSG_DB_READ_INDEX);
|
QModelIndex idx_read = index(idx.row(), MSG_DB_READ_INDEX);
|
||||||
QVariant dta = m_cache->containsData(idx_read.row()) ? m_cache->data(idx_read) : QSqlQueryModel::data(idx_read);
|
QVariant dta = m_cache->containsData(idx_read.row()) ? m_cache->data(idx_read) : QSqlQueryModel::data(idx_read);
|
||||||
|
|
||||||
return dta.toInt() == 0 ? qApp->skins()->currentSkin().m_colorPalette[Skin::PaletteColors::Highlight] : QVariant();
|
return dta.toInt() == 0 ? qApp->skins()->currentSkin().m_colorPalette[Skin::PaletteColors::Highlight] : QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
case NoHighlighting:
|
case MessageHighlighter::NoHighlighting:
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
|
|||||||
|
|
||||||
// Enum which describes basic filtering schemes
|
// Enum which describes basic filtering schemes
|
||||||
// for messages.
|
// for messages.
|
||||||
enum MessageHighlighter {
|
enum class MessageHighlighter {
|
||||||
NoHighlighting = 100,
|
NoHighlighting = 100,
|
||||||
HighlightUnread = 101,
|
HighlightUnread = 101,
|
||||||
HighlightImportant = 102
|
HighlightImportant = 102
|
||||||
|
@ -23,7 +23,10 @@ FormMessageFiltersManager::FormMessageFiltersManager(FeedReader* reader, const Q
|
|||||||
|
|
||||||
GuiUtilities::applyDialogProperties(*this, qApp->icons()->fromTheme(QSL("view-list-details")));
|
GuiUtilities::applyDialogProperties(*this, qApp->icons()->fromTheme(QSL("view-list-details")));
|
||||||
|
|
||||||
|
m_ui.m_treeFeeds->setIndentation(FEEDS_VIEW_INDENTATION);
|
||||||
m_ui.m_treeFeeds->setModel(m_feedsModel);
|
m_ui.m_treeFeeds->setModel(m_feedsModel);
|
||||||
|
m_ui.m_btnCheckAll->setIcon(qApp->icons()->fromTheme(QSL("dialog-yes")));
|
||||||
|
m_ui.m_btnUncheckAll->setIcon(qApp->icons()->fromTheme(QSL("dialog-no")));
|
||||||
m_ui.m_btnAddNew->setIcon(qApp->icons()->fromTheme(QSL("list-add")));
|
m_ui.m_btnAddNew->setIcon(qApp->icons()->fromTheme(QSL("list-add")));
|
||||||
m_ui.m_btnRemoveSelected->setIcon(qApp->icons()->fromTheme(QSL("list-remove")));
|
m_ui.m_btnRemoveSelected->setIcon(qApp->icons()->fromTheme(QSL("list-remove")));
|
||||||
m_ui.m_btnBeautify->setIcon(qApp->icons()->fromTheme(QSL("format-justify-fill")));
|
m_ui.m_btnBeautify->setIcon(qApp->icons()->fromTheme(QSL("format-justify-fill")));
|
||||||
@ -47,6 +50,8 @@ FormMessageFiltersManager::FormMessageFiltersManager(FeedReader* reader, const Q
|
|||||||
loadSelectedAccount();
|
loadSelectedAccount();
|
||||||
loadFilterFeedAssignments();
|
loadFilterFeedAssignments();
|
||||||
});
|
});
|
||||||
|
connect(m_ui.m_btnCheckAll, &QPushButton::clicked, m_feedsModel, &AccountCheckModel::checkAllItems);
|
||||||
|
connect(m_ui.m_btnUncheckAll, &QPushButton::clicked, m_feedsModel, &AccountCheckModel::uncheckAllItems);
|
||||||
|
|
||||||
initializeTestingMessage();
|
initializeTestingMessage();
|
||||||
loadFilter();
|
loadFilter();
|
||||||
|
@ -77,6 +77,9 @@
|
|||||||
<height>150</height>
|
<height>150</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="uniformRowHeights">
|
<property name="uniformRowHeights">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -88,14 +91,14 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="m_btnCheckAll">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Check all</string>
|
<string>&Check all</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QPushButton" name="m_btnUncheckAll">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Uncheck all</string>
|
<string>&Uncheck all</string>
|
||||||
</property>
|
</property>
|
||||||
@ -406,8 +409,8 @@
|
|||||||
<tabstop>m_btnRemoveSelected</tabstop>
|
<tabstop>m_btnRemoveSelected</tabstop>
|
||||||
<tabstop>m_cmbAccounts</tabstop>
|
<tabstop>m_cmbAccounts</tabstop>
|
||||||
<tabstop>m_treeFeeds</tabstop>
|
<tabstop>m_treeFeeds</tabstop>
|
||||||
<tabstop>pushButton</tabstop>
|
<tabstop>m_btnCheckAll</tabstop>
|
||||||
<tabstop>pushButton_2</tabstop>
|
<tabstop>m_btnUncheckAll</tabstop>
|
||||||
<tabstop>m_txtTitle</tabstop>
|
<tabstop>m_txtTitle</tabstop>
|
||||||
<tabstop>m_txtScript</tabstop>
|
<tabstop>m_txtScript</tabstop>
|
||||||
<tabstop>m_btnTest</tabstop>
|
<tabstop>m_btnTest</tabstop>
|
||||||
|
@ -77,10 +77,20 @@ void FeedsToolBar::loadSpecificActions(const QList<QAction*>& actions, bool init
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList FeedsToolBar::defaultActions() const {
|
QStringList FeedsToolBar::defaultActions() const {
|
||||||
return QString(GUI::FeedsToolbarActionsDef).split(',', QString::SkipEmptyParts);
|
return QString(GUI::FeedsToolbarActionsDef).split(',',
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FeedsToolBar::savedActions() const {
|
QStringList FeedsToolBar::savedActions() const {
|
||||||
return qApp->settings()->value(GROUP(GUI),
|
return qApp->settings()->value(GROUP(GUI),
|
||||||
SETTING(GUI::FeedsToolbarActions)).toString().split(',', QString::SkipEmptyParts);
|
SETTING(GUI::FeedsToolbarActions)).toString().split(',',
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,9 @@ void FeedsView::saveExpandStates(RootItem* item) {
|
|||||||
QList<RootItem*> items = item->getSubTree(RootItemKind::Category | RootItemKind::ServiceRoot);
|
QList<RootItem*> items = item->getSubTree(RootItemKind::Category | RootItemKind::ServiceRoot);
|
||||||
|
|
||||||
// Iterate all categories and save their expand statuses.
|
// Iterate all categories and save their expand statuses.
|
||||||
for (const RootItem* item : items) {
|
for (const RootItem* it : items) {
|
||||||
const QString setting_name = item->hashCode();
|
const QString setting_name = it->hashCode();
|
||||||
QModelIndex source_index = sourceModel()->indexForItem(item);
|
QModelIndex source_index = sourceModel()->indexForItem(it);
|
||||||
QModelIndex visible_index = model()->mapFromSource(source_index);
|
QModelIndex visible_index = model()->mapFromSource(source_index);
|
||||||
|
|
||||||
settings->setValue(GROUP(CategoriesExpandStates),
|
settings->setValue(GROUP(CategoriesExpandStates),
|
||||||
|
@ -118,11 +118,11 @@ 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(QSL("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::MessageHighlighter::NoHighlighting));
|
||||||
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme(QSL("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::MessageHighlighter::HighlightUnread));
|
||||||
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme(QSL("mail-mark-important")),
|
m_menuMessageHighlighter->addAction(qApp->icons()->fromTheme(QSL("mail-mark-important")),
|
||||||
tr("Highlight important messages"))->setData(QVariant::fromValue(MessagesModel::HighlightImportant));
|
tr("Highlight important messages"))->setData(QVariant::fromValue(MessagesModel::MessageHighlighter::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);
|
||||||
@ -138,12 +138,20 @@ void MessagesToolBar::initializeHighlighter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList MessagesToolBar::defaultActions() const {
|
QStringList MessagesToolBar::defaultActions() const {
|
||||||
return QString(GUI::MessagesToolbarDefaultButtonsDef).split(',',
|
return QString(GUI::MessagesToolbarDefaultButtonsDef).split(QL1C(','),
|
||||||
QString::SkipEmptyParts);
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SplitBehavior::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MessagesToolBar::savedActions() const {
|
QStringList MessagesToolBar::savedActions() const {
|
||||||
return qApp->settings()->value(GROUP(GUI),
|
return qApp->settings()->value(GROUP(GUI),
|
||||||
SETTING(GUI::MessagesToolbarDefaultButtons)).toString().split(',',
|
SETTING(GUI::MessagesToolbarDefaultButtons)).toString().split(QL1C(','),
|
||||||
QString::SkipEmptyParts);
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SplitBehavior::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -73,11 +73,22 @@ void StatusBar::saveChangeableActions(const QStringList& actions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList StatusBar::defaultActions() const {
|
QStringList StatusBar::defaultActions() const {
|
||||||
return QString(GUI::StatusbarActionsDef).split(',', QString::SkipEmptyParts);
|
return QString(GUI::StatusbarActionsDef).split(',',
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList StatusBar::savedActions() const {
|
QStringList StatusBar::savedActions() const {
|
||||||
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::StatusbarActions)).toString().split(',', QString::SkipEmptyParts);
|
return qApp->settings()->value(GROUP(GUI),
|
||||||
|
SETTING(GUI::StatusbarActions)).toString().split(',',
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QAction*> StatusBar::getSpecificActions(const QStringList& actions) {
|
QList<QAction*> StatusBar::getSpecificActions(const QStringList& actions) {
|
||||||
|
@ -72,17 +72,17 @@ void TabBar::wheelEvent(QWheelEvent* event) {
|
|||||||
|
|
||||||
// Make sure rotating works.
|
// Make sure rotating works.
|
||||||
if (number_of_tabs > 1) {
|
if (number_of_tabs > 1) {
|
||||||
if (event->delta() > 0) {
|
if (event->angleDelta().y() > 0) {
|
||||||
// Scroll to the LEFT tab.
|
// Scroll to the LEFT tab.
|
||||||
setCurrentIndex(current_index == 0 ?
|
setCurrentIndex(current_index == 0
|
||||||
number_of_tabs - 1 :
|
? number_of_tabs - 1
|
||||||
current_index - 1);
|
: current_index - 1);
|
||||||
}
|
}
|
||||||
else if (event->delta() < 0) {
|
else if (event->angleDelta().y() < 0) {
|
||||||
// Scroll to the RIGHT tab.
|
// Scroll to the RIGHT tab.
|
||||||
setCurrentIndex(current_index == number_of_tabs - 1 ?
|
setCurrentIndex(current_index == number_of_tabs - 1
|
||||||
0 :
|
? 0
|
||||||
current_index + 1);
|
: current_index + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ void Application::onAboutToQuit() {
|
|||||||
finish();
|
finish();
|
||||||
qDebug("Killing local peer connection to allow another instance to start.");
|
qDebug("Killing local peer connection to allow another instance to start.");
|
||||||
|
|
||||||
if (QProcess::startDetached(QString("\"") + QDir::toNativeSeparators(applicationFilePath()) + QString("\""))) {
|
if (QProcess::startDetached(QDir::toNativeSeparators(applicationFilePath()), {})) {
|
||||||
qDebug("New application instance was started.");
|
qDebug("New application instance was started.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -218,7 +218,12 @@ QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
|||||||
qPrintable(APP_SQL_PATH));
|
qPrintable(APP_SQL_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
database.transaction();
|
database.transaction();
|
||||||
|
|
||||||
@ -327,7 +332,12 @@ QSqlDatabase DatabaseFactory::sqliteInitializeFileBasedDatabase(const QString& c
|
|||||||
qPrintable(APP_SQL_PATH));
|
qPrintable(APP_SQL_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
database.transaction();
|
database.transaction();
|
||||||
|
|
||||||
@ -407,7 +417,12 @@ bool DatabaseFactory::sqliteUpdateDatabaseSchema(const QSqlDatabase& database, c
|
|||||||
qFatal("Updating of database schema failed. File '%s' cannot be opened.", qPrintable(QDir::toNativeSeparators(update_file_name)));
|
qFatal("Updating of database schema failed. File '%s' cannot be opened.", qPrintable(QDir::toNativeSeparators(update_file_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList statements = QString(update_file_handle.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
const QStringList statements = QString(update_file_handle.readAll()).split(APP_DB_COMMENT_SPLIT,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (const QString& statement : statements) {
|
for (const QString& statement : statements) {
|
||||||
QSqlQuery query = database.exec(statement);
|
QSqlQuery query = database.exec(statement);
|
||||||
@ -447,7 +462,12 @@ bool DatabaseFactory::mysqlUpdateDatabaseSchema(const QSqlDatabase& database,
|
|||||||
qFatal("Updating of database schema failed. File '%s' cannot be opened.", qPrintable(QDir::toNativeSeparators(update_file_name)));
|
qFatal("Updating of database schema failed. File '%s' cannot be opened.", qPrintable(QDir::toNativeSeparators(update_file_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList statements = QString(update_file_handle.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
QStringList statements = QString(update_file_handle.readAll()).split(APP_DB_COMMENT_SPLIT,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (QString statement : statements) {
|
for (QString statement : statements) {
|
||||||
QSqlQuery query = database.exec(statement.replace(APP_DB_NAME_PLACEHOLDER, db_name));
|
QSqlQuery query = database.exec(statement.replace(APP_DB_NAME_PLACEHOLDER, db_name));
|
||||||
@ -676,7 +696,12 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString& connection_
|
|||||||
qPrintable(APP_SQL_PATH));
|
qPrintable(APP_SQL_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT, QString::SkipEmptyParts);
|
const QStringList statements = QString(file_init.readAll()).split(APP_DB_COMMENT_SPLIT,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
database.transaction();
|
database.transaction();
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QProcess>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
IOFactory::IOFactory() = default;
|
IOFactory::IOFactory() = default;
|
||||||
@ -70,6 +71,18 @@ QString IOFactory::filterBadCharsFromFilename(const QString& name) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IOFactory::startProcessDetached(const QString& program, const QStringList& arguments,
|
||||||
|
const QString& native_arguments, const QString& working_directory) {
|
||||||
|
QProcess process;
|
||||||
|
|
||||||
|
process.setProgram(program);
|
||||||
|
process.setArguments(arguments);
|
||||||
|
process.setNativeArguments(native_arguments);
|
||||||
|
process.setWorkingDirectory(working_directory);
|
||||||
|
|
||||||
|
return process.startDetached(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray IOFactory::readFile(const QString& file_path) {
|
QByteArray IOFactory::readFile(const QString& file_path) {
|
||||||
QFile input_file(file_path);
|
QFile input_file(file_path);
|
||||||
QByteArray input_data;
|
QByteArray input_data;
|
||||||
|
@ -27,6 +27,10 @@ class IOFactory {
|
|||||||
|
|
||||||
// Filters out shit characters from filename.
|
// Filters out shit characters from filename.
|
||||||
static QString filterBadCharsFromFilename(const QString& name);
|
static QString filterBadCharsFromFilename(const QString& name);
|
||||||
|
static bool startProcessDetached(const QString& program,
|
||||||
|
const QStringList& arguments,
|
||||||
|
const QString& native_arguments = {},
|
||||||
|
const QString& working_directory = {});
|
||||||
|
|
||||||
// Returns contents of a file.
|
// Returns contents of a file.
|
||||||
// Throws exception when no such file exists.
|
// Throws exception when no such file exists.
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
@ -38,16 +39,13 @@ SimpleCrypt::SimpleCrypt() :
|
|||||||
m_key(0),
|
m_key(0),
|
||||||
m_compressionMode(CompressionAlways),
|
m_compressionMode(CompressionAlways),
|
||||||
m_protectionMode(ProtectionHash),
|
m_protectionMode(ProtectionHash),
|
||||||
m_lastError(ErrorNoError) {
|
m_lastError(ErrorNoError) {}
|
||||||
qsrand(uint(QDateTime::currentMSecsSinceEpoch() & 0xFFFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleCrypt::SimpleCrypt(quint64 key) :
|
SimpleCrypt::SimpleCrypt(quint64 key) :
|
||||||
m_key(key),
|
m_key(key),
|
||||||
m_compressionMode(CompressionAlways),
|
m_compressionMode(CompressionAlways),
|
||||||
m_protectionMode(ProtectionHash),
|
m_protectionMode(ProtectionHash),
|
||||||
m_lastError(ErrorNoError) {
|
m_lastError(ErrorNoError) {
|
||||||
qsrand(uint(QDateTime::currentMSecsSinceEpoch() & 0xFFFF));
|
|
||||||
splitKey();
|
splitKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +114,7 @@ QByteArray SimpleCrypt::encryptToByteArray(QByteArray plaintext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//prepend a random char to the string
|
//prepend a random char to the string
|
||||||
char randomChar = char(qrand() & 0xFF);
|
char randomChar = char(QRandomGenerator::global()->generate() & 0xFF);
|
||||||
|
|
||||||
ba = randomChar + integrityProtection + ba;
|
ba = randomChar + integrityProtection + ba;
|
||||||
int pos(0);
|
int pos(0);
|
||||||
@ -221,6 +219,7 @@ QByteArray SimpleCrypt::decryptToByteArray(QByteArray cypher) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
quint16 storedChecksum;
|
quint16 storedChecksum;
|
||||||
|
|
||||||
{
|
{
|
||||||
QDataStream s(&ba, QIODevice::ReadOnly);
|
QDataStream s(&ba, QIODevice::ReadOnly);
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ SystemFactory::AutoStartStatus SystemFactory::autoStartStatus() const {
|
|||||||
return AutoStartStatus::Disabled;
|
return AutoStartStatus::Disabled;
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
|
|
||||||
// Use proper freedesktop.org way to auto-start the application on Linux.
|
// Use proper freedesktop.org way to auto-start the application on Linux.
|
||||||
// INFO: http://standards.freedesktop.org/autostart-spec/latest/
|
// INFO: http://standards.freedesktop.org/autostart-spec/latest/
|
||||||
const QString desktop_file_location = autostartDesktopFileLocation();
|
const QString desktop_file_location = autostartDesktopFileLocation();
|
||||||
@ -82,7 +81,6 @@ SystemFactory::AutoStartStatus SystemFactory::autoStartStatus() const {
|
|||||||
return AutoStartStatus::Disabled;
|
return AutoStartStatus::Disabled;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Disable auto-start functionality on unsupported platforms.
|
// Disable auto-start functionality on unsupported platforms.
|
||||||
return AutoStartStatus::Unavailable;
|
return AutoStartStatus::Unavailable;
|
||||||
#endif
|
#endif
|
||||||
@ -139,7 +137,6 @@ bool SystemFactory::setAutoStartStatus(AutoStartStatus new_status) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
|
|
||||||
// Note that we expect here that no other program uses
|
// Note that we expect here that no other program uses
|
||||||
// "rssguard.desktop" desktop file.
|
// "rssguard.desktop" desktop file.
|
||||||
const QString destination_file = autostartDesktopFileLocation();
|
const QString destination_file = autostartDesktopFileLocation();
|
||||||
@ -279,7 +276,8 @@ bool SystemFactory::isVersionEqualOrNewer(const QString& new_version, const QStr
|
|||||||
|
|
||||||
bool SystemFactory::openFolderFile(const QString& file_path) {
|
bool SystemFactory::openFolderFile(const QString& file_path) {
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
return QProcess::startDetached(QString("explorer.exe /select, \"") + QDir::toNativeSeparators(file_path) + "\"");
|
return QProcess::startDetached(QSL("explorer.exe"),
|
||||||
|
{ "/select,", QDir::toNativeSeparators(file_path)});
|
||||||
#else
|
#else
|
||||||
const QString folder = QDir::toNativeSeparators(QFileInfo(file_path).absoluteDir().absolutePath());
|
const QString folder = QDir::toNativeSeparators(QFileInfo(file_path).absoluteDir().absolutePath());
|
||||||
|
|
||||||
|
@ -370,7 +370,12 @@ void AdBlockRule::parseFilter() {
|
|||||||
int optionsIndex = parsedLine.indexOf(QL1C('$'));
|
int optionsIndex = parsedLine.indexOf(QL1C('$'));
|
||||||
|
|
||||||
if (optionsIndex >= 0) {
|
if (optionsIndex >= 0) {
|
||||||
const QStringList options = parsedLine.mid(optionsIndex + 1).split(QL1C(','), QString::SkipEmptyParts);
|
const QStringList options = parsedLine.mid(optionsIndex + 1).split(QL1C(','),
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
int handledOptions = 0;
|
int handledOptions = 0;
|
||||||
|
|
||||||
for (const QString& option : options) {
|
for (const QString& option : options) {
|
||||||
@ -497,7 +502,12 @@ void AdBlockRule::parseFilter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AdBlockRule::parseDomains(const QString& domains, const QChar& separator) {
|
void AdBlockRule::parseDomains(const QString& domains, const QChar& separator) {
|
||||||
QStringList domainsList = domains.split(separator, QString::SkipEmptyParts);
|
QStringList domainsList = domains.split(separator,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (const QString& domain : domainsList) {
|
for (const QString& domain : domainsList) {
|
||||||
if (domain.isEmpty()) {
|
if (domain.isEmpty()) {
|
||||||
@ -618,15 +628,15 @@ QString AdBlockRule::createRegExpFromFilter(const QString& filter) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QStringMatcher> AdBlockRule::createStringMatchers(const QStringList& filters) const {
|
QList<QStringMatcher> AdBlockRule::createStringMatchers(const QStringList& filters) const {
|
||||||
QList<QStringMatcher> matchers;
|
QList<QStringMatcher> mtchrs;
|
||||||
|
|
||||||
matchers.reserve(filters.size());
|
mtchrs.reserve(filters.size());
|
||||||
|
|
||||||
for (const QString& filter : filters) {
|
for (const QString& filter : filters) {
|
||||||
matchers.append(QStringMatcher(filter, m_caseSensitivity));
|
mtchrs.append(QStringMatcher(filter, m_caseSensitivity));
|
||||||
}
|
}
|
||||||
|
|
||||||
return matchers;
|
return mtchrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AdBlockRule::regexMatched(const QString& str, int offset) const {
|
int AdBlockRule::regexMatched(const QString& str, int offset) const {
|
||||||
|
@ -89,8 +89,7 @@ const AdBlockRule* AdBlockSearchTree::prefixSearch(const QWebEngineUrlRequestInf
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QChar c = choppedUrlString.at(0);
|
Node* node = m_root->children.value(choppedUrlString.at(0));
|
||||||
Node* node = m_root->children.value(c);
|
|
||||||
|
|
||||||
if (node == nullptr) {
|
if (node == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -290,11 +290,11 @@ void AdBlockCustomList::loadSubscription(const QStringList& disabledRules) {
|
|||||||
stream.setCodec("UTF-8");
|
stream.setCodec("UTF-8");
|
||||||
|
|
||||||
if (!rules.contains(ddg1 + QL1S("\n"))) {
|
if (!rules.contains(ddg1 + QL1S("\n"))) {
|
||||||
stream << ddg1 << endl;
|
stream << ddg1 << Qt::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rules.contains(QL1S("\n") + ddg2)) {
|
if (!rules.contains(QL1S("\n") + ddg2)) {
|
||||||
stream << ddg2 << endl;
|
stream << ddg2 << Qt::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,12 +313,12 @@ void AdBlockCustomList::saveSubscription() {
|
|||||||
QTextStream textStream(&file);
|
QTextStream textStream(&file);
|
||||||
|
|
||||||
textStream.setCodec("UTF-8");
|
textStream.setCodec("UTF-8");
|
||||||
textStream << "Title: " << title() << endl;
|
textStream << "Title: " << title() << Qt::endl;
|
||||||
textStream << "Url: " << url().toString() << endl;
|
textStream << "Url: " << url().toString() << Qt::endl;
|
||||||
textStream << "[Adblock Plus 1.1.1]" << endl;
|
textStream << "[Adblock Plus 1.1.1]" << Qt::endl;
|
||||||
|
|
||||||
for (const AdBlockRule* rule : m_rules) {
|
for (const AdBlockRule* rule : m_rules) {
|
||||||
textStream << rule->filter() << endl;
|
textStream << rule->filter() << Qt::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -181,7 +181,13 @@ QList<HttpResponse> Downloader::decodeMultipartAnswer(QNetworkReply* reply) {
|
|||||||
QString content_type = reply->header(QNetworkRequest::KnownHeaders::ContentTypeHeader).toString();
|
QString content_type = reply->header(QNetworkRequest::KnownHeaders::ContentTypeHeader).toString();
|
||||||
QString boundary = content_type.mid(content_type.indexOf(QL1S("boundary=")) + 9);
|
QString boundary = content_type.mid(content_type.indexOf(QL1S("boundary=")) + 9);
|
||||||
QRegularExpression regex(QL1S("--") + boundary + QL1S("(--)?(\\r\\n)?"));
|
QRegularExpression regex(QL1S("--") + boundary + QL1S("(--)?(\\r\\n)?"));
|
||||||
QStringList list = QString::fromUtf8(data).split(regex, QString::SplitBehavior::SkipEmptyParts);
|
QStringList list = QString::fromUtf8(data).split(regex,
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
|
|
||||||
QList<HttpResponse> parts;
|
QList<HttpResponse> parts;
|
||||||
|
|
||||||
parts.reserve(list.size());
|
parts.reserve(list.size());
|
||||||
@ -197,7 +203,12 @@ QList<HttpResponse> Downloader::decodeMultipartAnswer(QNetworkReply* reply) {
|
|||||||
start_of_body - start_of_headers).replace(QRegularExpression(QSL("[\\n\\r]+")),
|
start_of_body - start_of_headers).replace(QRegularExpression(QSL("[\\n\\r]+")),
|
||||||
QSL("\n"));
|
QSL("\n"));
|
||||||
|
|
||||||
for (const QString& header_line : headers.split(QL1C('\n'), QString::SplitBehavior::SkipEmptyParts)) {
|
for (const QString& header_line : headers.split(QL1C('\n'),
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
Qt::SplitBehaviorFlags::SkipEmptyParts)) {
|
||||||
|
#else
|
||||||
|
QString::SkipEmptyParts)) {
|
||||||
|
#endif
|
||||||
int index_colon = header_line.indexOf(QL1C(':'));
|
int index_colon = header_line.indexOf(QL1C(':'));
|
||||||
|
|
||||||
if (index_colon > 0) {
|
if (index_colon > 0) {
|
||||||
|
@ -55,7 +55,13 @@ void DownloadItem::init() {
|
|||||||
m_reply->setParent(this);
|
m_reply->setParent(this);
|
||||||
|
|
||||||
connect(m_reply, &QNetworkReply::readyRead, this, &DownloadItem::downloadReadyRead);
|
connect(m_reply, &QNetworkReply::readyRead, this, &DownloadItem::downloadReadyRead);
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050F00 // Qt >= 5.15.0
|
||||||
|
connect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error);
|
||||||
|
#else
|
||||||
connect(m_reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &DownloadItem::error);
|
connect(m_reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &DownloadItem::error);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(m_reply, &QNetworkReply::downloadProgress, this, &DownloadItem::downloadProgress);
|
connect(m_reply, &QNetworkReply::downloadProgress, this, &DownloadItem::downloadProgress);
|
||||||
connect(m_reply, &QNetworkReply::metaDataChanged, this, &DownloadItem::metaDataChanged);
|
connect(m_reply, &QNetworkReply::metaDataChanged, this, &DownloadItem::metaDataChanged);
|
||||||
connect(m_reply, &QNetworkReply::finished, this, &DownloadItem::finished);
|
connect(m_reply, &QNetworkReply::finished, this, &DownloadItem::finished);
|
||||||
|
@ -33,8 +33,7 @@ bool WebFactory::sendMessageViaEmail(const Message& message) {
|
|||||||
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
|
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailExecutable)).toString();
|
||||||
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
|
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalEmailArguments)).toString();
|
||||||
|
|
||||||
return QProcess::startDetached(QString("\"") + browser + QSL("\" ") + arguments.arg(message.m_title,
|
return IOFactory::startProcessDetached(browser, {}, arguments.arg(message.m_title, stripTags(message.m_contents)));
|
||||||
stripTags(message.m_contents)));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Send it via mailto protocol.
|
// Send it via mailto protocol.
|
||||||
@ -49,10 +48,11 @@ bool WebFactory::openUrlInExternalBrowser(const QString& url) const {
|
|||||||
if (qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool()) {
|
if (qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserEnabled)).toBool()) {
|
||||||
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
|
const QString browser = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString();
|
||||||
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
|
const QString arguments = qApp->settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString();
|
||||||
const QString call_line = "\"" + browser + "\" \"" + arguments.arg(url) + "\"";
|
auto nice_args = arguments.arg(url);
|
||||||
|
|
||||||
qDebug("Running command '%s'.", qPrintable(call_line));
|
qDebug("Arguments for external browser: '%s'.", qPrintable(nice_args));
|
||||||
const bool result = QProcess::startDetached(call_line);
|
|
||||||
|
const bool result = IOFactory::startProcessDetached(browser, {}, nice_args);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
qDebug("External web browser call failed.");
|
qDebug("External web browser call failed.");
|
||||||
@ -75,7 +75,6 @@ QString WebFactory::escapeHtml(const QString& html) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString output = html;
|
QString output = html;
|
||||||
|
|
||||||
QMapIterator<QString, QString> i(m_escapes);
|
QMapIterator<QString, QString> i(m_escapes);
|
||||||
|
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
@ -92,7 +91,6 @@ QString WebFactory::deEscapeHtml(const QString& text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString output = text;
|
QString output = text;
|
||||||
|
|
||||||
QMapIterator<QString, QString> i(m_deEscapes);
|
QMapIterator<QString, QString> i(m_deEscapes);
|
||||||
|
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
@ -174,6 +172,7 @@ void WebFactory::createMenu(QMenu* menu) {
|
|||||||
|
|
||||||
menu->clear();
|
menu->clear();
|
||||||
QList<QAction*> actions;
|
QList<QAction*> actions;
|
||||||
|
|
||||||
actions << createEngineSettingsAction(tr("Auto-load images"), QWebEngineSettings::AutoLoadImages);
|
actions << createEngineSettingsAction(tr("Auto-load images"), QWebEngineSettings::AutoLoadImages);
|
||||||
actions << createEngineSettingsAction(tr("JS enabled"), QWebEngineSettings::JavascriptEnabled);
|
actions << createEngineSettingsAction(tr("JS enabled"), QWebEngineSettings::JavascriptEnabled);
|
||||||
actions << createEngineSettingsAction(tr("JS can open popup windows"), QWebEngineSettings::JavascriptCanOpenWindows);
|
actions << createEngineSettingsAction(tr("JS can open popup windows"), QWebEngineSettings::JavascriptCanOpenWindows);
|
||||||
@ -204,6 +203,7 @@ void WebFactory::webEngineSettingChanged(bool enabled) {
|
|||||||
const QAction* const act = qobject_cast<QAction*>(sender());
|
const QAction* const act = qobject_cast<QAction*>(sender());
|
||||||
|
|
||||||
QWebEngineSettings::WebAttribute attribute = static_cast<QWebEngineSettings::WebAttribute>(act->data().toInt());
|
QWebEngineSettings::WebAttribute attribute = static_cast<QWebEngineSettings::WebAttribute>(act->data().toInt());
|
||||||
|
|
||||||
qApp->settings()->setValue(WebEngineAttributes::ID, QString::number(static_cast<int>(attribute)), enabled);
|
qApp->settings()->setValue(WebEngineAttributes::ID, QString::number(static_cast<int>(attribute)), enabled);
|
||||||
QWebEngineProfile::defaultProfile()->settings()->setAttribute(attribute, act->isChecked());
|
QWebEngineProfile::defaultProfile()->settings()->setAttribute(attribute, act->isChecked());
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ void AccountCheckModel::setRootItem(RootItem* root_item, bool delete_previous_ro
|
|||||||
m_rootItem->deleteLater();
|
m_rootItem->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_checkStates.clear();
|
||||||
m_rootItem = root_item;
|
m_rootItem = root_item;
|
||||||
|
|
||||||
if (with_layout_change) {
|
if (with_layout_change) {
|
||||||
@ -172,7 +173,7 @@ QVariant AccountCheckModel::data(const QModelIndex& index, int role) const {
|
|||||||
else if (role == Qt::DecorationRole) {
|
else if (role == Qt::DecorationRole) {
|
||||||
auto ic = item->icon();
|
auto ic = item->icon();
|
||||||
|
|
||||||
return ic.isNull() ? QVariant() : ic;
|
return item->data(0, Qt::ItemDataRole::DecorationRole);
|
||||||
}
|
}
|
||||||
else if (role == Qt::EditRole) {
|
else if (role == Qt::EditRole) {
|
||||||
return QVariant::fromValue(item);
|
return QVariant::fromValue(item);
|
||||||
@ -206,6 +207,7 @@ bool AccountCheckModel::setData(const QModelIndex& index, const QVariant& value,
|
|||||||
// Change data for the actual item.
|
// Change data for the actual item.
|
||||||
m_checkStates[item] = static_cast<Qt::CheckState>(value.toInt());
|
m_checkStates[item] = static_cast<Qt::CheckState>(value.toInt());
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
|
emit checkStateChanged(item, m_checkStates[item]);
|
||||||
|
|
||||||
if (m_recursiveChange) {
|
if (m_recursiveChange) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -43,6 +43,9 @@ class AccountCheckModel : public QAbstractItemModel {
|
|||||||
void checkAllItems();
|
void checkAllItems();
|
||||||
void uncheckAllItems();
|
void uncheckAllItems();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void checkStateChanged(RootItem* item, Qt::CheckState);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RootItem* m_rootItem;
|
RootItem* m_rootItem;
|
||||||
|
|
||||||
|
@ -394,9 +394,9 @@ RootItem* InoreaderNetworkFactory::decodeFeedCategoriesData(const QString& categ
|
|||||||
QString title = subscription["title"].toString();
|
QString title = subscription["title"].toString();
|
||||||
QString url = subscription["htmlUrl"].toString();
|
QString url = subscription["htmlUrl"].toString();
|
||||||
QString parent_label;
|
QString parent_label;
|
||||||
QJsonArray categories = subscription["categories"].toArray();
|
QJsonArray assigned_categories = subscription["categories"].toArray();
|
||||||
|
|
||||||
for (const QJsonValue& cat : categories) {
|
for (const QJsonValue& cat : assigned_categories) {
|
||||||
QString potential_id = cat.toObject()["id"].toString();
|
QString potential_id = cat.toObject()["id"].toString();
|
||||||
|
|
||||||
if (potential_id.contains(QSL("/label/"))) {
|
if (potential_id.contains(QSL("/label/"))) {
|
||||||
|
@ -22,6 +22,7 @@ bool OwnCloudFeed::canBeEdited() const {
|
|||||||
|
|
||||||
bool OwnCloudFeed::editViaGui() {
|
bool OwnCloudFeed::editViaGui() {
|
||||||
QPointer<FormOwnCloudFeedDetails> form_pointer = new FormOwnCloudFeedDetails(serviceRoot(), qApp->mainFormWidget());
|
QPointer<FormOwnCloudFeedDetails> form_pointer = new FormOwnCloudFeedDetails(serviceRoot(), qApp->mainFormWidget());
|
||||||
|
|
||||||
form_pointer.data()->addEditFeed(this, nullptr);
|
form_pointer.data()->addEditFeed(this, nullptr);
|
||||||
delete form_pointer.data();
|
delete form_pointer.data();
|
||||||
return false;
|
return false;
|
||||||
@ -79,6 +80,4 @@ QList<Message> OwnCloudFeed::obtainNewMessages(bool* error_during_obtaining) {
|
|||||||
*error_during_obtaining = false;
|
*error_during_obtaining = false;
|
||||||
return messages.messages();
|
return messages.messages();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QList<Message>();
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user