From f48dc68662988b6eeb6544c2425c179b1f9b973d Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Tue, 11 Oct 2011 15:06:50 +0100
Subject: Provide click-through ToS for --eagle-mode


diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 3f65b14..7c0a2bd 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -8,7 +8,10 @@
 
 #include <string>
 #include <QSplitter>
+#include <QFile>
 #include <boost/bind.hpp>
+#include <QMessageBox>
+#include <QApplication>
 
 #include "QtLoginWindow.h"
 #include "QtChatTabs.h"
@@ -30,6 +33,7 @@
 #include "Swift/Controllers/BuildVersion.h"
 #include "SwifTools/AutoUpdater/AutoUpdater.h"
 #include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h"
+#include "Swiften/Base/Paths.h"
 
 #if defined(SWIFTEN_PLATFORM_WINDOWS)
 #include "WindowsNotifier.h"
@@ -171,6 +175,29 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
 		mainControllers_.push_back(mainController);
 	}
 
+	if (eagleMode) {
+		QString clickThroughPath(P2QSTRING((Paths::getExecutablePath() / "eagle-banner.txt").string()));
+		QFile clickThroughFile(clickThroughPath);
+		if (clickThroughFile.exists() && clickThroughFile.open(QIODevice::ReadOnly)) {
+			QString banner;
+			while (!clickThroughFile.atEnd()) {
+				QByteArray line = clickThroughFile.readLine();
+				banner += line + "\n";
+			}
+			if (!banner.isEmpty()) {
+				QMessageBox msgBox;
+				msgBox.setWindowTitle(tr("Confirm terms of use"));
+				msgBox.setText(tr("Do you agree to the terms of use?"));
+				msgBox.setInformativeText(banner);
+				msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+				msgBox.setDefaultButton(QMessageBox::No);
+				if (msgBox.exec() != QMessageBox::Yes) {
+					exit(0);
+				}
+			}
+		}
+	}
+
 
 	// PlatformAutoUpdaterFactory autoUpdaterFactory;
 	// if (autoUpdaterFactory.isSupported()) {
-- 
cgit v0.10.2-6-g49f6