cmmanager/cpdestinationplugin/src/cpiapitem.cpp
changeset 32 5c4486441ae6
parent 30 8dde790cab74
child 40 c5b848e6c7d1
equal deleted inserted replaced
31:c16e04725da3 32:5c4486441ae6
    75     const QString &iapName, 
    75     const QString &iapName, 
    76     int destId,
    76     int destId,
    77     bool apProtected,
    77     bool apProtected,
    78     CpBearerApPluginInterface *bearerPlugin) :
    78     CpBearerApPluginInterface *bearerPlugin) :
    79     CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), 
    79     CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), 
    80     mItemDataHelper(&itemDataHelper),
       
    81     mIapId(iapId), 
    80     mIapId(iapId), 
    82     mIapName(iapName),
    81     mIapName(iapName),
    83     mDestId(destId),
    82     mDestId(destId),
       
    83     mItemDataHelper(&itemDataHelper),
    84     mBearerPlugin(bearerPlugin),
    84     mBearerPlugin(bearerPlugin),
    85     mMoveOngoing(false),
    85     mMoveOngoing(false),
    86     mDialog(0),
    86     mDialog(0),
    87     mList(0)
    87     mList(0)
    88 {
    88 {
   268     delete itemDataHelper;
   268     delete itemDataHelper;
   269     OstTrace0( TRACE_FLOW, DUP1_CPIAPITEM_UPDATEIAP_EXIT, "CpIapItem::updateIap exit" );
   269     OstTrace0( TRACE_FLOW, DUP1_CPIAPITEM_UPDATEIAP_EXIT, "CpIapItem::updateIap exit" );
   270 }
   270 }
   271 
   271 
   272 /*!
   272 /*!
       
   273     Opens Iap settings view.
       
   274  */
       
   275 void CpIapItem::openIap()
       
   276 {
       
   277     onLaunchView();
       
   278 }
       
   279 
       
   280 /*!
   273     Gets access point specific view from bearer plugin.
   281     Gets access point specific view from bearer plugin.
   274     
   282     
   275     \return Returns settings view containing access point settings.
   283     \return Returns settings view containing access point settings.
   276  */
   284  */
   277 CpBaseSettingView *CpIapItem::createSettingView() const
   285 CpBaseSettingView *CpIapItem::createSettingView() const
   278 {
   286 {
   279     OstTraceFunctionEntry0(CPIAPITEM_CREATESETTINGVIEW_ENTRY);
   287     OstTraceFunctionEntry0(CPIAPITEM_CREATESETTINGVIEW_ENTRY);
   280     CpBaseSettingView *view = NULL;
   288     CpBaseSettingView *view = NULL;
   281     CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
   289     CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
   282     if (mBearerPlugin != NULL) {
   290     if (mBearerPlugin != NULL) {
   283         CpIapItem *iap = const_cast<CpIapItem*>(this);
   291         CmConnectionMethodShim *cm = mCmm->connectionMethod(mIapId);
   284         itemDataHelper->connectToForm( 
   292         bool cmConnected = cm->getBoolAttribute(CMManagerShim::CmConnected);
   285             SIGNAL(itemShown(const QModelIndex)),
   293         delete cm;
   286             iap, 
   294         
   287             SLOT(updateIap(const QModelIndex)));
   295         // Do not open connected AP
   288         view = mBearerPlugin->createSettingView(mIapId);
   296         if (!cmConnected) {
       
   297             CpIapItem *iap = const_cast<CpIapItem*>(this);
       
   298             itemDataHelper->connectToForm( 
       
   299                 SIGNAL(itemShown(const QModelIndex)),
       
   300                 iap, 
       
   301                 SLOT(updateIap(const QModelIndex)));
       
   302             view = mBearerPlugin->createSettingView(mIapId);
       
   303         }
   289     }
   304     }
   290     delete itemDataHelper;
   305     delete itemDataHelper;
   291     OstTraceFunctionExit0(CPIAPITEM_CREATESETTINGVIEW_EXIT);
   306     OstTraceFunctionExit0(CPIAPITEM_CREATESETTINGVIEW_EXIT);
   292     return view;
   307     return view;
   293 }
   308 }
   445     const QPointF &position)
   460     const QPointF &position)
   446 {
   461 {
   447     OstTraceFunctionEntry0(CPIAPITEM_CREATEITEMMENU_ENTRY);
   462     OstTraceFunctionEntry0(CPIAPITEM_CREATEITEMMENU_ENTRY);
   448     HbMenu* menu = new HbMenu();
   463     HbMenu* menu = new HbMenu();
   449     menu->setAttribute(Qt::WA_DeleteOnClose);
   464     menu->setAttribute(Qt::WA_DeleteOnClose);
       
   465     HbAction* openIapAction 
       
   466             = menu->addAction(hbTrId("txt_common_menu_open"));
       
   467     bool connected = connect(openIapAction, SIGNAL(triggered()), this, SLOT(openIap()));
       
   468     Q_ASSERT(connected);
   450     HbAction* moveIapAction 
   469     HbAction* moveIapAction 
   451         = menu->addAction(hbTrId("txt_occ_menu_move_to_other_destination"));
   470         = menu->addAction(hbTrId("txt_occ_menu_move_to_other_destination"));
   452     bool connected = connect(moveIapAction, SIGNAL(triggered()), this, SLOT(moveIap()));
   471     connected = connect(moveIapAction, SIGNAL(triggered()), this, SLOT(moveIap()));
   453     Q_ASSERT(connected);
   472     Q_ASSERT(connected);
   454     HbAction* deleteIapAction 
   473     HbAction* deleteIapAction 
   455         = menu->addAction(hbTrId("txt_common_menu_delete"));
   474         = menu->addAction(hbTrId("txt_common_menu_delete"));
   456     connected = connect(
   475     connected = connect(
   457         deleteIapAction, 
   476         deleteIapAction, 
   464     connected = connect(shareIapAction, SIGNAL(triggered()), this, SLOT(shareIap()));
   483     connected = connect(shareIapAction, SIGNAL(triggered()), this, SLOT(shareIap()));
   465     Q_ASSERT(connected);
   484     Q_ASSERT(connected);
   466        
   485        
   467     if (cmConnected) {
   486     if (cmConnected) {
   468         // Disable operations for connected APs
   487         // Disable operations for connected APs
       
   488         openIapAction->setDisabled(true);
   469         moveIapAction->setDisabled(true);
   489         moveIapAction->setDisabled(true);
   470         deleteIapAction->setDisabled(true);
   490         deleteIapAction->setDisabled(true);
   471         shareIapAction->setDisabled(true);
   491         shareIapAction->setDisabled(true);
   472     }
   492     }
   473     
   493