From 13bf4716eff5396e948d57e8e72f5cb8ec752d43 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Tue, 17 Mar 2015 15:49:19 +0100
Subject: Move common code into a shared QtUIFactory::showTabs() method

Test-Information:

Still builds and behaves as expected.

Change-Id: Ic3553ae2e34acf58a912bc7e2643fcb7d66f824e

diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index 2fac36a..c7b64b3 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2014 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
@@ -44,9 +44,7 @@ QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider*
 XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() {
 	QtXMLConsoleWidget* widget = new QtXMLConsoleWidget();
 	tabs->addTab(widget);
-	if (!tabs->isVisible()) {
-		tabs->show();
-	}
+	showTabs();
 	widget->show();
 	return widget;
 }
@@ -54,10 +52,8 @@ XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() {
 HistoryWindow* QtUIFactory::createHistoryWindow(UIEventStream* uiEventStream) {
 	QtHistoryWindow* window = new QtHistoryWindow(settings, uiEventStream);
 	tabs->addTab(window);
-	if (!tabs->isVisible()) {
-		tabs->show();
-	}
 
+	showTabs();
 	connect(window, SIGNAL(fontResized(int)), this, SLOT(handleHistoryWindowFontResized(int)));
 
 	window->handleFontResized(historyFontSize_);
@@ -73,9 +69,7 @@ void QtUIFactory::handleHistoryWindowFontResized(int size) {
 FileTransferListWidget* QtUIFactory::createFileTransferListWidget() {
 	QtFileTransferListWidget* widget = new QtFileTransferListWidget();
 	tabs->addTab(widget);
-	if (!tabs->isVisible()) {
-		tabs->show();
-	}
+	showTabs();
 	widget->show();
 	return widget;
 }
@@ -179,4 +173,12 @@ AdHocCommandWindow* QtUIFactory::createAdHocCommandWindow(boost::shared_ptr<Outg
 	return new QtAdHocCommandWindow(command);
 }
 
+void QtUIFactory::showTabs() {
+	if (tabs) {
+		if (!tabs->isVisible()) {
+			tabs->show();
+		}
+	}
+}
+
 }
diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h
index 41e5121..05b4f6a 100644
--- a/Swift/QtUI/QtUIFactory.h
+++ b/Swift/QtUI/QtUIFactory.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2014 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
@@ -58,6 +58,9 @@ namespace Swift {
 			void handleHistoryWindowFontResized(int);
 
 		private:
+			void showTabs();
+
+		private:
 			SettingsProviderHierachy* settings;
 			QtSettingsProvider* qtOnlySettings;
 			QtChatTabs* tabs;
-- 
cgit v0.10.2-6-g49f6