From 99063cc6e9168bf88d6c245d1f8bac02bd898c3d Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sun, 24 Mar 2013 10:03:46 +0000
Subject: Don't hide the tabset if in single window mode

Change-Id: I91272f94258a49c9626cf3130bfbf2838a434e9b

diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index 6d12d80..a119043 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -22,7 +22,7 @@
 #include <qdebug.h>
 
 namespace Swift {
-QtChatTabs::QtChatTabs() : QWidget() {
+QtChatTabs::QtChatTabs(bool singleWindow) : QWidget(), singleWindow_(singleWindow) {
 #ifndef Q_OS_MAC
 	setWindowIcon(QIcon(":/logo-chat-16.png"));
 #else
@@ -46,7 +46,6 @@ QtChatTabs::QtChatTabs() : QWidget() {
 	layout->setContentsMargins(0, 3, 0, 0);
 	layout->addWidget(tabs_);
 	setLayout(layout);
-	//resize(400, 300);
 }
 
 void QtChatTabs::closeEvent(QCloseEvent* event) {
@@ -114,7 +113,13 @@ void QtChatTabs::handleTabClosing() {
 	if (widget && ((index = tabs_->indexOf(widget)) >= 0)) {
 		tabs_->removeTab(index);
 		if (tabs_->count() == 0) {
-			hide();
+			if (!singleWindow_) {
+				hide();
+			}
+			else {
+				setWindowTitle("");
+				onTitleChanged("");
+			}
 		}
 		else {
 			handleTabTitleUpdated(tabs_->currentWidget());
diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h
index 35f426b..f9cd685 100644
--- a/Swift/QtUI/QtChatTabs.h
+++ b/Swift/QtUI/QtChatTabs.h
@@ -17,7 +17,7 @@ namespace Swift {
 	class QtChatTabs : public QWidget {
 		Q_OBJECT
 		public:
-			QtChatTabs();
+			QtChatTabs(bool singleWindow);
 			void addTab(QtTabbable* tab);
 			void minimise();
 			QtTabbable* getCurrentTab();
@@ -45,6 +45,7 @@ namespace Swift {
 		private:
 			void checkForFirstShow();
 			QtTabWidget* tabs_;
+			bool singleWindow_;
 	};
 }
 
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 515c83f..b44ee2f 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -156,7 +156,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
 		Log::setLogLevel(Swift::Log::debug);
 	}
 
-	tabs_ = options.count("no-tabs") && !splitter_ ? NULL : new QtChatTabs();
+	tabs_ = options.count("no-tabs") && !splitter_ ? NULL : new QtChatTabs(splitter_ != NULL);
 	bool startMinimized = options.count("start-minimized") > 0;
 	applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME);
 	storagesFactory_ = new FileStoragesFactory(applicationPathProvider_->getDataDir());
-- 
cgit v0.10.2-6-g49f6