void OptionsWidget_identityProfile::commit() { KviIdentityProfileSet::instance()->clear(); if(m_pTreeWidget->topLevelItemCount()) { KviIdentityProfileSet::instance()->setEnabled(m_pProfilesCheck->isChecked()); QTreeWidgetItem * pItem; for(int i=0; i < m_pTreeWidget->topLevelItemCount(); i++) { pItem = (QTreeWidgetItem *)m_pTreeWidget->topLevelItem(i); KviIdentityProfile * pProfile = new KviIdentityProfile(); pProfile->setName(pItem->text(0)); pProfile->setNetwork(pItem->text(1)); pProfile->setNick(pItem->text(2)); pProfile->setAltNick(pItem->text(3)); pProfile->setUserName(pItem->text(4)); pProfile->setRealName(pItem->text(5)); KviIdentityProfileSet::instance()->addProfile(pProfile); } } KviOptionsWidget::commit(); }
void OptionsWidget_identityProfile::editProfileEntry() { QTreeWidgetItem * pItem = (QTreeWidgetItem *)m_pTreeWidget->currentItem(); if(!pItem) return; // Fill in the editor data KviIdentityProfile profile; profile.setName(pItem->text(0)); profile.setNetwork(pItem->text(1)); profile.setNick(pItem->text(2)); profile.setAltNick(pItem->text(3)); profile.setUserName(pItem->text(4)); profile.setRealName(pItem->text(5)); m_iCurrentEditedProfile=m_pTreeWidget->indexOfTopLevelItem(pItem); if(m_pEditor) delete m_pEditor; m_pEditor = new IdentityProfileEditor(this); if(m_pEditor->editProfile(&profile)) { pItem->setText(0,profile.name()); pItem->setText(1,profile.network()); pItem->setText(2,profile.nick()); pItem->setText(3,profile.altNick()); pItem->setText(4,profile.userName()); pItem->setText(5,profile.realName()); } }