Skip to content

Commit

Permalink
FancyMenu: try fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgit committed Jan 6, 2024
1 parent 4eefd57 commit eb37c9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
19 changes: 9 additions & 10 deletions plugin-fancymenu/lxqtfancymenuwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,24 +329,22 @@ void LXQtFancyMenuWindow::runCommandHelper(const QString &cmd)
void LXQtFancyMenuWindow::addToFavorites(const QString &desktopFile)
{
mFavorites.append(desktopFile);

mAppModel->reloadAppMap(false);
mAppMap->addToFavorites(desktopFile);
reloadFavoritesModel();
mAppModel->reloadAppMap(true);

emit favoritesChanged();
}

void LXQtFancyMenuWindow::removeFromFavorites(const QString &desktopFile)
{
mFavorites.removeOne(desktopFile);
mAppMap->removeFromFavorites(desktopFile);
reloadFavoritesModel();
emit favoritesChanged();
}

void LXQtFancyMenuWindow::reloadFavoritesModel()
{
// TODO: reload only if showing favorites
mAppModel->reloadAppMap(false);
mAppMap->removeFromFavorites(desktopFile);
mAppModel->reloadAppMap(true);

emit favoritesChanged();
}

QStringList LXQtFancyMenuWindow::favorites() const
Expand All @@ -357,6 +355,7 @@ QStringList LXQtFancyMenuWindow::favorites() const
void LXQtFancyMenuWindow::setFavorites(const QStringList &newFavorites)
{
mFavorites = newFavorites;
mAppModel->reloadAppMap(false);
mAppMap->setFavorites(mFavorites);
reloadFavoritesModel();
mAppModel->reloadAppMap(true);
}
1 change: 0 additions & 1 deletion plugin-fancymenu/lxqtfancymenuwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ private slots:

void addToFavorites(const QString& desktopFile);
void removeFromFavorites(const QString& desktopFile);
void reloadFavoritesModel();

private:
QStringList mFavorites;
Expand Down

0 comments on commit eb37c9b

Please sign in to comment.