connectionmonitoring/connectionview/src/connectionview.cpp
changeset 40 c5b848e6c7d1
parent 30 8dde790cab74
child 41 bbb64eb3bdee
equal deleted inserted replaced
34:3b0cec605979 40:c5b848e6c7d1
    43 
    43 
    44 
    44 
    45 QTM_USE_NAMESPACE
    45 QTM_USE_NAMESPACE
    46 
    46 
    47 
    47 
       
    48 const qreal typeLabelWidth = 18.0;
       
    49 
    48 ConnectionView::ConnectionView():
    50 ConnectionView::ConnectionView():
    49     mNetConfigurationManager(new QNetworkConfigurationManager(this)),
    51     mNetConfigurationManager(new QNetworkConfigurationManager(this)),
    50     mSignalMapper(new QSignalMapper(this)),
    52     mSignalMapper(new QSignalMapper(this)),
    51     mConnectionCount(0),
    53     mConnectionCount(0),
    52     mClosingTimer(0)
    54     mClosingTimer(0)
   178     // If there are no active connections, then the dialog is not shown to the user
   180     // If there are no active connections, then the dialog is not shown to the user
   179     mConnectionCount = activeConfigurations.count();
   181     mConnectionCount = activeConfigurations.count();
   180     
   182     
   181     // Toolbar is shown only if there are more than one connections active
   183     // Toolbar is shown only if there are more than one connections active
   182     if (mConnectionCount > 1) {
   184     if (mConnectionCount > 1) {
   183         mToolBar->show();
   185         mMainView->setItemVisible(Hb::ToolBarItem, true);
   184     } else {
   186     } else {
   185         mToolBar->hide();
   187         mMainView->setItemVisible(Hb::ToolBarItem, false);
   186     }
   188     }
   187     
   189     
   188     // if there are connections, the main view with the connections is shown
   190     // if there are connections, the main view with the connections is shown
   189     if (mConnectionCount > 0) { 
   191     if (mConnectionCount > 0) { 
   190         setCurrentView(mMainView);
   192         setCurrentView(mMainView);
   314     
   316     
   315     // Create the horizontal layout for the labels
   317     // Create the horizontal layout for the labels
   316     QGraphicsLinearLayout *labelLayout = new QGraphicsLinearLayout(Qt::Horizontal);
   318     QGraphicsLinearLayout *labelLayout = new QGraphicsLinearLayout(Qt::Horizontal);
   317     labelLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   319     labelLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   318     HbLabel *typeLabel = new HbLabel(hbTrId("txt_occ_list_name"));
   320     HbLabel *typeLabel = new HbLabel(hbTrId("txt_occ_list_name"));
       
   321 
       
   322     // get the pixel size matching the spesified 18 units using the HbDeviceProfile
       
   323     // and set the width of the label
       
   324     HbDeviceProfile profile = HbDeviceProfile::profile(mMainView);
       
   325     typeLabel->setPreferredWidth(typeLabelWidth*profile.unitValue());
       
   326     typeLabel->setObjectName("mConnectionLabel");
       
   327     
   319     HbLabel *nameLabel = new HbLabel(iapName);
   328     HbLabel *nameLabel = new HbLabel(iapName);
   320     nameLabel->setAlignment(Qt::AlignRight);
   329     nameLabel->setAlignment(Qt::AlignRight);
       
   330     nameLabel->setObjectName("mConnectionLabel");
   321     labelLayout->addItem(typeLabel);
   331     labelLayout->addItem(typeLabel);
   322     labelLayout->addItem(nameLabel);
   332     labelLayout->addItem(nameLabel);
   323    
   333    
   324     HbWidget *labelWidget = new HbWidget();
   334     HbWidget *labelWidget = new HbWidget();
   325     labelWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   335     labelWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);