added option to automatically show 'all feeds' view on startup instead of categories, closes #47

This commit is contained in:
Hauke Schade 2013-05-18 23:51:43 +02:00
parent e11094fedc
commit 977807ace2
4 changed files with 32 additions and 2 deletions

View file

@ -201,8 +201,15 @@ Page {
loginErrorDialog.open();
}
else {
//Now show the categories View
rootWindow.openFile('Categories.qml');
if (settings.useAllFeedsOnStartup) {
var ttrss = rootWindow.getTTRSS();
var component = Qt.createComponent("Feeds.qml");
if (component.status === Component.Ready)
pageStack.push(component, { categoryId: ttrss.constants['categories']['ALL'], pageTitle: constant.allFeeds });
}
else
//Now show the categories View
rootWindow.openFile('Categories.qml');
}
}

View file

@ -76,6 +76,12 @@ Page {
onCheckedChanged: settings.displayIcons = checked
}
SettingsSwitchRow {
text: qsTr('Use All Feeds on Startup')
checked: settings.useAllFeedsOnStartup
onCheckedChanged: settings.useAllFeedsOnStartup = checked
}
}

View file

@ -110,6 +110,14 @@ void Settings::setAutoMarkRead(bool autoMarkRead) {
}
}
void Settings::setUseAllFeedsOnStartup(bool useAllFeedsOnStartup) {
if (_useAllFeedsOnStartup != useAllFeedsOnStartup) {
_useAllFeedsOnStartup = useAllFeedsOnStartup;
m_settings->setValue("useAllFeedsOnStartup", _useAllFeedsOnStartup);
emit useAllFeedsOnStartupChanged();
}
}
Settings::Settings(QObject *parent) : QObject(parent), m_settings(new QSettings(this)) {
_servername = m_settings->value("servername", "http://").toString();
_username = m_settings->value("username", "").toString();
@ -124,4 +132,5 @@ Settings::Settings(QObject *parent) : QObject(parent), m_settings(new QSettings(
_displayIcons = m_settings->value("displayIcons", true).toBool();
_webviewFontSize = m_settings->value("webviewFontSize", 22).toInt();
_autoMarkRead = m_settings->value("autoMarkRead", true).toBool();
_useAllFeedsOnStartup = m_settings->value("useAllFeedsOnStartup", false).toBool();
}

View file

@ -24,6 +24,7 @@ class Settings : public QObject
Q_PROPERTY(bool displayIcons READ displayIcons WRITE setDisplayIcons NOTIFY displayIconsChanged)
Q_PROPERTY(int webviewFontSize READ webviewFontSize WRITE setWebviewFontSize NOTIFY webviewFontSizeChanged)
Q_PROPERTY(bool autoMarkRead READ autoMarkRead WRITE setAutoMarkRead NOTIFY autoMarkReadChanged)
Q_PROPERTY(bool useAllFeedsOnStartup READ useAllFeedsOnStartup WRITE setUseAllFeedsOnStartup NOTIFY useAllFeedsOnStartupChanged)
public:
static Settings *instance();
@ -82,6 +83,11 @@ public:
}
void setAutoMarkRead(bool autoMarkRead);
bool useAllFeedsOnStartup() const {
return this->_useAllFeedsOnStartup;
}
void setUseAllFeedsOnStartup(bool useAllFeedsOnStartup);
signals:
void servernameChanged();
void usernameChanged();
@ -96,6 +102,7 @@ signals:
void displayIconsChanged();
void webviewFontSizeChanged();
void autoMarkReadChanged();
void useAllFeedsOnStartupChanged();
private:
static QScopedPointer<Settings> m_instance;
@ -118,5 +125,6 @@ private:
bool _displayIcons;
int _webviewFontSize;
bool _autoMarkRead;
bool _useAllFeedsOnStartup;
};
#endif // SETTINGS_HH