Skip to content

Commit

Permalink
Fix m_folderMenuInitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
cr7pt0gr4ph7 committed Oct 15, 2024
1 parent 64b2534 commit c16eb40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/library/trackset/crate/cratefeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ CrateFeature::CrateFeature(Library* pLibrary,
: BaseTrackSetFeature(pLibrary, pConfig, "CRATEHOME", QStringLiteral("crates")),
m_lockedCrateIcon(":/images/library/ic_library_locked_tracklist.svg"),
m_pTrackCollection(pLibrary->trackCollectionManager()->internalCollection()),
m_crateTableModel(this, pLibrary->trackCollectionManager()) {
m_crateTableModel(this, pLibrary->trackCollectionManager()),
m_folderMenuInitialized(false) {
initActions();

// construct child model
Expand Down Expand Up @@ -590,12 +591,12 @@ void CrateFeature::onRightClickChild(
moveToFolderMenu->setTitle(tr("Move to Folder"));
moveToFolderMenu->setObjectName("FolderMenu");

bool folderMenuInitialized = false;
m_folderMenuInitialized = false;
connect(moveToFolderMenu,
&QMenu::aboutToShow,
this,
[this, moveToFolderMenu, &folderMenuInitialized, selectionId] {
if (folderMenuInitialized) {
[this, moveToFolderMenu, selectionId] {
if (m_folderMenuInitialized) {
return;
}
moveToFolderMenu->clear();
Expand Down Expand Up @@ -623,7 +624,7 @@ void CrateFeature::onRightClickChild(

moveToFolderMenu->addSeparator();
moveToFolderMenu->addAction(m_pAddToNewFolderAction);
folderMenuInitialized = true;
m_folderMenuInitialized = true;
});

if (selectionId.isCrate()) {
Expand Down Expand Up @@ -684,6 +685,7 @@ void CrateFeature::onRightClickChild(
}

menu.exec(globalPos);
m_folderMenuInitialized = false;
}

void CrateFeature::slotCreateCrate() {
Expand Down
2 changes: 2 additions & 0 deletions src/library/trackset/crate/cratefeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ class CrateFeature : public BaseTrackSetFeature {
QModelIndex m_lastRightClickedIndex;
TrackId m_selectedTrackId;

bool m_folderMenuInitialized;

parented_ptr<QAction> m_pCreateCrateAction;
parented_ptr<QAction> m_pCreateFolderAction;
parented_ptr<QAction> m_pAddToNewFolderAction;
Expand Down

0 comments on commit c16eb40

Please sign in to comment.