mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #72
This commit is contained in:
parent
0a41c0d712
commit
365b5f6d59
2
core.h
2
core.h
|
@ -273,7 +273,7 @@ private:
|
||||||
private:
|
private:
|
||||||
Tox* tox;
|
Tox* tox;
|
||||||
ToxAv* toxav;
|
ToxAv* toxav;
|
||||||
QTimer *toxTimer, *saveTimer, *fileTimer, *bootstrapTimer;
|
QTimer *toxTimer, *fileTimer, *bootstrapTimer; //, *saveTimer;
|
||||||
Camera* camera;
|
Camera* camera;
|
||||||
QList<DhtServer> dhtServerList;
|
QList<DhtServer> dhtServerList;
|
||||||
int dhtServerId;
|
int dhtServerId;
|
||||||
|
|
|
@ -68,7 +68,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
{
|
{
|
||||||
QPoint pos = event->globalPos();
|
QPoint pos = event->globalPos();
|
||||||
QMenu menu;
|
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"));
|
QMenu* inviteMenu = menu.addMenu(tr("Invite in group","Menu to invite a friend in a groupchat"));
|
||||||
QMap<QAction*, Group*> groupActions;
|
QMap<QAction*, Group*> groupActions;
|
||||||
for (Group* group : GroupList::groupList)
|
for (Group* group : GroupList::groupList)
|
||||||
|
@ -79,17 +79,17 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
if (groupActions.isEmpty())
|
if (groupActions.isEmpty())
|
||||||
inviteMenu->setEnabled(false);
|
inviteMenu->setEnabled(false);
|
||||||
menu.addSeparator();
|
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);
|
QAction* selectedItem = menu.exec(pos);
|
||||||
if (selectedItem)
|
if (selectedItem)
|
||||||
{
|
{
|
||||||
if (selectedItem->text() == "Copy friend ID")
|
if (selectedItem == copyId)
|
||||||
{
|
{
|
||||||
emit copyFriendIdToClipboard(friendId);
|
emit copyFriendIdToClipboard(friendId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (selectedItem->text() == "Remove friend")
|
else if (selectedItem == removeFriendAction)
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
emit removeFriend(friendId);
|
emit removeFriend(friendId);
|
||||||
|
|
|
@ -70,18 +70,15 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
{
|
{
|
||||||
QPoint pos = event->globalPos();
|
QPoint pos = event->globalPos();
|
||||||
QMenu menu;
|
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);
|
QAction* selectedItem = menu.exec(pos);
|
||||||
if (selectedItem)
|
if (selectedItem == quitGroup)
|
||||||
{
|
|
||||||
if (selectedItem->text() == "Quit group")
|
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
emit removeGroup(groupId);
|
emit removeGroup(groupId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupWidget::mousePressEvent(QMouseEvent *event)
|
void GroupWidget::mousePressEvent(QMouseEvent *event)
|
||||||
|
|
|
@ -1146,19 +1146,16 @@ void Widget::minimizeBtnClicked()
|
||||||
void Widget::onStatusImgClicked()
|
void Widget::onStatusImgClicked()
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction(tr("Online","Button to set your status to 'Online'"));
|
QAction* online = menu.addAction(tr("Online","Button to set your status to 'Online'"));
|
||||||
menu.addAction(tr("Away","Button to set your status to 'Away'"));
|
QAction* away = menu.addAction(tr("Away","Button to set your status to 'Away'"));
|
||||||
menu.addAction(tr("Busy","Button to set your status to 'Busy'"));
|
QAction* busy = menu.addAction(tr("Busy","Button to set your status to 'Busy'"));
|
||||||
|
|
||||||
QPoint pos = QCursor::pos();
|
QPoint pos = QCursor::pos();
|
||||||
QAction* selectedItem = menu.exec(pos);
|
QAction* selectedItem = menu.exec(pos);
|
||||||
if (selectedItem)
|
if (selectedItem == online)
|
||||||
{
|
|
||||||
if (selectedItem->text() == "Online")
|
|
||||||
core->setStatus(Status::Online);
|
core->setStatus(Status::Online);
|
||||||
else if (selectedItem->text() == "Away")
|
else if (selectedItem == away)
|
||||||
core->setStatus(Status::Away);
|
core->setStatus(Status::Away);
|
||||||
else if (selectedItem->text() == "Busy")
|
else if (selectedItem == busy)
|
||||||
core->setStatus(Status::Busy);
|
core->setStatus(Status::Busy);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user