From 46395d97f60a0d24032e54d7eee659dbcd1c1093 Mon Sep 17 00:00:00 2001 From: Kevin Smith <git@kismith.co.uk> Date: Tue, 8 Feb 2011 21:07:06 +0000 Subject: Disable menu item with notice if the user has no Nickname Resolves: 717 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); -- cgit v0.10.2-6-g49f6