[tracking] Enable policy websites

Each kind of tracking has an associated webpage / URL describing
the policy for that tracking. The Calamares User Guide has some
generic information. When the user clicks on the Help (?) button
in a tracking-option block, go to that URL.
This commit is contained in:
Adriaan de Groot 2017-11-08 07:46:33 -05:00
parent 7a7e2b16cb
commit a0e8f76348
6 changed files with 49 additions and 7 deletions

View File

@ -44,6 +44,7 @@ TrackingPage::TrackingPage(QWidget *parent)
ui->setupUi( this ); ui->setupUi( this );
CALAMARES_RETRANSLATE( CALAMARES_RETRANSLATE(
ui->retranslateUi( this );
ui->installExplanation->setText( tr( "Installation tracking helps %1 count how many people use it. If you enable install-tracking, at the end of the installation, information about your hardware will be sent <b>one time only</b> to our servers. To see what will be sent, click on the help-icon." ).arg( *StringEntry::ShortProductName ) ); ui->installExplanation->setText( tr( "Installation tracking helps %1 count how many people use it. If you enable install-tracking, at the end of the installation, information about your hardware will be sent <b>one time only</b> to our servers. To see what will be sent, click on the help-icon." ).arg( *StringEntry::ShortProductName ) );
ui->machineExplanation->setText( tr( "Machine tracking helps %1 count how many people use it on an ongoing basis. If you enable machine-tracking, the system will send limited information about your hardware and installed software <b>periodically</b> to our servers. For information about the kind of information being sent, click on the help icon." ).arg( *StringEntry::ShortProductName ) ); ui->machineExplanation->setText( tr( "Machine tracking helps %1 count how many people use it on an ongoing basis. If you enable machine-tracking, the system will send limited information about your hardware and installed software <b>periodically</b> to our servers. For information about the kind of information being sent, click on the help icon." ).arg( *StringEntry::ShortProductName ) );
ui->userExplanation->setText( tr( "User tracking helps %1 understand how people use the system and the applications. If you enable user-tracking, the system will send information about your use of the installed software <b>regularly</b> to our servers. For information about the kind of information being sent and the policies that apply, click on the help icon." ).arg( *StringEntry::ShortProductName ) ); ui->userExplanation->setText( tr( "User tracking helps %1 understand how people use the system and the applications. If you enable user-tracking, the system will send information about your use of the installed software <b>regularly</b> to our servers. For information about the kind of information being sent and the policies that apply, click on the help icon." ).arg( *StringEntry::ShortProductName ) );
@ -81,7 +82,7 @@ void TrackingPage::setTrackingOption(TrackingType t, bool setting, bool user)
check->setChecked( user ); check->setChecked( user );
} }
else else
cDebug() << " .. unknown option" << int(t); cDebug() << "WARNING: unknown tracking option" << int(t);
} }
bool TrackingPage::getTrackingOption(TrackingType t) bool TrackingPage::getTrackingOption(TrackingType t)
@ -103,3 +104,31 @@ bool TrackingPage::getTrackingOption(TrackingType t)
return (check != nullptr) && check->isChecked(); return (check != nullptr) && check->isChecked();
} }
void TrackingPage::setTrackingPolicy(TrackingType t, QString url)
{
QToolButton *button = nullptr;
switch( t )
{
case TrackingType::InstallTracking:
button = ui->installPolicyButton;
break;
case TrackingType::MachineTracking:
button = ui->machinePolicyButton;
break;
case TrackingType::UserTracking:
button = ui->userPolicyButton;
break;
}
if ( button != nullptr )
if ( url.isEmpty() )
button->hide();
else
{
connect( button, &QToolButton::clicked, [url]{ QDesktopServices::openUrl( url ); } );
cDebug() << "Tracking policy" << int(t) << "set to" << url;
}
else
cDebug() << "WARNING: unknown tracking option" << int(t);
}

View File

@ -46,6 +46,8 @@ public:
*/ */
bool getTrackingOption( TrackingType t ); bool getTrackingOption( TrackingType t );
void setTrackingPolicy( TrackingType t, QString url );
private: private:
Ui::TrackingPage* ui; Ui::TrackingPage* ui;
}; };

View File

@ -24,6 +24,7 @@
#include "TrackingViewStep.h" #include "TrackingViewStep.h"
#include "TrackingPage.h" #include "TrackingPage.h"
#include <QDesktopServices>
#include <QVariantMap> #include <QVariantMap>
CALAMARES_PLUGIN_FACTORY_DEFINITION( TrackingViewStepFactory, registerPlugin<TrackingViewStep>(); ) CALAMARES_PLUGIN_FACTORY_DEFINITION( TrackingViewStepFactory, registerPlugin<TrackingViewStep>(); )
@ -116,7 +117,7 @@ TrackingViewStep::jobs() const
} }
void TrackingViewStep::setTrackingOption(const QVariantMap& configurationMap, const QString& key, TrackingType t) QVariantMap TrackingViewStep::setTrackingOption(const QVariantMap& configurationMap, const QString& key, TrackingType t)
{ {
cDebug() << "Tracking configuration" << key; cDebug() << "Tracking configuration" << key;
@ -138,6 +139,9 @@ void TrackingViewStep::setTrackingOption(const QVariantMap& configurationMap, co
trackingConfiguration.userEnabled = userEnabled; trackingConfiguration.userEnabled = userEnabled;
m_widget->setTrackingOption(t, settingEnabled, userEnabled); m_widget->setTrackingOption(t, settingEnabled, userEnabled);
m_widget->setTrackingPolicy(t, CalamaresUtils::getString( config, "policy" ) );
return config;
} }

View File

@ -59,7 +59,7 @@ public:
void setConfigurationMap( const QVariantMap& configurationMap ) override; void setConfigurationMap( const QVariantMap& configurationMap ) override;
private: private:
void setTrackingOption( const QVariantMap& configurationMap, const QString& key, TrackingType t ); QVariantMap setTrackingOption( const QVariantMap& configurationMap, const QString& key, TrackingType t );
struct TrackingEnabled struct TrackingEnabled
{ {

View File

@ -62,7 +62,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton"> <widget class="QToolButton" name="installPolicyButton">
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -132,7 +132,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_2"> <widget class="QToolButton" name="machinePolicyButton">
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -199,7 +199,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_3"> <widget class="QToolButton" name="userPolicyButton">
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>

View File

@ -33,6 +33,12 @@
# checkbox is set to the value of *default*. Both keys default to # checkbox is set to the value of *default*. Both keys default to
# "off", disabling all tracking-configuration through Calamares. # "off", disabling all tracking-configuration through Calamares.
# #
# Each area has a key *policy*, which is a Url to be opened when
# the user clicks on the corresponding Help button for an explanation
# of the details of that particular kind of tracking. If no policy
# is set, the help button is hidden. The example policy links
# go to Calamares' generic user manual.
#
# Each area may have other configuration keys, depending on the # Each area may have other configuration keys, depending on the
# area and how it needs to be configured. # area and how it needs to be configured.
--- ---
@ -51,7 +57,8 @@
install: install:
enabled: false enabled: false
default: false default: false
url: policy: "https://github.com/calamares/calamares/wiki/Users-Guide#installation-tracking"
# url: "https://example.com/install.php"
# The machine area has one specific configuration key: # The machine area has one specific configuration key:
# style: This string specifies what kind of tracking configuration # style: This string specifies what kind of tracking configuration