Commit 9c01ce1b6397b8cee5ad25ea3ec006a201a8f119
- Diff rendering mode:
- inline
- side by side
core/launcher/server.pro
(1 / 1)
|   | |||
| 80 | 80 | INCLUDEPATH += $(OPIEDIR)/noncore/settings/mediummount | |
| 81 | 81 | DEPENDPATH += $(OPIEDIR)/noncore/settings/mediummount | |
| 82 | 82 | ||
| 83 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiesecurity2 -lqrsync | ||
| 83 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiesecurity2 -lqrsync -lsysfs | ||
| 84 | 84 | TARGET = qpe | |
| 85 | 85 | ||
| 86 | 86 | ## not ready for use yet |
core/launcher/serverapp.cpp
(31 / 6)
|   | |||
| 54 | 54 | #endif | |
| 55 | 55 | #include <stdlib.h> | |
| 56 | 56 | ||
| 57 | #include <sysfs/libsysfs.h> | ||
| 58 | |||
| 57 | 59 | // NOTE: when we talk about "login" here we are talking about the | |
| 58 | 60 | // authentication system (MultiAuth) and not opie-login | |
| 59 | 61 | ||
| 60 | 62 | static ServerApplication *serverApp = 0; | |
| 61 | 63 | static bool loginlock = false; // TRUE if the authentication system is currently shown | |
| 62 | static QDateTime suspendDateTime; | ||
| 64 | static int suspendEpoch; | ||
| 65 | static int resumeEpoch; | ||
| 63 | 66 | ||
| 64 | 67 | QCopKeyRegister::QCopKeyRegister() | |
| 65 | 68 | : m_keyCode( 0 ) | |
| … | … | ||
| 598 | 598 | bool skipEnabled = pcfg.readBoolEntry( "suspendTime", false ); | |
| 599 | 599 | if( skipEnabled ) { | |
| 600 | 600 | int skipTime = pcfg.readNumEntry( "suspendTimeMins", 2 ) * 60; | |
| 601 | int secsSuspended = suspendDateTime.secsTo( QDateTime::currentDateTime() ); | ||
| 601 | int secsSuspended = resumeEpoch - suspendEpoch; | ||
| 602 | 602 | if ( secsSuspended < skipTime ) | |
| 603 | 603 | return true; | |
| 604 | 604 | } | |
| … | … | ||
| 626 | 626 | #endif | |
| 627 | 627 | ||
| 628 | 628 | namespace { | |
| 629 | void execAutoStart(const QDateTime& suspendTime ) { | ||
| 629 | void execAutoStart() { | ||
| 630 | 630 | QString appName; | |
| 631 | 631 | int delay; | |
| 632 | 632 | QDateTime now = QDateTime::currentDateTime(); | |
| … | … | ||
| 638 | 638 | ||
| 639 | 639 | // If the time between suspend and resume was longer then the | |
| 640 | 640 | // value saved as delay, start the app | |
| 641 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | ||
| 641 | if ( (resumeEpoch - suspendEpoch) >= ( delay * 60 ) && !appName.isEmpty() ) { | ||
| 642 | 642 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | |
| 643 | 643 | e << QString( appName ); | |
| 644 | 644 | } | |
| 645 | 645 | } | |
| 646 | 646 | } | |
| 647 | 647 | ||
| 648 | int ServerApplication::readRtc() | ||
| 649 | { | ||
| 650 | int ret = 0; | ||
| 651 | |||
| 652 | struct sysfs_class *cls = sysfs_open_class( "rtc" ); | ||
| 653 | if( cls ) { | ||
| 654 | struct sysfs_class_device *cdev = sysfs_get_class_device( cls, "rtc0" ); | ||
| 655 | if( cdev ) { | ||
| 656 | struct sysfs_attribute *attr = sysfs_get_classdev_attr( cdev, "since_epoch" ); | ||
| 657 | if( attr ) { | ||
| 658 | if( sysfs_read_attribute( attr ) == 0 ) | ||
| 659 | ret = atoi( attr->value ); | ||
| 660 | } | ||
| 661 | } | ||
| 662 | sysfs_close_class( cls ); | ||
| 663 | } | ||
| 664 | |||
| 665 | return ret; | ||
| 666 | } | ||
| 667 | |||
| 648 | 668 | void ServerApplication::doBeforeSuspend() | |
| 649 | 669 | { | |
| 650 | suspendDateTime = QDateTime::currentDateTime(); | ||
| 670 | suspendEpoch = readRtc(); | ||
| 651 | 671 | ||
| 652 | 672 | #ifdef QWS | |
| 653 | 673 | // Notify user that the system is suspending | |
| … | … | ||
| 696 | 696 | e << QString::null; | |
| 697 | 697 | #endif | |
| 698 | 698 | ||
| 699 | resumeEpoch = readRtc(); | ||
| 700 | |||
| 699 | 701 | if( !loginlock && Opie::Security::MultiauthPassword::isAuthenticating() ) { | |
| 700 | 702 | // Authentication is already taking place but not by us (eg. because the | |
| 701 | 703 | // user used the lock applet before suspending), so we need to let it | |
| … | … | ||
| 721 | 721 | ||
| 722 | 722 | void ServerApplication::doAfterResume() | |
| 723 | 723 | { | |
| 724 | execAutoStart( suspendDateTime ); | ||
| 724 | execAutoStart(); | ||
| 725 | 725 | } | |
| 726 | 726 | ||
| 727 | 727 | void ServerApplication::togglePower() |
core/launcher/serverapp.h
(1 / 0)
|   | |||
| 139 | 139 | void doResume(); | |
| 140 | 140 | void doAfterResume(); | |
| 141 | 141 | void doBeforeSuspend(); | |
| 142 | int readRtc(); | ||
| 142 | 143 | ||
| 143 | 144 | protected slots: | |
| 144 | 145 | void shutdown(ShutdownImpl::Type); |

