cmmanager/cpdestinationplugin/src/cpiapitem.cpp
changeset 29 1f1fcd7e941c
parent 28 860702281757
child 30 8dde790cab74
equal deleted inserted replaced
28:860702281757 29:1f1fcd7e941c
    74     int iapId, 
    74     int iapId, 
    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(itemDataHelper), 
    79     CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), 
       
    80     mItemDataHelper(&itemDataHelper),
    80     mIapId(iapId), 
    81     mIapId(iapId), 
    81     mIapName(iapName),
    82     mIapName(iapName),
    82     mDestId(destId),
    83     mDestId(destId),
    83     mBearerPlugin(bearerPlugin),
    84     mBearerPlugin(bearerPlugin),
    84     mMoveOngoing(false),
    85     mMoveOngoing(false),
   231     } catch (const std::exception&) {
   232     } catch (const std::exception&) {
   232         OstTrace0(TRACE_NORMAL, DUP1_CPIAPITEM_DELETECONFIRMED, "CpIapItem::deleteConfirmed: Exception caught");
   233         OstTrace0(TRACE_NORMAL, DUP1_CPIAPITEM_DELETECONFIRMED, "CpIapItem::deleteConfirmed: Exception caught");
   233         deleteSuccessful = false;
   234         deleteSuccessful = false;
   234     }
   235     }
   235     if (deleteSuccessful) {
   236     if (deleteSuccessful) {
   236         HbDataForm *form = static_cast<HbDataForm*>(QObject::parent()->parent());
   237         this->deleteLater();
   237         QModelIndex index = static_cast<HbDataFormModel*>(QObject::parent())->indexFromItem(this);
       
   238         HbAbstractViewItem *viewItem = form->itemByIndex(index);
       
   239         viewItem->deleteLater();
       
   240         OstTrace0(TRACE_NORMAL, CPIAPITEM_DELETECONFIRMED, "CpIapItem::deleteConfirmed: Emit access point changed signal");
   238         OstTrace0(TRACE_NORMAL, CPIAPITEM_DELETECONFIRMED, "CpIapItem::deleteConfirmed: Emit access point changed signal");
   241         emit iapChanged();
   239         emit iapChanged();
   242     } else {
   240     } else {
   243         showErrorNote(hbTrId("txt_occ_info_unable_to_save_setting"));
   241         showErrorNote(hbTrId("txt_occ_info_unable_to_save_setting"));
   244     }
   242     }
   259     } catch (const std::exception&) {
   257     } catch (const std::exception&) {
   260         OstTrace0( TRACE_NORMAL, CPIAPITEM_UPDATEIAP, "CpIapItem::updateIap: exception caught, CM name reading failed" );
   258         OstTrace0( TRACE_NORMAL, CPIAPITEM_UPDATEIAP, "CpIapItem::updateIap: exception caught, CM name reading failed" );
   261     }
   259     }
   262     // Disconnect because we need to do this only after returning
   260     // Disconnect because we need to do this only after returning
   263     // from accees point settings view
   261     // from accees point settings view
   264     HbDataForm *form = static_cast<HbDataForm*>(QObject::parent()->parent());
   262     CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
   265     disconnect(
   263     itemDataHelper->disconnectFromForm( 
   266         form, 
       
   267         SIGNAL(itemShown(const QModelIndex)),
   264         SIGNAL(itemShown(const QModelIndex)),
   268         this, 
   265         this, 
   269         SLOT(updateIap(const QModelIndex)));
   266         SLOT(updateIap(const QModelIndex)));
       
   267     delete itemDataHelper;
   270     OstTrace0( TRACE_FLOW, DUP1_CPIAPITEM_UPDATEIAP_EXIT, "CpIapItem::updateIap exit" );
   268     OstTrace0( TRACE_FLOW, DUP1_CPIAPITEM_UPDATEIAP_EXIT, "CpIapItem::updateIap exit" );
   271 }
   269 }
   272 
   270 
   273 /*!
   271 /*!
   274     Gets access point specific view from bearer plugin.
   272     Gets access point specific view from bearer plugin.
   277  */
   275  */
   278 CpBaseSettingView *CpIapItem::createSettingView() const
   276 CpBaseSettingView *CpIapItem::createSettingView() const
   279 {
   277 {
   280     OstTraceFunctionEntry0(CPIAPITEM_CREATESETTINGVIEW_ENTRY);
   278     OstTraceFunctionEntry0(CPIAPITEM_CREATESETTINGVIEW_ENTRY);
   281     CpBaseSettingView *view = NULL;
   279     CpBaseSettingView *view = NULL;
       
   280     CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
   282     if (mBearerPlugin != NULL) {
   281     if (mBearerPlugin != NULL) {
   283         HbDataForm *form = static_cast<HbDataForm*>(QObject::parent()->parent()); 
   282         CpIapItem *iap = const_cast<CpIapItem*>(this);
   284         bool connected = connect(
   283         itemDataHelper->connectToForm( 
   285             form, 
       
   286             SIGNAL(itemShown(const QModelIndex)),
   284             SIGNAL(itemShown(const QModelIndex)),
   287             this, 
   285             iap, 
   288             SLOT(updateIap(const QModelIndex)));
   286             SLOT(updateIap(const QModelIndex)));
   289         Q_ASSERT(connected);
       
   290         view = mBearerPlugin->createSettingView(mIapId);
   287         view = mBearerPlugin->createSettingView(mIapId);
   291     }
   288     }
       
   289     delete itemDataHelper;
   292     OstTraceFunctionExit0(CPIAPITEM_CREATESETTINGVIEW_EXIT);
   290     OstTraceFunctionExit0(CPIAPITEM_CREATESETTINGVIEW_EXIT);
   293     return view;
   291     return view;
   294 }
   292 }
   295 
   293 
   296 /*!
   294 /*!