Browse Source

Fix #72

pull/74/head
Tux3 / Mlkj / !Lev.uXFMLA 11 years ago
parent
commit
365b5f6d59
  1. 2
      core.h
  2. 8
      widget/friendwidget.cpp
  3. 13
      widget/groupwidget.cpp
  4. 21
      widget/widget.cpp

2
core.h

@ -273,7 +273,7 @@ private: @@ -273,7 +273,7 @@ private:
private:
Tox* tox;
ToxAv* toxav;
QTimer *toxTimer, *saveTimer, *fileTimer, *bootstrapTimer;
QTimer *toxTimer, *fileTimer, *bootstrapTimer; //, *saveTimer;
Camera* camera;
QList<DhtServer> dhtServerList;
int dhtServerId;

8
widget/friendwidget.cpp

@ -68,7 +68,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) @@ -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<QAction*, Group*> groupActions;
for (Group* group : GroupList::groupList)
@ -79,17 +79,17 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) @@ -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);

13
widget/groupwidget.cpp

@ -70,17 +70,14 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event) @@ -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;
}
}

21
widget/widget.cpp

@ -1146,19 +1146,16 @@ void Widget::minimizeBtnClicked() @@ -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);
}

Loading…
Cancel
Save