void KopeteAccountConfig::load() { KopeteAccountLVI *lvi = 0L; m_view->mAccountList->clear(); QPtrList<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts(); for ( Kopete::Account *i = accounts.first() ; i; i = accounts.next() ) { // Insert the item after the previous one lvi = new KopeteAccountLVI( i, m_view->mAccountList ); lvi->setText( 0, i->protocol()->displayName() ); lvi->setPixmap( 0, i->accountIcon() ); lvi->setText( 1, i->accountLabel() ); } m_newColors.clear(); slotItemSelected(); }
void KopeteAccountConfig::slotRemoveAccount() { KopeteAccountLVI *lvi = static_cast<KopeteAccountLVI*>( m_view->mAccountList->selectedItem() ); if ( !lvi || !lvi->account() ) return; Kopete::Account *i = lvi->account(); if ( KMessageBox::warningContinueCancel( this, i18n( "Are you sure you want to remove the account \"%1\"?" ).arg( i->accountLabel() ), i18n( "Remove Account" ), KGuiItem(i18n( "Remove Account" ), "editdelete"), "askRemoveAccount", KMessageBox::Notify | KMessageBox::Dangerous ) == KMessageBox::Continue ) { Kopete::AccountManager::self()->removeAccount( i ); delete lvi; } }