wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp
changeset 56 de27cc8389dd
parent 46 2fbd1d709fe7
child 62 b47b808de481
equal deleted inserted replaced
50:d4198dcb9983 56:de27cc8389dd
    23 #include <HbLineEdit>
    23 #include <HbLineEdit>
    24 #include <HbLabel>
    24 #include <HbLabel>
    25 #include <QTextStream>
    25 #include <QTextStream>
    26 #include <QTime>
    26 #include <QTime>
    27 #include <HbMainWindow>
    27 #include <HbMainWindow>
       
    28 #include <HbParameterLengthLimiter>
    28 
    29 
    29 // User includes
    30 // User includes
    30 #include "wpswizardstepthreenumber.h"
    31 #include "wpswizardstepthreenumber.h"
    31 #include "wpswizard_p.h"
    32 #include "wpswizard_p.h"
    32 
    33 
    90         mLoader = new HbDocumentLoader(mWizard->mainWindow());
    91         mLoader = new HbDocumentLoader(mWizard->mainWindow());
    91         
    92         
    92         mLoader->load(":/docml/occ_wps_02_03.docml", &ok);
    93         mLoader->load(":/docml/occ_wps_02_03.docml", &ok);
    93         Q_ASSERT(ok);
    94         Q_ASSERT(ok);
    94         
    95         
    95         // Initialize orientation
       
    96         loadDocmlSection(mWizard->mainWindow()->orientation());
       
    97 
       
    98         mWidget = qobject_cast<HbWidget*> (mLoader->findWidget("occ_wps_P2"));
    96         mWidget = qobject_cast<HbWidget*> (mLoader->findWidget("occ_wps_P2"));
    99         Q_ASSERT(mWidget);
    97         Q_ASSERT(mWidget);
   100 
    98 
   101         mHeading= qobject_cast<HbLabel*> (mLoader->findWidget("label_heading"));
    99         mHeading= qobject_cast<HbLabel*> (mLoader->findWidget("label_heading"));
   102         Q_ASSERT(mHeading);
   100         Q_ASSERT(mHeading);
   103         
       
   104         bool connectOk = connect(
       
   105             mWizard->mainWindow(), 
       
   106             SIGNAL(orientationChanged(Qt::Orientation)),
       
   107             this, 
       
   108             SLOT(loadDocmlSection(Qt::Orientation)));
       
   109         Q_ASSERT(connectOk);
       
   110     } 
   101     } 
   111     
   102     
   112     OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_EXIT, this);
   103     OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_EXIT, this);
   113 
   104 
   114     return mWidget;
   105     return mWidget;
   164    @return bool Indicating whether next button is enabled or not.
   155    @return bool Indicating whether next button is enabled or not.
   165  */
   156  */
   166 bool WpsPageStepThreeNumber::showPage()
   157 bool WpsPageStepThreeNumber::showPage()
   167 {
   158 {
   168     int randomNumber = computeRandNumber();
   159     int randomNumber = computeRandNumber();
   169     mHeading->setPlainText(hbTrId(
   160     mHeading->setPlainText(
       
   161         HbParameterLengthLimiter(
   170             "txt_occ_dialog_enter_1_on_the_wireless_station_t").arg(
   162             "txt_occ_dialog_enter_1_on_the_wireless_station_t").arg(
   171             randomNumber));
   163                 QString::number(randomNumber)));
   172     mWizard->setPin(randomNumber);
   164     mWizard->setPin(randomNumber);
   173     return true;
   165     return true;
   174 }
   166 }
   175 
   167 
   176 /*!
   168 /*!
   222     accum += 3 * ((aPin / 10) % 10);
   214     accum += 3 * ((aPin / 10) % 10);
   223     int digit = (accum % 10);
   215     int digit = (accum % 10);
   224     OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_EXIT, this);
   216     OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_EXIT, this);
   225     return (10 - digit) % 10;
   217     return (10 - digit) % 10;
   226 }
   218 }
   227 
       
   228 /*!
       
   229    Loads docml at initialization phase and when HbMainWindow sends 
       
   230    orientation() signal.
       
   231    
       
   232    @param [in] orientation orientation to be loaded.
       
   233  */
       
   234 void WpsPageStepThreeNumber::loadDocmlSection(Qt::Orientation orientation)
       
   235 {
       
   236     bool ok = false;
       
   237 
       
   238     // Load the orientation specific section
       
   239     if (orientation == Qt::Horizontal) {
       
   240         mLoader->load(":/docml/occ_wps_02_03.docml", "landscape", &ok);
       
   241         Q_ASSERT(ok);
       
   242     } else {
       
   243         Q_ASSERT(orientation == Qt::Vertical);
       
   244         mLoader->load(":/docml/occ_wps_02_03.docml", "portrait", &ok);
       
   245         Q_ASSERT(ok);
       
   246     }
       
   247 }
       
   248