summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-02-08 21:07:06 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-02-08 21:10:36 (GMT)
commit46395d97f60a0d24032e54d7eee659dbcd1c1093 (patch)
treedd6cb593578a98c08d2f5dee0d2b858bd9d368a2
parent5cb135fa91ff018906317c7464307492c33a325d (diff)
downloadswift-46395d97f60a0d24032e54d7eee659dbcd1c1093.zip
swift-46395d97f60a0d24032e54d7eee659dbcd1c1093.tar.bz2
Disable menu item with notice if the user has no Nickname
Resolves: 717
-rw-r--r--Swift/QtUI/QtNameWidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Swift/QtUI/QtNameWidget.cpp b/Swift/QtUI/QtNameWidget.cpp
index c85b2e9..412665d 100644
--- a/Swift/QtUI/QtNameWidget.cpp
+++ b/Swift/QtUI/QtNameWidget.cpp
@@ -42,17 +42,19 @@ void QtNameWidget::setJID(const QString& jid) {
void QtNameWidget::mousePressEvent(QMouseEvent* event) {
QMenu menu;
+ bool hasNick = !nick.isEmpty();
- QAction* showAsNick = new QAction("Show nickname", this);
+ QAction* showAsNick = new QAction(hasNick ? "Show nickname" : "(No Nickname Set)", this);
showAsNick->setCheckable(true);
- if (mode == ShowNick) {
+ showAsNick->setEnabled(hasNick);
+ if (mode == ShowNick && hasNick) {
showAsNick->setChecked(true);
}
menu.addAction(showAsNick);
QAction* showAsJID = new QAction("Show ID", this);
showAsJID->setCheckable(true);
- if (mode == ShowJID) {
+ if (mode == ShowJID || !hasNick) {
showAsJID->setChecked(true);
}
menu.addAction(showAsJID);