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. 26
      ui/propertiesdialog.cpp

@ -261,15 +261,12 @@ 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();
if ( ( index.row() < 0 ) || ( index.row() >= m_fonts.size() ) )
return QVariant();
if ( role != Qt::DisplayRole )
return QVariant(); return QVariant();
switch ( role )
{
case Qt::DisplayRole:
switch ( index.column() ) switch ( index.column() )
{ {
case 0: case 0:
@ -278,10 +275,19 @@ QVariant FontsListModel::data( const QModelIndex &index, int role ) const
return fontname.isEmpty() ? QString::fromLatin1( "-" ) : fontname; // TODO i18n return fontname.isEmpty() ? QString::fromLatin1( "-" ) : fontname; // TODO i18n
break; break;
} }
case 1: return descriptionForFontType( m_fonts.at( index.row() ).type() ); break; case 1:
case 2: return descriptionForEmbedType( m_fonts.at( index.row() ).embedType() ); break; return descriptionForFontType( m_fonts.at( index.row() ).type() );
case 3: return m_fonts.at( index.row() ).file(); break; break;
case 2:
return descriptionForEmbedType( m_fonts.at( index.row() ).embedType() );
break;
case 3:
return m_fonts.at( index.row() ).file();
break;
} }
break;
}
return QVariant(); return QVariant();
} }

Loading…
Cancel
Save