ui/uiengine/model/listmodel/src/glxalbummodel.cpp
changeset 54 0f0f3f26f787
parent 50 a0f57508af73
child 72 0a8e959402e5
equal deleted inserted replaced
52:a3a4c0de738e 54:0f0f3f26f787
    26 #include "glxicondefs.h" //Contains the icon names/Ids
    26 #include "glxicondefs.h" //Contains the icon names/Ids
    27 
    27 
    28 GlxAlbumModel::GlxAlbumModel(GlxModelParm & modelParm):mContextMode(GlxContextInvalid)
    28 GlxAlbumModel::GlxAlbumModel(GlxModelParm & modelParm):mContextMode(GlxContextInvalid)
    29 {
    29 {
    30     qDebug("GlxAlbumModel::GlxAlbumModel()");
    30     qDebug("GlxAlbumModel::GlxAlbumModel()");
    31     
    31     mSubState = -1;
    32     mMLWrapper = new GlxMLWrapper(modelParm.collection(),modelParm.depth(),modelParm.filterType());
    32     mMLWrapper = new GlxMLWrapper(modelParm.collection(),modelParm.depth(),modelParm.filterType());
    33     // mMLWrapper->setContextMode(GlxContextPtList);
    33     // mMLWrapper->setContextMode(GlxContextPtList);
    34     // mContextMode = GlxContextPtList;
    34     // mContextMode = GlxContextPtList;
    35     mMLWrapper->setContextMode(GlxContextSelectionList);
    35     mMLWrapper->setContextMode(GlxContextSelectionList);
    36     mContextMode = GlxContextSelectionList;
    36     mContextMode = GlxContextSelectionList;
    98     
    98     
    99     QStringList text;
    99     QStringList text;
   100     int rowIndex = index.row();
   100     int rowIndex = index.row();
   101     HbIcon* itemIcon = NULL;
   101     HbIcon* itemIcon = NULL;
   102     QModelIndex idx;
   102     QModelIndex idx;
       
   103     
       
   104     if ( role == GlxSubStateRole ){
       
   105         return mSubState;
       
   106     }
   103     
   107     
   104     if ( (!index.isValid()) || (rowIndex >= rowCount()) ) {
   108     if ( (!index.isValid()) || (rowIndex >= rowCount()) ) {
   105         return QVariant();
   109         return QVariant();
   106     }
   110     }
   107       
   111       
   163         if ( value.isValid() &&  value.canConvert <int> () ) {
   167         if ( value.isValid() &&  value.canConvert <int> () ) {
   164             setContextMode( (GlxContextMode) value.value <int> () );
   168             setContextMode( (GlxContextMode) value.value <int> () );
   165             return TRUE;
   169             return TRUE;
   166         }
   170         }
   167     }
   171     }
       
   172 
       
   173     if ( role == GlxSubStateRole && value.isValid() &&  value.canConvert <int> ()) {
       
   174         mSubState = value.value <int> () ;
       
   175         return TRUE;
       
   176     }
   168     
   177     
   169     if ( GlxFocusIndexRole == role ) {
   178     if ( GlxFocusIndexRole == role ) {
   170         if ( value.isValid() &&  value.canConvert <int> () ) {
   179         if ( value.isValid() &&  value.canConvert <int> () ) {
   171             setFocusIndex( index( value.value <int> (), 0) );
   180             setFocusIndex( index( value.value <int> (), 0) );
   172             return TRUE;
   181             return TRUE;
   264 
   273 
   265 void GlxAlbumModel::itemsAdded(int startIndex, int endIndex)
   274 void GlxAlbumModel::itemsAdded(int startIndex, int endIndex)
   266 {
   275 {
   267     qDebug("GlxAlbumModel::itemsAdded %d %d", startIndex, endIndex);
   276     qDebug("GlxAlbumModel::itemsAdded %d %d", startIndex, endIndex);
   268     beginInsertRows(QModelIndex(), startIndex, endIndex);
   277     beginInsertRows(QModelIndex(), startIndex, endIndex);
       
   278 	itemIconCache.clear();
   269     endInsertRows();	
   279     endInsertRows();	
   270 }
   280 }
   271 
   281 
   272 void GlxAlbumModel::itemsRemoved(int startIndex, int endIndex)
   282 void GlxAlbumModel::itemsRemoved(int startIndex, int endIndex)
   273 {
   283 {
   274 	qDebug("GlxAlbumModel::itemsRemoved %d %d", startIndex, endIndex);
   284 	qDebug("GlxAlbumModel::itemsRemoved %d %d", startIndex, endIndex);
   275 	beginRemoveRows(QModelIndex(), startIndex, endIndex);
   285 	beginRemoveRows(QModelIndex(), startIndex, endIndex);
       
   286 	itemIconCache.clear();
   276    	endRemoveRows();
   287    	endRemoveRows();
   277 	//emit rowsRemoved(index(startIndex,0), startIndex, endIndex );
   288 	//emit rowsRemoved(index(startIndex,0), startIndex, endIndex );
   278 	
   289 	
   279 }
   290 }
   280 
   291