videocollection/videocollectionview/src/videolistselectiondialog.cpp
changeset 35 3738fe97f027
parent 34 bbb98528c666
child 36 8aed59de29f9
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
    71     {
    71     {
    72         // create list widget
    72         // create list widget
    73         mListWidget = new VideoListWidget(mUiLoader);
    73         mListWidget = new VideoListWidget(mUiLoader);
    74         if (mListWidget)
    74         if (mListWidget)
    75         {
    75         {
    76             mListWidget->initialize(*mModel);
    76             if(mListWidget->initialize(*mModel) < 0)
       
    77             {
       
    78                 delete mListWidget;
       
    79                 mListWidget = 0;
       
    80             }
    77         }
    81         }
    78     }
    82     }
    79 }
    83 }
    80 
    84 
    81 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
   119         {
   123         {
   120             mSelectedVideos.insert(activeItem);
   124             mSelectedVideos.insert(activeItem);
   121         }
   125         }
   122     }
   126     }
   123     // set (or reset) generic id filter
   127     // set (or reset) generic id filter
   124     mModel->setGenericIdFilter(activeItem, (mTypeOfSelection == EDeleteVideos));    
   128     bool filterValue = true;
       
   129     if(mTypeOfSelection == EAddToCollection || mTypeOfSelection == ESelectCollection)
       
   130     {
       
   131         filterValue = false;
       
   132     }
       
   133     mModel->setGenericIdFilter(activeItem, filterValue);    
   125     activateSelection();
   134     activateSelection();
   126 }
   135 }
   127 
   136 
   128 // ---------------------------------------------------------------------------
   137 // ---------------------------------------------------------------------------
   129 // initDialog
   138 // initDialog
   136         mModel = VideoCollectionWrapper::instance().getModel(VideoCollectionWrapper::EGeneric);
   145         mModel = VideoCollectionWrapper::instance().getModel(VideoCollectionWrapper::EGeneric);
   137         if (!mModel)
   146         if (!mModel)
   138         {
   147         {
   139            return false;
   148            return false;
   140         }
   149         }
   141     }    
   150     }  
   142     if(!mListWidget)
       
   143     {
       
   144         mListWidget = new VideoListWidget(mUiLoader);
       
   145         mListWidget->initialize(*mModel);
       
   146     }
       
   147     if (!mListContainer)
   151     if (!mListContainer)
   148     {
   152     {
   149         mListContainer =
   153         mListContainer =
   150                 mUiLoader->findWidget<HbStackedWidget>(DOCML_NAME_LIST_CONTAINER);
   154                    mUiLoader->findWidget<HbStackedWidget>(DOCML_NAME_LIST_CONTAINER);
   151         if(mListContainer && mListWidget)
   155     
       
   156         if(!mListWidget)
       
   157         {
       
   158             mListWidget = new VideoListWidget(mUiLoader);
       
   159             if(mListWidget->initialize(*mModel) < 0)
       
   160             {
       
   161                 delete mListWidget;
       
   162                 mListWidget = 0;
       
   163                 mListContainer = 0;
       
   164                 return false;
       
   165             }
       
   166         }
       
   167         if(mListContainer)
   152         {
   168         {
   153             mListContainer->addWidget(mListWidget);
   169             mListContainer->addWidget(mListWidget);
   154         }
   170         }
   155     }
   171     }
       
   172 
   156     if(!mHeading)
   173     if(!mHeading)
   157     {
   174     {
   158         mHeading = mUiLoader->findWidget<HbLabel>(DOCML_NAME_DLG_HEADINGLBL);
   175         mHeading = mUiLoader->findWidget<HbLabel>(DOCML_NAME_DLG_HEADINGLBL);
   159     }
   176     }
   160     if(!mCheckboxContainer)
   177     if(!mCheckboxContainer)
   171     {
   188     {
   172         mCheckBox = mUiLoader->findWidget<HbCheckBox >(DOCML_NAME_MARKALL);
   189         mCheckBox = mUiLoader->findWidget<HbCheckBox >(DOCML_NAME_MARKALL);
   173     }
   190     }
   174     if(!primaryAction())
   191     if(!primaryAction())
   175     {
   192     {
   176         setPrimaryAction(new HbAction(tr("OK"), this)); //TODO: localisation
   193         setPrimaryAction(new HbAction(hbTrId("txt_common_button_ok"), this));
   177     }
   194     }
   178     if(!secondaryAction())
   195     if(!secondaryAction())
   179     {
   196     {
   180         setSecondaryAction(new HbAction(tr("Cancel"), this)); //TODO: localisation
   197         setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel"), this));
   181     }
   198     }
   182     if(!mListWidget || !mListContainer || !mHeading || !mCheckBox || !primaryAction() || !secondaryAction())
   199     if(!mListWidget || !mListContainer || !mHeading || !mCheckBox || !primaryAction() || !secondaryAction())
   183     {
   200     {
   184         return false;
   201         return false;
   185     }
   202     }
   190 // activateSelection
   207 // activateSelection
   191 // ---------------------------------------------------------------------------
   208 // ---------------------------------------------------------------------------
   192 //
   209 //
   193 void VideoListSelectionDialog::activateSelection()
   210 void VideoListSelectionDialog::activateSelection()
   194 {
   211 {
   195     // "add to collection" and "select collection" -selections needs 
   212     // "add to collection" and "remove from collection -selections needs 
   196     // additional functionality for primary key
   213     // additional functionality for primary key
   197     if(mTypeOfSelection == EAddToCollection ||
   214     if(mTypeOfSelection == EAddToCollection ||
   198        mTypeOfSelection == ESelectCollection)
   215        mTypeOfSelection == ERemoveFromCollection)
   199     {
   216     {
   200         primaryAction()->disconnect(SIGNAL(triggered()));
   217         primaryAction()->disconnect(SIGNAL(triggered()));
   201         connect(primaryAction(), SIGNAL(triggered()), this, SLOT(primaryActionTriggeredSlot()));
   218         connect(primaryAction(), SIGNAL(triggered()), this, SLOT(primaryActionTriggeredSlot()));
   202     }
   219     }
   203     
   220     QString headingTxt("");
   204     if(mTypeOfSelection == EDeleteVideos || mTypeOfSelection == EAddToCollection) 
   221     QString primaryTxt("");
   205     {
   222     // create texts
   206         mSelection.clear();
   223     switch(mTypeOfSelection)
   207         mListWidget->setSelectionMode(HbAbstractItemView::MultiSelection);   
   224     {
       
   225     case EDeleteVideos:
       
   226         primaryTxt = hbTrId("txt_common_button_delete");
       
   227     break;
       
   228     case EAddToCollection:
       
   229         primaryTxt = hbTrId("txt_common_button_add");
       
   230     break;
       
   231     case ERemoveFromCollection:
       
   232         primaryTxt = hbTrId("txt_common_button_remove");
       
   233     break;
       
   234     case ESelectCollection:
       
   235         primaryTxt = hbTrId("txt_videos_button_new");
       
   236     break;
       
   237     default:
       
   238     break;
       
   239     }
       
   240 
       
   241     HbAction *primary = primaryAction();
       
   242     primary->setText(primaryTxt);
       
   243 
       
   244     if(mTypeOfSelection == ESelectCollection)
       
   245     {
       
   246         headingTxt = hbTrId("txt_videos_title_select_collection");
       
   247         mCheckboxContainer->setVisible(false);
       
   248         mListWidget->setSelectionMode(-1);   
       
   249         mListWidget->activate(VideoCollectionCommon::ELevelCategory);
       
   250         // need to set primaryaction disabled here in order for it 
       
   251         // get correctly updated at modelReady(), where it will be enabled
       
   252         // if state would be same, no update will happen
       
   253         primary->setDisabled(true);
       
   254     }
       
   255     else
       
   256     {
       
   257         headingTxt = hbTrId("txt_videos_title_select_videos");
       
   258         mListWidget->setSelectionMode(HbAbstractItemView::MultiSelection);
   208         mListWidget->activate(VideoCollectionCommon::ELevelVideos);
   259         mListWidget->activate(VideoCollectionCommon::ELevelVideos);
   209         mCheckboxContainer->setVisible(true);
   260         mCheckboxContainer->setVisible(true);
   210         mItemCount->setPlainText(tr("0/%1").arg(mModel->rowCount())); 
   261         mItemCount->setPlainText(tr("0/%1").arg(mModel->rowCount())); 
   211         mCheckBox->setChecked(false);        
   262         mCheckBox->setChecked(false);
   212         QString txt("");
   263         // need to set primaryaction enabled here in order for it 
   213         mTypeOfSelection == EDeleteVideos ? txt = tr("Delete items") : txt = tr("Add to collection"); // localisation missing
   264         // get correctly updated at modelReady(), where it will be disabled  
   214         mHeading->setPlainText(txt);
   265         // if state would be same, no update will happen
   215         mTypeOfSelection == EDeleteVideos ? txt = hbTrId("txt_common_menu_delete") : txt = tr("Add"); // localisation missing
   266         primary->setDisabled(false);
   216         primaryAction()->setText(txt);
   267     }
   217         primaryAction()->setDisabled(true);
   268     mHeading->setPlainText(headingTxt);         
   218     }
       
   219     else
       
   220     {
       
   221         mListWidget->setSelectionMode(-1);   
       
   222         mListWidget->activate(VideoCollectionCommon::ELevelCategory);
       
   223         mCheckboxContainer->setVisible(false);
       
   224         mHeading->setPlainText(tr("Select collection")); // localisation missing
       
   225         primaryAction()->setText(tr("New")); // localisation missing    
       
   226         primaryAction()->setDisabled(false);
       
   227     }    
       
   228     // sort to make sure dialog has correctly filtered content
   269     // sort to make sure dialog has correctly filtered content
   229     // at the same order as in view
   270     // at the same order as in view
   230     VideoCollectionViewUtils::sortModel(mModel, false);        
   271     VideoCollectionViewUtils::sortModel(mModel, false);        
   231 }
   272 }
   232 
   273 
   233 // ---------------------------------------------------------------------------
   274 // ---------------------------------------------------------------------------
   234 // exec
   275 // exec
   235 // ---------------------------------------------------------------------------
   276 // ---------------------------------------------------------------------------
   236 //
   277 //
   237 HbAction* VideoListSelectionDialog::exec()
   278 void VideoListSelectionDialog::exec()
   238 {
   279 {
   239     // clear checkbox
   280     // clear checkbox
   240     mCheckBox->setChecked(false);
   281     mCheckBox->setChecked(false);
   241     
   282     
   242     mListWidget->clearSelection(); 
   283     mListWidget->clearSelection(); 
   243     
   284     
   244     // scroll list back to top
   285     // scroll list back to top
   245     mListWidget->scrollTo(mModel->index(0, 0));
   286     mListWidget->scrollTo(mModel->index(0, 0));
   246 
   287 
   247     connectSignals();
   288     if(mModel->rowCount())
   248     
   289     {
   249     // Launch popup syncronously
   290         connectSignals();
   250     bool accepted = false;
   291     
   251     HbDialog::exec() == primaryAction() ? accepted = true : accepted = false;
   292         // show dialog
   252     
   293         HbDialog::open();
       
   294     }
       
   295     else
       
   296     {
       
   297         // no items, finish right away
       
   298         finishedSlot(primaryAction());
       
   299     }
       
   300 }
       
   301 
       
   302 // ---------------------------------------------------------------------------
       
   303 // finishedSlot
       
   304 // ---------------------------------------------------------------------------
       
   305 //
       
   306 void VideoListSelectionDialog::finishedSlot(HbAction *action)
       
   307 {
   253     disconnectSignals();
   308     disconnectSignals();
   254    
   309     if(action == secondaryAction())
   255     if(accepted)
   310     {
   256     {
   311         return;
   257         // user is adding videos into selected collection 
   312     }
   258         // or selecting collection where to add videos
   313     QString albumName("");
   259         if(mTypeOfSelection == EAddToCollection ||
   314     if( mTypeOfSelection == ESelectCollection )
   260            mTypeOfSelection == ESelectCollection)
   315     {
   261         {            
   316         if( mSelectedAlbumId == TMPXItemId::InvalidId())
   262             if(mSelectedAlbumId != TMPXItemId::InvalidId() && mSelectedVideos.count())
   317         {
       
   318             albumName = queryNewAlbumSelected();
       
   319             if(mSelectedAlbumId == TMPXItemId::InvalidId())
   263             {
   320             {
   264                 if(mModel->addItemsInAlbum(mSelectedAlbumId, mSelectedVideos.toList()) == 0)
   321                 // user cancelled new album creation
       
   322                 return;
       
   323             }           
       
   324        }
       
   325        mTypeOfSelection = EAddToCollection;
       
   326 
       
   327     }
       
   328 
       
   329     if(mTypeOfSelection == EAddToCollection)
       
   330     {  
       
   331         if(mSelectedAlbumId != TMPXItemId::InvalidId() && mSelectedVideos.count())
       
   332         {
       
   333             if(mModel->addItemsInAlbum(mSelectedAlbumId, mSelectedVideos.toList()) == 0)
       
   334             {
       
   335                 if(!albumName.length())
   265                 {
   336                 {
   266                     QVariant data = getSelectedName();
   337                     albumName = getSelectedName();
   267                     VideoCollectionViewUtils::instance().showStatusMsgSlot(
       
   268                             VideoCollectionCommon::statusVideosAddedToCollection,
       
   269                             data);
       
   270                 }
   338                 }
       
   339                 QVariant data = albumName;
       
   340                 VideoCollectionViewUtils::instance().showStatusMsgSlot(
       
   341                         VideoCollectionCommon::statusVideosAddedToCollection,
       
   342                         data);
   271             }
   343             }
   272         }
   344         }
   273         // user is deleting videos
   345     }
   274         else if(mTypeOfSelection == EDeleteVideos)
   346     else if(mTypeOfSelection == ERemoveFromCollection)
   275         {
   347     {
   276             QVariant data = mSelection.indexes().count();
   348         if(mSelectedAlbumId != TMPXItemId::InvalidId() && mSelectedVideos.count())
   277             VideoCollectionViewUtils::instance().showStatusMsgSlot(
   349         {
   278                                                    VideoCollectionCommon::statusDeleteInProgress,
   350             if(mModel->removeItemsFromAlbum(mSelectedAlbumId, mSelectedVideos.toList()) == 0)
   279                                                    data);
   351             {
   280             // delete items            
   352                 QVariant data = getSelectedName();
   281             mModel->deleteItems(mSelection.indexes());
   353                 VideoCollectionViewUtils::instance().showStatusMsgSlot(
   282 
   354                         VideoCollectionCommon::statusVideosRemovedFromCollection,
   283         }
   355                         data);
   284         return primaryAction();
   356             }
       
   357         }
       
   358     }
       
   359     // user is deleting videos
       
   360     else if(mTypeOfSelection == EDeleteVideos)
       
   361     {
       
   362         QVariant data = mSelection.indexes().count();
       
   363         VideoCollectionViewUtils::instance().showStatusMsgSlot(
       
   364                 VideoCollectionCommon::statusDeleteInProgress,
       
   365                 data);
       
   366         // delete items            
       
   367         mModel->deleteItems(mSelection.indexes());
   285     } 
   368     } 
   286     return secondaryAction(); 
       
   287 }
   369 }
   288 
   370 
   289 // ---------------------------------------------------------------------------
   371 // ---------------------------------------------------------------------------
   290 // markAllStateChanged
   372 // markAllStateChanged
   291 // ---------------------------------------------------------------------------
   373 // ---------------------------------------------------------------------------
   310 // selectionChangedSlot
   392 // selectionChangedSlot
   311 // ---------------------------------------------------------------------------
   393 // ---------------------------------------------------------------------------
   312 //
   394 //
   313 void VideoListSelectionDialog::selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected)
   395 void VideoListSelectionDialog::selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected)
   314 {  
   396 {  
   315     
   397     if(!primaryAction() || mTypeOfSelection == ESelectCollection)
   316     if(!primaryAction())
       
   317     {
   398     {
   318         return;
   399         return;
   319     }
   400     }
   320    
   401    
   321     if(selected.indexes().count() > 0)
   402     if(selected.indexes().count() > 0)
   360 // modelReadySlot
   441 // modelReadySlot
   361 // ---------------------------------------------------------------------------
   442 // ---------------------------------------------------------------------------
   362 //
   443 //
   363 void VideoListSelectionDialog::modelReadySlot()
   444 void VideoListSelectionDialog::modelReadySlot()
   364 {
   445 {
   365     if(!mModel)
   446    
       
   447     if(mTypeOfSelection == ESelectCollection)
       
   448     {
       
   449         primaryAction()->setDisabled(false);
       
   450         if(!mModel->rowCount())
       
   451         {
       
   452             // in case there are no user defined albums, 
       
   453             // start input dialog right away by accepting dialog
       
   454             primaryAction()->trigger();
       
   455             return;
       
   456         }
       
   457     }
       
   458     if(mTypeOfSelection != ESelectCollection)
       
   459     {
       
   460         primaryAction()->setDisabled(true);
       
   461     }
       
   462     updateCounterSlot();
       
   463 }
       
   464 
       
   465 // ---------------------------------------------------------------------------
       
   466 // updateCounterSlot
       
   467 // ---------------------------------------------------------------------------
       
   468 //
       
   469 void VideoListSelectionDialog::updateCounterSlot()
       
   470 {
       
   471     if(!mItemCount)
   366     {
   472     {
   367         return;
   473         return;
   368     }
   474     }
   369     
   475 
   370     if(mTypeOfSelection == ESelectCollection && ! mModel->rowCount())
   476     int rowCount = mModel->rowCount();       
   371     {
       
   372         // in case there are no albums, start input dialog right away
       
   373         mSelectedAlbumId = queryNewAlbum();
       
   374         if(mSelectedAlbumId != TMPXItemId::InvalidId())
       
   375         {
       
   376             primaryAction()->trigger();
       
   377         }
       
   378         else
       
   379         {
       
   380             secondaryAction()->trigger();
       
   381         }
       
   382         return;
       
   383     }
       
   384     updateCounterSlot();
       
   385 }
       
   386 
       
   387 // ---------------------------------------------------------------------------
       
   388 // updateCounterSlot
       
   389 // ---------------------------------------------------------------------------
       
   390 //
       
   391 void VideoListSelectionDialog::updateCounterSlot()
       
   392 {
       
   393     if(!mItemCount || !mModel)
       
   394     {
       
   395         return;
       
   396     }
       
   397     // orbit does not update HbLabel read from docml in case it isn't cleared first
       
   398     int rowCount = mModel->rowCount();
       
   399     
       
   400    
       
   401     int selectionCount = mSelection.indexes().count();
   477     int selectionCount = mSelection.indexes().count();
   402     mItemCount->setPlainText(tr("%1/%2").arg(selectionCount).arg(rowCount));
   478     mItemCount->setPlainText(tr("%1/%2").arg(selectionCount).arg(rowCount));  
   403     
       
   404     mForcedCheck = true;
   479     mForcedCheck = true;
   405     if(selectionCount == rowCount && rowCount > 0)
   480     if(selectionCount == rowCount && rowCount > 0)
   406     {     
   481     {     
   407         mCheckBox->setChecked(true);
   482         mCheckBox->setChecked(true);
   408     }
   483     }
   421 void VideoListSelectionDialog::primaryActionTriggeredSlot()
   496 void VideoListSelectionDialog::primaryActionTriggeredSlot()
   422 {
   497 {
   423     // reconnect primary action
   498     // reconnect primary action
   424     primaryAction()->disconnect(SIGNAL(triggered()));
   499     primaryAction()->disconnect(SIGNAL(triggered()));
   425     connect(primaryAction(), SIGNAL(triggered()), this, SLOT(close()));
   500     connect(primaryAction(), SIGNAL(triggered()), this, SLOT(close()));
   426     
   501         
   427     if(mTypeOfSelection == EDeleteVideos) 
       
   428     {       
       
   429         primaryAction()->trigger();
       
   430 		return;
       
   431     }
       
   432     
       
   433     // update video items selection here before content changes.
   502     // update video items selection here before content changes.
   434     int count = mSelection.indexes().count();
   503     int count = mSelection.indexes().count();
   435     TMPXItemId id = TMPXItemId::InvalidId();
   504     TMPXItemId id = TMPXItemId::InvalidId();
   436     for(int i = 0; i < count; ++i)
   505     for(int i = 0; i < count; ++i)
   437     {
   506     {
   444     
   513     
   445     if(mSelectedAlbumId != TMPXItemId::InvalidId())
   514     if(mSelectedAlbumId != TMPXItemId::InvalidId())
   446     {
   515     {
   447         primaryAction()->trigger();
   516         primaryAction()->trigger();
   448         return;
   517         return;
   449     }
       
   450     
       
   451     
       
   452     else if(mTypeOfSelection == ESelectCollection)
       
   453     {
       
   454         // there's no selected collection and primary action pressed
       
   455         // -> user is willing to create a new collection
       
   456         mSelectedAlbumId = queryNewAlbum();
       
   457         if(mSelectedAlbumId != TMPXItemId::InvalidId())
       
   458         {       
       
   459             primaryAction()->trigger();
       
   460         }
       
   461         else
       
   462         {
       
   463             // cancelled
       
   464             secondaryAction()->trigger();
       
   465         }     
       
   466     }
   518     }
   467     else if(mTypeOfSelection == EAddToCollection)
   519     else if(mTypeOfSelection == EAddToCollection)
   468     {
   520     {
   469         // videos for collection selected, but collection 
   521         // videos for collection selected, but collection 
   470         // not yet selected, activate selection for it
   522         // not yet selected, activate selection for it
   476 // ---------------------------------------------------------------------------
   528 // ---------------------------------------------------------------------------
   477 // connectSignals
   529 // connectSignals
   478 // ---------------------------------------------------------------------------
   530 // ---------------------------------------------------------------------------
   479 //
   531 //
   480 void VideoListSelectionDialog::connectSignals()
   532 void VideoListSelectionDialog::connectSignals()
   481 {
   533 {   
       
   534     // dialog finished
       
   535     connect(this, SIGNAL(finished(HbAction*)), this, SLOT(finishedSlot(HbAction*)));
       
   536     
   482     // selection changes
   537     // selection changes
   483     connect(mListWidget, SIGNAL(activated(const QModelIndex&)),
   538     connect(mListWidget, SIGNAL(activated(const QModelIndex&)),
   484             this, SLOT(singleItemSelectedSlot(const QModelIndex&)));
   539             this, SLOT(singleItemSelectedSlot(const QModelIndex&)));
   485     
   540     
   486     connect(mListWidget->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
   541     connect(mListWidget->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
   487             this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
   542             this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
   488         
   543         
   489     // model changes signals
   544     // model changes signals
   490     connect(mModel, SIGNAL(modelReady()), this, SLOT(modelReadySlot()));    
   545     connect(mModel->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelReadySlot()));    
   491     connect(mModel, SIGNAL(modelChanged()), this, SLOT(updateCounterSlot()));    
   546     connect(mModel->sourceModel(), SIGNAL(modelChanged()), this, SLOT(updateCounterSlot()));    
   492     
   547     
   493     // mark all state changes
   548     // mark all state changes
   494     connect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
   549     connect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
   495 }
   550 }
   496  
   551  
   497 // ---------------------------------------------------------------------------
   552 // ---------------------------------------------------------------------------
   498 // disconnectSignals
   553 // disconnectSignals
   499 // ---------------------------------------------------------------------------
   554 // ---------------------------------------------------------------------------
   500 //
   555 //
   501 void VideoListSelectionDialog::disconnectSignals()
   556 void VideoListSelectionDialog::disconnectSignals()
   502 {    
   557 {   
       
   558     disconnect(this, SIGNAL(finished(HbAction*)), this, SLOT(finishedSlot(HbAction*)));
       
   559     
   503     disconnect(mListWidget, SIGNAL(activated(const QModelIndex&)),
   560     disconnect(mListWidget, SIGNAL(activated(const QModelIndex&)),
   504                 this, SLOT(singleItemSelectedSlot(const QModelIndex&)));
   561                 this, SLOT(singleItemSelectedSlot(const QModelIndex&)));
   505     
   562     
   506     disconnect(mListWidget->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
   563     disconnect(mListWidget->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
   507                             this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
   564                             this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
   508             
   565             
   509     // model changes signals
   566     // model changes signals
   510     disconnect(mModel, SIGNAL(modelReady()), this, SLOT(modelReadySlot()));    
   567     disconnect(mModel->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelReadySlot()));    
   511     disconnect(mModel, SIGNAL(modelChanged()), this, SLOT(updateCounterSlot()));   
   568     disconnect(mModel->sourceModel(), SIGNAL(modelChanged()), this, SLOT(updateCounterSlot()));   
   512     
   569     
   513     // mark all state changes
   570     // mark all state changes
   514     disconnect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));   
   571     disconnect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));   
   515 }
   572 }
   516 
   573 
   539     
   596     
   540     return name;
   597     return name;
   541 }
   598 }
   542 
   599 
   543 // ---------------------------------------------------------------------------
   600 // ---------------------------------------------------------------------------
   544 // queryNewAlbum
   601 // queryNewAlbumSelected
   545 // ---------------------------------------------------------------------------
   602 // ---------------------------------------------------------------------------
   546 //
   603 //
   547 TMPXItemId VideoListSelectionDialog::queryNewAlbum()
   604 QString VideoListSelectionDialog::queryNewAlbumSelected()
   548 {
   605 {
   549     TMPXItemId newId = TMPXItemId::InvalidId();
   606     mSelectedAlbumId = TMPXItemId::InvalidId();
   550     bool ok = false;
   607     bool ok = false;
   551     QString label(tr("Enter name:"));   // localisation missing
   608     QString label(hbTrId("txt_videos_title_enter_name"));
   552     QString text(tr("New collection")); // localisation missing
   609     QString text("");
   553     text = HbInputDialog::getText(label, text, &ok);
   610     text = HbInputDialog::getText(label, hbTrId("txt_videos_dialog_entry_new_collection"), &ok);
   554     if (ok && text.length())
   611     if (ok && text.length())
   555     {
   612     {
   556        // check for duplicate album name and add new album
   613        // check for duplicate album name and add new album
   557         newId = mModel->addNewAlbum(mModel->resolveAlbumName(text));
   614         text = mModel->resolveAlbumName(text);
   558     }
   615         mSelectedAlbumId = mModel->addNewAlbum(text);
   559     return newId;
   616     }
   560 }
   617     return text;
   561 
   618 }
       
   619