Fix pad lines.

This commit is contained in:
Martin Rotter 2017-07-21 10:10:02 +02:00
parent c01ea84e7b
commit a12d6a4764
35 changed files with 225 additions and 123 deletions

View File

@ -7,7 +7,7 @@
--indent-preproc-define --indent-preproc-define
--indent-col1-comments --indent-col1-comments
--max-continuation-indent=100 --max-continuation-indent=100
--break-blocks=all --break-blocks
--unpad-paren --unpad-paren
--pad-oper --pad-oper
--pad-comma --pad-comma
@ -19,7 +19,7 @@
--add-braces --add-braces
--convert-tabs --convert-tabs
--close-templates --close-templates
--max-code-length=200 --max-code-length=140
--lineend=linux --lineend=linux
-t -p -t -p
-M60Ucv -M60Ucv

View File

@ -127,7 +127,8 @@ QModelIndexList FeedsProxyModel::match(const QModelIndex& start, int role, const
} }
if (recurse && hasChildren(idx)) { if (recurse && hasChildren(idx)) {
result += match(index(0, idx.column(), idx), role, (entered_text.isEmpty() ? value : entered_text), (all_hits ? -1 : hits - result.count()), flags); result += match(index(0, idx.column(), idx), role, (entered_text.isEmpty() ? value : entered_text), (all_hits ? -1 : hits - result.count()),
flags);
} }
} }

View File

@ -33,7 +33,8 @@
#include "gui/settings/settingsshortcuts.h" #include "gui/settings/settingsshortcuts.h"
FormSettings::FormSettings(QWidget* parent) : QDialog(parent), m_panels(QList<SettingsPanel*>()), m_ui(new Ui::FormSettings), m_settings(qApp->settings()) { FormSettings::FormSettings(QWidget* parent) : QDialog(parent), m_panels(QList<SettingsPanel*>()), m_ui(new Ui::FormSettings),
m_settings(qApp->settings()) {
m_ui->setupUi(this); m_ui->setupUi(this);
// 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);

View File

@ -181,7 +181,8 @@ void FormUpdate::updateCompleted(QNetworkReply::NetworkError status, QByteArray
switch (status) { switch (status) {
case QNetworkReply::NoError: case QNetworkReply::NoError:
saveUpdateFile(contents); saveUpdateFile(contents);
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok, tr("Downloaded successfully"), tr("Package was downloaded successfully.\nYou can install it now.")); m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok, tr("Downloaded successfully"),
tr("Package was downloaded successfully.\nYou can install it now."));
m_btnUpdate->setText(tr("Install")); m_btnUpdate->setText(tr("Install"));
m_btnUpdate->setEnabled(true); m_btnUpdate->setEnabled(true);
break; break;

View File

@ -124,8 +124,10 @@ void FeedMessageViewer::loadSize() {
const Settings* settings = qApp->settings(); const Settings* settings = qApp->settings();
// Restore offsets of splitters. // Restore offsets of splitters.
m_feedSplitter->restoreState(QByteArray::fromBase64(settings->value(GROUP(GUI), SETTING(GUI::SplitterFeeds)).toString().toLocal8Bit())); m_feedSplitter->restoreState(QByteArray::fromBase64(settings->value(GROUP(GUI), SETTING(GUI::SplitterFeeds)).toString().toLocal8Bit()));
m_messageSplitter->restoreState(QByteArray::fromBase64(settings->value(GROUP(GUI), SETTING(GUI::SplitterMessages)).toString().toLocal8Bit())); m_messageSplitter->restoreState(QByteArray::fromBase64(settings->value(GROUP(GUI),
m_messagesView->header()->restoreState(QByteArray::fromBase64(settings->value(GROUP(GUI), SETTING(GUI::MessageViewState)).toString().toLocal8Bit())); SETTING(GUI::SplitterMessages)).toString().toLocal8Bit()));
m_messagesView->header()->restoreState(QByteArray::fromBase64(settings->value(GROUP(GUI),
SETTING(GUI::MessageViewState)).toString().toLocal8Bit()));
} }
void FeedMessageViewer::loadMessageViewerFonts() { void FeedMessageViewer::loadMessageViewerFonts() {

View File

@ -37,7 +37,8 @@ SettingsBrowserMail::SettingsBrowserMail(Settings* settings, QWidget* parent)
#else #else
connect(m_ui->m_checkOpenLinksInExternal, &QCheckBox::stateChanged, this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_checkOpenLinksInExternal, &QCheckBox::stateChanged, this, &SettingsBrowserMail::dirtifySettings);
#endif #endif
connect(m_ui->m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_txtProxyHost, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_txtProxyHost, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_txtProxyPassword, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_txtProxyPassword, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_txtProxyUsername, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_txtProxyUsername, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
@ -48,11 +49,14 @@ SettingsBrowserMail::SettingsBrowserMail(Settings* settings, QWidget* parent)
connect(m_ui->m_txtExternalBrowserExecutable, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_txtExternalBrowserExecutable, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_txtExternalEmailArguments, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_txtExternalEmailArguments, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_txtExternalEmailExecutable, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings); connect(m_ui->m_txtExternalEmailExecutable, &QLineEdit::textChanged, this, &SettingsBrowserMail::dirtifySettings);
connect(m_ui->m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsBrowserMail::onProxyTypeChanged); connect(m_ui->m_cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsBrowserMail::onProxyTypeChanged);
connect(m_ui->m_checkShowPassword, &QCheckBox::stateChanged, this, &SettingsBrowserMail::displayProxyPassword); connect(m_ui->m_checkShowPassword, &QCheckBox::stateChanged, this, &SettingsBrowserMail::displayProxyPassword);
connect(m_ui->m_cmbExternalBrowserPreset, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsBrowserMail::changeDefaultBrowserArguments); connect(m_ui->m_cmbExternalBrowserPreset, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsBrowserMail::changeDefaultBrowserArguments);
connect(m_ui->m_btnExternalBrowserExecutable, &QPushButton::clicked, this, &SettingsBrowserMail::selectBrowserExecutable); connect(m_ui->m_btnExternalBrowserExecutable, &QPushButton::clicked, this, &SettingsBrowserMail::selectBrowserExecutable);
connect(m_ui->m_cmbExternalEmailPreset, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsBrowserMail::changeDefaultEmailArguments); connect(m_ui->m_cmbExternalEmailPreset, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsBrowserMail::changeDefaultEmailArguments);
connect(m_ui->m_btnExternalEmailExecutable, &QPushButton::clicked, this, &SettingsBrowserMail::selectEmailExecutable); connect(m_ui->m_btnExternalEmailExecutable, &QPushButton::clicked, this, &SettingsBrowserMail::selectEmailExecutable);
} }
@ -139,8 +143,10 @@ void SettingsBrowserMail::loadSettings() {
#endif #endif
// Load settings of web browser GUI. // Load settings of web browser GUI.
m_ui->m_cmbExternalBrowserPreset->addItem(tr("Opera 12 or older"), QSL("-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),
m_ui->m_txtExternalBrowserArguments->setText(settings()->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserArguments)).toString()); SETTING(Browser::CustomExternalBrowserExecutable)).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());
// Load settings of e-mail. // Load settings of e-mail.
m_ui->m_cmbExternalEmailPreset->addItem(tr("Mozilla Thunderbird"), QSL("-compose \"subject='%1',body='%2'\"")); m_ui->m_cmbExternalEmailPreset->addItem(tr("Mozilla Thunderbird"), QSL("-compose \"subject='%1',body='%2'\""));
@ -152,7 +158,8 @@ void SettingsBrowserMail::loadSettings() {
m_ui->m_cmbProxyType->addItem(tr("Socks5"), QNetworkProxy::Socks5Proxy); m_ui->m_cmbProxyType->addItem(tr("Socks5"), QNetworkProxy::Socks5Proxy);
m_ui->m_cmbProxyType->addItem(tr("Http"), QNetworkProxy::HttpProxy); m_ui->m_cmbProxyType->addItem(tr("Http"), QNetworkProxy::HttpProxy);
// Load the settings. // Load the settings.
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(settings()->value(GROUP(Proxy), SETTING(Proxy::Type)).toInt()); QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(settings()->value(GROUP(Proxy),
SETTING(Proxy::Type)).toInt());
m_ui->m_cmbProxyType->setCurrentIndex(m_ui->m_cmbProxyType->findData(selected_proxy_type)); m_ui->m_cmbProxyType->setCurrentIndex(m_ui->m_cmbProxyType->findData(selected_proxy_type));
m_ui->m_txtProxyHost->setText(settings()->value(GROUP(Proxy), SETTING(Proxy::Host)).toString()); m_ui->m_txtProxyHost->setText(settings()->value(GROUP(Proxy), SETTING(Proxy::Host)).toString());
m_ui->m_txtProxyUsername->setText(settings()->value(GROUP(Proxy), SETTING(Proxy::Username)).toString()); m_ui->m_txtProxyUsername->setText(settings()->value(GROUP(Proxy), SETTING(Proxy::Username)).toString());

View File

@ -30,7 +30,8 @@ SettingsDatabase::SettingsDatabase(Settings* settings, QWidget* parent)
GuiUtilities::setLabelAsNotice(m_ui->m_lblDataStorageWarning, true); GuiUtilities::setLabelAsNotice(m_ui->m_lblDataStorageWarning, true);
GuiUtilities::setLabelAsNotice(m_ui->m_lblMysqlInfo, false); GuiUtilities::setLabelAsNotice(m_ui->m_lblMysqlInfo, false);
GuiUtilities::setLabelAsNotice(m_ui->m_lblSqliteInMemoryWarnings, true); GuiUtilities::setLabelAsNotice(m_ui->m_lblSqliteInMemoryWarnings, true);
connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsDatabase::dirtifySettings);
connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_txtMysqlDatabase->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_txtMysqlDatabase->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_txtMysqlHostname->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_txtMysqlHostname->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings);
@ -38,14 +39,16 @@ SettingsDatabase::SettingsDatabase(Settings* settings, QWidget* parent)
connect(m_ui->m_checkUseTransactions, &QCheckBox::toggled, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_checkUseTransactions, &QCheckBox::toggled, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_txtMysqlUsername->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_txtMysqlUsername->lineEdit(), &QLineEdit::textChanged, this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_spinMysqlPort, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &SettingsDatabase::dirtifySettings); connect(m_ui->m_spinMysqlPort, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &SettingsDatabase::dirtifySettings);
connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDatabase::selectSqlBackend); connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsDatabase::selectSqlBackend);
connect(m_ui->m_checkMysqlShowPassword, &QCheckBox::toggled, this, &SettingsDatabase::switchMysqlPasswordVisiblity); connect(m_ui->m_checkMysqlShowPassword, &QCheckBox::toggled, this, &SettingsDatabase::switchMysqlPasswordVisiblity);
connect(m_ui->m_txtMysqlUsername->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlUsernameChanged); connect(m_ui->m_txtMysqlUsername->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlUsernameChanged);
connect(m_ui->m_txtMysqlHostname->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlHostnameChanged); connect(m_ui->m_txtMysqlHostname->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlHostnameChanged);
connect(m_ui->m_txtMysqlPassword->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlPasswordChanged); connect(m_ui->m_txtMysqlPassword->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlPasswordChanged);
connect(m_ui->m_txtMysqlDatabase->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlDatabaseChanged); connect(m_ui->m_txtMysqlDatabase->lineEdit(), &BaseLineEdit::textChanged, this, &SettingsDatabase::onMysqlDatabaseChanged);
connect(m_ui->m_btnMysqlTestSetup, &QPushButton::clicked, this, &SettingsDatabase::mysqlTestConnection); connect(m_ui->m_btnMysqlTestSetup, &QPushButton::clicked, this, &SettingsDatabase::mysqlTestConnection);
connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDatabase::requireRestart); connect(m_ui->m_cmbDatabaseDriver, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsDatabase::requireRestart);
connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::requireRestart); connect(m_ui->m_checkSqliteUseInMemoryDatabase, &QCheckBox::toggled, this, &SettingsDatabase::requireRestart);
connect(m_ui->m_spinMysqlPort, &QSpinBox::editingFinished, this, &SettingsDatabase::requireRestart); connect(m_ui->m_spinMysqlPort, &QSpinBox::editingFinished, this, &SettingsDatabase::requireRestart);
connect(m_ui->m_txtMysqlHostname->lineEdit(), &BaseLineEdit::textEdited, this, &SettingsDatabase::requireRestart); connect(m_ui->m_txtMysqlHostname->lineEdit(), &BaseLineEdit::textEdited, this, &SettingsDatabase::requireRestart);
@ -140,7 +143,8 @@ void SettingsDatabase::switchMysqlPasswordVisiblity(bool visible) {
void SettingsDatabase::loadSettings() { void SettingsDatabase::loadSettings() {
onBeginLoadSettings(); onBeginLoadSettings();
m_ui->m_checkUseTransactions->setChecked(qApp->settings()->value(GROUP(Database), SETTING(Database::UseTransactions)).toBool()); m_ui->m_checkUseTransactions->setChecked(qApp->settings()->value(GROUP(Database), SETTING(Database::UseTransactions)).toBool());
m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::Information, tr("No connection test triggered so far."), tr("You did not executed any connection test yet.")); m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::Information, tr("No connection test triggered so far."),
tr("You did not executed any connection test yet."));
// Load SQLite. // Load SQLite.
m_ui->m_cmbDatabaseDriver->addItem(qApp->database()->humanDriverName(DatabaseFactory::SQLITE), APP_DB_SQLITE_DRIVER); m_ui->m_cmbDatabaseDriver->addItem(qApp->database()->humanDriverName(DatabaseFactory::SQLITE), APP_DB_SQLITE_DRIVER);
// Load in-memory database status. // Load in-memory database status.
@ -160,13 +164,15 @@ void SettingsDatabase::loadSettings() {
m_ui->m_txtMysqlDatabase->lineEdit()->setPlaceholderText(tr("Working database which you have full access to.")); m_ui->m_txtMysqlDatabase->lineEdit()->setPlaceholderText(tr("Working database which you have full access to."));
m_ui->m_txtMysqlHostname->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLHostname)).toString()); m_ui->m_txtMysqlHostname->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLHostname)).toString());
m_ui->m_txtMysqlUsername->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLUsername)).toString()); m_ui->m_txtMysqlUsername->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLUsername)).toString());
m_ui->m_txtMysqlPassword->lineEdit()->setText(TextFactory::decrypt(settings()->value(GROUP(Database), SETTING(Database::MySQLPassword)).toString())); m_ui->m_txtMysqlPassword->lineEdit()->setText(TextFactory::decrypt(settings()->value(GROUP(Database),
SETTING(Database::MySQLPassword)).toString()));
m_ui->m_txtMysqlDatabase->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLDatabase)).toString()); m_ui->m_txtMysqlDatabase->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLDatabase)).toString());
m_ui->m_spinMysqlPort->setValue(settings()->value(GROUP(Database), SETTING(Database::MySQLPort)).toInt()); m_ui->m_spinMysqlPort->setValue(settings()->value(GROUP(Database), SETTING(Database::MySQLPort)).toInt());
m_ui->m_checkMysqlShowPassword->setChecked(false); m_ui->m_checkMysqlShowPassword->setChecked(false);
} }
int index_current_backend = m_ui->m_cmbDatabaseDriver->findData(settings()->value(GROUP(Database), SETTING(Database::ActiveDriver)).toString()); int index_current_backend = m_ui->m_cmbDatabaseDriver->findData(settings()->value(GROUP(Database),
SETTING(Database::ActiveDriver)).toString());
if (index_current_backend >= 0) { if (index_current_backend >= 0) {
m_ui->m_cmbDatabaseDriver->setCurrentIndex(index_current_backend); m_ui->m_cmbDatabaseDriver->setCurrentIndex(index_current_backend);

View File

@ -61,7 +61,8 @@ void SettingsDownloads::loadSettings() {
void SettingsDownloads::saveSettings() { void SettingsDownloads::saveSettings() {
onBeginSaveSettings(); onBeginSaveSettings();
settings()->setValue(GROUP(Downloads), Downloads::ShowDownloadsWhenNewDownloadStarts, m_ui->m_checkOpenManagerWhenDownloadStarts->isChecked()); settings()->setValue(GROUP(Downloads), Downloads::ShowDownloadsWhenNewDownloadStarts,
m_ui->m_checkOpenManagerWhenDownloadStarts->isChecked());
settings()->setValue(GROUP(Downloads), Downloads::TargetDirectory, m_ui->m_txtDownloadsTargetDirectory->text()); settings()->setValue(GROUP(Downloads), Downloads::TargetDirectory, m_ui->m_txtDownloadsTargetDirectory->text());
settings()->setValue(GROUP(Downloads), Downloads::AlwaysPromptForFilename, m_ui->m_rbDownloadsAskEachFile->isChecked()); settings()->setValue(GROUP(Downloads), Downloads::AlwaysPromptForFilename, m_ui->m_rbDownloadsAskEachFile->isChecked());
qApp->downloadManager()->setDownloadDirectory(m_ui->m_txtDownloadsTargetDirectory->text()); qApp->downloadManager()->setDownloadDirectory(m_ui->m_txtDownloadsTargetDirectory->text());

View File

@ -46,10 +46,13 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
connect(m_ui->m_spinHeightImageAttachments, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), connect(m_ui->m_spinHeightImageAttachments, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, &SettingsFeedsMessages::dirtifySettings); this, &SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_checkAutoUpdate, &QCheckBox::toggled, m_ui->m_spinAutoUpdateInterval, &TimeSpinBox::setEnabled); connect(m_ui->m_checkAutoUpdate, &QCheckBox::toggled, m_ui->m_spinAutoUpdateInterval, &TimeSpinBox::setEnabled);
connect(m_ui->m_spinFeedUpdateTimeout, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_spinFeedUpdateTimeout, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_ui->m_cmbMessagesDateTimeFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsFeedsMessages::dirtifySettings); &SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_cmbMessagesDateTimeFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_cmbCountsFeedList, &QComboBox::currentTextChanged, this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_cmbCountsFeedList, &QComboBox::currentTextChanged, this, &SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_cmbCountsFeedList, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_cmbCountsFeedList, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_btnChangeMessagesFont, &QPushButton::clicked, this, &SettingsFeedsMessages::changeMessagesFont); connect(m_ui->m_btnChangeMessagesFont, &QPushButton::clicked, this, &SettingsFeedsMessages::changeMessagesFont);
if (!m_ui->m_spinFeedUpdateTimeout->suffix().startsWith(' ')) { if (!m_ui->m_spinFeedUpdateTimeout->suffix().startsWith(' ')) {
@ -100,7 +103,8 @@ void SettingsFeedsMessages::loadSettings() {
m_ui->m_spinHeightImageAttachments->setValue(settings()->value(GROUP(Messages), SETTING(Messages::MessageHeadImageHeight)).toInt()); m_ui->m_spinHeightImageAttachments->setValue(settings()->value(GROUP(Messages), SETTING(Messages::MessageHeadImageHeight)).toInt());
initializeMessageDateFormats(); initializeMessageDateFormats();
m_ui->m_checkMessagesDateTimeFormat->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::UseCustomDate)).toBool()); m_ui->m_checkMessagesDateTimeFormat->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::UseCustomDate)).toBool());
const int index_format = m_ui->m_cmbMessagesDateTimeFormat->findData(settings()->value(GROUP(Messages), SETTING(Messages::CustomDateFormat)).toString()); const int index_format = m_ui->m_cmbMessagesDateTimeFormat->findData(settings()->value(GROUP(Messages),
SETTING(Messages::CustomDateFormat)).toString());
if (index_format >= 0) { if (index_format >= 0) {
m_ui->m_cmbMessagesDateTimeFormat->setCurrentIndex(index_format); m_ui->m_cmbMessagesDateTimeFormat->setCurrentIndex(index_format);

View File

@ -62,12 +62,14 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se
connect(m_ui->m_checkCloseTabsMiddleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings); connect(m_ui->m_checkCloseTabsMiddleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_checkNewTabDoubleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings); connect(m_ui->m_checkNewTabDoubleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_grbCloseTabs, &QGroupBox::toggled, this, &SettingsGui::dirtifySettings); connect(m_ui->m_grbCloseTabs, &QGroupBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_cmbToolbarButtonStyle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsGui::dirtifySettings); connect(m_ui->m_cmbToolbarButtonStyle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsGui::dirtifySettings);
connect(m_ui->m_editorFeedsToolbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings); connect(m_ui->m_editorFeedsToolbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_editorMessagesToolbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings); connect(m_ui->m_editorMessagesToolbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_editorStatusbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings); connect(m_ui->m_editorStatusbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_listStyles, &QListWidget::currentItemChanged, this, &SettingsGui::dirtifySettings); connect(m_ui->m_listStyles, &QListWidget::currentItemChanged, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_cmbSelectToolBar, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), m_ui->m_stackedToolbars, &QStackedWidget::setCurrentIndex); connect(m_ui->m_cmbSelectToolBar, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), m_ui->m_stackedToolbars,
&QStackedWidget::setCurrentIndex);
} }
SettingsGui::~SettingsGui() { SettingsGui::~SettingsGui() {

View File

@ -56,7 +56,7 @@ Application::Application(const QString& id, int& argc, char** argv)
m_urlInterceptor(new NetworkUrlInterceptor(this)), m_urlInterceptor(new NetworkUrlInterceptor(this)),
#endif #endif
m_feedReader(nullptr), m_feedReader(nullptr),
m_updateFeedsLock(nullptr), m_userActions(QList<QAction*>()), m_mainForm(nullptr), m_updateFeedsLock(nullptr), m_userActions(QList<QAction*>()), m_mainForm(nullptr),
m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr), m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr),
m_localization(nullptr), m_icons(nullptr), m_database(nullptr), m_downloadManager(nullptr), m_shouldRestart(false) { m_localization(nullptr), m_icons(nullptr), m_database(nullptr), m_downloadManager(nullptr), m_shouldRestart(false) {
@ -68,8 +68,8 @@ Application::Application(const QString& id, int& argc, char** argv)
connect(QWebEngineProfile::defaultProfile(), &QWebEngineProfile::downloadRequested, this, &Application::downloadRequested); connect(QWebEngineProfile::defaultProfile(), &QWebEngineProfile::downloadRequested, this, &Application::downloadRequested);
QWebEngineProfile::defaultProfile()->setRequestInterceptor(m_urlInterceptor); QWebEngineProfile::defaultProfile()->setRequestInterceptor(m_urlInterceptor);
// TODO: Call load settings when saving app settings from dialog. // TODO: Call load settings when saving app settings from dialog.
// Will need add that if I add more settings in the future. // Will need add that if I add more settings in the future.
m_urlInterceptor->loadSettings(); m_urlInterceptor->loadSettings();
#endif #endif
} }

View File

@ -120,7 +120,7 @@ class Application : public QtSingleApplication {
// Returns pointer to "GOD" application singleton. // Returns pointer to "GOD" application singleton.
inline static Application* instance() { inline static Application* instance() {
return static_cast<Application*>(QCoreApplication::instance()); return static_cast<Application*>(QCoreApplication::instance());
} }
public slots: public slots:

View File

@ -654,7 +654,8 @@ 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(QSL("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.");
QFile file_init(APP_SQL_PATH + QDir::separator() + APP_DB_MYSQL_INIT); QFile file_init(APP_SQL_PATH + QDir::separator() + APP_DB_MYSQL_INIT);

View File

@ -551,9 +551,11 @@ int DatabaseQueries::updateMessages(QSqlDatabase db,
// Now, we update it if at least one of next conditions is true: // Now, we update it if at least one of next conditions is true:
// 1) Message has custom ID AND (its date OR read status OR starred status are changed). // 1) Message has custom ID AND (its date OR read status OR starred status are changed).
// 2) Message has its date fetched from feed AND its date is different from date in DB and contents is changed. // 2) Message has its date fetched from feed AND its date is different from date in DB and contents is changed.
if (/* 1 */ (!message.m_customId.isEmpty() && (message.m_created.toMSecsSinceEpoch() != date_existing_message || message.m_isRead != is_read_existing_message if (/* 1 */ (!message.m_customId.isEmpty() && (message.m_created.toMSecsSinceEpoch() != date_existing_message
|| message.m_isRead != is_read_existing_message
|| message.m_isImportant != is_important_existing_message)) || || message.m_isImportant != is_important_existing_message)) ||
/* 2 */ (message.m_createdFromFeed && message.m_created.toMSecsSinceEpoch() != date_existing_message && message.m_contents != contents_existing_message)) { /* 2 */ (message.m_createdFromFeed && message.m_created.toMSecsSinceEpoch() != date_existing_message
&& message.m_contents != contents_existing_message)) {
// Message exists, it is changed, update it. // Message exists, it is changed, update it.
query_update.bindValue(QSL(":title"), message.m_title); query_update.bindValue(QSL(":title"), message.m_title);
query_update.bindValue(QSL(":is_read"), (int) message.m_isRead); query_update.bindValue(QSL(":is_read"), (int) message.m_isRead);
@ -730,7 +732,8 @@ bool DatabaseQueries::cleanFeeds(QSqlDatabase db, const QStringList& ids, bool c
bool DatabaseQueries::purgeLeftoverMessages(QSqlDatabase db, int account_id) { bool DatabaseQueries::purgeLeftoverMessages(QSqlDatabase db, int account_id) {
QSqlQuery q(db); QSqlQuery q(db);
q.setForwardOnly(true); q.setForwardOnly(true);
q.prepare(QSL("DELETE FROM Messages WHERE account_id = :account_id AND feed NOT IN (SELECT custom_id FROM Feeds WHERE account_id = :account_id);")); q.prepare(
QSL("DELETE FROM Messages WHERE account_id = :account_id AND feed NOT IN (SELECT custom_id FROM Feeds WHERE account_id = :account_id);"));
q.bindValue(QSL(":account_id"), account_id); q.bindValue(QSL(":account_id"), account_id);
if (!q.exec()) { if (!q.exec()) {

View File

@ -28,37 +28,41 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
m_ui->setupUi(this); m_ui->setupUi(this);
m_knownSubscriptions << Subscription(QSL("EasyList (English)"), ADBLOCK_EASYLIST_URL) m_knownSubscriptions << Subscription(QSL("EasyList (English)"), ADBLOCK_EASYLIST_URL)
<< Subscription(QSL("BSI Lista Polska (Polish)"), QSL("http://www.bsi.info.pl/filtrABP.txt")) << Subscription(QSL("BSI Lista Polska (Polish)"), QSL("http://www.bsi.info.pl/filtrABP.txt"))
<< Subscription(QSL("EasyList Czech and Slovak (Czech)"), QSL("https://raw.githubusercontent.com/tomasko126/easylistczechandslovak/master/filters.txt")) << Subscription(QSL("EasyList Czech and Slovak (Czech)"),
QSL("https://raw.githubusercontent.com/tomasko126/easylistczechandslovak/master/filters.txt"))
<< Subscription(QSL("dutchblock (Dutch)"), QSL("http://groenewoudt.net/dutchblock/list.txt")) << Subscription(QSL("dutchblock (Dutch)"), QSL("http://groenewoudt.net/dutchblock/list.txt"))
<< Subscription(QSL("Filtros Nauscopicos (Spanish)"), QSL("http://abp.mozilla-hispano.org/nauscopio/filtros.txt")) << Subscription(QSL("Filtros Nauscopicos (Spanish)"), QSL("http://abp.mozilla-hispano.org/nauscopio/filtros.txt"))
<< Subscription(QSL("IsraelList (Hebrew)"), QSL("http://secure.fanboy.co.nz/israelilist/IsraelList.txt")) << Subscription(QSL("IsraelList (Hebrew)"), QSL("http://secure.fanboy.co.nz/israelilist/IsraelList.txt"))
<< Subscription(QSL("NLBlock (Dutch)"), QSL("http://www.verzijlbergh.com/adblock/nlblock.txt")) << Subscription(QSL("NLBlock (Dutch)"), QSL("http://www.verzijlbergh.com/adblock/nlblock.txt"))
<< Subscription(QSL("Peter Lowe's list (English)"), QSL("http://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&mimetype=plaintext")) << Subscription(QSL("Peter Lowe's list (English)"),
QSL("http://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&mimetype=plaintext"))
<< Subscription(QSL("PLgeneral (Polish)"), QSL("http://www.niecko.pl/adblock/adblock.txt")) << Subscription(QSL("PLgeneral (Polish)"), QSL("http://www.niecko.pl/adblock/adblock.txt"))
<< Subscription(QSL("Schacks Adblock Plus liste (Danish)"), QSL("http://adblock.schack.dk/block.txt")) << Subscription(QSL("Schacks Adblock Plus liste (Danish)"), QSL("http://adblock.schack.dk/block.txt"))
<< Subscription(QSL("Xfiles (Italian)"), QSL("http://mozilla.gfsolone.com/filtri.txt")) << Subscription(QSL("Xfiles (Italian)"), QSL("http://mozilla.gfsolone.com/filtri.txt"))
<< Subscription(QSL("EasyPrivacy (English)"), QSL("http://easylist-downloads.adblockplus.org/easyprivacy.txt")) << Subscription(QSL("EasyPrivacy (English)"), QSL("http://easylist-downloads.adblockplus.org/easyprivacy.txt"))
<< Subscription(QSL("RU Adlist (Russian)"), QSL("https://easylist-downloads.adblockplus.org/advblock.txt")) << Subscription(QSL("RU Adlist (Russian)"), QSL("https://easylist-downloads.adblockplus.org/advblock.txt"))
<< Subscription(QSL("ABPindo (Indonesian)"), QSL("https://raw.githubusercontent.com/heradhis/indonesianadblockrules/master/subscriptions/abpindo.txt")) << Subscription(QSL("ABPindo (Indonesian)"),
QSL("https://raw.githubusercontent.com/heradhis/indonesianadblockrules/master/subscriptions/abpindo.txt"))
<< Subscription(QSL("Easylist China (Chinese)"), QSL("https://easylist-downloads.adblockplus.org/easylistchina.txt")) << Subscription(QSL("Easylist China (Chinese)"), QSL("https://easylist-downloads.adblockplus.org/easylistchina.txt"))
<< Subscription(QSL("Anti-Adblock Killer"), QSL("https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt")) << Subscription(QSL("Anti-Adblock Killer"),
QSL("https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt"))
<< Subscription(tr("Other..."), QString()); << Subscription(tr("Other..."), QString());
foreach (const Subscription& subscription, m_knownSubscriptions) { foreach (const Subscription& subscription, m_knownSubscriptions) {
m_ui->comboBox->addItem(subscription.m_title); m_ui->m_cmbPresets->addItem(subscription.m_title);
} }
connect(m_ui->comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_ui->comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
this, &AdBlockAddSubscriptionDialog::indexChanged); &AdBlockAddSubscriptionDialog::indexChanged);
indexChanged(0); indexChanged(0);
} }
QString AdBlockAddSubscriptionDialog::title() const { QString AdBlockAddSubscriptionDialog::title() const {
return m_ui->title->text(); return m_ui->m_txtTitle->text();
} }
QString AdBlockAddSubscriptionDialog::url() const { QString AdBlockAddSubscriptionDialog::url() const {
return m_ui->url->text(); return m_ui->m_txtUrl->text();
} }
void AdBlockAddSubscriptionDialog::indexChanged(int index) { void AdBlockAddSubscriptionDialog::indexChanged(int index) {
@ -66,10 +70,9 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index) {
// "Other..." entry. // "Other..." entry.
if (subscription.m_url.isEmpty()) { if (subscription.m_url.isEmpty()) {
m_ui->title->clear(); m_ui->m_txtTitle->clear();
m_ui->url->clear(); m_ui->m_txtUrl->clear();
} }
else { else {
int pos = subscription.m_title.indexOf(QLatin1Char('(')); int pos = subscription.m_title.indexOf(QLatin1Char('('));
QString title = subscription.m_title; QString title = subscription.m_title;
@ -78,10 +81,10 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index) {
title = title.left(pos).trimmed(); title = title.left(pos).trimmed();
} }
m_ui->title->setText(title); m_ui->m_txtTitle->setText(title);
m_ui->title->setCursorPosition(0); m_ui->m_txtTitle->setCursorPosition(0);
m_ui->url->setText(subscription.m_url); m_ui->m_txtUrl->setText(subscription.m_url);
m_ui->url->setCursorPosition(0); m_ui->m_txtUrl->setCursorPosition(0);
} }
} }

View File

@ -7,36 +7,68 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>557</width> <width>557</width>
<height>162</height> <height>145</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Add Subscription</string> <string>Add Subscription</string>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="1" column="0" colspan="2"> <item row="0" column="1">
<widget class="QComboBox" name="comboBox"/> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="m_cbUsePredefined">
<property name="text">
<string>Use predefined subscription</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_cmbPresets">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_lblTitle">
<property name="text">
<string>Title</string>
</property>
<property name="buddy">
<cstring>m_txtTitle</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_txtTitle">
<property name="placeholderText">
<string>Title of subscription</string>
</property>
</widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="m_lblUrl">
<property name="text"> <property name="text">
<string>Title:</string> <string>URL</string>
</property>
<property name="buddy">
<cstring>m_txtUrl</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="title"/> <widget class="QLineEdit" name="m_txtUrl">
</item> <property name="placeholderText">
<item row="3" column="0"> <string>Absolute URL to online subscription file</string>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Address:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="QLineEdit" name="url"/>
</item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
@ -47,15 +79,27 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_3"> <spacer name="verticalSpacer">
<property name="text"> <property name="orientation">
<string>Add new subscription to AdBlock:</string> <enum>Qt::Vertical</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>m_cbUsePredefined</tabstop>
<tabstop>m_cmbPresets</tabstop>
<tabstop>m_txtTitle</tabstop>
<tabstop>m_txtUrl</tabstop>
</tabstops>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
@ -65,12 +109,12 @@
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>248</x> <x>283</x>
<y>254</y> <y>111</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>157</x> <x>157</x>
<y>274</y> <y>132</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -81,12 +125,12 @@
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>316</x> <x>351</x>
<y>260</y> <y>111</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>286</x> <x>286</x>
<y>274</y> <y>132</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>

View File

@ -31,7 +31,8 @@
AdBlockDialog::AdBlockDialog(QWidget* parent) AdBlockDialog::AdBlockDialog(QWidget* parent)
: QWidget(parent), m_ui(new Ui::AdBlockDialog), m_manager(AdBlockManager::instance()), m_currentTreeWidget(0), m_currentSubscription(0), m_loaded(false) { : QWidget(parent), m_ui(new Ui::AdBlockDialog), m_manager(AdBlockManager::instance()), m_currentTreeWidget(0), m_currentSubscription(0),
m_loaded(false) {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
m_ui->setupUi(this); m_ui->setupUi(this);
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS

View File

@ -102,7 +102,7 @@ bool AdBlockManager::block(QWebEngineUrlRequestInfo& request) {
res = true; res = true;
if (request.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame) { if (request.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame) {
// NOTE: We are blocking main URL frame, we can display "AdBlock error page" or // NOTE: We are blocking main URL frame, we can display "AdBlock error page" or
// redirect to somewhere. // redirect to somewhere.
request.block(true); request.block(true);
} }
@ -182,7 +182,7 @@ AdBlockSubscription* AdBlockManager::addSubscription(const QString& title, const
subscription->setFilePath(filePath); subscription->setFilePath(filePath);
subscription->loadSubscription(m_disabledRules); subscription->loadSubscription(m_disabledRules);
m_subscriptions.insert(m_subscriptions.count() - 1, subscription); m_subscriptions.insert(m_subscriptions.count() - 1, subscription);
// TODO: Reload user stylesheet. // TODO: Reload user stylesheet.
// connect(subscription, SIGNAL(subscriptionUpdated()), mApp, SLOT(reloadUserStyleSheet())); // connect(subscription, SIGNAL(subscriptionUpdated()), mApp, SLOT(reloadUserStyleSheet()));
connect(subscription, SIGNAL(subscriptionChanged()), this, SLOT(updateMatcher())); connect(subscription, SIGNAL(subscriptionChanged()), this, SLOT(updateMatcher()));
return subscription; return subscription;
@ -272,11 +272,11 @@ void AdBlockManager::load() {
AdBlockCustomList* customList = new AdBlockCustomList(this); AdBlockCustomList* customList = new AdBlockCustomList(this);
m_subscriptions.append(customList); m_subscriptions.append(customList);
// Load all subscriptions. // Load all subscriptions.
foreach (AdBlockSubscription* subscription, m_subscriptions) { foreach (AdBlockSubscription* subscription, m_subscriptions) {
subscription->loadSubscription(m_disabledRules); subscription->loadSubscription(m_disabledRules);
// TODO: Reload user stylesheet. // TODO: Reload user stylesheet.
// connect(subscription, SIGNAL(subscriptionUpdated()), mApp, SLOT(reloadUserStyleSheet())); // connect(subscription, SIGNAL(subscriptionUpdated()), mApp, SLOT(reloadUserStyleSheet()));
connect(subscription, SIGNAL(subscriptionChanged()), this, SLOT(updateMatcher())); connect(subscription, SIGNAL(subscriptionChanged()), this, SLOT(updateMatcher()));
} }

View File

@ -32,7 +32,8 @@ AdBlockMatcher::~AdBlockMatcher() {
clear(); clear();
} }
const AdBlockRule* AdBlockMatcher::match(const QWebEngineUrlRequestInfo& request, const QString& urlDomain, const QString& urlString) const { const AdBlockRule* AdBlockMatcher::match(const QWebEngineUrlRequestInfo& request, const QString& urlDomain,
const QString& urlString) const {
// Exception rules. // Exception rules.
if (m_networkExceptionTree.find(request, urlDomain, urlString)) { if (m_networkExceptionTree.find(request, urlDomain, urlString)) {
return 0; return 0;

View File

@ -86,7 +86,8 @@ const AdBlockRule* AdBlockSearchTree::find(const QWebEngineUrlRequestInfo& reque
return 0; return 0;
} }
const AdBlockRule* AdBlockSearchTree::prefixSearch(const QWebEngineUrlRequestInfo& request, const QString& domain, const QString& urlString, const QChar* string, int len) const { const AdBlockRule* AdBlockSearchTree::prefixSearch(const QWebEngineUrlRequestInfo& request, const QString& domain, const QString& urlString,
const QChar* string, int len) const {
if (len <= 0) { if (len <= 0) {
return 0; return 0;
} }

View File

@ -208,7 +208,7 @@ const AdBlockRule* AdBlockSubscription::enableRule(int offset) {
emit subscriptionChanged(); emit subscriptionChanged();
if (rule->isCssRule()) { if (rule->isCssRule()) {
// TODO: Reload user stylesheet. // TODO: Reload user stylesheet.
} }
return rule; return rule;
@ -230,7 +230,7 @@ const AdBlockRule* AdBlockSubscription::disableRule(int offset) {
emit subscriptionChanged(); emit subscriptionChanged();
if (rule->isCssRule()) { if (rule->isCssRule()) {
// TODO: Reload user stylesheet. // TODO: Reload user stylesheet.
} }
return rule; return rule;
@ -365,7 +365,7 @@ int AdBlockCustomList::addRule(AdBlockRule* rule) {
emit subscriptionChanged(); emit subscriptionChanged();
if (rule->isCssRule()) { if (rule->isCssRule()) {
// TODO: Reload user stylesheet. // TODO: Reload user stylesheet.
} }
return m_rules.count() - 1; return m_rules.count() - 1;
@ -382,7 +382,7 @@ bool AdBlockCustomList::removeRule(int offset) {
emit subscriptionChanged(); emit subscriptionChanged();
if (rule->isCssRule()) { if (rule->isCssRule()) {
// TODO: Reload user stylesheet. // TODO: Reload user stylesheet.
} }
AdBlockManager::instance()->removeDisabledRule(filter); AdBlockManager::instance()->removeDisabledRule(filter);
@ -400,7 +400,7 @@ const AdBlockRule* AdBlockCustomList::replaceRule(AdBlockRule* rule, int offset)
emit subscriptionChanged(); emit subscriptionChanged();
if (rule->isCssRule() || oldRule->isCssRule()) { if (rule->isCssRule() || oldRule->isCssRule()) {
// TODO: Reload user stylesheet. // TODO: Reload user stylesheet.
} }
delete oldRule; delete oldRule;

View File

@ -63,7 +63,8 @@ void BaseNetworkAccessManager::loadSettings() {
} }
void BaseNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& error) { void BaseNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& error) {
qWarning("Ignoring SSL errors for '%s': '%s' (code %d).", qPrintable(reply->url().toString()), qPrintable(reply->errorString()), (int) reply->error()); qWarning("Ignoring SSL errors for '%s': '%s' (code %d).", qPrintable(reply->url().toString()), qPrintable(reply->errorString()),
(int) reply->error());
reply->ignoreSslErrors(error); reply->ignoreSslErrors(error);
} }

View File

@ -32,7 +32,7 @@ void NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
info.setHttpHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1")); info.setHttpHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1"));
} }
// NOTE: Here we can add custom headers for each webengine request, for example "User-Agent". // NOTE: Here we can add custom headers for each webengine request, for example "User-Agent".
foreach (UrlInterceptor* interceptor, m_interceptors) { foreach (UrlInterceptor* interceptor, m_interceptors) {
interceptor->interceptRequest(info); interceptor->interceptRequest(info);

View File

@ -36,7 +36,7 @@ SilentNetworkAccessManager::~SilentNetworkAccessManager() {
} }
SilentNetworkAccessManager* SilentNetworkAccessManager::instance() { SilentNetworkAccessManager* SilentNetworkAccessManager::instance() {
return qz_silent_acmanager(); return qz_silent_acmanager();
} }
void SilentNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) { void SilentNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) {

View File

@ -38,7 +38,7 @@ class SilentNetworkAccessManager : public BaseNetworkAccessManager {
public slots: public slots:
// This cannot do any GUI stuff. // This cannot do any GUI stuff.
void onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator); void onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator);
}; };
#endif // SILENTNETWORKACCESSMANAGER_H #endif // SILENTNETWORKACCESSMANAGER_H

View File

@ -28,7 +28,7 @@ Q_GLOBAL_STATIC(WebFactory, qz_webfactory)
WebFactory::WebFactory() WebFactory::WebFactory()
: m_escapes(QMap<QString, QString>()), m_deEscapes(QMap<QString, QString>()) { : m_escapes(QMap<QString, QString>()), m_deEscapes(QMap<QString, QString>()) {
} }
WebFactory::~WebFactory() { WebFactory::~WebFactory() {
@ -71,7 +71,7 @@ bool WebFactory::openUrlInExternalBrowser(const QString& url) {
} }
WebFactory* WebFactory::instance() { WebFactory* WebFactory::instance() {
return qz_webfactory(); return qz_webfactory();
} }
QString WebFactory::stripTags(QString text) { QString WebFactory::stripTags(QString text) {
@ -80,7 +80,7 @@ QString WebFactory::stripTags(QString text) {
QString WebFactory::escapeHtml(const QString& html) { QString WebFactory::escapeHtml(const QString& html) {
if (m_escapes.isEmpty()) { if (m_escapes.isEmpty()) {
genereteEscapes(); genereteEscapes();
} }
QString output = html; QString output = html;

View File

@ -27,8 +27,8 @@ class QWebEngineSettings;
class WebFactory { class WebFactory {
public: public:
// Constructor. // Constructor.
explicit WebFactory(); explicit WebFactory();
// Destructor. // Destructor.
virtual ~WebFactory(); virtual ~WebFactory();
@ -52,10 +52,10 @@ class WebFactory {
private: private:
// Escape sequences generators. // Escape sequences generators.
void genereteEscapes(); void genereteEscapes();
void generateDeescapes(); void generateDeescapes();
QMap<QString, QString> m_escapes; QMap<QString, QString> m_escapes;
QMap<QString, QString> m_deEscapes; QMap<QString, QString> m_deEscapes;
}; };

View File

@ -134,7 +134,8 @@ void FormFeedDetails::onUrlChanged(const QString& new_url) {
else if (!new_url.simplified().isEmpty()) { else if (!new_url.simplified().isEmpty()) {
// New url is not well-formed but is not empty on the other hand. // New url is not well-formed but is not empty on the other hand.
m_ui->m_txtUrl->setStatus(LineEditWithStatus::Warning, tr("The URL does not meet standard pattern. Does your URL start with \"http://\" or \"https://\" prefix.")); m_ui->m_txtUrl->setStatus(LineEditWithStatus::Warning,
tr("The URL does not meet standard pattern. Does your URL start with \"http://\" or \"https://\" prefix."));
} }
else { else {
@ -301,7 +302,8 @@ void FormFeedDetails::createConnections() {
connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormFeedDetails::onUsernameChanged); connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &FormFeedDetails::onUsernameChanged);
connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormFeedDetails::onPasswordChanged); connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &FormFeedDetails::onPasswordChanged);
connect(m_ui->m_gbAuthentication, &QGroupBox::toggled, this, &FormFeedDetails::onAuthenticationSwitched); connect(m_ui->m_gbAuthentication, &QGroupBox::toggled, this, &FormFeedDetails::onAuthenticationSwitched);
connect(m_ui->m_cmbAutoUpdateType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &FormFeedDetails::onAutoUpdateTypeChanged); connect(m_ui->m_cmbAutoUpdateType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&FormFeedDetails::onAutoUpdateTypeChanged);
connect(m_ui->m_btnFetchMetadata, &QPushButton::clicked, this, &FormFeedDetails::guessFeed); connect(m_ui->m_btnFetchMetadata, &QPushButton::clicked, this, &FormFeedDetails::guessFeed);
// Icon connections. // Icon connections.
connect(m_actionFetchIcon, &QAction::triggered, this, &FormFeedDetails::guessIconOnly); connect(m_actionFetchIcon, &QAction::triggered, this, &FormFeedDetails::guessIconOnly);

View File

@ -382,14 +382,16 @@ void ServiceRoot::setAccountId(int account_id) {
bool ServiceRoot::loadMessagesForItem(RootItem* item, MessagesModel* model) { bool ServiceRoot::loadMessagesForItem(RootItem* item, MessagesModel* model) {
if (item->kind() == RootItemKind::Bin) { if (item->kind() == RootItemKind::Bin) {
model->setFilter(QString("Messages.is_deleted = 1 AND Messages.is_pdeleted = 0 AND Messages.account_id = %1").arg(QString::number(accountId()))); model->setFilter(QString("Messages.is_deleted = 1 AND Messages.is_pdeleted = 0 AND Messages.account_id = %1").arg(QString::number(
accountId())));
} }
else { else {
QList<Feed*> children = item->getSubTreeFeeds(); QList<Feed*> children = item->getSubTreeFeeds();
QString filter_clause = textualFeedIds(children).join(QSL(", ")); QString filter_clause = textualFeedIds(children).join(QSL(", "));
model->setFilter(QString("Feeds.custom_id IN (%1) AND Messages.is_deleted = 0 AND Messages.is_pdeleted = 0 AND Messages.account_id = %2").arg(filter_clause, model->setFilter(
QString::number(accountId()))); QString("Feeds.custom_id IN (%1) AND Messages.is_deleted = 0 AND Messages.is_pdeleted = 0 AND Messages.account_id = %2").arg(filter_clause,
QString::number(accountId())));
qDebug("Loading messages from feeds: %s.", qPrintable(filter_clause)); qDebug("Loading messages from feeds: %s.", qPrintable(filter_clause));
} }

View File

@ -43,7 +43,8 @@ void FormOwnCloudFeedDetails::apply() {
bool renamed = false; bool renamed = false;
if (m_ui->m_txtTitle->lineEdit()->text() != m_editableFeed->title()) { if (m_ui->m_txtTitle->lineEdit()->text() != m_editableFeed->title()) {
if (!qobject_cast<OwnCloudServiceRoot*>(m_serviceRoot)->network()->renameFeed(m_ui->m_txtTitle->lineEdit()->text(), m_editableFeed->customId())) { if (!qobject_cast<OwnCloudServiceRoot*>(m_serviceRoot)->network()->renameFeed(m_ui->m_txtTitle->lineEdit()->text(),
m_editableFeed->customId())) {
qWarning("ownCloud: Došlo k problému při prejmenování kanálu s ownCloud ID '%d'.", m_editableFeed->customId()); qWarning("ownCloud: Došlo k problému při prejmenování kanálu s ownCloud ID '%d'.", m_editableFeed->customId());
} }
@ -54,7 +55,8 @@ void FormOwnCloudFeedDetails::apply() {
// User edited auto-update status. Save it. // User edited auto-update status. Save it.
OwnCloudFeed* new_feed_data = new OwnCloudFeed(); OwnCloudFeed* new_feed_data = new OwnCloudFeed();
new_feed_data->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(m_ui->m_cmbAutoUpdateType->currentIndex()).toInt())); new_feed_data->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(
m_ui->m_cmbAutoUpdateType->currentIndex()).toInt()));
new_feed_data->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value()); new_feed_data->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value());
qobject_cast<OwnCloudFeed*>(m_editableFeed)->editItself(new_feed_data); qobject_cast<OwnCloudFeed*>(m_editableFeed)->editItself(new_feed_data);
delete new_feed_data; delete new_feed_data;
@ -65,9 +67,11 @@ void FormOwnCloudFeedDetails::apply() {
} }
else { else {
const RootItem* parent = static_cast<RootItem*>(m_ui->m_cmbParentCategory->itemData(m_ui->m_cmbParentCategory->currentIndex()).value<void*>()); const RootItem* parent = static_cast<RootItem*>(m_ui->m_cmbParentCategory->itemData(
m_ui->m_cmbParentCategory->currentIndex()).value<void*>());
const int category_id = parent->kind() == RootItemKind::ServiceRoot ? 0 : parent->customId(); const int category_id = parent->kind() == RootItemKind::ServiceRoot ? 0 : parent->customId();
const bool response = qobject_cast<OwnCloudServiceRoot*>(m_serviceRoot)->network()->createFeed(m_ui->m_txtUrl->lineEdit()->text(), category_id); const bool response = qobject_cast<OwnCloudServiceRoot*>(m_serviceRoot)->network()->createFeed(m_ui->m_txtUrl->lineEdit()->text(),
category_id);
if (response) { if (response) {
// Feed was added online. // Feed was added online.

View File

@ -55,7 +55,8 @@ QString OwnCloudServiceEntryPoint::code() const {
} }
QString OwnCloudServiceEntryPoint::description() const { QString OwnCloudServiceEntryPoint::description() const {
return QObject::tr("The News app is an RSS/Atom feed aggregator. It is part of Nextcloud suite. This plugin implements %1 API.").arg(API_VERSION); return QObject::tr("The News app is an RSS/Atom feed aggregator. It is part of Nextcloud suite. This plugin implements %1 API.").arg(
API_VERSION);
} }
QString OwnCloudServiceEntryPoint::version() const { QString OwnCloudServiceEntryPoint::version() const {

View File

@ -41,7 +41,8 @@ void FormStandardFeedDetails::apply() {
new_feed->setPasswordProtected(m_ui->m_gbAuthentication->isChecked()); new_feed->setPasswordProtected(m_ui->m_gbAuthentication->isChecked());
new_feed->setUsername(m_ui->m_txtUsername->lineEdit()->text()); new_feed->setUsername(m_ui->m_txtUsername->lineEdit()->text());
new_feed->setPassword(m_ui->m_txtPassword->lineEdit()->text()); new_feed->setPassword(m_ui->m_txtPassword->lineEdit()->text());
new_feed->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(m_ui->m_cmbAutoUpdateType->currentIndex()).toInt())); new_feed->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(
m_ui->m_cmbAutoUpdateType->currentIndex()).toInt()));
new_feed->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value()); new_feed->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value());
if (m_editableFeed == nullptr) { if (m_editableFeed == nullptr) {

View File

@ -144,14 +144,16 @@ void FormEditTtRssAccount::performTest() {
else if (result.apiLevel() < MINIMAL_API_LEVEL) { else if (result.apiLevel() < MINIMAL_API_LEVEL) {
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error, m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Error,
tr("Selected Tiny Tiny RSS server is running unsupported version of API (%1). At least API level %2 is required.").arg(QString::number(result.apiLevel()), tr("Selected Tiny Tiny RSS server is running unsupported version of API (%1). At least API level %2 is required.").arg(QString::number(
result.apiLevel()),
QString::number(MINIMAL_API_LEVEL)), QString::number(MINIMAL_API_LEVEL)),
tr("Selected Tiny Tiny RSS server is running unsupported version of API.")); tr("Selected Tiny Tiny RSS server is running unsupported version of API."));
} }
else { else {
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Ok, m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Ok,
tr("Tiny Tiny RSS server is okay, running with API level %1, while at least API level %2 is required.").arg(QString::number(result.apiLevel()), tr("Tiny Tiny RSS server is okay, running with API level %1, while at least API level %2 is required.").arg(QString::number(
result.apiLevel()),
QString::number(MINIMAL_API_LEVEL)), QString::number(MINIMAL_API_LEVEL)),
tr("Tiny Tiny RSS server is okay.")); tr("Tiny Tiny RSS server is okay."));
} }

View File

@ -43,7 +43,8 @@ void FormTtRssFeedDetails::apply() {
if (m_editableFeed != nullptr) { if (m_editableFeed != nullptr) {
// User edited auto-update status. Save it. // User edited auto-update status. Save it.
TtRssFeed* new_feed_data = new TtRssFeed(); TtRssFeed* new_feed_data = new TtRssFeed();
new_feed_data->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(m_ui->m_cmbAutoUpdateType->currentIndex()).toInt())); new_feed_data->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(
m_ui->m_cmbAutoUpdateType->currentIndex()).toInt()));
new_feed_data->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value()); new_feed_data->setAutoUpdateInitialInterval(m_ui->m_spinAutoUpdateInterval->value());
qobject_cast<TtRssFeed*>(m_editableFeed)->editItself(new_feed_data); qobject_cast<TtRssFeed*>(m_editableFeed)->editItself(new_feed_data);
delete new_feed_data; delete new_feed_data;

View File

@ -34,7 +34,8 @@
TtRssNetworkFactory::TtRssNetworkFactory() TtRssNetworkFactory::TtRssNetworkFactory()
: m_bareUrl(QString()), m_fullUrl(QString()), m_username(QString()), m_password(QString()), m_forceServerSideUpdate(false), m_authIsUsed(false), : m_bareUrl(QString()), m_fullUrl(QString()), m_username(QString()), m_password(QString()), m_forceServerSideUpdate(false),
m_authIsUsed(false),
m_authUsername(QString()), m_authPassword(QString()), m_sessionId(QString()), m_authUsername(QString()), m_authPassword(QString()), m_sessionId(QString()),
m_lastLoginTime(QDateTime()), m_lastError(QNetworkReply::NoError) { m_lastLoginTime(QDateTime()), m_lastError(QNetworkReply::NoError) {
} }
@ -155,7 +156,8 @@ TtRssGetFeedsCategoriesResponse TtRssNetworkFactory::getFeedsCategories() {
json["include_empty"] = true; json["include_empty"] = true;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw; QByteArray result_raw;
NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout,
QJsonDocument(json).toJson(QJsonDocument::Compact),
CONTENT_TYPE, result_raw, CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
@ -165,7 +167,8 @@ TtRssGetFeedsCategoriesResponse TtRssNetworkFactory::getFeedsCategories() {
// We are not logged in. // We are not logged in.
login(); login();
json["sid"] = m_sessionId; json["sid"] = m_sessionId;
network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), CONTENT_TYPE, result_raw, network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact),
CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
result = TtRssGetFeedsCategoriesResponse(QString::fromUtf8(result_raw)); result = TtRssGetFeedsCategoriesResponse(QString::fromUtf8(result_raw));
@ -194,7 +197,8 @@ TtRssGetHeadlinesResponse TtRssNetworkFactory::getHeadlines(int feed_id, int lim
json["sanitize"] = sanitize; json["sanitize"] = sanitize;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw; QByteArray result_raw;
NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout,
QJsonDocument(json).toJson(QJsonDocument::Compact),
CONTENT_TYPE, result_raw, CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
@ -204,7 +208,8 @@ TtRssGetHeadlinesResponse TtRssNetworkFactory::getHeadlines(int feed_id, int lim
// We are not logged in. // We are not logged in.
login(); login();
json["sid"] = m_sessionId; json["sid"] = m_sessionId;
network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), CONTENT_TYPE, result_raw, network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact),
CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
result = TtRssGetHeadlinesResponse(QString::fromUtf8(result_raw)); result = TtRssGetHeadlinesResponse(QString::fromUtf8(result_raw));
@ -231,7 +236,8 @@ TtRssUpdateArticleResponse TtRssNetworkFactory::updateArticles(const QStringList
json["field"] = (int) field; json["field"] = (int) field;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw; QByteArray result_raw;
NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout,
QJsonDocument(json).toJson(QJsonDocument::Compact),
CONTENT_TYPE, result_raw, CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
@ -272,7 +278,8 @@ TtRssSubscribeToFeedResponse TtRssNetworkFactory::subscribeToFeed(const QString&
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw; QByteArray result_raw;
NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout,
QJsonDocument(json).toJson(QJsonDocument::Compact),
CONTENT_TYPE, result_raw, CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
@ -304,7 +311,8 @@ TtRssUnsubscribeFeedResponse TtRssNetworkFactory::unsubscribeFeed(int feed_id) {
json["feed_id"] = feed_id; json["feed_id"] = feed_id;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw; QByteArray result_raw;
NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), CONTENT_TYPE, result_raw, NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout,
QJsonDocument(json).toJson(QJsonDocument::Compact), CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
TtRssUnsubscribeFeedResponse result(QString::fromUtf8(result_raw)); TtRssUnsubscribeFeedResponse result(QString::fromUtf8(result_raw));
@ -313,7 +321,8 @@ TtRssUnsubscribeFeedResponse TtRssNetworkFactory::unsubscribeFeed(int feed_id) {
// We are not logged in. // We are not logged in.
login(); login();
json["sid"] = m_sessionId; json["sid"] = m_sessionId;
network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact), CONTENT_TYPE, result_raw, network_reply = NetworkFactory::performNetworkOperation(m_fullUrl, timeout, QJsonDocument(json).toJson(QJsonDocument::Compact),
CONTENT_TYPE, result_raw,
QNetworkAccessManager::PostOperation, QNetworkAccessManager::PostOperation,
m_authIsUsed, m_authUsername, m_authPassword); m_authIsUsed, m_authUsername, m_authPassword);
result = TtRssUnsubscribeFeedResponse(QString::fromUtf8(result_raw)); result = TtRssUnsubscribeFeedResponse(QString::fromUtf8(result_raw));