diff -r 92ab7f8d0eab -r 6bb1b21d2484 phonesettings/cpphonesettingsplugins/telephonyplugin/src/cptelephonypluginview.cpp --- a/phonesettings/cpphonesettingsplugins/telephonyplugin/src/cptelephonypluginview.cpp Fri Mar 19 09:28:42 2010 +0200 +++ b/phonesettings/cpphonesettingsplugins/telephonyplugin/src/cptelephonypluginview.cpp Fri Apr 16 14:58:25 2010 +0300 @@ -16,19 +16,20 @@ */ #include "cptelephonypluginview.h" -#include "cpplugincommon.h" #include "cppluginlogging.h" #include #include #include #include #include -#include +#include #include #include +#include +#include CpTelephonyPluginView::CpTelephonyPluginView() : - CpBaseSettingView(), + CpBaseSettingView(0,0), m_helper(NULL) { DPRINT << ": IN"; @@ -45,35 +46,32 @@ DPRINT << ": translator installed"; } - HbDataForm *form = settingForm(); + HbDataForm *form = qobject_cast(widget()); if (form) { HbDataFormModel *model = new HbDataFormModel; form->setHeading(hbTrId("Telephone settings")); // Create and initialize plugin's item data helper m_helper = initializeItemDataHelper(); - HbDataFormModelItem *item(NULL); + QList items; - DPRINT << ": Loading cpcallsplugin"; // Load calls plugin - item = groupItemFromPlugin("cpcallsplugin"); - if (item) { - model->appendDataFormItem(item); - } + DPRINT << ": Loading cpcallsplugin"; + items.append(groupItemFromPlugin("cpcallsplugin")); // Load diverts plugin DPRINT << ": Loading cpdivertsplugin"; - item = groupItemFromPlugin("cpdivertplugin"); - if (item) { - model->appendDataFormItem(item); - } + items.append(groupItemFromPlugin("cpdivertplugin")); + // Load call mailboxes plugin DPRINT << ": Loading vmbxcpplugin"; - item = groupItemFromPlugin("vmbxcpplugin"); - if (item) { - model->appendDataFormItem(item); + items.append(groupItemFromPlugin("vmbxcpplugin")); + + // Insert items to form model + foreach (CpSettingFormItemData* i, items) { + model->appendDataFormItem(i); } - + form->setModel(model); } @@ -89,23 +87,16 @@ DPRINT << ": OUT"; } -HbDataFormModelItem* CpTelephonyPluginView::groupItemFromPlugin( const QString& plugin ) +QList CpTelephonyPluginView::groupItemFromPlugin( const QString& plugin ) { DPRINT << ": IN"; - CpSettingFormItemData *item(NULL); - CpPluginPlatInterface *p(NULL); + QList items; + CpPluginInterface *p(NULL); try { - p = Tools::loadCpPlugin(plugin); + p = CpPluginLoader::loadCpPlugin(plugin); if (p && m_helper){ - item = p->createSettingFormItemData(*m_helper); - if (item){ - item->setType(HbDataFormModelItem::GroupItem); - QObject::connect( - settingForm(), SIGNAL(itemShown(QModelIndex)), - item, SLOT(itemShown(QModelIndex))); - DPRINT << "plugin:" << plugin; - } + items = p->createSettingFormItemData(*m_helper); } } catch(...) { DPRINT << "CATCH ERROR"; @@ -113,72 +104,13 @@ } DPRINT << ": OUT"; - return item; -} - -void CpTelephonyPluginView::onConnectionAdded(HbDataFormModelItem *item, - const QString &signal, - QObject *receiver, - const QString &method) -{ - DPRINT << ": IN"; - - if (HbDataForm *form = settingForm()) { - form->addConnection(item, signal.toAscii(), receiver, method.toAscii()); - } - - DPRINT << ": OUT"; -} - -void CpTelephonyPluginView::onConnectionRemoved(HbDataFormModelItem *item, - const QString &signal, - QObject *receiver, - const QString &method) -{ - DPRINT << ": IN"; - - if (HbDataForm *form = settingForm()) { - form->removeConnection(item, signal.toAscii(), receiver, method.toAscii()); - } - - DPRINT << ": OUT"; -} - -void CpTelephonyPluginView::onPrototypeAdded(HbAbstractViewItem *prototype) -{ - DPRINT << ": IN"; - - if (HbDataForm *form = settingForm()) { - QList prototypes = form->itemPrototypes(); - prototypes.append(prototype); - form->setItemPrototypes(prototypes); - } - - DPRINT << ": OUT"; + return items; } CpItemDataHelper* CpTelephonyPluginView::initializeItemDataHelper() { - DPRINT << ": IN"; - - CpItemDataHelper *itemDataHelper = new CpItemDataHelper; - DPRINT << "itemDataHelper:" << reinterpret_cast(itemDataHelper); - itemDataHelper->bindToForm(settingForm()); - connect(itemDataHelper, - SIGNAL(connectionAdded(HbDataFormModelItem*, QString, QObject *, QString)), - this, - SLOT(onConnectionAdded(HbDataFormModelItem*, QString, QObject *, QString))); - connect(itemDataHelper, - SIGNAL(connectionRemoved(HbDataFormModelItem*, QString, QObject *, QString)), - this, - SLOT(onConnectionRemoved(HbDataFormModelItem*, QString, QObject *, QString))); - connect(itemDataHelper, - SIGNAL(prototypeAdded(HbAbstractViewItem *)), - this, - SLOT(onPrototypeAdded(HbAbstractViewItem *))); - - DPRINT << ": OUT : helper signals connected"; - return itemDataHelper; + DPRINT; + return new CpItemDataHelper(qobject_cast(widget())); } // End of File.