ipsservices/nmipssettings/src/nmipssettingsplugin.cpp
changeset 57 ae34e1715e21
parent 51 d845db10c0d4
child 62 a8c646b56683
equal deleted inserted replaced
56:15bc1d5d6267 57:ae34e1715e21
   133                 this, SIGNAL(goOffline(const NmId &)));
   133                 this, SIGNAL(goOffline(const NmId &)));
   134 
   134 
   135         connect(mSettingsHelper, SIGNAL(createUserDefinedMode()),
   135         connect(mSettingsHelper, SIGNAL(createUserDefinedMode()),
   136                 this, SLOT(createUserDefinedMode()));
   136                 this, SLOT(createUserDefinedMode()));
   137         
   137         
   138         connect(mForm, SIGNAL(pressed(QModelIndex)),
       
   139                 this, SLOT(itemPress(QModelIndex)));
       
   140         // Get the value if some ui items need to be hidden.
   138         // Get the value if some ui items need to be hidden.
   141         QVariant data;
   139         QVariant data;
   142         mSettingsManager->readSetting(IpsServices::UserNameHidden, data);
   140         mSettingsManager->readSetting(IpsServices::UserNameHidden, data);
   143         mHiddenItem = data.toBool();
   141         mHiddenItem = data.toBool();
   144         // Add items to the model.
   142         // Add items to the model.
   655         mSettingsHelper->handleReceivingScheduleSettingChange(
   653         mSettingsHelper->handleReceivingScheduleSettingChange(
   656             IpsServices::ReceptionInboxSyncWindow, selectedValue);
   654             IpsServices::ReceptionInboxSyncWindow, selectedValue);
   657     }
   655     }
   658 }
   656 }
   659 
   657 
   660 /*!
       
   661     Called when item is pressed on the view.
       
   662 
       
   663     \param index Index to the pressed item.
       
   664 */
       
   665 void NmIpsSettingsPlugin::itemPress(const QModelIndex &index)
       
   666 {
       
   667     NM_FUNCTION;
       
   668     
       
   669     int type(index.data(HbDataFormModelItem::ItemTypeRole).toInt());
       
   670     
       
   671     if (type == HbDataFormModelItem::GroupItem) {
       
   672         // Scroll the groupitem to top if needed.
       
   673         HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index));
       
   674         bool expanded = item->isExpanded();
       
   675         
       
   676         if (!expanded) {
       
   677             mForm->scrollTo(index, HbAbstractItemView::PositionAtTop);
       
   678         }
       
   679     }
       
   680     
       
   681     if (type == HbDataFormModelItem::TextItem) {
       
   682         // Turn off predictive input for line-edit.
       
   683         HbDataFormViewItem *item = static_cast<HbDataFormViewItem *>(mForm->itemByIndex(index));
       
   684         HbWidget *widget = item->dataItemContentWidget();
       
   685         widget->setInputMethodHints(Qt::ImhNoPredictiveText);
       
   686     }
       
   687 }
       
   688 Q_EXPORT_PLUGIN2(nmipssettings, NmIpsSettingsPlugin);
   658 Q_EXPORT_PLUGIN2(nmipssettings, NmIpsSettingsPlugin);