Browse Source

Fix #2301 and use QStringLiteral for comparison

pull/2552/head
TheNain38 10 years ago
parent
commit
eb3ec79b20
  1. 29
      src/widget/widget.cpp

29
src/widget/widget.cpp

@ -414,13 +414,13 @@ void Widget::updateIcons()
QString status; QString status;
if (eventIcon) if (eventIcon)
{ {
status = "event"; status = QStringLiteral("event");
} }
else else
{ {
status = ui->statusButton->property("status").toString(); status = ui->statusButton->property("status").toString();
if (!status.length()) if (!status.length())
status = "offline"; status = QStringLiteral("offline");
} }
QIcon ico; QIcon ico;
@ -502,6 +502,11 @@ void Widget::closeEvent(QCloseEvent *event)
} }
else else
{ {
if (autoAwayActive)
{
emit statusSet(Status::Online);
autoAwayActive = false;
}
saveWindowGeometry(); saveWindowGeometry();
saveSplitterGeometry(); saveSplitterGeometry();
qApp->exit(0); qApp->exit(0);
@ -889,13 +894,13 @@ void Widget::addFriend(int friendId, const QString &userId)
if (chatDate > activityDate && chatDate.isValid()) if (chatDate > activityDate && chatDate.isValid())
Settings::getInstance().setFriendActivity(newfriend->getToxId(), chatDate); Settings::getInstance().setFriendActivity(newfriend->getToxId(), chatDate);
contactListWidget->addFriendWidget(newfriend->getFriendWidget(),Status::Offline,Settings::getInstance().getFriendCircleID(newfriend->getToxId())); contactListWidget->addFriendWidget(newfriend->getFriendWidget(), Status::Offline, Settings::getInstance().getFriendCircleID(newfriend->getToxId()));
Core* core = Nexus::getCore(); Core* core = Nexus::getCore();
CoreAV* coreav = core->getAv(); CoreAV* coreav = core->getAv();
connect(newfriend, &Friend::displayedNameChanged, this, &Widget::onFriendDisplayChanged); connect(newfriend, &Friend::displayedNameChanged, this, &Widget::onFriendDisplayChanged);
connect(settingsWidget, &SettingsWidget::compactToggled, newfriend->getFriendWidget(), &GenericChatroomWidget::compactChange); connect(settingsWidget, &SettingsWidget::compactToggled, newfriend->getFriendWidget(), &GenericChatroomWidget::compactChange);
connect(newfriend->getFriendWidget(), SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*,bool)), this, SLOT(onChatroomWidgetClicked(GenericChatroomWidget*,bool))); connect(newfriend->getFriendWidget(), SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*, bool)), this, SLOT(onChatroomWidgetClicked(GenericChatroomWidget*, bool)));
connect(newfriend->getFriendWidget(), SIGNAL(removeFriend(int)), this, SLOT(removeFriend(int))); connect(newfriend->getFriendWidget(), SIGNAL(removeFriend(int)), this, SLOT(removeFriend(int)));
connect(newfriend->getFriendWidget(), SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int))); connect(newfriend->getFriendWidget(), SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int)));
connect(newfriend->getFriendWidget(), SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), newfriend->getChatForm(), SLOT(focusInput())); connect(newfriend->getFriendWidget(), SIGNAL(chatroomWidgetClicked(GenericChatroomWidget*)), newfriend->getChatForm(), SLOT(focusInput()));
@ -1922,25 +1927,25 @@ QString Widget::getStatusTitle(Status status)
switch (status) switch (status)
{ {
case Status::Online: case Status::Online:
return "online"; return QStringLiteral("online");
case Status::Away: case Status::Away:
return "away"; return QStringLiteral("away");
case Status::Busy: case Status::Busy:
return "busy"; return QStringLiteral("busy");
case Status::Offline: case Status::Offline:
default: default:
return "offline"; return QStringLiteral("offline");
} }
} }
Status Widget::getStatusFromString(QString status) Status Widget::getStatusFromString(QString status)
{ {
if (status == "online") if (status == QStringLiteral("online"))
return Status::Online; return Status::Online;
else if (status == "busy") else if (status == QStringLiteral("away"))
return Status::Busy;
else if (status == "away")
return Status::Away; return Status::Away;
else if (status == QStringLiteral("busy"))
return Status::Busy;
else else
return Status::Offline; return Status::Offline;
} }

Loading…
Cancel
Save