ui/uiengine/model/listmodel/src/glxalbummodel.cpp
changeset 45 863223ea6961
parent 40 112f0ac2d1f0
child 50 a0f57508af73
child 55 fb37077c270f
equal deleted inserted replaced
44:aa2fa096cbfb 45:863223ea6961
    46 	qDebug("updateItem() connection status %d", err);
    46 	qDebug("updateItem() connection status %d", err);
    47 	err = connect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int)));
    47 	err = connect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int)));
    48 	qDebug("insertItems() connection status %d", err);
    48 	qDebug("insertItems() connection status %d", err);
    49 	err = connect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)));
    49 	err = connect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)));
    50 	qDebug("removeItems() connection status %d", err);
    50 	qDebug("removeItems() connection status %d", err);
       
    51     err = connect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelPopulated()));
       
    52 	qDebug("populated() connection status %d", err);
    51     err = connect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)));
    53     err = connect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)));
    52 	qDebug("iconAvailable() connection status %d", err);
    54 	qDebug("iconAvailable() connection status %d", err);
       
    55 	mTempVisibleWindowIndex = 0;
    53     itemIconCache.setMaxCost(50);
    56     itemIconCache.setMaxCost(50);
    54 }
    57 }
    55 
    58 
    56 GlxAlbumModel::~GlxAlbumModel()
    59 GlxAlbumModel::~GlxAlbumModel()
    57 {
    60 {
    60     mDefaultIcon = NULL;
    63     mDefaultIcon = NULL;
    61 	int err = disconnect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType)));
    64 	int err = disconnect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType)));
    62 	err = disconnect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int)));
    65 	err = disconnect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int)));
    63 	err = disconnect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)));
    66 	err = disconnect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)));
    64     err = disconnect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)));
    67     err = disconnect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)));
       
    68     err = disconnect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelPopulated()));
    65 	delete mMLWrapper;
    69 	delete mMLWrapper;
    66     mMLWrapper = NULL;
    70     mMLWrapper = NULL;
    67     itemIconCache.clear();
    71     itemIconCache.clear();
    68 }
    72 }
    69 
    73 
   147     case GlxListItemCount :
   151     case GlxListItemCount :
   148         return mMLWrapper->retrieveListItemCount( getFocusIndex().row() );
   152         return mMLWrapper->retrieveListItemCount( getFocusIndex().row() );
   149         
   153         
   150     case GlxSystemItemRole :
   154     case GlxSystemItemRole :
   151         return mMLWrapper->isSystemItem( getFocusIndex().row() );
   155         return mMLWrapper->isSystemItem( getFocusIndex().row() );
       
   156     case GlxVisualWindowIndex :
       
   157         return mMLWrapper->getVisibleWindowIndex();
   152            
   158            
   153     default :       
   159     default :       
   154         return QVariant();
   160         return QVariant();
   155     }
   161     }
   156 }
   162 }
   184         if ( value.isValid() &&  value.canConvert <int> () ) {
   190         if ( value.isValid() &&  value.canConvert <int> () ) {
   185             setSelectedIndex( index( value.value <int> (), 0) );
   191             setSelectedIndex( index( value.value <int> (), 0) );
   186             return TRUE;
   192             return TRUE;
   187         }
   193         }
   188     }
   194     }
       
   195     if ( GlxTempVisualWindowIndex == role ) {
       
   196         if ( value.isValid() && value.canConvert<int> () ) {
       
   197         mTempVisibleWindowIndex = value.value <int> (); 
       
   198             return TRUE;
       
   199         }
       
   200     }
   189     return FALSE;
   201     return FALSE;
   190 }
   202 }
   191 
   203 
   192 QModelIndex GlxAlbumModel::index(int row, int column, const QModelIndex &parent) const
   204 QModelIndex GlxAlbumModel::index(int row, int column, const QModelIndex &parent) const
   193 {
   205 {
   230 QModelIndex GlxAlbumModel::getFocusIndex() const
   242 QModelIndex GlxAlbumModel::getFocusIndex() const
   231 {
   243 {
   232     return index(mMLWrapper->getFocusIndex(), 0);
   244     return index(mMLWrapper->getFocusIndex(), 0);
   233 }
   245 }
   234 
   246 
       
   247 void GlxAlbumModel::modelPopulated()
       
   248 {
       
   249     if ( mTempVisibleWindowIndex!=-1) {
       
   250         mMLWrapper->setVisibleWindowIndex(mTempVisibleWindowIndex);
       
   251         mTempVisibleWindowIndex = -1;
       
   252         emit listPopulated();
       
   253     }
       
   254 }
   235 void GlxAlbumModel::itemUpdated1(int mlIndex,GlxTBContextType tbContextType  )
   255 void GlxAlbumModel::itemUpdated1(int mlIndex,GlxTBContextType tbContextType  )
   236 {
   256 {
   237 	Q_UNUSED(tbContextType);
   257 	Q_UNUSED(tbContextType);
   238 	qDebug("GlxAlbumModel::itemUpdated %d", mlIndex);
   258 	qDebug("GlxAlbumModel::itemUpdated %d", mlIndex);
   239 	
   259