summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtNameWidget.cpp')
-rw-r--r--Swift/QtUI/QtNameWidget.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Swift/QtUI/QtNameWidget.cpp b/Swift/QtUI/QtNameWidget.cpp
index 08e32f5..c172caa 100644
--- a/Swift/QtUI/QtNameWidget.cpp
+++ b/Swift/QtUI/QtNameWidget.cpp
@@ -1,8 +1,8 @@
/*
- * Copyright (c) 2010-2012 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include "QtNameWidget.h"
@@ -14,13 +14,13 @@
#include <Swift/QtUI/QtElidingLabel.h>
#include <Swift/QtUI/QtSettingsProvider.h>
#include <Swift/QtUI/QtUISettingConstants.h>
namespace Swift {
-QtNameWidget::QtNameWidget(SettingsProvider* settings, QWidget *parent) : QWidget(parent), settings(settings) {
+QtNameWidget::QtNameWidget(SettingsProvider* settings, QWidget *parent) : QWidget(parent), settings(settings), isOnline_(false) {
QHBoxLayout* mainLayout = new QHBoxLayout(this);
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0,0,0,0);
mode = settings->getSetting(QtUISettingConstants::SHOW_NICK_IN_ROSTER_HEADER) ? ShowNick : ShowJID;
@@ -38,12 +38,16 @@ void QtNameWidget::setNick(const QString& nick) {
void QtNameWidget::setJID(const QString& jid) {
this->jid = jid;
updateText();
}
+void QtNameWidget::setOnline(const bool isOnline) {
+ isOnline_ = isOnline;
+}
+
void QtNameWidget::mousePressEvent(QMouseEvent* event) {
QMenu menu;
bool hasNick = !nick.isEmpty();
QAction* showAsNick = new QAction(hasNick ? tr("Show Nickname") : tr("(No Nickname Set)"), this);
showAsNick->setCheckable(true);
@@ -59,12 +63,13 @@ void QtNameWidget::mousePressEvent(QMouseEvent* event) {
showAsJID->setChecked(true);
}
menu.addAction(showAsJID);
QAction* editProfile = new QAction(tr("Edit Profile"), this);
menu.addAction(editProfile);
+ editProfile->setEnabled(isOnline_);
QAction* result = menu.exec(event->globalPos());
if (result == showAsJID) {
mode = ShowJID;
}
else if (result == showAsNick) {