Logo Search packages:      
Sourcecode: kmess version File versions

void AccountsManagerPage::deleteAccount (  )  [slot]

Delete the currently selected account

Definition at line 132 of file accountsmanagerpage.cpp.

References AccountsManager::deleteAccount(), AccountsManager::getAccountByHandle(), Account::getHandle(), and readProperties().

Referenced by AccountsManagerPage().

{
  if( accountsList_->selectedItems().isEmpty() )
  {
    kWarning() << "No account was selected for deletion!";
    return;
  }

  QListWidgetItem *selection = accountsList_->selectedItems().first();
  const QString &handle( selection->data( Qt::UserRole ).toString() );

  // Prevent deletion of the currently connected account
  KMessApplication *kmessApp = static_cast<KMessApplication*>( kapp );
  if( kmessApp->getContactListWindow()->isConnected()
  &&  CurrentAccount::instance()->getHandle() == handle )
  {
    kWarning() << "Cannot delete the current account!";
    return;
  }

  Account *account = accountsManager_->getAccountByHandle( handle );
  if( ! account )
  {
    return;
  }

  int result = KMessageBox::warningYesNo(
                                 this,
                                 i18n("<html>Are you sure you want to delete the account '%1' ?<br/>"
                                      "All settings of this account will be lost.</html>",
                                      handle ) );
  if( result != KMessageBox::Yes )
  {
    return;
  }

  accountsManager_->deleteAccount( account );

  // Refresh the accounts list
  readProperties();
}


Generated by  Doxygen 1.6.0   Back to index