diff --git a/src/modules/tracking/TrackingPage.cpp b/src/modules/tracking/TrackingPage.cpp index 82e0d99c5..000ea2002 100644 --- a/src/modules/tracking/TrackingPage.cpp +++ b/src/modules/tracking/TrackingPage.cpp @@ -48,7 +48,20 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent ) group->addButton( ui->userRadio ); ui->noneRadio->setChecked( true ); - connect( config, &Config::generalPolicyChanged, this, &TrackingPage::setGeneralPolicy ); + // TODO: move to .ui file + ui->generalPolicyLabel->setTextInteractionFlags( Qt::TextBrowserInteraction ); + + connect( config, &Config::generalPolicyChanged, [ this ]( const QString& url ) { + this->ui->generalPolicyLabel->setVisible( !url.isEmpty() ); + } ); + connect( ui->generalPolicyLabel, &QLabel::linkActivated, [ config ] { + QString url( config->generalPolicy() ); + if ( !url.isEmpty() ) + { + QDesktopServices::openUrl( url ); + } + } ); + retranslate(); } @@ -76,22 +89,6 @@ TrackingPage::retranslate() } -void -TrackingPage::setGeneralPolicy( QString url ) -{ - if ( url.isEmpty() ) - { - ui->generalPolicyLabel->hide(); - } - else - { - ui->generalPolicyLabel->show(); - ui->generalPolicyLabel->setTextInteractionFlags( Qt::TextBrowserInteraction ); - ui->generalPolicyLabel->show(); - connect( ui->generalPolicyLabel, &QLabel::linkActivated, [ url ] { QDesktopServices::openUrl( url ); } ); - } -} - void TrackingPage::setTrackingLevel( TrackingType t ) { diff --git a/src/modules/tracking/TrackingPage.h b/src/modules/tracking/TrackingPage.h index ce8b87729..f63f7375c 100644 --- a/src/modules/tracking/TrackingPage.h +++ b/src/modules/tracking/TrackingPage.h @@ -41,9 +41,6 @@ public: void setTrackingLevel( TrackingType t ); public Q_SLOTS: - ///@brief Set URL for the global link - void setGeneralPolicy( QString url ); - void retranslate(); private: