Skip to content

Commit

Permalink
Fixed regression in account's muc menu
Browse files Browse the repository at this point in the history
After adding sorting they started referreing wrong mucs
  • Loading branch information
Ri0n committed May 6, 2024
1 parent 696a48b commit b7e5e39
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/contactlistaccountmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ private slots:
if (account->bookmarkManager()->isAvailable()) {
bookmarksManageAction_->setEnabled(true);
bookmarksMenu_->addSeparator();
using SortableItem = std::pair<QString, const ConferenceBookmark *>;
auto const &conferences = account->bookmarkManager()->conferences();
using SortableItem = std::pair<QString, const ConferenceBookmark *>;
auto const &conferences = account->bookmarkManager()->conferences();

std::vector<SortableItem> sorted;
sorted.reserve(conferences.size());
for (auto const &c : conferences) {
Expand All @@ -221,8 +222,7 @@ private slots:
for (const auto &cp : sorted) {
auto c = *std::get<1>(cp);
QAction *joinAction = new QAction(c.name(), this);
joinAction->setProperty("bookmark", bookmarksJoinActions_.count());
connect(joinAction, SIGNAL(triggered()), SLOT(bookmarksJoin()));
connect(joinAction, &QAction::triggered, account, [this, c]() { account->actionJoin(c, true); });
bookmarksMenu_->addAction(joinAction);
bookmarksJoinActions_ << joinAction;
}
Expand Down Expand Up @@ -317,16 +317,6 @@ private slots:
w->show();
}

void bookmarksJoin()
{
if (!account)
return;

QAction *joinAction = static_cast<QAction *>(sender());
ConferenceBookmark c = account->bookmarkManager()->conferences()[joinAction->property("bookmark").toInt()];
account->actionJoin(c, true);
}

void addContact()
{
if (!account)
Expand Down

0 comments on commit b7e5e39

Please sign in to comment.