Skip to content
Snippets Groups Projects
Commit 86d51b4a authored by Kevin Kofler's avatar Kevin Kofler
Browse files

keyboard: Pass settings directly, not through GlobalStorage.

Pass the settings from keyboard.conf directly to the
SetKeyboardLayoutJob rather than through GlobalStorage.
parent 2fec6e32
No related branches found
No related tags found
No related merge requests found
...@@ -190,7 +190,8 @@ KeyboardPage::prettyStatus() const ...@@ -190,7 +190,8 @@ KeyboardPage::prettyStatus() const
QList< Calamares::job_ptr > QList< Calamares::job_ptr >
KeyboardPage::createJobs() KeyboardPage::createJobs( const QString& xOrgConfFileName,
const QString& convertedKeymapPath )
{ {
QList< Calamares::job_ptr > list; QList< Calamares::job_ptr > list;
QString selectedModel = m_models.value( ui->comboBoxModel->currentText(), QString selectedModel = m_models.value( ui->comboBoxModel->currentText(),
...@@ -198,7 +199,9 @@ KeyboardPage::createJobs() ...@@ -198,7 +199,9 @@ KeyboardPage::createJobs()
Calamares::Job* j = new SetKeyboardLayoutJob( selectedModel, Calamares::Job* j = new SetKeyboardLayoutJob( selectedModel,
m_selectedLayout, m_selectedLayout,
m_selectedVariant ); m_selectedVariant,
xOrgConfFileName,
convertedKeymapPath );
list.append( Calamares::job_ptr( j ) ); list.append( Calamares::job_ptr( j ) );
return list; return list;
......
...@@ -48,7 +48,8 @@ public: ...@@ -48,7 +48,8 @@ public:
QString prettyStatus() const; QString prettyStatus() const;
QList< Calamares::job_ptr > createJobs(); QList< Calamares::job_ptr > createJobs( const QString& xOrgConfFileName,
const QString& convertedKeymapPath );
void finalize(); void finalize();
......
...@@ -108,7 +108,7 @@ void ...@@ -108,7 +108,7 @@ void
KeyboardViewStep::onLeave() KeyboardViewStep::onLeave()
{ {
m_widget->finalize(); m_widget->finalize();
m_jobs = m_widget->createJobs(); m_jobs = m_widget->createJobs( m_xOrgConfFileName, m_convertedKeymapPath );
m_prettyStatus = m_widget->prettyStatus(); m_prettyStatus = m_widget->prettyStatus();
} }
...@@ -123,23 +123,23 @@ KeyboardViewStep::setConfigurationMap( const QVariantMap& configurationMap ) ...@@ -123,23 +123,23 @@ KeyboardViewStep::setConfigurationMap( const QVariantMap& configurationMap )
configurationMap.value( "xOrgConfFileName" ).type() == QVariant::String && configurationMap.value( "xOrgConfFileName" ).type() == QVariant::String &&
!configurationMap.value( "xOrgConfFileName" ).toString().isEmpty() ) !configurationMap.value( "xOrgConfFileName" ).toString().isEmpty() )
{ {
gs->insert( "keyboardXOrgConfFileName", m_xOrgConfFileName = configurationMap.value( "xOrgConfFileName" )
configurationMap.value( "xOrgConfFileName" ) ); .toString();
} }
else else
{ {
gs->insert( "keyboardXOrgConfFileName", "00-keyboard.conf" ); m_xOrgConfFileName = "00-keyboard.conf";
} }
if ( configurationMap.contains( "convertedKeymapPath" ) && if ( configurationMap.contains( "convertedKeymapPath" ) &&
configurationMap.value( "convertedKeymapPath" ).type() == QVariant::String && configurationMap.value( "convertedKeymapPath" ).type() == QVariant::String &&
!configurationMap.value( "convertedKeymapPath" ).toString().isEmpty() ) !configurationMap.value( "convertedKeymapPath" ).toString().isEmpty() )
{ {
gs->insert( "keyboardConvertedKeymapPath", m_convertedKeymapPath = configurationMap.value( "convertedKeymapPath" )
configurationMap.value( "convertedKeymapPath" ) ); .toString();
} }
else else
{ {
gs->remove( "keyboardConvertedKeymapPath" ); m_convertedKeymapPath = QString();
} }
} }
...@@ -61,6 +61,9 @@ private: ...@@ -61,6 +61,9 @@ private:
bool m_nextEnabled; bool m_nextEnabled;
QString m_prettyStatus; QString m_prettyStatus;
QString m_xOrgConfFileName;
QString m_convertedKeymapPath;
QList< Calamares::job_ptr > m_jobs; QList< Calamares::job_ptr > m_jobs;
}; };
......
...@@ -37,11 +37,15 @@ ...@@ -37,11 +37,15 @@
SetKeyboardLayoutJob::SetKeyboardLayoutJob( const QString& model, SetKeyboardLayoutJob::SetKeyboardLayoutJob( const QString& model,
const QString& layout, const QString& layout,
const QString& variant ) const QString& variant,
const QString& xOrgConfFileName,
const QString& convertedKeymapPath )
: Calamares::Job() : Calamares::Job()
, m_model( model ) , m_model( model )
, m_layout( layout ) , m_layout( layout )
, m_variant( variant ) , m_variant( variant )
, m_xOrgConfFileName( xOrgConfFileName )
, m_convertedKeymapPath( convertedKeymapPath )
{ {
} }
...@@ -243,14 +247,12 @@ SetKeyboardLayoutJob::exec() ...@@ -243,14 +247,12 @@ SetKeyboardLayoutJob::exec()
// Get the path to the destination's /etc/X11/xorg.conf.d/00-keyboard.conf // Get the path to the destination's /etc/X11/xorg.conf.d/00-keyboard.conf
QString xorgConfDPath = destDir.absoluteFilePath( "etc/X11/xorg.conf.d" ); QString xorgConfDPath = destDir.absoluteFilePath( "etc/X11/xorg.conf.d" );
destDir.mkpath( xorgConfDPath ); destDir.mkpath( xorgConfDPath );
QString keyboardConfFile = gs->value( "keyboardXOrgConfFileName" ).toString();
QString keyboardConfPath = QDir( xorgConfDPath ) QString keyboardConfPath = QDir( xorgConfDPath )
.absoluteFilePath( keyboardConfFile ); .absoluteFilePath( m_xOrgConfFileName );
// Get the path to the destination's path to the converted key mappings // Get the path to the destination's path to the converted key mappings
QString convertedKeymapPath; QString convertedKeymapPath;
QString convertedKeymapPathSetting QString convertedKeymapPathSetting = m_convertedKeymapPath;
= gs->value( "keyboardConvertedKeymapPath" ).toString();
if ( !convertedKeymapPathSetting.isEmpty() ) if ( !convertedKeymapPathSetting.isEmpty() )
{ {
while ( convertedKeymapPathSetting.startsWith( '/' ) ) while ( convertedKeymapPathSetting.startsWith( '/' ) )
......
...@@ -29,7 +29,9 @@ class SetKeyboardLayoutJob : public Calamares::Job ...@@ -29,7 +29,9 @@ class SetKeyboardLayoutJob : public Calamares::Job
public: public:
SetKeyboardLayoutJob( const QString& model, SetKeyboardLayoutJob( const QString& model,
const QString& layout, const QString& layout,
const QString& variant ); const QString& variant,
const QString& xOrgConfFileName,
const QString& convertedKeymapPath );
QString prettyName() const override; QString prettyName() const override;
Calamares::JobResult exec() override; Calamares::JobResult exec() override;
...@@ -44,6 +46,8 @@ private: ...@@ -44,6 +46,8 @@ private:
QString m_model; QString m_model;
QString m_layout; QString m_layout;
QString m_variant; QString m_variant;
QString m_xOrgConfFileName;
QString m_convertedKeymapPath;
}; };
#endif /* SETKEYBOARDLAYOUTJOB_H */ #endif /* SETKEYBOARDLAYOUTJOB_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment