wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp
changeset 43 72ebcbb64834
parent 39 7b3e49e4608a
child 53 bdc64aa9b954
equal deleted inserted replaced
39:7b3e49e4608a 43:72ebcbb64834
    28 #include "wlanqtutils.h"
    28 #include "wlanqtutils.h"
    29 #include "wlanwizard_p.h"
    29 #include "wlanwizard_p.h"
    30 #include "wlanwizardplugin.h"
    30 #include "wlanwizardplugin.h"
    31 #include "wlanwizardsummaryviewitem.h"
    31 #include "wlanwizardsummaryviewitem.h"
    32 #include "wlanwizardpagesummary.h"
    32 #include "wlanwizardpagesummary.h"
       
    33 #include "OstTraceDefinitions.h"
       
    34 #ifdef OST_TRACE_COMPILER_IN_USE
       
    35 #include "wlanwizardpagesummaryTraces.h"
       
    36 #endif
       
    37 
    33 
    38 
    34 /*!
    39 /*!
    35    \class WlanWizardPageSummary
    40    \class WlanWizardPageSummary
    36    \brief Implements Wizard summary page.
    41    \brief Implements Wizard summary page.
    37  */
    42  */
    54  */
    59  */
    55 WlanWizardPageSummary::WlanWizardPageSummary(WlanWizardPrivate* parent) :
    60 WlanWizardPageSummary::WlanWizardPageSummary(WlanWizardPrivate* parent) :
    56     WlanWizardPageInternal(parent), 
    61     WlanWizardPageInternal(parent), 
    57     mListWidget(NULL) 
    62     mListWidget(NULL) 
    58 {
    63 {
       
    64     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY );
       
    65     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT );
    59 }
    66 }
    60 
    67 
    61 /*!
    68 /*!
    62    Destructor.
    69    Destructor.
    63  */
    70  */
    64 WlanWizardPageSummary::~WlanWizardPageSummary()
    71 WlanWizardPageSummary::~WlanWizardPageSummary()
    65 {
    72 {
       
    73     OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY );
    66     HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout);
    74     HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout);
    67     
    75     
    68     // Wizard framework deletes the visualization (owns mListWidget).
    76     // Wizard framework deletes the visualization (owns mListWidget).
       
    77     OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT );
    69 }
    78 }
    70 
    79 
    71 /*!
    80 /*!
    72    See WlanWizardPage::initializePage()
    81    See WlanWizardPage::initializePage()
    73  */
    82  */
    74 HbWidget* WlanWizardPageSummary::initializePage()
    83 HbWidget* WlanWizardPageSummary::initializePage()
    75 {
    84 {
       
    85     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_ENTRY );
    76     // Note that from summary page it is not possible to step back
    86     // Note that from summary page it is not possible to step back
    77     // this means that it is not possible that this method is called twice.
    87     // this means that it is not possible that this method is called twice.
    78     Q_ASSERT(!mListWidget);
    88     Q_ASSERT(!mListWidget);
    79     
    89     
    80     loadDocml();
    90     loadDocml();
    91     appendToList(
   101     appendToList(
    92         row, hbTrId("txt_occ_dblist_security_mode"), securityModeText());    
   102         row, hbTrId("txt_occ_dblist_security_mode"), securityModeText());    
    93 
   103 
    94     addDynamicItems(row);
   104     addDynamicItems(row);
    95         
   105         
       
   106     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_EXIT );
    96     return qobject_cast<HbWidget*>(mListWidget);
   107     return qobject_cast<HbWidget*>(mListWidget);
    97 }
   108 }
    98 
   109 
    99 /*!
   110 /*!
   100    Loads docml.
   111    Loads docml.
   101  */
   112  */
   102 void WlanWizardPageSummary::loadDocml()
   113 void WlanWizardPageSummary::loadDocml()
   103 {
   114 {
       
   115     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_LOADDOCML_ENTRY );
   104     bool ok;    
   116     bool ok;    
   105     HbDocumentLoader docLoader(mWizard->mainWindow());
   117     HbDocumentLoader docLoader(mWizard->mainWindow());
   106     
   118     
   107     docLoader.load(":/docml/occ_add_wlan_05.docml", &ok);
   119     docLoader.load(":/docml/occ_add_wlan_05.docml", &ok);
   108     Q_ASSERT(ok);
   120     Q_ASSERT(ok);
   118     mListWidget->setLayoutName("wlanwizardsummaryitem");
   130     mListWidget->setLayoutName("wlanwizardsummaryitem");
   119     
   131     
   120     // Register the location of hblistviewitem.css and hblistviewitem.widgetml  
   132     // Register the location of hblistviewitem.css and hblistviewitem.widgetml  
   121     ok = HbStyleLoader::registerFilePath(WlanWizardPageSummaryLayout);
   133     ok = HbStyleLoader::registerFilePath(WlanWizardPageSummaryLayout);
   122     Q_ASSERT(ok);
   134     Q_ASSERT(ok);
       
   135     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_LOADDOCML_EXIT );
   123 }
   136 }
   124 
   137 
   125 /*!
   138 /*!
   126    Gets localized network mode from the WlanWizardPrivate::ConfNetworkMode
   139    Gets localized network mode from the WlanWizardPrivate::ConfNetworkMode
   127    configuration.
   140    configuration.
   128     
   141     
   129    @return localized network mode text.
   142    @return localized network mode text.
   130  */
   143  */
   131 QString WlanWizardPageSummary::networkModeText() const
   144 QString WlanWizardPageSummary::networkModeText() const
   132 {
   145 {
       
   146     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_ENTRY );
   133     QString ret;
   147     QString ret;
   134     int mode = mWizard->configuration(
   148     int mode = mWizard->configuration(
   135         WlanWizardPrivate::ConfNetworkMode).toInt();
   149         WlanWizardPrivate::ConfNetworkMode).toInt();
   136         
   150         
   137     switch (mode) {
   151     switch (mode) {
   146          } else {
   160          } else {
   147              ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu");
   161              ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu");
   148          }
   162          }
   149          break;
   163          break;
   150      }
   164      }
       
   165     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_EXIT );
   151     return ret;
   166     return ret;
   152 }
   167 }
   153 
   168 
   154 /*!
   169 /*!
   155    Gets localized security mode from the WlanWizardPrivate::ConfSecurityMode
   170    Gets localized security mode from the WlanWizardPrivate::ConfSecurityMode
   157    
   172    
   158    @return localized security mode text.
   173    @return localized security mode text.
   159  */
   174  */
   160 QString WlanWizardPageSummary::securityModeText() const
   175 QString WlanWizardPageSummary::securityModeText() const
   161 {
   176 {
       
   177     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_ENTRY );
   162     QString ret;
   178     QString ret;
   163     int mode = mWizard->configuration(WlanWizardPrivate::ConfSecurityMode).toInt();
   179     int mode = mWizard->configuration(WlanWizardPrivate::ConfSecurityMode).toInt();
   164     switch (mode) {
   180     switch (mode) {
   165     case CMManagerShim::WlanSecMode802_1x:
   181     case CMManagerShim::WlanSecMode802_1x:
   166         ret = hbTrId("txt_occ_dblist_security_mode_val_8021x");
   182         ret = hbTrId("txt_occ_dblist_security_mode_val_8021x");
   189     default:
   205     default:
   190         Q_ASSERT(mode == CMManagerShim::WlanSecModeOpen);
   206         Q_ASSERT(mode == CMManagerShim::WlanSecModeOpen);
   191         ret = hbTrId("txt_occ_dblist_security_mode_val_open");
   207         ret = hbTrId("txt_occ_dblist_security_mode_val_open");
   192         break;
   208         break;
   193     }
   209     }
       
   210     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_EXIT );
   194     return ret;
   211     return ret;
   195 }
   212 }
   196 
   213 
   197 /*!
   214 /*!
   198    Adds dynamic content to the view.
   215    Adds dynamic content to the view.
   199    
   216    
   200    @param [in,out] row row to where insert happens.
   217    @param [in,out] row row to where insert happens.
   201  */
   218  */
   202 void WlanWizardPageSummary::addDynamicItems(int &row)
   219 void WlanWizardPageSummary::addDynamicItems(int &row)
   203 {
   220 {
       
   221     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_ENTRY );
   204     if (mWizard->isEapEnabled()) {
   222     if (mWizard->isEapEnabled()) {
   205         appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row);
   223         appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row);
   206         appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row);
   224         appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row);
   207         appendToListPluginInfo(WlanWizardPlugin::SummaryEapFastProvisioningMode, row);
   225         appendToListPluginInfo(WlanWizardPlugin::SummaryEapFastProvisioningMode, row);
   208     }
   226     }
   209 
   227 
   210     // TODO: Hotspot: no need to show destination..
       
   211     QString value;
   228     QString value;
   212 
   229 
   213     switch (mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt()) {
   230     switch (mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt()) {
   214     case WlanQtUtils::IctPassed:
   231     case WlanQtUtils::IctPassed:
   215         value = hbTrId("txt_occ_dblist_destination_val_internet");
   232         value = hbTrId("txt_occ_dblist_destination_val_internet");
   220         value = hbTrId("txt_occ_dblist_destination_val_uncategorized");
   237         value = hbTrId("txt_occ_dblist_destination_val_uncategorized");
   221         appendToList(row, hbTrId("txt_occ_dblist_destination"), value);
   238         appendToList(row, hbTrId("txt_occ_dblist_destination"), value);
   222         break;
   239         break;
   223         
   240         
   224     default:
   241     default:
   225         Q_ASSERT(WlanQtUtils::IctHotspotPassed == mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt());
   242         Q_ASSERT(WlanQtUtils::IctHotspotPassed ==
       
   243             mWizard->configuration(WlanWizardPrivate::ConfIctStatus).toInt());
   226         // Add nothing to list.
   244         // Add nothing to list.
   227         break;
   245         break;
   228     }
   246     }
       
   247     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_EXIT );
   229 }
   248 }
   230 
   249 
   231 /*!
   250 /*!
   232    Appends new item to the end of the summary list
   251    Appends new item to the end of the summary list
   233    
   252    
   238 void WlanWizardPageSummary::appendToList(
   257 void WlanWizardPageSummary::appendToList(
   239     int &row, 
   258     int &row, 
   240     const QString title, 
   259     const QString title, 
   241     const QString value)
   260     const QString value)
   242 {
   261 {
       
   262     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_ENTRY );
   243     HbListWidgetItem *item = new HbListWidgetItem();
   263     HbListWidgetItem *item = new HbListWidgetItem();
   244     item->setText(title);
   264     item->setText(title);
   245     item->setSecondaryText(value);
   265     item->setSecondaryText(value);
   246     mListWidget->insertItem(row++, item);
   266     mListWidget->insertItem(row++, item);
       
   267     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_EXIT );
   247 }
   268 }
   248 
   269 
   249 /*!
   270 /*!
   250    Appends new item to the end of the summary list
   271    Appends new item to the end of the summary list
   251    
   272    
   253    @param [in,out] row number to where the item is inserted
   274    @param [in,out] row number to where the item is inserted
   254  */
   275  */
   255 void WlanWizardPageSummary::appendToListPluginInfo( 
   276 void WlanWizardPageSummary::appendToListPluginInfo( 
   256     WlanWizardPlugin::Summary id, int &row )
   277     WlanWizardPlugin::Summary id, int &row )
   257 {
   278 {
       
   279     OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_ENTRY );
   258     QString title;
   280     QString title;
   259     QString value;
   281     QString value;
   260     WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin();
   282     WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin();
   261     Q_ASSERT(plugin);
   283     Q_ASSERT(plugin);
   262     if (plugin->summary(id, title, value)) {
   284     if (plugin->summary(id, title, value)) {
   263         appendToList(row, title, value );
   285         appendToList(row, title, value );
   264     }
   286     }
   265 }
   287     OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_EXIT );
       
   288 }