logsui/logsapp/src/logsmatchesview.cpp
changeset 16 c5af8598d22c
parent 11 64a47b97e1e1
child 21 2f0af9ba7665
equal deleted inserted replaced
14:f27aebe284bb 16:c5af8598d22c
    43 LogsMatchesView::LogsMatchesView( 
    43 LogsMatchesView::LogsMatchesView( 
    44     LogsComponentRepository& repository, LogsAbstractViewManager& viewManager )
    44     LogsComponentRepository& repository, LogsAbstractViewManager& viewManager )
    45     : LogsBaseView(LogsMatchesViewId, repository, viewManager),
    45     : LogsBaseView(LogsMatchesViewId, repository, viewManager),
    46       mListView(0),
    46       mListView(0),
    47       mModel(0),
    47       mModel(0),
    48       mAddToContactsButton(0),
    48       mAddToContactsButton(0)
    49       mAddToContactsButtonDisabled(false)
       
    50 {
    49 {
    51     LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::LogsMatchesView()" );
    50     LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::LogsMatchesView()" );
    52     
    51     
    53     mActivities.append( logsActivityIdViewMatches );
    52     mActivities.append( logsActivityIdViewMatches );
    54 }
    53 }
    68 // LogsMatchesView::activated
    67 // LogsMatchesView::activated
    69 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    70 //
    69 //
    71 void LogsMatchesView::activated(bool showDialer, QVariant args)
    70 void LogsMatchesView::activated(bool showDialer, QVariant args)
    72 {
    71 {
    73     // Disable add to contacts button handling while view is activated
       
    74     // to avoid unnecessary quick appear/dissappear of it.
       
    75     mAddToContactsButtonDisabled = true;
       
    76     
       
    77     LogsBaseView::activated(showDialer, args);
    72     LogsBaseView::activated(showDialer, args);
    78     
    73     
    79     LogsMatchesModel* model = qVariantValue<LogsMatchesModel*>(args);
    74     LogsMatchesModel* model = qVariantValue<LogsMatchesModel*>(args);
    80     updateModel(model);
    75     updateModel(model);
    81     dialpadEditorTextChanged();
    76     dialpadEditorTextChanged();
    82     
    77     
    83     activateEmptyListIndicator(mModel);
    78     activateEmptyListIndicator(mModel);
    84     
    79     
    85     scrollToTopItem(mListView);
    80     scrollToTopItem(mListView);
    86     
    81     
    87     mAddToContactsButtonDisabled = false;
    82     LogsBaseView::activationCompleted();
    88 }
    83 }
    89 
    84 
    90 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
    91 // LogsMatchesView::deactivated
    86 // LogsMatchesView::deactivated
    92 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
   152     mListView->setItemRecycling(true);
   147     mListView->setItemRecycling(true);
   153     mListView->setFrictionEnabled(true);
   148     mListView->setFrictionEnabled(true);
   154     mListView->listItemPrototype()->setTextFormat(Qt::RichText);
   149     mListView->listItemPrototype()->setTextFormat(Qt::RichText);
   155     
   150     
   156     connect(mListView, SIGNAL(activated(const QModelIndex)),
   151     connect(mListView, SIGNAL(activated(const QModelIndex)),
   157             this, SLOT(initiateCallback(const QModelIndex)));
   152             this, SLOT(initiateCallback(const QModelIndex)), 
       
   153             Qt::UniqueConnection);
   158     
   154     
   159     connect(mListView,
   155     connect(mListView,
   160             SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
   156             SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
   161             this,
   157             this,
   162             SLOT(showListItemMenu(HbAbstractViewItem*, const QPointF&)));
   158             SLOT(showListItemMenu(HbAbstractViewItem*, const QPointF&)), 
       
   159             Qt::UniqueConnection);
   163    
   160    
   164     LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::initListWidget() " );
   161     LOGS_QDEBUG( "logs [UI] <- LogsMatchesView::initListWidget() " );
   165 }
   162 }
   166 
   163 
   167 // -----------------------------------------------------------------------------
   164 // -----------------------------------------------------------------------------
   319 //
   316 //
   320 void LogsMatchesView::updateAddContactButton()
   317 void LogsMatchesView::updateAddContactButton()
   321 {
   318 {
   322     if (mAddToContactsButton) {
   319     if (mAddToContactsButton) {
   323         LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::updateAddContactButton()" );
   320         LOGS_QDEBUG( "logs [UI] <-> LogsMatchesView::updateAddContactButton()" );
       
   321         // Disable add to contacts button handling while view is being activated
       
   322         // to avoid unnecessary quick appear/dissappear of it.
   324         bool matchesFound(model() && (model()->rowCount() > 0));
   323         bool matchesFound(model() && (model()->rowCount() > 0));
   325         mAddToContactsButton->setVisible(
   324         mAddToContactsButton->setVisible(
   326             !mAddToContactsButtonDisabled && !matchesFound && isDialpadInput() );
   325             !mActivating && !matchesFound && isDialpadInput() );
   327     }
   326     }
   328 }
   327 }