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