示例#1
0
void addUser::ok() {
  QString tmp;
  uint newuid;
  tmp.setStr(leid->text());
  newuid = tmp.toInt();
  
  if (users->lookup(newuid) != NULL) {
    ksprintf(&tmp, i18n("User with UID %u already exists"), newuid);
    err->addMsg(tmp, STOP);
    err->display();
    return;
  }

  check();
  
  if (createhome->isChecked()) {
    if (checkHome())
      user->setCreateHome(1);

    if (checkMailBox())
      user->setCreateMailBox(1);
  }

  if (copyskel->isChecked())
    user->setCopySkel(1);

  accept();
}
示例#2
0
void addUser::slotOk()
{
  KU::KUser *user = mUsers.first();

  if ( !check() ) return;

  mergeUser( user, user );

  if ( ( user->getCaps() & KU::KUser::Cap_POSIX ) && 
    kug->getUsers().lookup( user->getUID() ) ) {
    KMessageBox::sorry( 0, i18n("User with UID %1 already exists.").arg( user->getUID() ) );
    return;
  }

  if ( ( kug->getUsers().getCaps() & KU::KUsers::Cap_Samba ) && 
     ( user->getCaps() & KU::KUser::Cap_Samba ) ) {
    if ( kug->getUsers().lookup_sam( user->getSID().getRID() ) ) {
      KMessageBox::sorry( 0, i18n("User with RID %1 already exists.").arg( user->getSID().getRID() ) );
      return;
    }
  }

  if (createhome->isChecked())
  {
    user->setCreateHome(true);
    user->setCreateMailBox(true);
  }
  if (copyskel->isChecked())
  {
    user->setCopySkel(true);
  }

  if (user->getCreateHome() && !checkHome())
     return;

  if (user->getCreateMailBox() && !checkMailBox())
     user->setCreateMailBox(false);

  saveg();
  accept();
}