diff options
author | Tobias Markmann <tm@ayena.de> | 2014-09-29 08:07:05 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2014-10-17 20:11:30 (GMT) |
commit | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (patch) | |
tree | 78bb8ce9a6bcbc397805bcd433b96b3b23994f09 /Swift/QtUI/Roster/QtRosterWidget.cpp | |
parent | 1722d220533a78e8b2acbcd571631960656e78f8 (diff) | |
download | swift-38b0cb785fea8eae5e48fae56440695fdfd10ee1.zip swift-38b0cb785fea8eae5e48fae56440695fdfd10ee1.tar.bz2 |
Disable online only actions when offline.
Disabling action, menu items and drag 'n' drop which require an online
connection when the user is offline.
Test-Information:
Checked by going offline and checking the relevant actions and menu items.
Change-Id: Iacfa2c9f815d3b9bbad9ca4c2d0d04f95ce9a9e4
Diffstat (limited to 'Swift/QtUI/Roster/QtRosterWidget.cpp')
-rw-r--r-- | Swift/QtUI/Roster/QtRosterWidget.cpp | 10 |
1 files changed, 9 insertions, 1 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 @@ -60,33 +60,38 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { QMenu contextMenu; 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")); QAction* unblockContact = NULL; if (contact->blockState() == ContactRosterItem::IsBlocked || contact->blockState() == ContactRosterItem::IsDomainBlocked) { unblockContact = contextMenu.addAction(tr("Unblock")); + unblockContact->setEnabled(isOnline()); } QAction* blockContact = NULL; if (contact->blockState() == ContactRosterItem::IsUnblocked) { blockContact = contextMenu.addAction(tr("Block")); + blockContact->setEnabled(isOnline()); } #ifdef SWIFT_EXPERIMENTAL_FT QAction* sendFile = NULL; if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { sendFile = contextMenu.addAction(tr("Send File")); + sendFile->setEnabled(isOnline()); } #endif #ifdef SWIFT_EXPERIMENTAL_WB QAction* startWhiteboardChat = NULL; 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) { eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); @@ -135,6 +140,9 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { if (P2QSTRING(group->getDisplayName()) == tr("Contacts")) { renameGroupAction->setEnabled(false); } + else { + renameGroupAction->setEnabled(isOnline()); + } QAction* result = contextMenu.exec(event->globalPos()); if (result == renameGroupAction) { renameGroup(group); |