[tracking] Configure user-tracking areas

main
Adriaan de Groot 5 years ago
parent e834ce532c
commit 9b8d591b5d

@ -165,6 +165,8 @@ UserTrackingConfig::setConfigurationMap( const QVariantMap& configurationMap )
m_userTrackingStyle = CalamaresUtils::getString( configurationMap, "style" ); m_userTrackingStyle = CalamaresUtils::getString( configurationMap, "style" );
validate( m_userTrackingStyle, isValidUserTrackingStyle ); validate( m_userTrackingStyle, isValidUserTrackingStyle );
m_userTrackingAreas = CalamaresUtils::getStringList( configurationMap, "areas" );
} }

@ -149,9 +149,11 @@ public:
void setConfigurationMap( const QVariantMap& configurationMap ); void setConfigurationMap( const QVariantMap& configurationMap );
QString userTrackingStyle() { return m_userTrackingStyle; } QString userTrackingStyle() { return m_userTrackingStyle; }
QStringList userTrackingAreas() const { return m_userTrackingAreas; }
private: private:
QString m_userTrackingStyle; QString m_userTrackingStyle;
QStringList m_userTrackingAreas; // fine-grained areas
}; };
class Config : public QObject class Config : public QObject

@ -169,7 +169,8 @@ TrackingUserJob::addJob( Calamares::JobList& list, UserTrackingConfig* config )
const auto style = config->userTrackingStyle(); const auto style = config->userTrackingStyle();
if ( style == "kuserfeedback" ) if ( style == "kuserfeedback" )
{ {
list.append( Calamares::job_ptr( new TrackingKUserFeedbackJob() ) ); list.append(
Calamares::job_ptr( new TrackingKUserFeedbackJob( QString( "root" ), config->userTrackingAreas() ) ) );
} }
else else
{ {
@ -178,6 +179,12 @@ TrackingUserJob::addJob( Calamares::JobList& list, UserTrackingConfig* config )
} }
} }
TrackingKUserFeedbackJob::TrackingKUserFeedbackJob( const QString& username, const QStringList& areas )
: m_username( username )
, m_areas( areas )
{
}
QString QString
TrackingKUserFeedbackJob::prettyName() const TrackingKUserFeedbackJob::prettyName() const
{ {
@ -206,10 +213,9 @@ TrackingKUserFeedbackJob::exec()
FeedbackLevel=16 FeedbackLevel=16
)x"; )x";
for ( const QString& area : QStringList { "PlasmaUserFeedback" } ) for ( const QString& area : m_areas )
{ {
// TODO: get the configured user name QString path = QStringLiteral( "/home/%1/.config/%2" ).arg( m_username, area );
QString path = QStringLiteral( "/home/%1/.config/%2" ).arg( QString(), area );
cDebug() << "Configuring KUserFeedback" << path; cDebug() << "Configuring KUserFeedback" << path;
int r = CalamaresUtils::System::instance()->createTargetFile( path, config ); int r = CalamaresUtils::System::instance()->createTargetFile( path, config );

@ -114,10 +114,16 @@ public:
class TrackingKUserFeedbackJob : public Calamares::Job class TrackingKUserFeedbackJob : public Calamares::Job
{ {
public: public:
TrackingKUserFeedbackJob( const QString& username, const QStringList& areas );
QString prettyName() const override; QString prettyName() const override;
QString prettyDescription() const override; QString prettyDescription() const override;
QString prettyStatusMessage() const override; QString prettyStatusMessage() const override;
Calamares::JobResult exec() override; Calamares::JobResult exec() override;
private:
QString m_username;
QStringList m_areas;
}; };
#endif #endif

Loading…
Cancel
Save