summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r--Swift/QtUI/Roster/QtRosterWidget.cpp10
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp10
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.h4
3 files changed, 22 insertions, 2 deletions
diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp
index 4a3c9f3..8c296e5 100644
--- a/Swift/QtUI/Roster/QtRosterWidget.cpp
+++ b/Swift/QtUI/Roster/QtRosterWidget.cpp
@@ -61,5 +61,7 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) {
QAction* editContact = contextMenu.addAction(tr("Edit…"));
+ editContact->setEnabled(isOnline());
QAction* removeContact = contextMenu.addAction(tr("Remove"));
+ removeContact->setEnabled(isOnline());
QAction* showProfileForContact = contextMenu.addAction(tr("Show Profile"));
@@ -68,4 +70,5 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
contact->blockState() == ContactRosterItem::IsDomainBlocked) {
unblockContact = contextMenu.addAction(tr("Unblock"));
+ unblockContact->setEnabled(isOnline());
}
@@ -73,4 +76,5 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
if (contact->blockState() == ContactRosterItem::IsUnblocked) {
blockContact = contextMenu.addAction(tr("Block"));
+ blockContact->setEnabled(isOnline());
}
@@ -79,4 +83,5 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) {
sendFile = contextMenu.addAction(tr("Send File"));
+ sendFile->setEnabled(isOnline());
}
#endif
@@ -85,7 +90,7 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
if (contact->supportsFeature(ContactRosterItem::WhiteboardFeature)) {
startWhiteboardChat = contextMenu.addAction(tr("Start Whiteboard Chat"));
+ startWhiteboardChat->setEnabled(isOnline());
}
#endif
-
QAction* result = contextMenu.exec(event->globalPos());
if (result == editContact) {
@@ -136,4 +141,7 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
renameGroupAction->setEnabled(false);
}
+ else {
+ renameGroupAction->setEnabled(isOnline());
+ }
QAction* result = contextMenu.exec(event->globalPos());
if (result == renameGroupAction) {
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp
index 5333260..f296088 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidget.cpp
@@ -1,4 +1,4 @@
/*
- * Copyright (c) 2010-2012 Kevin Smith
+ * Copyright (c) 2010-2014 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
@@ -253,3 +253,11 @@ JID QtTreeWidget::selectedJID() const {
}
+void QtTreeWidget::setOnline(bool isOnline) {
+ isOnline_ = isOnline;
+}
+
+bool QtTreeWidget::isOnline() const {
+ return isOnline_;
+}
+
}
diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h
index cf2f73e..12d34f5 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.h
+++ b/Swift/QtUI/Roster/QtTreeWidget.h
@@ -37,4 +37,6 @@ class QtTreeWidget : public QTreeView {
JID jidFromIndex(const QModelIndex& index) const;
JID selectedJID() const;
+ void setOnline(bool isOnline);
+
public:
boost::signal<void (RosterItem*)> onSomethingSelectedChanged;
@@ -55,4 +57,5 @@ class QtTreeWidget : public QTreeView {
bool event(QEvent* event);
QModelIndexList getSelectedIndexes() const;
+ bool isOnline() const;
private:
@@ -72,4 +75,5 @@ class QtTreeWidget : public QTreeView {
bool tooltipShown_;
MessageTarget messageTarget_;
+ bool isOnline_;
};