wlanutilities/wlanwizard/src/wlanwizardpagessid.cpp
changeset 60 822a45792fdd
parent 43 72ebcbb64834
equal deleted inserted replaced
53:bdc64aa9b954 60:822a45792fdd
    14 * Description: 
    14 * Description: 
    15 * WLAN Wizard Page: SSID Selection.
    15 * WLAN Wizard Page: SSID Selection.
    16 */
    16 */
    17 
    17 
    18 // System includes
    18 // System includes
       
    19 
    19 #include <HbDocumentLoader>
    20 #include <HbDocumentLoader>
    20 #include <HbMainWindow>
    21 #include <HbMainWindow>
    21 #include <HbWidget>
    22 #include <HbWidget>
    22 #include <HbLineEdit>
    23 #include <HbLineEdit>
    23 #include <HbEditorInterface>
    24 #include <HbEditorInterface>
    24 #include <HbLabel>
    25 #include <HbLabel>
       
    26 
    25 #include <wlanqtutils.h>
    27 #include <wlanqtutils.h>
    26 
    28 
    27 // User includes
    29 // User includes
       
    30 
    28 #include "wlanwizardpagessid.h"
    31 #include "wlanwizardpagessid.h"
    29 #include "wlanwizard_p.h"
    32 #include "wlanwizard_p.h"
    30 #include "wlanwizardutils.h"
    33 #include "wlanwizardutils.h"
       
    34 
    31 #include "OstTraceDefinitions.h"
    35 #include "OstTraceDefinitions.h"
    32 #ifdef OST_TRACE_COMPILER_IN_USE
    36 #ifdef OST_TRACE_COMPILER_IN_USE
    33 #include "wlanwizardpagessidTraces.h"
    37 #include "wlanwizardpagessidTraces.h"
    34 #endif
    38 #endif
    35 
    39 
    42     mWidget(NULL),
    46     mWidget(NULL),
    43     mLabel(NULL),
    47     mLabel(NULL),
    44     mSsid(NULL),
    48     mSsid(NULL),
    45     mLoader(NULL)
    49     mLoader(NULL)
    46 {
    50 {
    47     OstTraceFunctionEntry0( WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY );
    51     OstTraceFunctionEntry0(WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY);
    48 
    52     OstTraceFunctionExit0(WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT);
    49     OstTraceFunctionExit0( WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT );
       
    50 }
    53 }
    51 
    54 
    52 /*!
    55 /*!
    53  * Destructor. Loader widget is deleted.
    56  * Destructor. Loader widget is deleted.
    54  * All document widgets are deleted by wlanwizard_p destructor.
    57  * All document widgets are deleted by wlanwizard_p destructor.
    55  */
    58  */
    56 WlanWizardPageSsid::~WlanWizardPageSsid()
    59 WlanWizardPageSsid::~WlanWizardPageSsid()
    57 {
    60 {
    58     OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY );
    61     OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY);
       
    62     
    59     delete mLoader;
    63     delete mLoader;
    60     OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT );
    64     
       
    65     OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT);
    61 }
    66 }
    62 
    67 
    63 /*!
    68 /*!
    64  * Page initialization. If view is already loaded, does nothing.
    69  * Page initialization. If view is already loaded, does nothing.
    65  * @return pointer to widget "occ_add_wlan_01".
    70  * @return pointer to widget "occ_add_wlan_01".
    66  */
    71  */
    67 HbWidget* WlanWizardPageSsid::initializePage()
    72 HbWidget* WlanWizardPageSsid::initializePage()
    68 {
    73 {
    69     OstTraceFunctionEntry0( WLANWIZARDPAGESSID_INITIALIZEPAGE_ENTRY );
    74     OstTraceFunctionEntry0(WLANWIZARDPAGESSID_INITIALIZEPAGE_ENTRY);
    70     OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESSID_INITIALIZEPAGE,
    75     
    71         "WlanWizardPageSsid::initializePage" );
    76     OstTrace0(
       
    77         TRACE_NORMAL,
       
    78         WLANWIZARDPAGESSID_INITIALIZEPAGE,
       
    79         "WlanWizardPageSsid::initializePage");
    72 
    80 
    73     // It is not possible for this method to be called more than once during
    81     // It is not possible for this method to be called more than once during
    74     // wizard lifetime.
    82     // wizard lifetime.
    75     Q_ASSERT(mWidget == NULL);
    83     Q_ASSERT(mWidget == NULL);
    76 
    84 
   110         SLOT(textChanged(const QString &)));
   118         SLOT(textChanged(const QString &)));
   111     Q_ASSERT(ok);
   119     Q_ASSERT(ok);
   112 
   120 
   113     HbEditorInterface editInterface(mSsid);
   121     HbEditorInterface editInterface(mSsid);
   114     
   122     
   115     // TODO: remove (HbEditorConstraints) type cast when 
       
   116     // Q_DECLARE_OPERATORS_FOR_FLAGS(HbEditorConstraints) is defined (SDK xxx)
       
   117     editInterface.setInputConstraints(
   123     editInterface.setInputConstraints(
   118         (HbEditorConstraints)(HbEditorConstraintAutoCompletingField |
   124         HbEditorConstraintAutoCompletingField |
   119             HbEditorConstraintLatinAlphabetOnly));
   125         HbEditorConstraintLatinAlphabetOnly);
   120     
   126     
   121     editInterface.setSmileyTheme(HbSmileyTheme());
   127     editInterface.setSmileyTheme(HbSmileyTheme());
   122     editInterface.setEditorClass(HbInputEditorClassNetworkName);
   128     editInterface.setEditorClass(HbInputEditorClassNetworkName);
   123     mSsid->setInputMethodHints(
   129     mSsid->setInputMethodHints(
   124         Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase);
   130         Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase);
   125     mSsid->setMaxLength(WlanWizardUtils::SsidMaxLength);
   131     mSsid->setMaxLength(WlanWizardUtils::SsidMaxLength);
   126 
   132 
   127 	OstTraceFunctionExit0( WLANWIZARDPAGESSID_INITIALIZEPAGE_EXIT );
   133 	OstTraceFunctionExit0(WLANWIZARDPAGESSID_INITIALIZEPAGE_EXIT);
   128 	return mWidget;
   134 	return mWidget;
   129 }
   135 }
   130 
   136 
   131 /*!
   137 /*!
   132  * This method is overrides the default implementation from WlanWizardPage.
   138  * This method is overrides the default implementation from WlanWizardPage.
   133  * It indicates whether the Next-button should be enabled or not.
   139  * It indicates whether the Next-button should be enabled or not.
   134  * @return true, if mSsid edit field is not empty.
   140  * @return true, if mSsid edit field is not empty.
   135  */
   141  */
   136 bool WlanWizardPageSsid::showPage()
   142 bool WlanWizardPageSsid::showPage()
   137 {
   143 {
   138     OstTraceFunctionEntry0( WLANWIZARDPAGESSID_SHOWPAGE_ENTRY );
   144     OstTraceFunctionEntry0(WLANWIZARDPAGESSID_SHOWPAGE_ENTRY);
       
   145     
   139     // Initiate the scanning of public APs here.
   146     // Initiate the scanning of public APs here.
   140     mWizard->wlanQtUtils()->scanWlanAps();
   147     mWizard->wlanQtUtils()->scanWlanAps();
   141     
   148     
   142     // Open virtual keyboard by setting focus to line edit
   149     // Open virtual keyboard by setting focus to line edit
   143     mSsid->setFocus();
   150     mSsid->setFocus();
   144     OstTraceFunctionExit0( WLANWIZARDPAGESSID_SHOWPAGE_EXIT );
   151     
       
   152     OstTraceFunctionExit0(WLANWIZARDPAGESSID_SHOWPAGE_EXIT);
   145     return !(mSsid->text().isEmpty());
   153     return !(mSsid->text().isEmpty());
   146 }
   154 }
   147 
   155 
   148 /*!
   156 /*!
   149  * Stores the SSID selection in the configuration.
   157  * Stores the SSID selection in the configuration.
   150  * @param [out] removeFromStack returns false.
   158  * @param [out] removeFromStack returns false.
   151  * @return WlanWizardPageScanning page id.
   159  * @return WlanWizardPageScanning page id.
   152  */
   160  */
   153 int WlanWizardPageSsid::nextId(bool &removeFromStack) const
   161 int WlanWizardPageSsid::nextId(bool &removeFromStack) const
   154 {
   162 {
   155     OstTraceFunctionEntry0( WLANWIZARDPAGESSID_NEXTID_ENTRY );
   163     OstTraceFunctionEntry0(WLANWIZARDPAGESSID_NEXTID_ENTRY);
       
   164     
   156     removeFromStack = false;
   165     removeFromStack = false;
   157 
   166 
   158     // SSID is stored into configuration
   167     // SSID is stored into configuration
   159     mWizard->setConfiguration(WlanWizardPrivate::ConfSsid, mSsid->text());
   168     QString ssid(mSsid->text());
   160     
   169     mWizard->setConfiguration(WlanWizardPrivate::ConfName, ssid);
   161     OstTraceFunctionExit0( WLANWIZARDPAGESSID_NEXTID_EXIT );
   170     mWizard->setConfiguration(WlanWizardPrivate::ConfSsid, ssid.toUtf8());
       
   171     
       
   172     OstTraceFunctionExit0(WLANWIZARDPAGESSID_NEXTID_EXIT);
   162     return WlanWizardPageInternal::PageScanning;
   173     return WlanWizardPageInternal::PageScanning;
   163 }
   174 }
   164 
   175 
   165 /*!
   176 /*!
   166  * Loads the document orientation information from occ_add_wlan_01_04.docml
   177  * Loads the document orientation information from occ_add_wlan_01_04.docml
   168  * @param [in] orientation indicates whether the phone is in portrait or
   179  * @param [in] orientation indicates whether the phone is in portrait or
   169  * landscape mode.
   180  * landscape mode.
   170  */
   181  */
   171 void WlanWizardPageSsid::loadDocmlSection(Qt::Orientation orientation)
   182 void WlanWizardPageSsid::loadDocmlSection(Qt::Orientation orientation)
   172 {
   183 {
   173     OstTraceFunctionEntry0( WLANWIZARDPAGESSID_LOADDOCMLSECTION_ENTRY );
   184     OstTraceFunctionEntry0(WLANWIZARDPAGESSID_LOADDOCMLSECTION_ENTRY);
   174     OstTrace1( TRACE_FLOW, WLANWIZARDPAGESSID_LOADDOCML,
   185     
       
   186     OstTrace1(
       
   187         TRACE_FLOW,
       
   188         WLANWIZARDPAGESSID_LOADDOCML,
   175         "WlanWizardPageSsid::loadDocml - orientation ;orientation=%x",
   189         "WlanWizardPageSsid::loadDocml - orientation ;orientation=%x",
   176         ( TUint )( orientation ) );
   190         (TUint)orientation);
   177 
   191 
   178     WlanWizardPageInternal::loadDocmlSection(
   192     WlanWizardPageInternal::loadDocmlSection(
   179         mLoader,
   193         mLoader,
   180         orientation,
   194         orientation,
   181         ":/docml/occ_add_wlan_01_04.docml", 
   195         ":/docml/occ_add_wlan_01_04.docml", 
   182         "portrait_section",
   196         "portrait_section",
   183         "landscape_section");
   197         "landscape_section");
   184     OstTraceFunctionExit0( WLANWIZARDPAGESSID_LOADDOCMLSECTION_EXIT );
   198     
       
   199     OstTraceFunctionExit0(WLANWIZARDPAGESSID_LOADDOCMLSECTION_EXIT);
   185 }
   200 }
   186 
   201 
   187 /*!
   202 /*!
   188  * Executed when changes have been made to the mSsid field (and the field is
   203  * Executed when changes have been made to the mSsid field (and the field is
   189  * not empty).
   204  * not empty).
   190  * @param [in] text is not used at this point.
   205  * @param [in] text is not used at this point.
   191  */
   206  */
   192 void WlanWizardPageSsid::textChanged(const QString &text)
   207 void WlanWizardPageSsid::textChanged(const QString &text)
   193 {
   208 {
   194     OstTraceFunctionEntry0( WLANWIZARDPAGESSID_TEXTCHANGED_ENTRY );
   209     OstTraceFunctionEntry0(WLANWIZARDPAGESSID_TEXTCHANGED_ENTRY);
       
   210 
   195     Q_UNUSED(text);
   211     Q_UNUSED(text);
   196     OstTrace0( TRACE_FLOW, WLANWIZARDPAGESSID_TEXTCHANGED,
   212     OstTrace0(
   197         "WlanWizardPageSsid::textChanged in text edit widget" );
   213         TRACE_FLOW,
       
   214         WLANWIZARDPAGESSID_TEXTCHANGED,
       
   215         "WlanWizardPageSsid::textChanged in text edit widget");
   198 
   216 
   199     mWizard->enableNextButton(!(mSsid->text().isEmpty()));
   217     mWizard->enableNextButton(!(mSsid->text().isEmpty()));
   200     OstTraceFunctionExit0( WLANWIZARDPAGESSID_TEXTCHANGED_EXIT );
   218 
   201 }
   219     OstTraceFunctionExit0(WLANWIZARDPAGESSID_TEXTCHANGED_EXIT);
       
   220 }