Missed code for 2.0.0.4.

This commit is contained in:
Martin Rotter 2014-11-06 17:28:05 +01:00
parent a7bf685203
commit ceb6ce218b
6 changed files with 21 additions and 13 deletions

View File

@ -86,9 +86,7 @@ QVariant FeedsModelCategory::data(int column, int role) const {
return m_title;
}
else if (column == FDS_MODEL_COUNTS_INDEX) {
return qApp->settings()->value(APP_CFG_FEEDS,
"count_format",
"(%unread)").toString()
return qApp->settings()->value(APP_CFG_FEEDS, COUNT_FORMAT, DEFAULT_VALUE(COUNT_FORMAT)).toString()
.replace("%unread", QString::number(countOfUnreadMessages()))
.replace("%all", QString::number(countOfAllMessages()));
}

View File

@ -174,7 +174,9 @@ QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(co
QByteArray feed_contents;
NetworkResult network_result = NetworkFactory::downloadFeedFile(url,
qApp->settings()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt(),
qApp->settings()->value(APP_CFG_FEEDS,
UPDATE_TIMEOUT,
DEFAULT_VALUE(UPDATE_TIMEOUT)).toInt(),
feed_contents,
!username.isEmpty(),
username,
@ -286,9 +288,7 @@ QVariant FeedsModelFeed::data(int column, int role) const {
return m_title;
}
else if (column == FDS_MODEL_COUNTS_INDEX) {
return qApp->settings()->value(APP_CFG_FEEDS,
"count_format",
"(%unread)").toString()
return qApp->settings()->value(APP_CFG_FEEDS, COUNT_FORMAT, DEFAULT_VALUE(COUNT_FORMAT)).toString()
.replace("%unread", QString::number(countOfUnreadMessages()))
.replace("%all", QString::number(countOfAllMessages()));
}
@ -390,7 +390,7 @@ QVariant FeedsModelFeed::data(int column, int role) const {
void FeedsModelFeed::update() {
QByteArray feed_contents;
int download_timeout = qApp->settings()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt();
int download_timeout = qApp->settings()->value(APP_CFG_FEEDS, UPDATE_TIMEOUT, DEFAULT_VALUE(UPDATE_TIMEOUT)).toInt();
m_networkError = NetworkFactory::downloadFeedFile(url(), download_timeout, feed_contents, passwordProtected(), username(), password()).first;
if (m_networkError != QNetworkReply::NoError) {

View File

@ -62,7 +62,7 @@ QVariant FeedsModelRecycleBin::data(int column, int role) const {
return m_title;
}
else if (column == FDS_MODEL_COUNTS_INDEX) {
return qApp->settings()->value(APP_CFG_FEEDS, "count_format", "(%unread)").toString()
return qApp->settings()->value(APP_CFG_FEEDS, COUNT_FORMAT, DEFAULT_VALUE(COUNT_FORMAT)).toString()
.replace("%unread", QString::number(countOfUnreadMessages()))
.replace("%all", QString::number(countOfAllMessages()));
}

View File

@ -182,7 +182,7 @@ void FormSettings::loadFeedsMessages() {
m_ui->m_checkRemoveReadMessagesOnExit->setChecked(settings->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool());
m_ui->m_checkAutoUpdate->setChecked(settings->value(APP_CFG_FEEDS, "auto_update_enabled", false).toBool());
m_ui->m_spinAutoUpdateInterval->setValue(settings->value(APP_CFG_FEEDS, "auto_update_interval", DEFAULT_AUTO_UPDATE_INTERVAL).toInt());
m_ui->m_spinFeedUpdateTimeout->setValue(settings->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt());
m_ui->m_spinFeedUpdateTimeout->setValue(settings->value(APP_CFG_FEEDS, UPDATE_TIMEOUT, DEFAULT_VALUE(UPDATE_TIMEOUT)).toInt());
m_ui->m_checkUpdateAllFeedsOnStartup->setChecked(settings->value(APP_CFG_FEEDS, "feeds_update_on_startup", false).toBool());
m_ui->m_cmbCountsFeedList->addItems(QStringList() << "(%unread)" << "[%unread]" << "%unread/%all" << "%unread-%all" << "[%unread|%all]");
m_ui->m_cmbCountsFeedList->setEditText(settings->value(APP_CFG_FEEDS, "count_format", "(%unread)").toString());
@ -216,7 +216,7 @@ void FormSettings::saveFeedsMessages() {
settings->setValue(APP_CFG_MESSAGES, "clear_read_on_exit", m_ui->m_checkRemoveReadMessagesOnExit->isChecked());
settings->setValue(APP_CFG_FEEDS, "auto_update_enabled", m_ui->m_checkAutoUpdate->isChecked());
settings->setValue(APP_CFG_FEEDS, "auto_update_interval", m_ui->m_spinAutoUpdateInterval->value());
settings->setValue(APP_CFG_FEEDS, "feed_update_timeout", m_ui->m_spinFeedUpdateTimeout->value());
settings->setValue(APP_CFG_FEEDS, UPDATE_TIMEOUT, m_ui->m_spinFeedUpdateTimeout->value());
settings->setValue(APP_CFG_FEEDS, "feeds_update_on_startup", m_ui->m_checkUpdateAllFeedsOnStartup->isChecked());
settings->setValue(APP_CFG_FEEDS, "count_format", m_ui->m_cmbCountsFeedList->currentText());
settings->setValue(APP_CFG_MESSAGES, "use_custom_date", m_ui->m_checkMessagesDateTimeFormat->isChecked());

View File

@ -31,7 +31,7 @@ Settings::Settings(const QString &file_name, Format format,
: QSettings(file_name, format, parent), m_initializationStatus(status) {
}
Settings::~Settings() {
Settings::~Settings() {
checkSettings();
qDebug("Deleting Settings instance.");
}

View File

@ -20,8 +20,19 @@
#include <QSettings>
#include "definitions/definitions.h"
#include <QPointer>
#define DEFAULT_VALUE(x) x##_DEF
// Feeds.
#define UPDATE_TIMEOUT "feed_update_timeout"
#define UPDATE_TIMEOUT_DEF DOWNLOAD_TIMEOUT
#define COUNT_FORMAT "count_format"
#define COUNT_FORMAT_DEF "(%unread)"
class Settings : public QSettings {
Q_OBJECT
@ -54,7 +65,6 @@ class Settings : public QSettings {
QSettings::Status checkSettings();
bool initiateRestoration(const QString &settings_backup_file_path);
static void finishRestoration(const QString &desired_settings_file_path);
// Creates settings file in correct location.