From c4302e5f4984b2c3a0b16628a021f2cd2e053116 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sun, 27 Mar 2011 16:09:56 -0400 Subject: [PATCH] Show legal indemnity warning, and link to the legal page on the web site. Only displays the first time you go online (unless you don't accept it, of course). --- src/libtomahawk/tomahawksettings.cpp | 11 +++++++++++ src/libtomahawk/tomahawksettings.h | 3 +++ src/sip/SipHandler.cpp | 15 +++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp index 34609d5ec..a4008388b 100644 --- a/src/libtomahawk/tomahawksettings.cpp +++ b/src/libtomahawk/tomahawksettings.cpp @@ -89,6 +89,17 @@ TomahawkSettings::hasScannerPath() const return contains( "scannerpath" ); } +void +TomahawkSettings::setAcceptedLegalWarning( bool accept ) +{ + setValue( "acceptedLegalWarning", accept ); +} + +bool +TomahawkSettings::acceptedLegalWarning() const +{ + return value( "acceptedLegalWarning", false ).toBool(); +} bool TomahawkSettings::httpEnabled() const diff --git a/src/libtomahawk/tomahawksettings.h b/src/libtomahawk/tomahawksettings.h index cb7fa9bef..f7f5e2922 100644 --- a/src/libtomahawk/tomahawksettings.h +++ b/src/libtomahawk/tomahawksettings.h @@ -45,6 +45,9 @@ public: void setScannerPath( const QString& path ); bool hasScannerPath() const; + bool acceptedLegalWarning() const; + void setAcceptedLegalWarning( bool accept ); + /// UI settings QByteArray mainWindowGeometry() const; void setMainWindowGeometry( const QByteArray& geom ); diff --git a/src/sip/SipHandler.cpp b/src/sip/SipHandler.cpp index 3b3327082..d09fe9d7e 100644 --- a/src/sip/SipHandler.cpp +++ b/src/sip/SipHandler.cpp @@ -28,6 +28,7 @@ #include "network/controlconnection.h" #include "sourcelist.h" #include "tomahawksettings.h" +#include "tomahawk/tomahawkapp.h" #include "config.h" @@ -168,6 +169,20 @@ SipHandler::pluginLoaded( const QString& name ) const void SipHandler::connectPlugins( bool startup, const QString &pluginName ) { +#ifndef TOMAHAWK_HEADLESS + if ( !TomahawkSettings::instance()->acceptedLegalWarning() ) + { + int result = QMessageBox::question( + TomahawkApp::instance()->mainWindow(), "Legal Warning", + "By pressing OK below, you agree that your use of Tomahawk will be in accordance with any applicable laws, including copyright and intellectual property laws, in effect in your country of residence, and indemify the Tomahawk developers and project from liability should you choose to break those laws.\n\nFor more information, please see http://gettomahawk.com/legal", + "I Do Not Agree", "I Agree" + ); + if ( result != 1 ) + return; + else + TomahawkSettings::instance()->setAcceptedLegalWarning( true ); + } +#endif foreach( SipPlugin* sip, m_plugins ) { if ( pluginName.isEmpty() || ( !pluginName.isEmpty() && sip->name() == pluginName ) )