This commit is contained in:
Martin Rotter 2020-11-13 12:22:22 +01:00
parent b42f328e14
commit 910bfd0ecb
7 changed files with 32 additions and 0 deletions

View File

@ -159,6 +159,7 @@ QList<QAction*> FormMain::allActions() const {
actions << m_ui->m_actionClearAllItems;
actions << m_ui->m_actionShowOnlyUnreadItems;
actions << m_ui->m_actionShowTreeBranches;
actions << m_ui->m_actionAutoExpandItemsWhenSelected;
actions << m_ui->m_actionShowOnlyUnreadMessages;
actions << m_ui->m_actionMarkSelectedMessagesAsRead;
actions << m_ui->m_actionMarkSelectedMessagesAsUnread;
@ -596,6 +597,8 @@ void FormMain::loadSize() {
SETTING(Feeds::ShowOnlyUnreadFeeds)).toBool());
m_ui->m_actionShowTreeBranches->setChecked(settings->value(GROUP(Feeds),
SETTING(Feeds::ShowTreeBranches)).toBool());
m_ui->m_actionAutoExpandItemsWhenSelected->setChecked(settings->value(GROUP(Feeds),
SETTING(Feeds::AutoExpandOnSelection)).toBool());
m_ui->m_actionShowOnlyUnreadMessages->setChecked(settings->value(GROUP(Messages),
SETTING(Messages::ShowOnlyUnreadMessages)).toBool());
m_ui->m_actionAlternateColorsInLists->setChecked(settings->value(GROUP(GUI),
@ -763,6 +766,8 @@ void FormMain::createConnections() {
tabWidget()->feedMessageViewer(), &FeedMessageViewer::toggleShowOnlyUnreadFeeds);
connect(m_ui->m_actionShowTreeBranches, &QAction::toggled,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::toggleShowFeedTreeBranches);
connect(m_ui->m_actionAutoExpandItemsWhenSelected, &QAction::toggled,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::toggleItemsAutoExpandingOnSelection);
connect(m_ui->m_actionAlternateColorsInLists, &QAction::toggled,
tabWidget()->feedMessageViewer(), &FeedMessageViewer::alternateRowColorsInLists);
connect(m_ui->m_actionShowOnlyUnreadMessages, &QAction::toggled,

View File

@ -116,6 +116,7 @@
<addaction name="m_actionDeleteSelectedItem"/>
<addaction name="separator"/>
<addaction name="m_actionShowOnlyUnreadItems"/>
<addaction name="m_actionAutoExpandItemsWhenSelected"/>
<addaction name="m_actionShowTreeBranches"/>
<addaction name="m_actionExpandCollapseItem"/>
<addaction name="separator"/>
@ -784,6 +785,14 @@
<string>Alternate row colors in lists</string>
</property>
</action>
<action name="m_actionAutoExpandItemsWhenSelected">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Automatically &amp;expand items when selected</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -188,6 +188,12 @@ void FeedMessageViewer::toggleShowFeedTreeBranches() {
qApp->settings()->setValue(GROUP(Feeds), Feeds::ShowTreeBranches, origin->isChecked());
}
void FeedMessageViewer::toggleItemsAutoExpandingOnSelection() {
const QAction* origin = qobject_cast<QAction*>(sender());
qApp->settings()->setValue(GROUP(Feeds), Feeds::AutoExpandOnSelection, origin->isChecked());
}
void FeedMessageViewer::alternateRowColorsInLists() {
const QAction* origin = qobject_cast<QAction*>(sender());

View File

@ -66,6 +66,7 @@ class RSSGUARD_DLLSPEC FeedMessageViewer : public TabContent {
void toggleShowOnlyUnreadMessages();
void toggleShowOnlyUnreadFeeds();
void toggleShowFeedTreeBranches();
void toggleItemsAutoExpandingOnSelection();
void alternateRowColorsInLists();
private slots:

View File

@ -713,6 +713,11 @@ void FeedsView::selectionChanged(const QItemSelection& selected, const QItemSele
emit itemSelected(selected_item);
m_proxyModel->invalidateReadFeedsFilter();
if (!selectedIndexes().isEmpty() &&
qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::AutoExpandOnSelection)).toBool()) {
expand(selectedIndexes().first());
}
}
void FeedsView::keyPressEvent(QKeyEvent* event) {

View File

@ -60,6 +60,9 @@ DVALUE(bool) Feeds::ShowOnlyUnreadFeedsDef = false;
DKEY Feeds::ShowTreeBranches = "show_tree_branches";
DVALUE(bool) Feeds::ShowTreeBranchesDef = true;
DKEY Feeds::AutoExpandOnSelection = "auto_expand_on_selection";
DVALUE(bool) Feeds::AutoExpandOnSelectionDef = false;
DKEY Feeds::ListFont = "list_font";
// Messages.

View File

@ -79,6 +79,9 @@ namespace Feeds {
KEY ShowTreeBranches;
VALUE(bool) ShowTreeBranchesDef;
KEY AutoExpandOnSelection;
VALUE(bool) AutoExpandOnSelectionDef;
KEY ListFont;
}