icon and tooltip information in participants, saving bookmarks, subscription and unsubscription, deletion of MUCs

This commit is contained in:
Blue 2019-09-03 23:28:58 +03:00
parent 5547d78608
commit 5f8d38bd9a
19 changed files with 216 additions and 9 deletions

View file

@ -455,6 +455,41 @@ void Squawk::onRosterContextMenu(const QPoint& point)
emit removeContactRequest(cnt->getAccountName(), cnt->getJid());
});
}
break;
case Models::Item::room: {
Models::Room* room = static_cast<Models::Room*>(item);
hasMenu = true;
QAction* dialog = contextMenu->addAction(Shared::icon("mail-message"), "Open conversation");
connect(dialog, &QAction::triggered, [this, index]() {
onRosterItemDoubleClicked(index);
});
Models::Roster::ElId id(room->getAccountName(), room->getJid());
if (room->getAutoJoin()) {
QAction* unsub = contextMenu->addAction(Shared::icon("news-unsubscribe"), "Unsubscribe");
connect(unsub, &QAction::triggered, [this, id]() {
emit setRoomAutoJoin(id.account, id.name, false);
if (conversations.find(id) == conversations.end()) { //to leave the room if it's not opened in a conversation window
emit setRoomJoined(id.account, id.name, false);
}
});
} else {
QAction* unsub = contextMenu->addAction(Shared::icon("news-subscribe"), "Subscribe");
connect(unsub, &QAction::triggered, [this, id]() {
emit setRoomAutoJoin(id.account, id.name, true);
if (conversations.find(id) == conversations.end()) { //to join the room if it's not already joined
emit setRoomJoined(id.account, id.name, true);
}
});
}
QAction* remove = contextMenu->addAction(Shared::icon("edit-delete"), "Remove");
connect(remove, &QAction::triggered, [this, id]() {
emit removeRoomRequest(id.account, id.name);
});
}
break;
default: