Changeset 64c397b


Ignore:
Timestamp:
06/27/14 00:13:43 (10 months ago)
Author:
yurkis <yurkis@…>
Branches:
master, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
eae76a1
Parents:
4905ba9
Message:

Added 'de-logout' related functions to libpcbsd. Untested!

Location:
src-qt4/libpcbsd/utils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/libpcbsd/utils/pcbsd-utils.h

    r3f6d079 r64c397b  
    158158   static QVector<DesktopEnvironmentInfo> installedDesktops(); 
    159159   static DesktopEnvironmentInfo currentDesktop(); 
     160 
     161   /** Check ability to desktop environment session quit 
     162    * 
     163    *\return TRUE is application is able to quit session 
     164    */ 
     165   static bool canLogout(); 
     166 
     167   /** Performs correct desktop environment session quit 
     168    * 
     169    * Performs correct desktop environment session quit. It is not working for all of desktop environments. 
     170    * \see canLogout() 
     171    */ 
     172   bool logout(); 
    160173}; 
    161174 
  • src-qt4/libpcbsd/utils/utils.cpp

    r3f6d079 r64c397b  
    872872        TRY_GET_VALUE_STR(DE_FILE_MANAGER, FileManager); 
    873873        TRY_GET_VALUE_STR(DE_TERMINAL, TerminalCommand); 
    874         TRY_GET_VALUE_STR(DE_CONFIG_APP, ConfigurationApplication); 
     874        TRY_GET_VALUE_STR(DE_CONFIG_APP, ConfigurationApplication); 
    875875        //TODO: another fields 
    876876    }//while process output reading 
     
    903903} 
    904904 
    905  
     905bool Utils::canLogout() 
     906{ 
     907    // de-logout calls pnly one time for each application. 
     908    // you can use this function without performance worry 
     909    static bool wasCalledAlready = false; 
     910    static bool storedVal = false; 
     911    if (wasCalledAlready) 
     912    { 
     913        return storedVal; 
     914    } 
     915 
     916    QProcess* delogout = new QProcess(); 
     917    delogout->start(QString("/usr/local/bin/de-logout"), QStringList()<<"-check"); 
     918    delogout->waitForFinished(-1); 
     919 
     920    wasCalledAlready = true; 
     921    storedVal = (delogout->exitCode() == 0); 
     922    return storedVal; 
     923} 
     924 
     925bool Utils::logout() 
     926{ 
     927    QProcess* delogout = new QProcess(); 
     928    delogout->start(QString("/usr/local/bin/de-logout"), QStringList()<<"-check"); 
     929    delogout->waitForFinished(-1); 
     930 
     931    return (delogout->exitCode() == 0); 
     932} 
     933 
     934 
Note: See TracChangeset for help on using the changeset viewer.