Changes in / [2078496:47a52f4]


Ignore:
Location:
src-qt4/PCDM/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/src/loginWidget.cpp

    rbac293d rae41693  
    1818  pwVisible = FALSE; //Have the password box hide the input behind dots 
    1919  allowPWVisible = TRUE; //Allow the password button to show the password text 
    20    
     20  showUsers = true; //Display the available users on the system 
     21         
    2122  //Create the Grid layout 
    2223  QHBoxLayout* hlayout1 = new QHBoxLayout(); 
    2324  QHBoxLayout* hlayout2 = new QHBoxLayout(); 
     25  QHBoxLayout* hlayout3 = new QHBoxLayout(); 
    2426  QVBoxLayout* vlayout = new QVBoxLayout(); 
    2527  QFormLayout* flayout = new QFormLayout(); 
     
    3638  linePassword = new QLineEdit; 
    3739        linePassword->setFocusPolicy(Qt::StrongFocus); 
     40  lineUsername = new QLineEdit; 
     41        lineUsername->setFocusPolicy(Qt::StrongFocus); 
    3842  pushLogin = new QToolButton; 
    3943        QAction* tmp1 = new QAction(this); 
     
    5761    vlayout->addWidget(listUserBig); 
    5862    //User selected widgets 
    59       flayout->addRow(pushUserIcon, listUsers); 
     63        hlayout3->addWidget(listUsers); 
     64        hlayout3->addWidget(lineUsername); 
     65      flayout->addRow(pushUserIcon, hlayout3); 
    6066      flayout->addRow(pushViewPassword, linePassword); 
    6167      flayout->addRow(deIcon,listDE); 
     
    8894void LoginWidget::updateWidget(){ 
    8995  //Setup the visibility/sizes 
    90   if(userSelected){ 
     96  if(userSelected && showUsers){ 
    9197    userIcon->setVisible(FALSE); 
    9298    listUserBig->setVisible(FALSE); 
    9399    pushUserIcon->setVisible(TRUE); 
    94100    listUsers->setVisible(TRUE); 
     101    lineUsername->setVisible(false); 
    95102    linePassword->setVisible(TRUE); 
    96103    pushLogin->setVisible(TRUE); 
     
    98105    if( listDE->count() < 1 ){ listDE->setVisible(FALSE); deIcon->setVisible(FALSE); } 
    99106    else{ listDE->setVisible(TRUE); deIcon->setVisible(TRUE); } 
    100   }else{ 
     107  }else if(!showUsers){ 
     108    //Do not show either of the user selection widgets 
     109    userIcon->setVisible(FALSE); 
     110    listUserBig->setVisible(FALSE); 
     111    pushUserIcon->setVisible(TRUE); 
     112    listUsers->setVisible(false); 
     113    lineUsername->setVisible(true); 
     114    linePassword->setVisible(TRUE); 
     115    pushLogin->setVisible(TRUE); 
     116    pushViewPassword->setVisible(TRUE); 
     117    if( listDE->count() < 1 ){ listDE->setVisible(FALSE); deIcon->setVisible(FALSE); } 
     118    else{ listDE->setVisible(TRUE); deIcon->setVisible(TRUE); } 
     119  }else{ 
     120    //ShowUsers and none selected 
    101121    userIcon->setVisible(TRUE); 
    102122    listUserBig->setVisible(TRUE); 
     
    154174 
    155175void LoginWidget::slotTryLogin(){ 
    156   QString user = listUsers->currentText(); 
     176  QString user; 
     177  if(showUsers){ 
     178    user = listUsers->currentText(); 
     179  }else{ 
     180    user = lineUsername->text(); 
     181  } 
    157182  QString pw = linePassword->text(); 
    158183  emit loginRequested(user,pw); 
     
    364389  } 
    365390} 
     391 
     392void LoginWidget::allowUserSelection(bool allow){ 
     393  showUsers = allow; 
     394  updateWidget(); 
     395} 
  • src-qt4/PCDM/src/loginWidget.h

    r72c9698 rae41693  
    5454        void resetFocus(QString item=""); 
    5555        void allowPasswordView(bool); 
     56        void allowUserSelection(bool); 
    5657   
    5758  private: 
     
    5960        QComboBox* listDE; 
    6061        QListWidget* listUserBig; 
    61         QLineEdit* linePassword; 
     62        QLineEdit *linePassword, *lineUsername; 
    6263        QToolButton* pushLogin; 
    6364        QToolButton* pushViewPassword; 
     
    6970        QSize desktopIconSize; 
    7071        QString hostName; 
    71         bool userSelected, pwVisible, allowPWVisible; 
     72        bool userSelected, pwVisible, allowPWVisible, showUsers; 
    7273 
    7374        void updateWidget(); 
  • src-qt4/PCDM/src/pcdm-backend.cpp

    r7af9bd1 rae41693  
    471471  bool usepw = true; //for testing purposes 
    472472  if(usepw){ 
    473     //Use "pw" to get all possible users 
     473    //Use "getent" to get all possible users 
    474474    QProcess p; 
    475475    p.setProcessChannelMode(QProcess::MergedChannels); 
     
    477477      env.insert("MM_CHARSET","UTF-8"); 
    478478    p.setProcessEnvironment(env); 
    479     p.start("pw usershow -a"); 
     479    p.start("getent passwd"); 
    480480    while(p.state()==QProcess::Starting || p.state() == QProcess::Running){ 
    481481      p.waitForFinished(200); 
     
    488488    bool bad = FALSE; 
    489489    // "nologin" as their shell 
    490     if(uList[i].section(":",9,9).contains("nologin")){bad=TRUE;} 
     490    if(uList[i].section(":",6,6).contains("nologin")){bad=TRUE;} 
    491491    // "nonexistent" as their user directory 
    492     else if(uList[i].section(":",8,8).contains("nonexistent")){bad=TRUE;} 
     492    else if(uList[i].section(":",5,5).contains("nonexistent")){bad=TRUE;} 
    493493    // uid > 1000 
    494494    else if(uList[i].section(":",2,2).toInt() < 1000){bad=TRUE;} 
     
    499499      //Add this user to the lists if it is good 
    500500      usernameList << uList[i].section(":",0,0).simplified(); 
    501       displaynameList << uList[i].section(":",7,7).simplified(); 
    502       homedirList << uList[i].section(":",8,8).simplified(); 
    503       usershellList << uList[i].section(":",9,9).simplified(); 
     501      displaynameList << uList[i].section(":",4,4).simplified(); 
     502      homedirList << uList[i].section(":",5,5).simplified(); 
     503      usershellList << uList[i].section(":",6,6).simplified(); 
    504504    } 
    505505   } 
  • src-qt4/PCDM/src/pcdm-config.cpp

    r28c79ad rae41693  
    2525  confStruct << "TRUE";                                 // [8] Password view button enabled 
    2626  confStruct << "10";                                           // [9] Auto-login delay (seconds) 
     27  confStruct << "TRUE";                                 // [10] Show System Users 
    2728  return; 
    2829} 
     
    5657      else if(var=="ENABLE_VIEW_PASSWORD_BUTTON"){ confStruct[8] = val; } 
    5758      else if(var=="AUTO_LOGIN_DELAY"){ confStruct[9] = val; } 
     59      else if(var=="SHOW_SYSTEM_USERS"){ confStruct[10] = val; } 
    5860      else{} 
    5961       
     
    117119} 
    118120 
     121bool Config::allowUserSelection(){ 
     122  if(confStruct[10].toLower()=="true"){ return TRUE; } 
     123  else{ return FALSE; }  
     124} 
  • src-qt4/PCDM/src/pcdm-config.h

    r28c79ad rae41693  
    3434  static QString splashscreen();        //return the image file for the splashscreen 
    3535  static bool allowPasswordView();      //returns whether password view button is enabled 
     36  static bool allowUserSelection();     //returns whether to display system users for selection 
    3637 
    3738}; 
  • src-qt4/PCDM/src/pcdm-gui.cpp

    r656891d rae41693  
    192192    //Enable/disable the password view functionality 
    193193    loginW->allowPasswordView( Config::allowPasswordView() ); 
     194    loginW->allowUserSelection( Config::allowUserSelection() ); 
    194195    //Add item to the grid 
    195196    grid->addWidget( loginW, currentTheme->itemLocation("login","row"), \ 
Note: See TracChangeset for help on using the changeset viewer.