summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-10-11 14:06:50 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-10-11 14:06:50 (GMT)
commitf48dc68662988b6eeb6544c2425c179b1f9b973d (patch)
tree1f5ef1b4e41ff68bb77e1cba0f5de9ccb527e9cf /Swift/QtUI
parent09210ff317de63a8011130edceba3a508a6009d8 (diff)
downloadswift-contrib-f48dc68662988b6eeb6544c2425c179b1f9b973d.zip
swift-contrib-f48dc68662988b6eeb6544c2425c179b1f9b973d.tar.bz2
Provide click-through ToS for --eagle-mode
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtSwift.cpp27
1 files changed, 27 insertions, 0 deletions
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
@@ -2,19 +2,22 @@
* Copyright (c) 2010-2011 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include "QtSwift.h"
#include <string>
#include <QSplitter>
+#include <QFile>
#include <boost/bind.hpp>
+#include <QMessageBox>
+#include <QApplication>
#include "QtLoginWindow.h"
#include "QtChatTabs.h"
#include "QtSystemTray.h"
#include "QtSoundPlayer.h"
#include "QtSwiftUtil.h"
#include "QtUIFactory.h"
#include "QtChatWindowFactory.h"
#include <Swiften/Base/Log.h>
@@ -24,18 +27,19 @@
#include <string>
#include "Swiften/Base/Platform.h"
#include "Swiften/Elements/Presence.h"
#include "Swiften/Client/Client.h"
#include "Swift/Controllers/MainController.h"
#include "Swift/Controllers/ApplicationInfo.h"
#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"
#elif defined(HAVE_GROWL)
#include "SwifTools/Notifier/GrowlNotifier.h"
#elif defined(SWIFTEN_PLATFORM_LINUX)
#include "FreeDesktopNotifier.h"
#else
#include "SwifTools/Notifier/NullNotifier.h"
@@ -165,18 +169,41 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
dock_,
notifier_,
uriHandler_,
&idleDetector_,
options.count("latency-debug") > 0,
eagleMode);
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()) {
// autoUpdater_ = autoUpdaterFactory.createAutoUpdater(SWIFT_APPCAST_URL);
// autoUpdater_->checkForUpdates();
// }
}
QtSwift::~QtSwift() {