logsui/logsapp/src/logsrecentcallsview.cpp
changeset 4 e52d42f9500c
parent 2 7119b73b84d6
child 6 41c0a814d878
equal deleted inserted replaced
2:7119b73b84d6 4:e52d42f9500c
   410     connect(mListView,
   410     connect(mListView,
   411             SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
   411             SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
   412             this,
   412             this,
   413             SLOT(showListItemMenu(HbAbstractViewItem*, const QPointF&)));
   413             SLOT(showListItemMenu(HbAbstractViewItem*, const QPointF&)));
   414     
   414     
   415     mListView->setScrollingStyle(HbScrollArea::PanOrFlick); 
       
   416     mListView->setFrictionEnabled(true);
   415     mListView->setFrictionEnabled(true);
   417     
   416     
   418     mListViewX = mListView->pos().x();
   417     mListViewX = mListView->pos().x();
   419     
   418     
   420     grabGesture(Qt::SwipeGesture);
   419     grabGesture(Qt::SwipeGesture);
   704     LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
   703     LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
   705     if ( mListView ) {
   704     if ( mListView ) {
   706         updateMenu();
   705         updateMenu();
   707         updateListLayoutName(*mListView);
   706         updateListLayoutName(*mListView);
   708         updateListSize();
   707         updateListSize();
   709         HbDeviceProfile deviceProf;
       
   710         LogsConfigurationParams param;
   708         LogsConfigurationParams param;
   711         QString testString = mListView->layoutName();
   709         param.setListItemTextWidth( getListItemTextWidth() );
   712         //note: ListItemTextWidth values are currently hardcoded and 
       
   713         //they are taken from hblistviewitem.css "text-1" field
       
   714         if (mListView->layoutName() == logsListLandscapeDialpadLayout) {
       
   715             param.setListItemTextWidth( 38 * deviceProf.unitValue() );
       
   716         } else {
       
   717             param.setListItemTextWidth( 40 * deviceProf.unitValue() );
       
   718         }
       
   719         mModel->updateConfiguration(param);
   710         mModel->updateConfiguration(param);
   720     }
   711     }
   721     LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
   712     LOGS_QDEBUG( "logs [UI] <- LogsRecentCallsView::updateWidgetsSizeAndLayout()" );
   722 }
   713 }
       
   714 
       
   715 // -----------------------------------------------------------------------------
       
   716 // LogsRecentCallsView::getListItemTextWidth
       
   717 // -----------------------------------------------------------------------------
       
   718 //
       
   719 int LogsRecentCallsView::getListItemTextWidth()
       
   720 {
       
   721     LOGS_QDEBUG( "logs [UI] -> LogsRecentCallsView::ListItemText()" );
       
   722 
       
   723     qreal width = 0;
       
   724 
       
   725     // layoutrect broken, fix will be in MCL wk14, use workaround meanwhile
       
   726     //QRectF screenRect = mViewManager.mainWindow().layoutRect();
       
   727     QRectF screenRect = (mViewManager.mainWindow().orientation() == Qt::Horizontal) ? 
       
   728             QRectF(0,0,640,360) : QRectF(0,0,360,640);
       
   729     LOGS_QDEBUG_2( "logs [UI]  screenRect:", screenRect );
       
   730     
       
   731     // Cannot use hb-param-screen-width in expressions currently due bug in layoutrect
       
   732     qreal modifier = 0.0;
       
   733     QString expr;
       
   734     if (mListView->layoutName() == QLatin1String(logsListDefaultLayout)) {
       
   735         expr = "expr(var(hb-param-graphic-size-primary-medium) + var(hb-param-margin-gene-left) + var(hb-param-margin-gene-right) + var(hb-param-margin-gene-middle-horizontal))";
       
   736         width = screenRect.width();
       
   737     } else {
       
   738         expr = "expr(var(hb-param-graphic-size-primary-medium) + var(hb-param-margin-gene-left) + var(hb-param-margin-gene-right))";
       
   739         width = screenRect.width() / 2;
       
   740     }
       
   741     
       
   742     if ( expr.isEmpty() || !style()->parameter(expr, modifier) ){
       
   743         LOGS_QDEBUG( "logs [UI] No expression or incorrect expression" );
       
   744     }
       
   745     width -= modifier;
       
   746     
       
   747     LOGS_QDEBUG_2( "logs [UI] <- LogsRecentCallsView::ListItemText(): ", width );   
       
   748     return qRound(width);
       
   749 }
       
   750 
   723 
   751 
   724 // -----------------------------------------------------------------------------
   752 // -----------------------------------------------------------------------------
   725 // LogsRecentCallsView::updateCallButton
   753 // LogsRecentCallsView::updateCallButton
   726 // If dialpad contains text or there is items in list, call button is enabled
   754 // If dialpad contains text or there is items in list, call button is enabled
   727 // -----------------------------------------------------------------------------
   755 // -----------------------------------------------------------------------------