Skip to content

Commit 5c9b638

Browse files
author
Milkii Brewster
committed
fix: restoreLastSelection returns bool; add missing includes for GCC build
1 parent 1272718 commit 5c9b638

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/library/sidebarmodel.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,14 +699,14 @@ void SidebarModel::saveSelectionToConfig(const QModelIndex& index) {
699699
}
700700
}
701701

702-
void SidebarModel::restoreLastSelection() {
702+
bool SidebarModel::restoreLastSelection() {
703703
if (!m_pConfig) {
704-
return;
704+
return false;
705705
}
706706

707707
QString savedFeatureIcon = m_pConfig->getValue(kLastSelectedFeatureConfigKey);
708708
if (savedFeatureIcon.isEmpty()) {
709-
return;
709+
return false;
710710
}
711711

712712
QString savedChildDataStr = m_pConfig->getValue(kLastSelectedChildConfigKey);
@@ -734,7 +734,7 @@ void SidebarModel::restoreLastSelection() {
734734
}
735735

736736
if (!pTargetFeature) {
737-
return;
737+
return false;
738738
}
739739

740740
QModelIndex targetIndex = index(featureIndex, 0);
@@ -752,7 +752,7 @@ void SidebarModel::restoreLastSelection() {
752752
VERIFY_OR_DEBUG_ASSERT(!matches.isEmpty() && matches.first().isValid()) {
753753
// Child not found, select feature root
754754
emit selectIndex(targetIndex, true);
755-
return;
755+
return true;
756756
}
757757

758758
// Translate child index to sidebar index
@@ -764,4 +764,5 @@ void SidebarModel::restoreLastSelection() {
764764
}
765765

766766
emit selectIndex(targetIndex, true);
767+
return true;
767768
}

src/library/sidebarmodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class SidebarModel : public QAbstractItemModel {
8383
void slotModelAboutToBeReset();
8484
void slotModelReset();
8585
void slotFeatureIsLoading(LibraryFeature*, bool selectFeature);
86-
void restoreLastSelection();
86+
bool restoreLastSelection();
8787
void slotFeatureLoadingFinished(LibraryFeature*);
8888

8989
signals:

0 commit comments

Comments
 (0)