wlanutilities/wlanwizard/inc/wlanwizard_p.h
branchRCL_3
changeset 25 f28ada11abbf
parent 24 63be7eb3fc78
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
     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 * WLAN Wizard: Private implementation.
       
    16 */
       
    17 
       
    18 #ifndef WLANWIZARD_P_H
       
    19 #define WLANWIZARD_P_H
       
    20 
       
    21 // System includes
       
    22 #include <QObject>
       
    23 #include <QHash>
       
    24 
       
    25 // User includes
       
    26 #include "wlanwizardhelper.h"
       
    27 
       
    28 // Forward declarations
       
    29 class QTimer;
       
    30 class HbTranslator;
       
    31 class HbStackedWidget;
       
    32 class HbWidget;
       
    33 class HbLabel;
       
    34 class HbDialog;
       
    35 class HbAction;
       
    36 class HbDocumentLoader;
       
    37 class HbMainWindow;
       
    38 class WlanQtUtils;
       
    39 class WlanWizardPlugin;
       
    40 class WlanWizardPage;
       
    41 class WlanWizard;
       
    42 class EapWizard;
       
    43 class WpsWizard;
       
    44 
       
    45 class TestWlanWizardContext;
       
    46 
       
    47 // External data types
       
    48 
       
    49 // Constants
       
    50 
       
    51 /*!
       
    52    @addtogroup group_wlan_wizard
       
    53    @{   
       
    54  */
       
    55 class WlanWizardPrivate: public QObject, public WlanWizardHelper
       
    56 {
       
    57 	Q_OBJECT
       
    58 
       
    59 public:
       
    60     // API implementation
       
    61     WlanWizardPrivate(WlanWizard* wizard, HbMainWindow *mainWindow);
       
    62     virtual ~WlanWizardPrivate();
       
    63 
       
    64     void setParameters(
       
    65         const QString &ssid, 
       
    66         int networkMode, 
       
    67         int securityMode,
       
    68         bool usePsk, 
       
    69         bool wps);
       
    70 
       
    71     void show();
       
    72 
       
    73 public:
       
    74     // For WLAN Wizard pages
       
    75     int getNextPageId(
       
    76         const QString &ssid, 
       
    77         int networkMode, 
       
    78         int securityMode,
       
    79         bool usePsk, 
       
    80         bool hidden, 
       
    81         bool wps);
       
    82     
       
    83     WlanQtUtils* wlanQtUtils() const;
       
    84     WlanWizardPlugin* wlanWizardPlugin() const;
       
    85     bool isEapEnabled() const;
       
    86     bool handleIap();
       
    87 
       
    88 public:
       
    89     // from WlanWizardHelper, for all wizards
       
    90     virtual QVariant configuration(ConfigurationId confId) const;
       
    91     virtual void setConfiguration(ConfigurationId confId, const QVariant &value);
       
    92     virtual void clearConfiguration(ConfigurationId confId);
       
    93     virtual bool configurationExists(ConfigurationId confId);
       
    94     virtual void enableNextButton(bool enable);
       
    95     virtual void addPage(int pageId, WlanWizardPage *page);
       
    96     virtual void nextPage();
       
    97     virtual HbMainWindow* mainWindow() const;
       
    98     virtual bool isCurrentPage(const HbWidget *page) const;
       
    99     virtual int nextPageId(bool useWps);
       
   100 
       
   101 signals:
       
   102     
       
   103 public slots:
       
   104 
       
   105     void cancelTriggered();
       
   106     
       
   107 protected:
       
   108 
       
   109 protected slots:
       
   110 
       
   111 private:
       
   112     Q_DISABLE_COPY(WlanWizardPrivate)
       
   113     static const int PageTimeout = 1500;
       
   114 
       
   115 private slots:
       
   116     void previousTriggered();
       
   117     void nextTriggered();
       
   118     void finishTriggered();
       
   119     void onTimeOut();
       
   120     void startPageOperation();
       
   121     
       
   122 private:
       
   123     void toNextPage();
       
   124     void showPage(int pageId, bool removeFromStack);
       
   125     void createPages();
       
   126     void closeViews();
       
   127     void updateFrame(int pageId);
       
   128     void loadDocml();
       
   129     void disconnectActions();
       
   130 
       
   131 private:
       
   132     // Not owned pointers
       
   133     //! Pointer to Wizard API class, needed to send signals
       
   134     WlanWizard *q_ptr;
       
   135     //! Pointer to mainwindow from where the wizard was launched
       
   136     HbMainWindow *mMainWindow;
       
   137     //! used for timer protected pages (progressbar)
       
   138     QTimer *mPageTimer;
       
   139     //! Wizard heading aka HbDialog::heading
       
   140     HbLabel *mTitle;
       
   141     //! Toolbar action: Next
       
   142     HbAction *mActionNext;
       
   143     //! Toolbar action: Previous
       
   144     HbAction *mActionPrevious;
       
   145     //! Toolbar action: Finish
       
   146     HbAction *mActionFinish;
       
   147     //! Toolbar action: Cancel
       
   148     HbAction *mActionCancel;
       
   149     /*! acts as HbDialog::contentWidget. When next is clicked a wizard page
       
   150        (HbWidget) is added to the stack. When prev is pressed the current
       
   151         item is removed from the stack. The previous pages are always in the
       
   152         stacked widget
       
   153      */
       
   154     HbStackedWidget *mStackedWidget;
       
   155     
       
   156     // Owned pointers
       
   157     
       
   158     //! Dialog, from docml
       
   159     QScopedPointer<HbDialog> mDialog;
       
   160     //! Translator
       
   161     QScopedPointer<HbTranslator> mTranslator;
       
   162     //! Provides services like: create/update iap, scan, connect, disconnect
       
   163     QScopedPointer<WlanQtUtils> mWlanQtUtils;
       
   164     //! Document loader for docml
       
   165     QScopedPointer<HbDocumentLoader> mDocLoader;
       
   166     //! Extensible Authentication Protocol (EAP) Wizard plugin, instantiated
       
   167     //! when required
       
   168     QScopedPointer<EapWizard> mEapWizard;
       
   169     //! Wifi Protected Setup (WPS) Wizard plugin, instantiated when required
       
   170     QScopedPointer<WpsWizard> mWpsWizard;
       
   171     //! Maps UI object of page into a control object
       
   172     QHash<HbWidget* , WlanWizardPage *> mPageMapper;
       
   173     //! Maps page id to control object of page.
       
   174     QHash<int, WlanWizardPage *> mPages;
       
   175 
       
   176     //! Holds wlan wizard configurations. 
       
   177     QHash<ConfigurationId, QVariant> mConfigurations;
       
   178     //! holds the page id which is displayed when WlanWizard::show() is called
       
   179     int mFirstPageId;
       
   180     //! Flag to keep track if movement to next page is allowed when timer is used
       
   181     bool mPageFinished;
       
   182     //! flag to indicate that wizard has been closed via either cancel or finish
       
   183     bool mClosed;
       
   184     
       
   185     // Friend classes
       
   186     friend class WlanWizard;
       
   187     friend class TestWlanWizardContext;
       
   188 };
       
   189 
       
   190 /*! @} */
       
   191 
       
   192 #endif // WLANWIZARD_P_H