Keyboard: special-case, pc+latin interpreted as us,
instead of as unknown which selects the first layout in the list.
This commit is contained in:
parent
7f08ea9d15
commit
e57579c92f
@ -37,6 +37,21 @@
|
||||
#include <QProcess>
|
||||
#include <QPushButton>
|
||||
|
||||
static QPersistentModelIndex
|
||||
findLayout( const KeyboardLayoutModel* klm, const QString& currentLayout )
|
||||
{
|
||||
QPersistentModelIndex currentLayoutItem;
|
||||
|
||||
for ( int i = 0; i < klm->rowCount(); ++i )
|
||||
{
|
||||
QModelIndex idx = klm->index( i );
|
||||
if ( idx.isValid() &&
|
||||
idx.data( KeyboardLayoutModel::KeyboardLayoutKeyRole ).toString() == currentLayout )
|
||||
currentLayoutItem = idx;
|
||||
}
|
||||
|
||||
return currentLayoutItem;
|
||||
}
|
||||
|
||||
KeyboardPage::KeyboardPage( QWidget* parent )
|
||||
: QWidget()
|
||||
@ -160,14 +175,13 @@ KeyboardPage::init()
|
||||
// Block signals
|
||||
ui->listLayout->blockSignals( true );
|
||||
|
||||
QPersistentModelIndex currentLayoutItem;
|
||||
|
||||
for ( int i = 0; i < klm->rowCount(); ++i )
|
||||
QPersistentModelIndex currentLayoutItem = findLayout( klm, currentLayout );
|
||||
if ( !currentLayoutItem.isValid() && (
|
||||
( currentLayout == "latin" )
|
||||
|| ( currentLayout == "pc" ) ) )
|
||||
{
|
||||
QModelIndex idx = klm->index( i );
|
||||
if ( idx.isValid() &&
|
||||
idx.data( KeyboardLayoutModel::KeyboardLayoutKeyRole ).toString() == currentLayout )
|
||||
currentLayoutItem = idx;
|
||||
currentLayout = "us";
|
||||
currentLayoutItem = findLayout( klm, currentLayout );
|
||||
}
|
||||
|
||||
// Set current layout and variant
|
||||
@ -341,4 +355,3 @@ KeyboardPage::onListVariantCurrentItemChanged( QListWidgetItem* current, QListWi
|
||||
m_selectedLayout = layout;
|
||||
m_selectedVariant = variant;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user