Work on issue #10.
This commit is contained in:
parent
0ead577cac
commit
ef02b774b1
@ -84,6 +84,7 @@
|
||||
#define APP_CFG_BROWSER "browser"
|
||||
#define APP_CFG_MESSAGES "messages"
|
||||
#define APP_CFG_FEEDS "feeds"
|
||||
#define APP_CFG_CAT_EXP "categories_expand_states"
|
||||
|
||||
#if defined(Q_OS_OSX)
|
||||
#define APP_PREFIX "@CMAKE_INSTALL_PREFIX@/@APP_LOW_NAME@.app/Contents/Resources"
|
||||
|
@ -73,6 +73,8 @@ FeedMessageViewer::~FeedMessageViewer() {
|
||||
void FeedMessageViewer::saveSize() {
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
m_feedsView->saveExpandedStates();
|
||||
|
||||
// Store offsets of splitters.
|
||||
settings->setValue(APP_CFG_GUI,
|
||||
"splitter_feeds",
|
||||
@ -100,6 +102,8 @@ void FeedMessageViewer::loadSize() {
|
||||
Settings *settings = Settings::instance();
|
||||
int default_msg_section_size = m_messagesView->header()->defaultSectionSize();
|
||||
|
||||
m_feedsView->loadExpandedStates();
|
||||
|
||||
// Restore offsets of splitters.
|
||||
m_feedSplitter->restoreState(QByteArray::fromBase64(settings->value(APP_CFG_GUI, "splitter_feeds").toString().toLocal8Bit()));
|
||||
m_messageSplitter->restoreState(QByteArray::fromBase64(settings->value(APP_CFG_GUI, "splitter_messages").toString().toLocal8Bit()));
|
||||
|
@ -115,6 +115,29 @@ FeedsModelFeed *FeedsView::isCurrentIndexFeed() const {
|
||||
return m_sourceModel->feedForIndex(current_mapped);
|
||||
}
|
||||
|
||||
void FeedsView::saveExpandedStates() {
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Iterate all categories and save their expand statuses.
|
||||
foreach (FeedsModelCategory *category, sourceModel()->allCategories().values()) {
|
||||
settings->setValue(APP_CFG_CAT_EXP,
|
||||
QString::number(category->id()),
|
||||
isExpanded(model()->mapFromSource(sourceModel()->indexForItem(category))));
|
||||
}
|
||||
}
|
||||
|
||||
void FeedsView::loadExpandedStates() {
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
// Iterate all categories and save their expand statuses.
|
||||
foreach (FeedsModelCategory *category, sourceModel()->allCategories().values()) {
|
||||
setExpanded(model()->mapFromSource(sourceModel()->indexForItem(category)),
|
||||
settings->value(APP_CFG_CAT_EXP,
|
||||
QString::number(category->id()),
|
||||
true).toBool());
|
||||
}
|
||||
}
|
||||
|
||||
void FeedsView::updateAllFeeds() {
|
||||
if (SystemFactory::instance()->applicationCloseLock()->tryLock()) {
|
||||
emit feedsUpdateRequested(allFeeds());
|
||||
|
@ -66,6 +66,9 @@ class FeedsView : public QTreeView {
|
||||
FeedsModelCategory *isCurrentIndexCategory() const;
|
||||
FeedsModelFeed *isCurrentIndexFeed() const;
|
||||
|
||||
void saveExpandedStates();
|
||||
void loadExpandedStates();
|
||||
|
||||
public slots:
|
||||
// Feed updating.
|
||||
void updateAllFeeds();
|
||||
|
Loading…
x
Reference in New Issue
Block a user