stateproviders/ftustateprovider/src/ftuwizardmenustate.cpp
changeset 16 208ec88db289
parent 14 88ff81299c11
equal deleted inserted replaced
15:4956c89a3c3f 16:208ec88db289
    26 #include <hbicon.h>
    26 #include <hbicon.h>
    27 #include <hbinstance.h>
    27 #include <hbinstance.h>
    28 #include <hblistview.h>
    28 #include <hblistview.h>
    29 #include <hbdocumentloader.h>
    29 #include <hbdocumentloader.h>
    30 #include <HbTranslator>
    30 #include <HbTranslator>
       
    31 #include <HbGroupBox>
       
    32 #include <HbListViewItem>
    31 
    33 
    32 #include <QStandardItemModel>
    34 #include <QStandardItemModel>
    33 #include <QDate>
    35 #include <QDate>
    34 #include <QTime>
    36 #include <QTime>
    35 #include <xqsettingsmanager.h>
    37 #include <xqsettingsmanager.h>
    77     mCenrepHandler = new FtuStateCenrepHandler(NULL);
    79     mCenrepHandler = new FtuStateCenrepHandler(NULL);
    78     int registeredPlugins = mCenrepHandler->registeredPluginCount();
    80     int registeredPlugins = mCenrepHandler->registeredPluginCount();
    79     for(int counter = 0; counter < registeredPlugins; counter ++){
    81     for(int counter = 0; counter < registeredPlugins; counter ++){
    80         mCompletedWizardList << mCenrepHandler->getPluginInfo(counter);
    82         mCompletedWizardList << mCenrepHandler->getPluginInfo(counter);
    81     }
    83     }
    82         
    84     connect(mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(changeListStrechingStyle(Qt::Orientation)));
    83 }
    85 }
    84 
    86 
    85 // ---------------------------------------------------------------------------
    87 // ---------------------------------------------------------------------------
    86 // FtuWizardMenuState::~FtuWizardMenuState
    88 // FtuWizardMenuState::~FtuWizardMenuState
    87 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
   181     {    
   183     {    
   182         // Connect for progress updates.
   184         // Connect for progress updates.
   183         connect(addedWizard, SIGNAL(progressUpdated(FtuWizard *, bool, int)), 
   185         connect(addedWizard, SIGNAL(progressUpdated(FtuWizard *, bool, int)), 
   184                 this, SLOT(updateProgress(FtuWizard *, bool, int)));
   186                 this, SLOT(updateProgress(FtuWizard *, bool, int)));
   185 
   187 
       
   188         connect(addedWizard, SIGNAL(wizardSettingsChanged(FtuWizard*)), 
       
   189                         this, SLOT(changeWizardSettings(FtuWizard*)));
       
   190         
       
   191         
   186         const FtuWizardSetting& settings = addedWizard->wizardSettings();
   192         const FtuWizardSetting& settings = addedWizard->wizardSettings();
   187         QStandardItem* newItem = new QStandardItem();
   193         QStandardItem* newItem = new QStandardItem();
   188         QList<QVariant> iconList;
   194         QList<QVariant> iconList;
   189         HbIcon icon (settings.mTocDefaultIcon.filePath() );
   195         HbIcon icon (settings.mTocDefaultIcon.filePath() );
   190         iconList.append(icon);
   196         iconList.append(icon);
   191         HbIcon rightIcon(QString(qtTrId("qtg_small_tick")));
   197         HbIcon rightIcon(QString(qtTrId("qtg_small_tick")));
   192         
   198         
   193         QStringList data;
   199         QStringList data;
   194         data << settings.mTocLabel;
   200         data << settings.mTocLabel;
       
   201         data << settings.mTocSecondaryLabel;
   195         QDate date = addedWizard->wizardCompletedDate();
   202         QDate date = addedWizard->wizardCompletedDate();
   196         if(date.isNull())
   203         if(!date.isNull())
   197         {
       
   198             data << emptyLine;
       
   199         }
       
   200         else
       
   201         {
   204         {
   202             //Plugin has already completed, Append tick mark on right side
   205             //Plugin has already completed, Append tick mark on right side
   203             iconList.append(rightIcon);
   206             iconList.append(rightIcon);
   204             data << updatedAsString(date);
   207         }
   205         }
   208         
   206 
   209 
   207         newItem->setData(iconList, Qt::DecorationRole);
   210         newItem->setData(iconList, Qt::DecorationRole);
   208         newItem->setData(QVariant(data), Qt::DisplayRole);
   211         newItem->setData(QVariant(data), Qt::DisplayRole);
   209 
   212 
   210         mModel->appendRow(newItem);        
   213         mModel->appendRow(newItem);        
   235 // FtWizardMenuState::createInfoText
   238 // FtWizardMenuState::createInfoText
   236 // ---------------------------------------------------------------------------
   239 // ---------------------------------------------------------------------------
   237 //
   240 //
   238 void FtuWizardMenuState::createInfoText()
   241 void FtuWizardMenuState::createInfoText()
   239 {
   242 {
   240     mInfoText = qobject_cast<HbLabel *>(mDocumentLoader->findWidget(TOC_INFOTEXT_LABEL));                               
   243     mInfoText = qobject_cast<HbGroupBox *>(mDocumentLoader->findWidget(TOC_INFOTEXT_LABEL));                               
   241     mInfoText->setPlainText(hbTrId("txt_ftu_subhead_select_setting_you_want_to_edit"));
   244     mInfoText->setHeading(hbTrId("txt_ftu_subhead_select_setting_you_want_to_edit"));
   242 }
   245 }
   243 
   246 
   244 // ---------------------------------------------------------------------------
   247 // ---------------------------------------------------------------------------
   245 // FtuWizardMenuState::activateWizard
   248 // FtuWizardMenuState::activateWizard
   246 // ---------------------------------------------------------------------------
   249 // ---------------------------------------------------------------------------
   286         iconList.append(icon);
   289         iconList.append(icon);
   287         HbIcon rightIcon(QString("qtg_small_tick"));
   290         HbIcon rightIcon(QString("qtg_small_tick"));
   288         
   291         
   289         if(progress < progressCompelete)
   292         if(progress < progressCompelete)
   290         {
   293         {
   291             QString progressStr;
   294             data << wizards[index]->wizardSettings().mTocSecondaryLabel;
   292             QString progressNumber;
       
   293             progressNumber.setNum(progress);
       
   294             progressStr = hbTrId("txt_ftu_list_progress_status").arg(progressNumber);
       
   295             data << progressStr;
       
   296         }
   295         }
   297         else
   296         else
   298         {         
   297         {   
   299             QDate date = wizards[index]->wizardCompletedDate();
   298             data << wizards[index]->wizardSettings().mTocSecondaryLabel;
   300             data << updatedAsString(date);
       
   301 
       
   302             //Plugin has completed 100%, Append tick mark on right side
   299             //Plugin has completed 100%, Append tick mark on right side
   303             iconList.append(rightIcon);
   300             iconList.append(rightIcon);
   304 
   301 
   305             XQSettingsManager settingsManager;
   302             XQSettingsManager settingsManager;
   306             
   303             
   313         }
   310         }
   314         mModel->item(index)->setData(QVariant(data), Qt::DisplayRole);
   311         mModel->item(index)->setData(QVariant(data), Qt::DisplayRole);
   315         mModel->item(index)->setData(iconList, Qt::DecorationRole);
   312         mModel->item(index)->setData(iconList, Qt::DecorationRole);
   316     }
   313     }
   317 }
   314 }
       
   315 
       
   316 // ---------------------------------------------------------------------------
       
   317 // FtuWizardMenuState::changeWizardSettings
       
   318 // ---------------------------------------------------------------------------
       
   319 //
       
   320 void FtuWizardMenuState::changeWizardSettings(FtuWizard* caller)
       
   321     {
       
   322     QList<FtuWizard*> wizards = content()->wizards();
       
   323         int index = -1;
       
   324         
       
   325         // Get the index of the wizard
       
   326         for(int i = 0 ; i < wizards.size() ; ++i)
       
   327         {
       
   328             if(caller == wizards[i])
       
   329             {
       
   330                 QDEBUG("::changeWizardSettings wizard found at: " << i;)
       
   331                 index = i;
       
   332             }
       
   333         }
       
   334         if(index != -1)
       
   335         {
       
   336 
       
   337             QStringList data;
       
   338             data << wizards[index]->wizardSettings().mTocLabel;
       
   339             data << wizards[index]->wizardSettings().mTocSecondaryLabel;
       
   340             QList<QVariant> iconList;
       
   341             HbIcon icon (wizards[index]->wizardSettings().mTocDefaultIcon.filePath());
       
   342             iconList.append(icon);
       
   343             HbIcon rightIcon(QString("qtg_small_tick")); 
       
   344             if(true == mCompletedWizardList[index])
       
   345                 {
       
   346                 iconList.append(rightIcon);
       
   347                 }
       
   348             mModel->item(index)->setData(QVariant(data), Qt::DisplayRole);
       
   349             mModel->item(index)->setData(iconList, Qt::DecorationRole);
       
   350         }
       
   351     }
       
   352 
       
   353 // ---------------------------------------------------------------------------
       
   354 // FtuWizardMenuState::changeListStrechingStyle
       
   355 // ---------------------------------------------------------------------------
       
   356 //
       
   357 void FtuWizardMenuState::changeListStrechingStyle(Qt::Orientation orientation)
       
   358 {
       
   359     HbListViewItem *prototypeItem = mListView->listItemPrototype();
       
   360     if (orientation == Qt::Vertical) {
       
   361         // change the streching style of list to no strech
       
   362         prototypeItem->setStretchingStyle(HbListViewItem::NoStretching );
       
   363         
       
   364     } else if (orientation == Qt::Horizontal) {
       
   365         // change the streching style of list to landscape strech
       
   366         prototypeItem->setStretchingStyle(HbListViewItem::StretchLandscape);
       
   367     }
       
   368 }
       
   369