reindent and add a switch for the role

svn path=/trunk/KDE/kdegraphics/okular/; revision=779693
remotes/origin/KDE/4.1
Pino Toscano 18 years ago
parent 3004d81bd8
commit d6b22c270d
  1. 44
      ui/propertiesdialog.cpp

@ -261,27 +261,33 @@ static QString descriptionForEmbedType( Okular::FontInfo::EmbedType type )
QVariant FontsListModel::data( const QModelIndex &index, int role ) const QVariant FontsListModel::data( const QModelIndex &index, int role ) const
{ {
if ( !index.isValid() ) if ( !index.isValid() || index.row() < 0 || index.row() >= m_fonts.count() )
return QVariant(); return QVariant();
if ( ( index.row() < 0 ) || ( index.row() >= m_fonts.size() ) )
return QVariant();
if ( role != Qt::DisplayRole )
return QVariant();
switch ( index.column() ) switch ( role )
{ {
case 0: case Qt::DisplayRole:
{ switch ( index.column() )
QString fontname = m_fonts.at( index.row() ).name(); {
return fontname.isEmpty() ? QString::fromLatin1( "-" ) : fontname; // TODO i18n case 0:
{
QString fontname = m_fonts.at( index.row() ).name();
return fontname.isEmpty() ? QString::fromLatin1( "-" ) : fontname; // TODO i18n
break;
}
case 1:
return descriptionForFontType( m_fonts.at( index.row() ).type() );
break;
case 2:
return descriptionForEmbedType( m_fonts.at( index.row() ).embedType() );
break;
case 3:
return m_fonts.at( index.row() ).file();
break;
}
break; break;
} }
case 1: return descriptionForFontType( m_fonts.at( index.row() ).type() ); break;
case 2: return descriptionForEmbedType( m_fonts.at( index.row() ).embedType() ); break;
case 3: return m_fonts.at( index.row() ).file(); break;
}
return QVariant(); return QVariant();
} }

Loading…
Cancel
Save