wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp
changeset 46 2fbd1d709fe7
child 47 b3d8f88532b7
child 56 de27cc8389dd
equal deleted inserted replaced
45:d9ec2b8c6bad 46:2fbd1d709fe7
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *   WPS Wizard Page: Step 3 Push button number
       
    16  *
       
    17  */
       
    18 
       
    19 // System includes
       
    20 #include <HbDocumentLoader>
       
    21 #include <HbWidget>
       
    22 #include <HbRadioButtonList>
       
    23 #include <HbLineEdit>
       
    24 #include <HbLabel>
       
    25 #include <HbMainwindow>
       
    26 
       
    27 // User includes
       
    28 #include "wpswizardstepthreebutton.h"
       
    29 #include "wpswizard_p.h"
       
    30 
       
    31 // Trace includes
       
    32 #include "OstTraceDefinitions.h"
       
    33 #ifdef OST_TRACE_COMPILER_IN_USE
       
    34 #include "wpswizardstepthreebuttonTraces.h"
       
    35 #endif
       
    36 
       
    37 // External function prototypes
       
    38 
       
    39 // Local constants
       
    40 
       
    41 /*!
       
    42    \class WpsPageStepThreeButton
       
    43    \brief Implementation of wps wizard page for step three button press mode.
       
    44  */
       
    45 
       
    46 // ======== LOCAL FUNCTIONS ========
       
    47 
       
    48 // ======== MEMBER FUNCTIONS ========
       
    49 
       
    50 /*!
       
    51    Constructor for WPS page three button
       
    52    
       
    53    @param [in] parent Pointer to the WPS wizard private implementation 
       
    54  */
       
    55 WpsPageStepThreeButton::WpsPageStepThreeButton(WpsWizardPrivate* parent) :
       
    56     WpsWizardPage(parent), 
       
    57     mWidget(NULL), 
       
    58     mHeading(NULL),
       
    59     mLoader(NULL)
       
    60 {
       
    61     OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_ENTRY, this); 
       
    62     OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_EXIT, this);
       
    63 
       
    64 }
       
    65 
       
    66 /*!
       
    67    Destructor
       
    68  */
       
    69 WpsPageStepThreeButton::~WpsPageStepThreeButton()
       
    70 {
       
    71     OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_DESTRUCTOR_ENTRY, this);
       
    72     delete mLoader;
       
    73     OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_WPSPAGESTEPTHREEBUTTON_DESTRUCTOR_EXIT, this);
       
    74 }
       
    75 
       
    76 /*!
       
    77    Loads the page with all the widgets
       
    78    
       
    79    @return HbWidget* Returns the view widget
       
    80  */
       
    81 HbWidget* WpsPageStepThreeButton::initializePage()
       
    82 {
       
    83     OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_ENTRY, this);
       
    84 
       
    85     if (!mWidget) {
       
    86         bool ok;
       
    87         mLoader = new HbDocumentLoader(mWizard->mainWindow());
       
    88         
       
    89         mLoader->load(":/docml/occ_wps_02_03.docml", &ok);
       
    90         Q_ASSERT(ok);
       
    91         
       
    92         // Initialize orientation
       
    93         loadDocmlSection(mWizard->mainWindow()->orientation());
       
    94 
       
    95         mWidget = qobject_cast<HbWidget*> (mLoader->findWidget("occ_wps_P2"));
       
    96         Q_ASSERT(mWidget);
       
    97 
       
    98         mHeading = qobject_cast<HbLabel*> (mLoader->findWidget("label_heading"));
       
    99         Q_ASSERT(mHeading);
       
   100         
       
   101         mHeading->setPlainText(hbTrId("txt_occ_dialog_first_press_button_on_the_wireless"));
       
   102         
       
   103         bool connectOk = connect(
       
   104             mWizard->mainWindow(), 
       
   105             SIGNAL(orientationChanged(Qt::Orientation)),
       
   106             this, 
       
   107             SLOT(loadDocmlSection(Qt::Orientation)));
       
   108        Q_ASSERT(connectOk);
       
   109     } 
       
   110     
       
   111     OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_EXIT, this);
       
   112     return mWidget;
       
   113 }
       
   114 
       
   115 /*!
       
   116    Funtion to determine the next page to be displayed in the wizard process
       
   117    
       
   118    @param [out] removeFromStack bool indicating whether the current page should be 
       
   119    removed from the stack
       
   120    
       
   121    @return int Page Id of the next page to be displayed.
       
   122  */
       
   123 int WpsPageStepThreeButton::nextId(bool &removeFromStack) const
       
   124 {
       
   125     OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_NEXTID_ENTRY, this);
       
   126     removeFromStack = false;
       
   127     OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_NEXTID_EXIT, this);
       
   128 
       
   129     return WpsWizardPage::PageWpsWizardStep4;
       
   130 }
       
   131 
       
   132 /*!
       
   133    Determines the Number of steps to move backwards when 'Prev' Button
       
   134    is clicked
       
   135    
       
   136    @return int Number of pages to move backwards
       
   137  */
       
   138 int WpsPageStepThreeButton::previousTriggered()
       
   139 {
       
   140     OstTraceFunctionEntry1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_ENTRY, this); 
       
   141     OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_PREVIOUSTRIGGERED_EXIT, this);
       
   142     return (PageWpsWizardStep3_Button - PageWpsWizardStep2);
       
   143 }
       
   144 
       
   145 /*!
       
   146    Loads docml at initialization phase and when HbMainWindow sends 
       
   147    orientation() signal.
       
   148    
       
   149    @param [in] orientation orientation to be loaded.
       
   150  */
       
   151 void WpsPageStepThreeButton::loadDocmlSection(Qt::Orientation orientation)
       
   152 {
       
   153     bool ok = false;
       
   154     
       
   155     // Load the orientation specific section
       
   156     if (orientation == Qt::Horizontal) {
       
   157         mLoader->load(":/docml/occ_wps_02_03.docml", "landscape", &ok);
       
   158         Q_ASSERT(ok);
       
   159     } else {
       
   160         Q_ASSERT(orientation == Qt::Vertical);
       
   161         mLoader->load(":/docml/occ_wps_02_03.docml", "portrait", &ok);
       
   162         Q_ASSERT(ok);
       
   163     }
       
   164 }
       
   165