From 8effa7fb6c2e341734be5392566c06e9ac38d1b7 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Mon, 1 Nov 2010 20:19:05 +0000
Subject: Disable bookmarks when offline.

Resolves: #679
Release-Notes: You can no longer use bookmarks while offline.

diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 0353cb9..4a9e164 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -161,7 +161,7 @@ void ChatsManager::setOnline(bool enabled) {
 			controllerPair.second->rejoin();
 		}
 	}
-
+	chatListWindow_->setBookmarksEnabled(enabled);
 }
 
 void ChatsManager::handleChatRequest(const String &contact) {
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp
index 86dfa8f..887d9a4 100644
--- a/Swift/QtUI/ChatList/QtChatListWindow.cpp
+++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp
@@ -68,6 +68,9 @@ void QtChatListWindow::setupContextMenus() {
 }
 
 void QtChatListWindow::handleItemActivated(const QModelIndex& index) {
+	if (!bookmarksEnabled_) {
+		return;
+	}
 	ChatListItem* item = model_->getItemForIndex(index);
 	ChatListMUCItem* mucItem = dynamic_cast<ChatListMUCItem*>(item);
 	if (mucItem) {
diff --git a/Swiften/MUC/MUCBookmarkManager.h b/Swiften/MUC/MUCBookmarkManager.h
index 8067b4b..35f5447 100644
--- a/Swiften/MUC/MUCBookmarkManager.h
+++ b/Swiften/MUC/MUCBookmarkManager.h
@@ -27,7 +27,7 @@ namespace Swift {
 			void removeBookmark(const MUCBookmark& bookmark);
 			void replaceBookmark(const MUCBookmark& oldBookmark, const MUCBookmark& newBookmark);
 
-			const std::vector<MUCBookmark>& getBookmarks() const; 
+			const std::vector<MUCBookmark>& getBookmarks() const;
 
 		public:
 			boost::signal<void (const MUCBookmark&)> onBookmarkAdded;
-- 
cgit v0.10.2-6-g49f6