Changeset 28c79ad


Ignore:
Timestamp:
02/27/14 08:53:55 (5 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2
Children:
5eaf60c
Parents:
97252e15
Message:

Add an auto-login delay function for PCDM that defaults to 10 seconds. This will pop-up a window giving the user the specified amount of time to either cancel the auto-login or immediately continue on.

Location:
src-qt4/PCDM
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/PCDM.pro

    r999faef r28c79ad  
    1616           src/dialogKeyboard.cpp \ 
    1717           src/dialogLocale.cpp \ 
    18            src/loginWidget.cpp 
     18           src/loginWidget.cpp \ 
     19           src/pcdm-logindelay.cpp 
    1920 
    2021HEADERS += src/pcdm-gui.h \ 
     
    2728           src/dialogKeyboard.h \ 
    2829           src/dialogLocale.h \ 
    29            src/loginWidget.h 
     30           src/loginWidget.h \ 
     31           src/pcdm-logindelay.h 
    3032            
    3133FORMS += src/dialogKeyboard.ui \ 
    32          src/dialogLocale.ui 
     34         src/dialogLocale.ui \ 
     35         src/pcdm-logindelay.ui 
    3336 
    3437TRANSLATIONS =  i18n/PCDM_af.ts \ 
  • src-qt4/PCDM/src/main.cpp

    r5e38281 r28c79ad  
    2323#include "pcdm-config.h" 
    2424#include "pcdm-xprocess.h" 
     25#include "pcdm-logindelay.h" 
    2526 
    2627#define TMPLANGFILE QString("/tmp/.PCDMLang") 
     
    5152  if(QFile::exists(TMPAUTOLOGINFILE)){ ALtriggered=TRUE; QFile::remove(TMPAUTOLOGINFILE); } 
    5253   
    53   QString changeLang;  
     54  //QString changeLang;  
    5455  // Load the configuration file 
    5556  QString confFile = "/usr/local/etc/pcdm.conf"; 
     
    7576  XProcess desktop; 
    7677   
     78  // Check what directory our app is in 
     79    QString appDir = "/usr/local/share/PCDM"; 
     80    // Load the translator 
     81    QTranslator translator; 
     82    QString langCode = lang; 
     83    //Check for a language change detected 
     84    //if ( ! changeLang.isEmpty() )        
     85       //langCode = changeLang; 
     86    //Load the proper locale for the translator 
     87    if ( QFile::exists(appDir + "/i18n/PCDM_" + langCode + ".qm" ) ) { 
     88      translator.load( QString("PCDM_") + langCode, appDir + "/i18n/" ); 
     89      a.installTranslator(&translator); 
     90      Backend::log("Loaded Translation:" + appDir + "/i18n/PCDM_" + langCode + ".qm"); 
     91    } else { 
     92      Backend::log("Could not find: " + appDir + "/i18n/PCDM_" + langCode + ".qm"); 
     93      langCode = ""; 
     94    } 
     95    //qDebug() << "Translation Finished:" << QString::number(clock.elapsed())+" ms"; 
     96     
    7797  //*** STARTUP THE PROGRAM *** 
    7898  bool goodAL = FALSE; //Flag for whether the autologin was successful 
     
    86106         goodAL=FALSE;    
    87107    }else{ 
    88         desktop.loginToXSession(user,pwd, dsk,lang); 
    89         splash.close(); 
    90         if(desktop.isRunning()){ 
    91           goodAL=TRUE; //flag this as a good login to skip the GUI 
     108        //Run the time delay for the autologin attempt 
     109        if(Config::autoLoginDelay() > 1){ 
     110          loginDelay dlg(Config::autoLoginDelay(), user); 
     111          splash.close(); 
     112          dlg.start(); 
     113          dlg.exec(); 
     114          goodAL = dlg.continueLogin; 
     115        }else{ 
     116          goodAL = true; 
    92117        } 
     118        //now start the autologin if appropriate 
     119        if(goodAL){ 
     120          desktop.loginToXSession(user,pwd, dsk,lang); 
     121          splash.close(); 
     122          if(desktop.isRunning()){ 
     123            goodAL=TRUE; //flag this as a good login to skip the GUI 
     124          } 
     125        } 
    93126    } 
    94127  } 
     
    96129  if(!goodAL){ 
    97130    // ------START THE PCDM GUI------- 
    98      
    99     // Check what directory our app is in 
    100     QString appDir = "/usr/local/share/PCDM"; 
    101     // Load the translator 
    102     QTranslator translator; 
    103     QString langCode = lang; 
    104     //Check for a language change detected 
    105     if ( ! changeLang.isEmpty() )        
    106        langCode = changeLang; 
    107     //Load the proper locale for the translator 
    108     if ( QFile::exists(appDir + "/i18n/PCDM_" + langCode + ".qm" ) ) { 
    109       translator.load( QString("PCDM_") + langCode, appDir + "/i18n/" ); 
    110       a.installTranslator(&translator); 
    111       Backend::log("Loaded Translation:" + appDir + "/i18n/PCDM_" + langCode + ".qm"); 
    112     } else { 
    113       Backend::log("Could not find: " + appDir + "/i18n/PCDM_" + langCode + ".qm"); 
    114       langCode = ""; 
    115     } 
    116     //qDebug() << "Translation Finished:" << QString::number(clock.elapsed())+" ms"; 
    117131 
    118132    Backend::log("Starting up PCDM interface"); 
  • src-qt4/PCDM/src/pcdm-config.cpp

    red87765 r28c79ad  
    2424  confStruct << "/usr/local/share/PCDM/images/default-splash.png"; // [7] Splash Screen File 
    2525  confStruct << "TRUE";                                 // [8] Password view button enabled 
     26  confStruct << "10";                                           // [9] Auto-login delay (seconds) 
    2627  return; 
    2728} 
     
    5455      else if(var=="SPLASHSCREEN_FILE"){ confStruct[7] = val; } 
    5556      else if(var=="ENABLE_VIEW_PASSWORD_BUTTON"){ confStruct[8] = val; } 
     57      else if(var=="AUTO_LOGIN_DELAY"){ confStruct[9] = val; } 
    5658      else{} 
    5759       
     
    102104} 
    103105 
     106int Config::autoLoginDelay(){ 
     107  return confStruct[9].toInt();  
     108} 
     109 
    104110QString Config::splashscreen(){ 
    105111  return confStruct[7];  
  • src-qt4/PCDM/src/pcdm-config.h

    r1620346 r28c79ad  
    3131  static QString autoLoginDesktop();    //return *.desktop file to startup automatically 
    3232  static QString autoLoginPassword();   //returns password to log in automatically 
     33  static int autoLoginDelay(); //Returns the number of seconds to delay auto-login 
    3334  static QString splashscreen();        //return the image file for the splashscreen 
    3435  static bool allowPasswordView();      //returns whether password view button is enabled 
Note: See TracChangeset for help on using the changeset viewer.