Added 'English' and 'Use System Default' options.

These complete the ability to select languages from the preferences panel.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-12-06 17:48:38 -02:00 committed by Dirk Hohndel
parent 7436178fe0
commit 9b7b477d7c
4 changed files with 101 additions and 61 deletions

View file

@ -1772,24 +1772,24 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
if ( !s.endsWith(".qm") ){
continue;
}
languages.push_back(s);
languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
}
}
QVariant LanguageModel::data(const QModelIndex& index, int role) const
{
QLocale loc;
QString currentString = languages.at(index.row());
if(!index.isValid())
return QVariant();
switch(role){
case Qt::DisplayRole:{
QString currentString = languages.at(index.row());
QLocale l( currentString.remove("subsurface_"));
return l.countryToString(l.country());
return currentString == "English" ? currentString : l.countryToString(l.country());
}break;
case Qt::UserRole:{
QString currentString = languages.at(index.row());
return currentString.remove("subsurface_");
return currentString == "English" ? "en_US" : currentString.remove("subsurface_");
}break;
}
return QVariant();