[tracking] Configure user-tracking areas
This commit is contained in:
parent
e834ce532c
commit
9b8d591b5d
@ -165,6 +165,8 @@ UserTrackingConfig::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
|
||||
m_userTrackingStyle = CalamaresUtils::getString( configurationMap, "style" );
|
||||
validate( m_userTrackingStyle, isValidUserTrackingStyle );
|
||||
|
||||
m_userTrackingAreas = CalamaresUtils::getStringList( configurationMap, "areas" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,9 +149,11 @@ public:
|
||||
void setConfigurationMap( const QVariantMap& configurationMap );
|
||||
|
||||
QString userTrackingStyle() { return m_userTrackingStyle; }
|
||||
QStringList userTrackingAreas() const { return m_userTrackingAreas; }
|
||||
|
||||
private:
|
||||
QString m_userTrackingStyle;
|
||||
QStringList m_userTrackingAreas; // fine-grained areas
|
||||
};
|
||||
|
||||
class Config : public QObject
|
||||
|
@ -169,7 +169,8 @@ TrackingUserJob::addJob( Calamares::JobList& list, UserTrackingConfig* config )
|
||||
const auto style = config->userTrackingStyle();
|
||||
if ( style == "kuserfeedback" )
|
||||
{
|
||||
list.append( Calamares::job_ptr( new TrackingKUserFeedbackJob() ) );
|
||||
list.append(
|
||||
Calamares::job_ptr( new TrackingKUserFeedbackJob( QString( "root" ), config->userTrackingAreas() ) ) );
|
||||
}
|
||||
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
|
||||
TrackingKUserFeedbackJob::prettyName() const
|
||||
{
|
||||
@ -206,10 +213,9 @@ TrackingKUserFeedbackJob::exec()
|
||||
FeedbackLevel=16
|
||||
)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( QString(), area );
|
||||
QString path = QStringLiteral( "/home/%1/.config/%2" ).arg( m_username, area );
|
||||
cDebug() << "Configuring KUserFeedback" << path;
|
||||
|
||||
int r = CalamaresUtils::System::instance()->createTargetFile( path, config );
|
||||
|
@ -114,10 +114,16 @@ public:
|
||||
class TrackingKUserFeedbackJob : public Calamares::Job
|
||||
{
|
||||
public:
|
||||
TrackingKUserFeedbackJob( const QString& username, const QStringList& areas );
|
||||
|
||||
QString prettyName() const override;
|
||||
QString prettyDescription() const override;
|
||||
QString prettyStatusMessage() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
private:
|
||||
QString m_username;
|
||||
QStringList m_areas;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user