[keyboard] Refactor findLegacyKeymap into something testable
This commit is contained in:
parent
2e1dd8e7b1
commit
af3261b16f
@ -79,8 +79,8 @@ SetKeyboardLayoutJob::findConvertedKeymap( const QString& convertedKeymapPath )
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||
STATICTEST QString
|
||||
findLegacyKeymap( const QString& layout, const QString& model, const QString& variant )
|
||||
{
|
||||
cDebug() << "Looking for legacy keymap in QRC";
|
||||
|
||||
@ -109,20 +109,20 @@ SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||
// Determine how well matching this entry is
|
||||
// We assume here that we have one X11 layout. If the UI changes to
|
||||
// allow more than one layout, this should change too.
|
||||
if ( m_layout == mapping[ 1 ] )
|
||||
if ( layout == mapping[ 1 ] )
|
||||
// If we got an exact match, this is best
|
||||
{
|
||||
matching = 10;
|
||||
}
|
||||
// Look for an entry whose first layout matches ours
|
||||
else if ( mapping[ 1 ].startsWith( m_layout + ',' ) )
|
||||
else if ( mapping[ 1 ].startsWith( layout + ',' ) )
|
||||
{
|
||||
matching = 5;
|
||||
}
|
||||
|
||||
if ( matching > 0 )
|
||||
{
|
||||
if ( m_model.isEmpty() || m_model == mapping[ 2 ] )
|
||||
if ( model.isEmpty() || model == mapping[ 2 ] )
|
||||
{
|
||||
matching++;
|
||||
}
|
||||
@ -137,7 +137,7 @@ SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||
mappingVariant.remove( 1, 0 );
|
||||
}
|
||||
|
||||
if ( m_variant == mappingVariant )
|
||||
if ( variant == mappingVariant )
|
||||
{
|
||||
matching++;
|
||||
}
|
||||
@ -162,6 +162,12 @@ SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||
return name;
|
||||
}
|
||||
|
||||
QString
|
||||
SetKeyboardLayoutJob::findLegacyKeymap() const
|
||||
{
|
||||
return ::findLegacyKeymap( m_layout, m_model, m_variant );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SetKeyboardLayoutJob::writeVConsoleData( const QString& vconsoleConfPath, const QString& convertedKeymapPath ) const
|
||||
|
Loading…
Reference in New Issue
Block a user