Commit 4312fba0610f73dbe282b2314de50cecf68d0d7d
- Diff rendering mode:
- inline
- side by side
core/launcher/server.cpp
(2 / 27)
|   | |||
| 42 | 42 | #include <opie2/odevicebutton.h> | |
| 43 | 43 | #include <opie2/odevice.h> | |
| 44 | 44 | #include <opie2/oprocess.h> | |
| 45 | #include <opie2/osysevent.h> | ||
| 45 | 46 | ||
| 46 | 47 | #include <qtopia/applnk.h> | |
| 47 | 48 | #include <qtopia/private/categories.h> | |
| … | … | ||
| 500 | 500 | delete syncDialog; | |
| 501 | 501 | syncDialog = 0; | |
| 502 | 502 | transferServer->syncAccessManager()->reset(); | |
| 503 | notifyPostSync(); | ||
| 503 | OSysEvent::sendSysEvent(SYSEVENT_POST_SYNC); | ||
| 504 | 504 | } | |
| 505 | 505 | else if (msg == "setSyncPeerInfo(QString,QString)") { | |
| 506 | 506 | QString peerId, peerName; | |
| … | … | ||
| 623 | 623 | if (!appName.isEmpty()) { | |
| 624 | 624 | cfg.writeEntry("Apps", appName); | |
| 625 | 625 | cfg.writeEntry("Delay", delay); | |
| 626 | } | ||
| 627 | } | ||
| 628 | } | ||
| 629 | #endif | ||
| 630 | } | ||
| 631 | |||
| 632 | void Server::notifyPostSync() | ||
| 633 | { | ||
| 634 | #ifndef QT_NO_COP | ||
| 635 | QFile f( QPEApplication::qpeDir() + "etc/post_sync" ); | ||
| 636 | if( f.open( IO_ReadOnly ) ) { | ||
| 637 | QTextStream ts(&f); | ||
| 638 | while( !ts.atEnd() ) { | ||
| 639 | QString s = ts.readLine(); | ||
| 640 | if(!s.startsWith("#")) { | ||
| 641 | QStringList sl = QStringList::split( ' ', s ); | ||
| 642 | // Lines should be: | ||
| 643 | // uniqueid appname channel message | ||
| 644 | // (where appname is the sync appname, for future filtering) | ||
| 645 | // e.g. | ||
| 646 | // datebook_alarm datebook QPE/Application/datebook registerAllAlarms() | ||
| 647 | if( sl.count() > 3 ) { | ||
| 648 | QCString channel( sl[2] ); | ||
| 649 | QCString message( sl[3] ); | ||
| 650 | QCopEnvelope e( channel, message ); | ||
| 651 | } | ||
| 652 | 626 | } | |
| 653 | 627 | } | |
| 654 | 628 | } |
core/launcher/server.h
(0 / 1)
|   | |||
| 89 | 89 | void preloadApps(); | |
| 90 | 90 | void prepareDirectAccess(); | |
| 91 | 91 | void postDirectAccess(); | |
| 92 | void notifyPostSync(); | ||
| 93 | 92 | QString cardInfoString(); | |
| 94 | 93 | QString installLocationsString(); | |
| 95 | 94 |
etc/opie_sysevents.conf
(3 / 0)
|   | |||
| 1 | datebook_postsync postsync datebook QPE/Application/datebook registerAllAlarms() | ||
| 2 | datebook_pretime presystemtimechange datebook QPE/Application/datebook | ||
| 3 | datebook_posttime postsystemtimechange datebook QPE/Application/datebook registerAllAlarms() |
|   | |||
| 15 | 15 | osharedpointer.h \ | |
| 16 | 16 | osmartpointer.h \ | |
| 17 | 17 | ostorageinfo.h \ | |
| 18 | osysevent.h \ | ||
| 18 | 19 | xmltree.h | |
| 19 | 20 | ||
| 20 | 21 | SOURCES = oapplication.cpp \ | |
| … | … | ||
| 31 | 31 | oresource.cpp \ | |
| 32 | 32 | osmartpointer.cpp \ | |
| 33 | 33 | ostorageinfo.cpp \ | |
| 34 | osysevent.cpp \ | ||
| 34 | 35 | xmltree.cpp | |
| 35 | 36 | ||
| 36 | 37 |
libopie2/opiecore/osysevent.cpp
(95 / 0)
|   | |||
| 1 | /* | ||
| 2 | This file is part of the Opie Project | ||
| 3 | Copyright (C) 2010 Paul Eggleton <bluelightning@bluelightning.org> | ||
| 4 | =. | ||
| 5 | .=l. | ||
| 6 | .>+-= | ||
| 7 | _;:, .> :=|. This program is free software; you can | ||
| 8 | .> <`_, > . <= redistribute it and/or modify it under | ||
| 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
| 10 | .="- .-=="i, .._ License as published by the Free Software | ||
| 11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
| 12 | ._= =} : or (at your option) any later version. | ||
| 13 | .%`+i> _;_. | ||
| 14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
| 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
| 16 | : .. .:, . . . without even the implied warranty of | ||
| 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
| 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
| 19 | ..}^=.= = ; Library General Public License for more | ||
| 20 | ++= -. .` .: details. | ||
| 21 | : = ...= . :.=- | ||
| 22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
| 23 | -_. . . )=. = Library General Public License along with | ||
| 24 | -- :-=` this library; see the file COPYING.LIB. | ||
| 25 | If not, write to the Free Software Foundation, | ||
| 26 | Inc., 59 Temple Place - Suite 330, | ||
| 27 | Boston, MA 02111-1307, USA. | ||
| 28 | */ | ||
| 29 | |||
| 30 | #include "osysevent.h" | ||
| 31 | |||
| 32 | #include <qstring.h> | ||
| 33 | #include <qfile.h> | ||
| 34 | #include <qtextstream.h> | ||
| 35 | |||
| 36 | #include <qtopia/qcopenvelope_qws.h> | ||
| 37 | #include <qpe/qpeapplication.h> | ||
| 38 | #include <qpe/alarmserver.h> | ||
| 39 | |||
| 40 | #include <opie2/odebug.h> | ||
| 41 | #include <opie2/oprocess.h> | ||
| 42 | |||
| 43 | using namespace Opie; | ||
| 44 | using namespace Opie::Core; | ||
| 45 | |||
| 46 | void OSysEvent::sendSysEvent( int eventtype ) | ||
| 47 | { | ||
| 48 | #ifndef QT_NO_COP | ||
| 49 | QString event; | ||
| 50 | switch( eventtype ) { | ||
| 51 | case SYSEVENT_POST_SYNC: | ||
| 52 | event = "postsync"; | ||
| 53 | break; | ||
| 54 | case SYSEVENT_PRE_SYS_TIME_CHANGE: | ||
| 55 | event = "presystemtimechange"; | ||
| 56 | break; | ||
| 57 | case SYSEVENT_POST_SYS_TIME_CHANGE: | ||
| 58 | event = "postsystemtimechange"; | ||
| 59 | break; | ||
| 60 | default: | ||
| 61 | return; | ||
| 62 | } | ||
| 63 | |||
| 64 | QFile f( QPEApplication::qpeDir() + "etc/opie_sysevents.conf" ); | ||
| 65 | if( f.open( IO_ReadOnly ) ) { | ||
| 66 | QTextStream ts(&f); | ||
| 67 | while( !ts.atEnd() ) { | ||
| 68 | QString s = ts.readLine(); | ||
| 69 | if(!s.startsWith("#")) { | ||
| 70 | QStringList sl = QStringList::split( ' ', s ); | ||
| 71 | // Lines should be: | ||
| 72 | // uniqueid event appname channel message | ||
| 73 | // e.g. | ||
| 74 | // datebook_postsync postsync datebook QPE/Application/datebook registerAllAlarms() | ||
| 75 | if( sl.count() > 3 ) { | ||
| 76 | if( sl[1] == event ) { | ||
| 77 | QCString channel( sl[3] ); | ||
| 78 | if( sl.count() > 4 ) { | ||
| 79 | QCString message( sl[4] ); | ||
| 80 | QCopEnvelope e( channel, message ); | ||
| 81 | // FIXME message args | ||
| 82 | } | ||
| 83 | else if( eventtype == SYSEVENT_PRE_SYS_TIME_CHANGE ) { | ||
| 84 | // Special event - just delete alarms for the specified channel | ||
| 85 | AlarmServer::deleteAlarm( QDateTime(), channel, QCString(), -1 ); | ||
| 86 | } | ||
| 87 | } | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } | ||
| 91 | f.close(); | ||
| 92 | } | ||
| 93 | |||
| 94 | #endif | ||
| 95 | } |
libopie2/opiecore/osysevent.h
(58 / 0)
|   | |||
| 1 | /* | ||
| 2 | This file is part of the Opie Project | ||
| 3 | Copyright (C) 2010 Paul Eggleton <bluelightning@bluelightning.org> | ||
| 4 | =. | ||
| 5 | .=l. | ||
| 6 | .>+-= | ||
| 7 | _;:, .> :=|. This program is free software; you can | ||
| 8 | .> <`_, > . <= redistribute it and/or modify it under | ||
| 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
| 10 | .="- .-=="i, .._ License as published by the Free Software | ||
| 11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
| 12 | ._= =} : or (at your option) any later version. | ||
| 13 | .%`+i> _;_. | ||
| 14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
| 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
| 16 | : .. .:, . . . without even the implied warranty of | ||
| 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
| 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
| 19 | ..}^=.= = ; Library General Public License for more | ||
| 20 | ++= -. .` .: details. | ||
| 21 | : = ...= . :.=- | ||
| 22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
| 23 | -_. . . )=. = Library General Public License along with | ||
| 24 | -- :-=` this library; see the file COPYING.LIB. | ||
| 25 | If not, write to the Free Software Foundation, | ||
| 26 | Inc., 59 Temple Place - Suite 330, | ||
| 27 | Boston, MA 02111-1307, USA. | ||
| 28 | */ | ||
| 29 | |||
| 30 | #ifndef OSYSEVENT_H | ||
| 31 | #define OSYSEVENT_H | ||
| 32 | |||
| 33 | #include <qobject.h> | ||
| 34 | #include <qcstring.h> | ||
| 35 | |||
| 36 | #define SYSEVENT_POST_SYNC 1 | ||
| 37 | #define SYSEVENT_PRE_SYS_TIME_CHANGE 2 | ||
| 38 | #define SYSEVENT_POST_SYS_TIME_CHANGE 3 | ||
| 39 | |||
| 40 | namespace Opie { | ||
| 41 | namespace Core { | ||
| 42 | /** | ||
| 43 | *\brief OSysEvent system event handling | ||
| 44 | * | ||
| 45 | * Contains functions for sending and handling system events. | ||
| 46 | * | ||
| 47 | * @author bluelightning | ||
| 48 | */ | ||
| 49 | class OSysEvent | ||
| 50 | { | ||
| 51 | public: | ||
| 52 | static void sendSysEvent( int eventtype ); | ||
| 53 | }; | ||
| 54 | |||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | #endif |
|   | |||
| 36 | 36 | #include "predicttabwidget.h" | |
| 37 | 37 | ||
| 38 | 38 | #include <qpe/config.h> | |
| 39 | #include <qpe/datebookdb.h> | ||
| 40 | 39 | #include <qpe/qpeapplication.h> | |
| 41 | 40 | #include <qpe/qpedialog.h> | |
| 41 | #include <qpe/timeconversion.h> | ||
| 42 | 42 | ||
| 43 | 43 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | |
| 44 | 44 | #include <qpe/qcopenvelope_qws.h> | |
| 45 | 45 | #endif | |
| 46 | 46 | ||
| 47 | #include <opie2/osysevent.h> | ||
| 48 | |||
| 47 | 49 | #include <qlayout.h> | |
| 48 | 50 | #include <qmessagebox.h> | |
| 49 | 51 | #include <qsocket.h> | |
| … | … | ||
| 130 | 130 | disableScreenSaver << 0 << 0 << 0; | |
| 131 | 131 | } | |
| 132 | 132 | ||
| 133 | // Pre time change system event | ||
| 134 | OSysEvent::sendSysEvent(SYSEVENT_PRE_SYS_TIME_CHANGE); | ||
| 135 | |||
| 133 | 136 | // Update the systemtime | |
| 134 | 137 | timeTab->saveSettings( true ); | |
| 135 | 138 | ||
| … | … | ||
| 142 | 142 | // Save settings options | |
| 143 | 143 | settingsTab->saveSettings(); | |
| 144 | 144 | ||
| 145 | // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better | ||
| 146 | // grip on itself (example re-trigger alarms for when we travel back in time). | ||
| 147 | DateBookDB db; | ||
| 145 | // Post time change system event | ||
| 146 | OSysEvent::sendSysEvent(SYSEVENT_POST_SYS_TIME_CHANGE); | ||
| 148 | 147 | ||
| 149 | 148 | // Turn back on the screensaver | |
| 150 | 149 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |

