[tracking] Implement KUserFeedback configuration
- write config files to turn on KUserFeedback (for known areas) - TODO: get the right home directory to write in
This commit is contained in:
parent
bed884c971
commit
fab3ff2c41
@ -162,3 +162,72 @@ true
|
||||
tr( "Could not configure machine feedback correctly, Calamares error %1." ).arg( r ) );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TrackingUserJob::addJob( Calamares::JobList& list, UserTrackingConfig* config )
|
||||
{
|
||||
if ( config->isEnabled() )
|
||||
{
|
||||
const auto style = config->userTrackingStyle();
|
||||
if ( style == "kuserfeedback" )
|
||||
{
|
||||
list.append( Calamares::job_ptr( new TrackingKUserFeedbackJob() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "Unsupported user tracking style" << style;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString
|
||||
TrackingKUserFeedbackJob::prettyName() const
|
||||
{
|
||||
return tr( "KDE user feedback" );
|
||||
}
|
||||
|
||||
QString
|
||||
TrackingKUserFeedbackJob::prettyDescription() const
|
||||
{
|
||||
return prettyName();
|
||||
}
|
||||
|
||||
QString
|
||||
TrackingKUserFeedbackJob::prettyStatusMessage() const
|
||||
{
|
||||
return tr( "Configuring KDE user feedback." );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
TrackingKUserFeedbackJob::exec()
|
||||
{
|
||||
// This is the contents of a config file to turn on some kind
|
||||
// of KUserFeedback tracking; the level (16) is chosen for minimal
|
||||
// but not zero tracking.
|
||||
static const char config[] = R"x([Global]
|
||||
FeedbackLevel=16
|
||||
)x";
|
||||
|
||||
for ( const QString& area : QStringList { "PlasmaUserFeedback" } )
|
||||
{
|
||||
// TODO: get the configured user name
|
||||
QString path = QStringLiteral( "/home/%1/.config/%2" ).arg( QString(), area );
|
||||
cDebug() << "Configuring KUserFeedback" << path;
|
||||
|
||||
int r = CalamaresUtils::System::instance()->createTargetFile( path, config );
|
||||
if ( r > 0 )
|
||||
{
|
||||
return Calamares::JobResult::error(
|
||||
tr( "Error in KDE user feedback configuration." ),
|
||||
tr( "Could not configure KDE user feedback correctly, script error %1." ).arg( r ) );
|
||||
}
|
||||
else if ( r < 0 )
|
||||
{
|
||||
return Calamares::JobResult::error(
|
||||
tr( "Error in KDE user feedback configuration." ),
|
||||
tr( "Could not configure KDE user feedback correctly, Calamares error %1." ).arg( r ) );
|
||||
}
|
||||
}
|
||||
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
class InstallTrackingConfig;
|
||||
class MachineTrackingConfig;
|
||||
class UserTrackingConfig;
|
||||
|
||||
class QSemaphore;
|
||||
|
||||
@ -75,6 +76,12 @@ public:
|
||||
static void addJob( Calamares::JobList& list, MachineTrackingConfig* config );
|
||||
};
|
||||
|
||||
/** @brief Tracking machines, KDE neon style
|
||||
*
|
||||
* The machine has a machine-id, and this is sed(1)'ed into the
|
||||
* update-manager configuration, to report the machine-id back
|
||||
* to KDE neon servers.
|
||||
*/
|
||||
class TrackingMachineNeonJob : public TrackingMachineJob
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -85,5 +92,32 @@ public:
|
||||
Calamares::JobResult exec() override;
|
||||
};
|
||||
|
||||
/** @brief Base class for user-tracking jobs
|
||||
*
|
||||
* User-tracking configuration depends on the distro / style of user
|
||||
* tracking being implemented, so there are subclasses to switch on the
|
||||
* relevant kind of tracking. Users are tracked persistently (the user
|
||||
* can of course configure the tracking again once the system is restarted).
|
||||
*/
|
||||
class TrackingUserJob : public Calamares::Job
|
||||
{
|
||||
public:
|
||||
static void addJob( Calamares::JobList& list, UserTrackingConfig* config );
|
||||
};
|
||||
|
||||
/** @brief Turn on KUserFeedback in target system
|
||||
*
|
||||
* This writes suitable files for turning on KUserFeedback for the
|
||||
* normal user configured in Calamares. The feedback can be reconfigured
|
||||
* by the user through Plasma's user-feedback dialog.
|
||||
*/
|
||||
class TrackingKUserFeedbackJob : public Calamares::Job
|
||||
{
|
||||
public:
|
||||
QString prettyName() const override;
|
||||
QString prettyDescription() const override;
|
||||
QString prettyStatusMessage() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user