示例#1
0
void SimpleAddCode::passwordChanged()
{
    int passError = back->validatePassword(passBox->text(), confirmPassBox->text());
    
    QColor passBoxColour = white;
    passBox->setToolTip(tr("Passwords match"));
    
    switch (passError)
    {
    case 1:
	passBox->setToolTip("");
	break;
    case 2:
        passBoxColour = red;
	passBox->setToolTip(tr("Passwords do not match"));
	break;
    case 3:
        passBoxColour = red;
        passBox->setToolTip(tr("Invalid input"));
    }
    
    QPalette bgPal(passBoxColour);
    bgPal.setColor(QPalette::Window,passBoxColour);
    passBox->setPalette(bgPal);

}
示例#2
0
void SimpleAddCode::usernameChanged()
{
    QString username = usernameBox->text().toLower();
    usernameBox->setText(username);
    
    //Validate
    int usernameError = back->validateUsername(username);
    
    QColor usernameBoxColour = white;
    usernameBox->setToolTip( tr("Good Input"));
    
    switch (usernameError) 
    {
    case 1:
	usernameBox->setToolTip( tr("The field is empty"));
	break;
    case 2:
	usernameBoxColour = red;
	usernameBox->setToolTip( tr("This field can only accept letters and numbers"));
	break;
    case 3:
	usernameBoxColour = red;
	usernameBox->setToolTip(tr("This username is already in use, please choose another."));
    }
    
    QPalette bgPal(usernameBoxColour);
    bgPal.setColor(QPalette::Window,usernameBoxColour);
    usernameBox->setPalette(bgPal);

}
示例#3
0
void AddDlgCode::homeChanged()
{
    int homeError = back->validateHome(homeBox->text());
    
    QColor homeBoxColour = white;
    homeBox->setToolTip(tr("Directory will be used"));
    
    switch (homeError)
    {
    case 1:
	homeBox->setToolTip( tr("The field is empty"));
	break;
    case 2:
	homeBoxColour = red;
	homeBox->setToolTip(tr("Invalid Path!"));
	break;
    case 3:
	homeBox->setToolTip( tr("Directory does not exist, but will be made"));
	break;
    case 4:
	homeBoxColour = orange;
	homeBox->setToolTip(tr("Placing home directory outside '/home/' can cause compatibility problems with some programs. NOT RECOMMENDED"));
	break;
    case 5:
	homeBoxColour = red;
	homeBox->setToolTip(tr("Requested path is a file (not a directory!)"));
	break;
    }
    
    QPalette bgPal(homeBoxColour);
    bgPal.setColor(QPalette::Window,homeBoxColour);
    homeBox->setPalette(bgPal);

}
示例#4
0
void AddDlgCode::changeUID(){
  QColor uidBoxColour = white;
  if(radio_autoUID->isChecked()){
    spin_customUID->setEnabled(false);
  }else{
    spin_customUID->setEnabled(true);
    if( back->validateUID(spin_customUID->value()) ){
      uidBoxColour = red;
    }
  }
  QPalette bgPal(uidBoxColour);
  bgPal.setColor(QPalette::Window,uidBoxColour);
  spin_customUID->setPalette(bgPal);
}
示例#5
0
void AddDlgCode::usernameChanged()
{
    QString username = usernameBox->text().toLower();
    usernameBox->setText(username);
    
    QString groupText = tr("New Group");
    if (username != "")
    {
	groupText+=" (";
	groupText+=username;
	groupText+=")";
    }
    groupRadioNew->setText(groupText);
    
    QString homeDir = "/usr/home/";
    homeDir+=username;
    if (username != "") {
	homeDir+="/";
    }
    homeBox->setText(homeDir);
    
    //Validate
    int usernameError = back->validateUsername(username);
    
    QColor usernameBoxColour = white;
    usernameBox->setToolTip(tr("Good Input"));
    
    switch (usernameError) 
    {
    case 1:
	usernameBox->setToolTip( tr("The field is empty"));
	break;
    case 2:
	usernameBoxColour = red;
	usernameBox->setToolTip(tr("This field can only accept letters and numbers"));
	break;
    case 3:
	usernameBoxColour = red;
	usernameBox->setToolTip(tr("This username is already in use, please choose another."));
    }
    
    QPalette bgPal(usernameBoxColour);
    bgPal.setColor(QPalette::Window,usernameBoxColour);
    usernameBox->setPalette(bgPal);

}
示例#6
0
void SimpleAddCode::fullnameChanged()
{
    int fullnameError = back->validateFullname(fullnameBox->text());
    
    QColor fullnameBoxColour = white;
    fullnameBox->setToolTip(tr("Good Input"));
    
    switch(fullnameError)
    {
    case 1:
	fullnameBox->setToolTip(tr("The field is empty"));
	break;
    case 2:
	fullnameBoxColour = red;
	fullnameBox->setToolTip(tr("This field may not contain ! @ or :"));
	break;
    }
    
    QPalette bgPal(fullnameBoxColour);
    bgPal.setColor(QPalette::Window,fullnameBoxColour);
    fullnameBox->setPalette(bgPal);
}