Revision: 201037 PDK_4.0.a
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 00:06:49 +0300
changeset 16 208ec88db289
parent 15 4956c89a3c3f
Revision: 201037 Kit: 201039
stateproviders/ftustateprovider/inc/ftuwizardmenustate.h
stateproviders/ftustateprovider/resources/ftustateprovider.docml
stateproviders/ftustateprovider/src/ftuwizardmenustate.cpp
--- a/stateproviders/ftustateprovider/inc/ftuwizardmenustate.h	Fri Sep 17 08:27:43 2010 +0300
+++ b/stateproviders/ftustateprovider/inc/ftuwizardmenustate.h	Mon Oct 04 00:06:49 2010 +0300
@@ -22,6 +22,7 @@
 #include <QAbstractItemModel>
 #include <QState>
 #include "ftutest_global.h"
+#include <ftuwizard.h>
 
 FTU_TEST_CLASS(FtuStateProviderTest)
 
@@ -38,6 +39,7 @@
 class FtuStateCenrepHandler;
 class HbMenu;
 class HbTranslator;
+class HbGroupBox;
 
 /** @ingroup group_ftustateprovider
  * @brief The state where wizard menu is shown
@@ -124,6 +126,15 @@
      */    
     void updateProgress(FtuWizard *caller, bool show, int progress);
     
+	/**
+     * Signalled when user changes WizardSettings
+     */
+    void changeWizardSettings(FtuWizard *caller);
+    
+    /**
+     * changes the streching style of the list
+     */
+    void changeListStrechingStyle(Qt::Orientation);    
 signals:
 
     /**
@@ -136,7 +147,7 @@
 
     HbMainWindow*                           mMainWindow;
     HbView*                                 mTocView;
-    HbLabel*                                mInfoText;
+    HbGroupBox*                             mInfoText;
     HbListView*                             mListView;    
     HbDocumentLoader*                       mDocumentLoader;
 
--- a/stateproviders/ftustateprovider/resources/ftustateprovider.docml	Fri Sep 17 08:27:43 2010 +0300
+++ b/stateproviders/ftustateprovider/resources/ftustateprovider.docml	Mon Oct 04 00:06:49 2010 +0300
@@ -2,25 +2,21 @@
 <hbdocument version="1.1">
     <widget name="tocView" type="HbView">
         <widget name="content" role="HbView:widget" type="HbWidget">
-            <widget name="tocInfoTextLabel" type="HbLabel">
-                <real name="z" value="1"/>
-                <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
-                <sizehint height="5un" type="PREFERRED" width="45.97015un"/>
-            </widget>
             <widget name="tocListView" type="HbListView">
                 <real name="z" value="2"/>
                 <sizepolicy horizontalPolicy="Expanding" horizontalStretch="0" verticalPolicy="Expanding" verticalStretch="0"/>
                 <sizehint height="81.04478un" type="PREFERRED" width="51.64179un"/>
             </widget>
+            <widget name="tocInfoTextLabel" type="HbGroupBox">
+                <sizehint type="PREFERRED" width="25un"/>
+                <sizehint height="4.7un" type="MINIMUM"/>
+                <bool name="collapsable" value="FALSE"/>
+                <string name="heading"/>
+            </widget>
             <real name="z" value="0"/>
-            <layout type="anchor">
-                <anchoritem dst="tocInfoTextLabel" dstEdge="LEFT" spacing="1un" src="" srcEdge="LEFT"/>
-                <anchoritem dst="tocInfoTextLabel" dstEdge="TOP" spacing="1un" src="" srcEdge="TOP"/>
-                <anchoritem dst="tocInfoTextLabel" dstEdge="RIGHT" spacing="-1un" src="" srcEdge="RIGHT"/>
-                <anchoritem dst="tocListView" dstEdge="LEFT" spacing="1un" src="" srcEdge="LEFT"/>
-                <anchoritem dst="tocListView" dstEdge="TOP" spacing="6un" src="" srcEdge="TOP"/>
-                <anchoritem dst="tocListView" dstEdge="RIGHT" spacing="-1un" src="" srcEdge="RIGHT"/>
-                <anchoritem dst="tocListView" dstEdge="BOTTOM" spacing="-1un" src="" srcEdge="BOTTOM"/>
+            <layout orientation="Vertical" type="linear">
+                <linearitem itemname="tocInfoTextLabel"/>
+                <linearitem itemname="tocListView"/>
             </layout>
         </widget>
     </widget>
--- a/stateproviders/ftustateprovider/src/ftuwizardmenustate.cpp	Fri Sep 17 08:27:43 2010 +0300
+++ b/stateproviders/ftustateprovider/src/ftuwizardmenustate.cpp	Mon Oct 04 00:06:49 2010 +0300
@@ -28,6 +28,8 @@
 #include <hblistview.h>
 #include <hbdocumentloader.h>
 #include <HbTranslator>
+#include <HbGroupBox>
+#include <HbListViewItem>
 
 #include <QStandardItemModel>
 #include <QDate>
@@ -79,7 +81,7 @@
     for(int counter = 0; counter < registeredPlugins; counter ++){
         mCompletedWizardList << mCenrepHandler->getPluginInfo(counter);
     }
-        
+    connect(mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(changeListStrechingStyle(Qt::Orientation)));
 }
 
 // ---------------------------------------------------------------------------
@@ -183,6 +185,10 @@
         connect(addedWizard, SIGNAL(progressUpdated(FtuWizard *, bool, int)), 
                 this, SLOT(updateProgress(FtuWizard *, bool, int)));
 
+        connect(addedWizard, SIGNAL(wizardSettingsChanged(FtuWizard*)), 
+                        this, SLOT(changeWizardSettings(FtuWizard*)));
+        
+        
         const FtuWizardSetting& settings = addedWizard->wizardSettings();
         QStandardItem* newItem = new QStandardItem();
         QList<QVariant> iconList;
@@ -192,17 +198,14 @@
         
         QStringList data;
         data << settings.mTocLabel;
+        data << settings.mTocSecondaryLabel;
         QDate date = addedWizard->wizardCompletedDate();
-        if(date.isNull())
-        {
-            data << emptyLine;
-        }
-        else
+        if(!date.isNull())
         {
             //Plugin has already completed, Append tick mark on right side
             iconList.append(rightIcon);
-            data << updatedAsString(date);
         }
+        
 
         newItem->setData(iconList, Qt::DecorationRole);
         newItem->setData(QVariant(data), Qt::DisplayRole);
@@ -237,8 +240,8 @@
 //
 void FtuWizardMenuState::createInfoText()
 {
-    mInfoText = qobject_cast<HbLabel *>(mDocumentLoader->findWidget(TOC_INFOTEXT_LABEL));                               
-    mInfoText->setPlainText(hbTrId("txt_ftu_subhead_select_setting_you_want_to_edit"));
+    mInfoText = qobject_cast<HbGroupBox *>(mDocumentLoader->findWidget(TOC_INFOTEXT_LABEL));                               
+    mInfoText->setHeading(hbTrId("txt_ftu_subhead_select_setting_you_want_to_edit"));
 }
 
 // ---------------------------------------------------------------------------
@@ -288,17 +291,11 @@
         
         if(progress < progressCompelete)
         {
-            QString progressStr;
-            QString progressNumber;
-            progressNumber.setNum(progress);
-            progressStr = hbTrId("txt_ftu_list_progress_status").arg(progressNumber);
-            data << progressStr;
+            data << wizards[index]->wizardSettings().mTocSecondaryLabel;
         }
         else
-        {         
-            QDate date = wizards[index]->wizardCompletedDate();
-            data << updatedAsString(date);
-
+        {   
+            data << wizards[index]->wizardSettings().mTocSecondaryLabel;
             //Plugin has completed 100%, Append tick mark on right side
             iconList.append(rightIcon);
 
@@ -315,3 +312,58 @@
         mModel->item(index)->setData(iconList, Qt::DecorationRole);
     }
 }
+
+// ---------------------------------------------------------------------------
+// FtuWizardMenuState::changeWizardSettings
+// ---------------------------------------------------------------------------
+//
+void FtuWizardMenuState::changeWizardSettings(FtuWizard* caller)
+    {
+    QList<FtuWizard*> wizards = content()->wizards();
+        int index = -1;
+        
+        // Get the index of the wizard
+        for(int i = 0 ; i < wizards.size() ; ++i)
+        {
+            if(caller == wizards[i])
+            {
+                QDEBUG("::changeWizardSettings wizard found at: " << i;)
+                index = i;
+            }
+        }
+        if(index != -1)
+        {
+
+            QStringList data;
+            data << wizards[index]->wizardSettings().mTocLabel;
+            data << wizards[index]->wizardSettings().mTocSecondaryLabel;
+            QList<QVariant> iconList;
+            HbIcon icon (wizards[index]->wizardSettings().mTocDefaultIcon.filePath());
+            iconList.append(icon);
+            HbIcon rightIcon(QString("qtg_small_tick")); 
+            if(true == mCompletedWizardList[index])
+                {
+                iconList.append(rightIcon);
+                }
+            mModel->item(index)->setData(QVariant(data), Qt::DisplayRole);
+            mModel->item(index)->setData(iconList, Qt::DecorationRole);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// FtuWizardMenuState::changeListStrechingStyle
+// ---------------------------------------------------------------------------
+//
+void FtuWizardMenuState::changeListStrechingStyle(Qt::Orientation orientation)
+{
+    HbListViewItem *prototypeItem = mListView->listItemPrototype();
+    if (orientation == Qt::Vertical) {
+        // change the streching style of list to no strech
+        prototypeItem->setStretchingStyle(HbListViewItem::NoStretching );
+        
+    } else if (orientation == Qt::Horizontal) {
+        // change the streching style of list to landscape strech
+        prototypeItem->setStretchingStyle(HbListViewItem::StretchLandscape);
+    }
+}
+