diff --git a/core.h b/core.h index 411cf43b1..2d6766769 100644 --- a/core.h +++ b/core.h @@ -273,7 +273,7 @@ private: private: Tox* tox; ToxAv* toxav; - QTimer *toxTimer, *saveTimer, *fileTimer, *bootstrapTimer; + QTimer *toxTimer, *fileTimer, *bootstrapTimer; //, *saveTimer; Camera* camera; QList dhtServerList; int dhtServerId; diff --git a/widget/friendwidget.cpp b/widget/friendwidget.cpp index 972b68a34..49ebec8ae 100644 --- a/widget/friendwidget.cpp +++ b/widget/friendwidget.cpp @@ -68,7 +68,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) { QPoint pos = event->globalPos(); QMenu menu; - menu.addAction(tr("Copy friend ID","Menu to copy the Tox ID of that friend")); + QAction* copyId = menu.addAction(tr("Copy friend ID","Menu to copy the Tox ID of that friend")); QMenu* inviteMenu = menu.addMenu(tr("Invite in group","Menu to invite a friend in a groupchat")); QMap groupActions; for (Group* group : GroupList::groupList) @@ -79,17 +79,17 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) if (groupActions.isEmpty()) inviteMenu->setEnabled(false); menu.addSeparator(); - menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist")); + QAction* removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist")); QAction* selectedItem = menu.exec(pos); if (selectedItem) { - if (selectedItem->text() == "Copy friend ID") + if (selectedItem == copyId) { emit copyFriendIdToClipboard(friendId); return; } - else if (selectedItem->text() == "Remove friend") + else if (selectedItem == removeFriendAction) { hide(); emit removeFriend(friendId); diff --git a/widget/groupwidget.cpp b/widget/groupwidget.cpp index c3a4dfb08..f0392daf3 100644 --- a/widget/groupwidget.cpp +++ b/widget/groupwidget.cpp @@ -70,17 +70,14 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event) { QPoint pos = event->globalPos(); QMenu menu; - menu.addAction(tr("Quit group","Menu to quit a groupchat")); + QAction* quitGroup = menu.addAction(tr("Quit group","Menu to quit a groupchat")); QAction* selectedItem = menu.exec(pos); - if (selectedItem) + if (selectedItem == quitGroup) { - if (selectedItem->text() == "Quit group") - { - hide(); - emit removeGroup(groupId); - return; - } + hide(); + emit removeGroup(groupId); + return; } } diff --git a/widget/widget.cpp b/widget/widget.cpp index fc92c5526..59a6c4660 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -1146,19 +1146,16 @@ void Widget::minimizeBtnClicked() void Widget::onStatusImgClicked() { QMenu menu; - menu.addAction(tr("Online","Button to set your status to 'Online'")); - menu.addAction(tr("Away","Button to set your status to 'Away'")); - menu.addAction(tr("Busy","Button to set your status to 'Busy'")); + QAction* online = menu.addAction(tr("Online","Button to set your status to 'Online'")); + QAction* away = menu.addAction(tr("Away","Button to set your status to 'Away'")); + QAction* busy = menu.addAction(tr("Busy","Button to set your status to 'Busy'")); QPoint pos = QCursor::pos(); QAction* selectedItem = menu.exec(pos); - if (selectedItem) - { - if (selectedItem->text() == "Online") - core->setStatus(Status::Online); - else if (selectedItem->text() == "Away") - core->setStatus(Status::Away); - else if (selectedItem->text() == "Busy") - core->setStatus(Status::Busy); - } + if (selectedItem == online) + core->setStatus(Status::Online); + else if (selectedItem == away) + core->setStatus(Status::Away); + else if (selectedItem == busy) + core->setStatus(Status::Busy); }