summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-13 21:27:29 (UTC)
committer zecke <zecke>2004-03-13 21:27:29 (UTC)
commit184a0cd9935d0a249038cdbe05488c181b273d64 (patch) (side-by-side diff)
treec8f3508ab1be012083d9e2140221cfeb9a9ab83a
parenta3304e23c7f8576a4584475ef0cf49d0e588671e (diff)
downloadopie-184a0cd9935d0a249038cdbe05488c181b273d64.zip
opie-184a0cd9935d0a249038cdbe05488c181b273d64.tar.gz
opie-184a0cd9935d0a249038cdbe05488c181b273d64.tar.bz2
Fix namespaces in the launcher.. and found a problem with my script
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/applauncher.cpp1
-rw-r--r--core/launcher/documentlist.cpp1
-rw-r--r--core/launcher/main.cpp2
-rw-r--r--core/launcher/qcopbridge.cpp1
-rw-r--r--core/launcher/screensaver.cpp20
-rw-r--r--core/launcher/server.cpp10
-rw-r--r--core/launcher/server.h4
-rw-r--r--core/launcher/serverapp.cpp9
-rw-r--r--core/launcher/serverapp.h10
-rw-r--r--core/launcher/transferserver.cpp1
-rw-r--r--core/launcher/wait.cpp1
-rw-r--r--core/launcher/wait.h4
12 files changed, 37 insertions, 27 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
index efbf426..5a5517c 100644
--- a/core/launcher/applauncher.cpp
+++ b/core/launcher/applauncher.cpp
@@ -37,48 +37,49 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <errno.h>
#else
#include <process.h>
#include <windows.h>
#include <winbase.h>
#endif
#include <signal.h>
#include <sys/types.h>
#include <stdlib.h>
#include <qtimer.h>
#include <qwindowsystem_qws.h>
#include <qmessagebox.h>
#include <qfileinfo.h>
#include <qtopia/qcopenvelope_qws.h>
#include <qtopia/qpeapplication.h>
#include "applauncher.h"
#include "documentlist.h"
+using namespace Opie::Core;
const int AppLauncher::RAISE_TIMEOUT_MS = 5000;
//---------------------------------------------------------------------------
static AppLauncher* appLauncherPtr;
const int appStopEventID = 1290;
class AppStoppedEvent : public QCustomEvent
{
public:
AppStoppedEvent(int pid, int status)
: QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { }
int pid() { return mPid; }
int status() { return mStatus; }
private:
int mPid, mStatus;
};
AppLauncher::AppLauncher(QObject *parent, const char *name)
: QObject(parent, name), qlPid(0), qlReady(FALSE),
appKillerBox(0)
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 63f853e..3e0a96c 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -26,48 +26,49 @@
#include <qtopia/config.h>
#include <qtopia/mimetype.h>
#include <qtopia/resource.h>
#include <qtopia/private/categories.h>
#include <qtopia/qpeapplication.h>
#include <qtopia/applnk.h>
#include <qtopia/storage.h>
#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
#include <qtimer.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <qfile.h>
#include <qdir.h>
#include <qpainter.h>
#include <qimage.h>
#include <qcopchannel_qws.h>
#include <qlistview.h>
#include <qlist.h>
#include <qpixmap.h>
+using namespace Opie::Core;
AppLnkSet *DocumentList::appLnkSet = 0;
static const int MAX_SEARCH_DEPTH = 10;
class DocumentListPrivate : public QObject {
Q_OBJECT
public:
DocumentListPrivate( ServerInterface *gui );
~DocumentListPrivate();
void initialize();
const QString nextFile();
const DocLnk *iterate();
bool store( DocLnk* dl );
void estimatedPercentScanned();
void appendDocpath(FileSystem*);
DocLnkSet dls;
QDict<void> reference;
QDictIterator<void> *dit;
enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state;
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index c136bd9..3e7e0d2 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -41,49 +41,49 @@
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#ifndef Q_OS_WIN32
#include <unistd.h>
#else
#include <process.h>
#endif
#include "calibrate.h"
#ifdef QT_QWS_LOGIN
#include "../login/qdmdialogimpl.h"
#endif
#ifdef Q_WS_QWS
#include <qkeyboard_qws.h>
#endif
#include <qmessagebox.h>
#include <opie2/odevice.h>
-using namespace Opie;
+using namespace Opie::Core;
static void cleanup()
{
QDir dir( "/tmp", "qcop-msg-*" );
QStringList stale = dir.entryList();
QStringList::Iterator it;
for ( it = stale.begin(); it != stale.end(); ++it ) {
dir.remove( *it );
}
}
static void refreshTimeZoneConfig()
{
/* ### FIXME timezone handling */
#if 0
// We need to help WorldTime in setting up its configuration for
// the current translation
// BEGIN no tr
const char *defaultTz[] = {
"America/New_York",
"America/Los_Angeles",
"Europe/Oslo",
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp
index 53efba4..33df6c4 100644
--- a/core/launcher/qcopbridge.cpp
+++ b/core/launcher/qcopbridge.cpp
@@ -33,48 +33,49 @@
#include <qtextstream.h>
#include <qtimer.h>
#ifdef Q_WS_QWS
#include <qcopchannel_qws.h>
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#endif
#ifndef Q_OS_WIN32
#include <pwd.h>
#include <unistd.h>
#include <sys/types.h>
#endif
#if defined(_OS_LINUX_)
#include <shadow.h>
#endif
//#define INSECURE
const int block_size = 51200;
+using namespace Opie::Core;
QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent,
const char* name )
: QServerSocket( port, 1, parent, name ),
desktopChannel( 0 ),
cardChannel( 0 )
{
if ( !ok() )
qWarning( "Failed to bind to port %d", port );
else {
#ifndef QT_NO_COP
desktopChannel = new QCopChannel( "QPE/Desktop", this );
connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(desktopMessage(const QCString&,const QByteArray&)) );
cardChannel = new QCopChannel( "QPE/Card", this );
connect( cardChannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(desktopMessage(const QCString&,const QByteArray&)) );
#endif
}
sendSync = FALSE;
openConnections.setAutoDelete( TRUE );
authorizeConnections();
}
QCopBridge::~QCopBridge()
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp
index e544c61..6aaab3a 100644
--- a/core/launcher/screensaver.cpp
+++ b/core/launcher/screensaver.cpp
@@ -1,34 +1,34 @@
#include "screensaver.h"
#include <qpe/config.h>
#include <qpe/network.h>
#include <opie2/odevice.h>
-using namespace Opie;
+using namespace Opie::Core;
OpieScreenSaver::OpieScreenSaver ( )
: QObject ( 0, "screensaver" ), QWSScreenSaver ( )
{
m_disable_suspend = 100;
m_enable_dim = false;
m_enable_lightoff = false;
m_enable_suspend = false;
m_onlylcdoff = false;
m_enable_dim_ac = false;
m_enable_lightoff_ac = false;
m_enable_suspend_ac = false;
m_onlylcdoff_ac = false;
m_use_light_sensor = false;
m_backlight_sensor = -1;
::memset ( m_sensordata, 0xff, LS_Count * sizeof( m_sensordata [0] ));
m_lcd_status = true;
m_backlight_normal = -1;
@@ -136,49 +136,49 @@ void OpieScreenSaver::setIntervals ( int dim, int lightoff, int suspend )
{
Config config ( "apm" );
config. setGroup ( m_on_ac ? "AC" : "Battery" );
int v[ 4 ];
if ( dim < 0 )
dim = config. readNumEntry ( "Dim", m_on_ac ? 60 : 30 );
if ( lightoff < 0 )
lightoff = config. readNumEntry ( "LightOff", m_on_ac ? 120 : 20 );
if ( suspend < 0 )
suspend = config. readNumEntry ( "Suspend", m_on_ac ? 0 : 60 );
if ( m_on_ac ) {
m_enable_dim_ac = ( dim > 0 );
m_enable_lightoff_ac = ( lightoff > 0 );
m_enable_suspend_ac = ( suspend > 0 );
m_onlylcdoff_ac = config.readBoolEntry ( "LcdOffOnly", false );
}
else {
m_enable_dim = ( dim > 0 );
m_enable_lightoff = ( lightoff > 0 );
m_enable_suspend = ( suspend > 0 );
m_onlylcdoff = config.readBoolEntry ( "LcdOffOnly", false );
}
-
+
//qDebug("screen saver intervals: %d %d %d", dim, lightoff, suspend);
v [ 0 ] = QMAX( 1000 * dim, 100 );
v [ 1 ] = QMAX( 1000 * lightoff, 100 );
v [ 2 ] = QMAX( 1000 * suspend, 100 );
v [ 3 ] = 0;
if ( !dim && !lightoff && !suspend )
QWSServer::setScreenSaverInterval( 0 );
else
QWSServer::setScreenSaverIntervals( v );
}
/**
* Set suspend time. Will read the dim and lcd-off times from the config file.
*
* @param suspend time in seconds to go into APM suspend, -1 to
* read value from config file, 0 to disable
*/
void OpieScreenSaver::setInterval ( int interval )
{
setIntervals ( -1, -1, interval );
}
@@ -194,56 +194,56 @@ void OpieScreenSaver::setMode ( int mode )
/**
* Set display brightness
*
* Get's default values for backlight, contrast and light sensor from config file.
*
* @param bright desired brighness (-1 to use automatic sensor data or value
* from config file, -2 to toggle backlight on and off, -3 to
* force backlight off)
*/
void OpieScreenSaver::setBacklight ( int bright )
{
// Read from config
Config config ( "apm" );
config. setGroup ( m_on_ac ? "AC" : "Battery" );
m_backlight_normal = config. readNumEntry ( "Brightness", m_on_ac ? 255 : 127 );
int contrast = config. readNumEntry ( "Contrast", 127);
m_use_light_sensor = config. readBoolEntry ( "LightSensor", false );
//qDebug ( "setBacklight: %d (norm: %d) (ls: %d)", bright, m_backlight_normal, m_use_light_sensor ? 1 : 0 );
killTimers ( );
if (( bright < 0 ) && m_use_light_sensor ) {
QStringList sl = config. readListEntry ( "LightSensorData", ';' );
-
+
m_sensordata [LS_SensorMin] = 40;
m_sensordata [LS_SensorMax] = 215;
m_sensordata [LS_LightMin] = 1;
m_sensordata [LS_LightMax] = 255;
m_sensordata [LS_Steps] = 12;
- m_sensordata [LS_Interval] = 2000;
-
+ m_sensordata [LS_Interval] = 2000;
+
for ( uint i = 0; i < LS_Count; i++ ) {
if ( i < sl. count ( ))
m_sensordata [i] = sl [i]. toInt ( );
}
if ( m_sensordata [LS_Steps] < 2 ) // sanity check to avoid SIGFPE
m_sensordata [LS_Steps] = 2;
timerEvent ( 0 );
startTimer ( m_sensordata [LS_Interval] );
}
setBacklightInternal ( bright );
ODevice::inst ( )-> setDisplayContrast(contrast);
}
/**
* Internal brightness setting method
*
* Get's default values for backlight and light sensor from config file.
*
* @param bright desired brighness (-1 to use automatic sensor data or value
* from config file, -2 to toggle backlight on and off, -3 to
* force backlight off)
@@ -258,71 +258,71 @@ void OpieScreenSaver::setBacklightInternal ( int bright )
if ( m_backlight_forcedoff && bright != -2 )
return ;
if ( bright == -2 ) {
// Toggle between off and on
bright = m_backlight_current ? 0 : -1;
m_backlight_forcedoff = !bright;
}
if ( bright == -1 )
bright = m_use_light_sensor ? m_backlight_sensor : m_backlight_normal;
if ( bright != m_backlight_current ) {
ODevice::inst ( )-> setDisplayBrightness ( bright );
m_backlight_current = bright;
}
}
/**
* Timer event used for automatic setting the backlight according to a light sensor
* and to set the default brightness
*/
void OpieScreenSaver::timerEvent ( QTimerEvent * )
{
int s = ODevice::inst ( )-> readLightSensor ( ) * 256 / ODevice::inst ( )-> lightSensorResolution ( );
-
+
if ( s < m_sensordata [LS_SensorMin] )
m_backlight_sensor = m_sensordata [LS_LightMax];
else if ( s >= m_sensordata [LS_SensorMax] )
m_backlight_sensor = m_sensordata [LS_LightMin];
else {
int dx = m_sensordata [LS_SensorMax] - m_sensordata [LS_SensorMin];
int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin];
-
+
int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0
-
+
m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 );
}
//qDebug ( "f(%d) = %d [%d - %d] -> [%d - %d] / %d", s, m_backlight_sensor, m_sensordata [LS_SensorMin], m_sensordata [LS_SensorMax], m_sensordata [LS_LightMin], m_sensordata [LS_LightMax], m_sensordata [LS_Steps] );
if ( m_level <= 0 )
setBacklightInternal ( -1 );
}
/**
* Like ODevice::setDisplayStatus(), but keep current state in m_lcd_status.
*/
void OpieScreenSaver::setDisplayState ( bool on )
{
if ( m_lcd_status != on ) {
ODevice::inst ( ) -> setDisplayStatus ( on );
m_lcd_status = on;
}
}
/**
* Set display to default ac/battery settings when power status changed.
*/
void OpieScreenSaver::powerStatusChanged ( PowerStatus ps )
{
bool newonac = ( ps. acStatus ( ) == PowerStatus::Online );
-
+
if ( newonac != m_on_ac ) {
m_on_ac = newonac;
setInterval ( -1 );
setBacklight ( -1 );
- restore ( );
+ restore ( );
}
}
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index ea0b792..634082b 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -42,50 +42,50 @@
#include <qtopia/config.h>
#include <qtopia/resource.h>
#include <qtopia/version.h>
#include <qtopia/storage.h>
#include <qtopia/qcopenvelope_qws.h>
#include <qwindowsystem_qws.h>
#include <qgfx_qws.h>
#include <qtopia/global.h>
//#include <qtopia/custom.h>
#include <opie2/odevicebutton.h>
#include <opie2/odevice.h>
#include <unistd.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qtextstream.h>
#include <stdlib.h>
extern QRect qt_maxWindowRect;
-using namespace Opie;
+using namespace Opie::Core;
static QWidget *calibrate(bool)
{
#ifdef Q_WS_QWS
Calibrate *c = new Calibrate;
c->show();
return c;
#else
return 0;
#endif
}
#define FACTORY(T) \
static QWidget *new##T( bool maximized ) { \
QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
if ( maximized ) { \
if ( qApp->desktop()->width() <= 350 ) { \
w->showMaximized(); \
} else { \
w->resize( QSize( 300, 300 ) ); \
} \
} \
w->show(); \
return w; \
}
@@ -138,50 +138,50 @@ Server::Server() :
last_today_show = QDate::currentDate();
#if 0
tsmMonitor = new TempScreenSaverMode();
connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) );
#endif
serverGui = new Launcher;
serverGui->createGUI();
docList = new DocumentList( serverGui );
appLauncher = new AppLauncher(this);
connect(appLauncher, SIGNAL(launched(int,const QString&)), this, SLOT(applicationLaunched(int,const QString&)) );
connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) );
connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) );
storage = new StorageInfo( this );
connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) );
// start services
startTransferServer();
(void) new IrServer( this );
packageHandler = new PackageHandler( this );
- connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
- this,SLOT(activate(const Opie::ODeviceButton*,bool)));
+ connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)),
+ this,SLOT(activate(const Opie::Core::ODeviceButton*,bool)));
setGeometry( -10, -10, 9, 9 );
QCopChannel *channel = new QCopChannel("QPE/System", this);
connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(systemMsg(const QCString&,const QByteArray&)) );
QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this );
connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) );
connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) );
connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) );
preloadApps();
}
void Server::show()
{
ServerApplication::login(TRUE);
QWidget::show();
}
Server::~Server()
@@ -200,52 +200,52 @@ static bool hasVisibleWindow(const QString& clientname, bool partial)
{
#ifdef QWS
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
if ( w->client()->identity() == clientname ) {
if ( partial && !w->isFullyObscured() )
return TRUE;
if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
# if QT_VERSION < 0x030000
QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
QSize(qt_screen->width(),qt_screen->height()) );
# else
QRect mwr = qt_maxWindowRect;
# endif
if ( mwr.contains(w->requested().boundingRect()) )
return TRUE;
}
}
}
#endif
return FALSE;
}
-void Server::activate(const Opie::ODeviceButton* button, bool held)
+void Server::activate(const ODeviceButton* button, bool held)
{
Global::terminateBuiltin("calibrate"); // No tr
- Opie::OQCopMessage om;
+ OQCopMessage om;
if ( held ) {
om = button->heldAction();
} else {
om = button->pressedAction();
}
if ( om.channel() != "ignore" )
om.send();
// A button with no action defined, will return a null ServiceRequest. Don't attempt
// to send/do anything with this as it will crash
/* ### FIXME */
#if 0
if ( !sr.isNull() ) {
QString app = sr.app();
bool vis = hasVisibleWindow(app, app != "qpe");
if ( sr.message() == "raise()" && vis ) {
sr.setMessage("nextView()");
} else {
// "back door"
sr << (int)vis;
}
sr.send();
diff --git a/core/launcher/server.h b/core/launcher/server.h
index 91bf883..1dc5e7e 100644
--- a/core/launcher/server.h
+++ b/core/launcher/server.h
@@ -17,71 +17,73 @@
** not clear to you.
**
**********************************************************************/
#ifndef DESKTOP_H
#define DESKTOP_H
#include <qwidget.h>
#include <qdatetime.h>
//#include "qcopbridge.h"
class QCopBridge;
class QHostAddress;
class TransferServer;
class PackageHandler;
class ServiceRequest;
class TempScreenSaverMonitor;
class AppLauncher;
class AppLnkSet;
class StorageInfo;
class SyncDialog;
class DocumentList;
class ServerInterface;
namespace Opie {
+namespace Core {
class ODeviceButton;
}
+}
class Server : public QWidget {
Q_OBJECT
public:
Server();
~Server();
static bool mkdir(const QString &path);
void show();
static bool setKeyboardLayout( const QString &kb );
public slots:
void systemMsg(const QCString &, const QByteArray &);
void receiveTaskBar(const QCString &msg, const QByteArray &data);
void terminateServers();
void pokeTimeMonitors();
private slots:
- void activate(const Opie::ODeviceButton*,bool);
+ void activate(const Opie::Core::ODeviceButton*,bool);
void syncConnectionClosed( const QHostAddress & );
void applicationLaunched(int pid, const QString &app);
void applicationTerminated(int pid, const QString &app);
void applicationConnected(const QString &app);
void storageChanged();
void cancelSync();
protected:
void styleChange( QStyle & );
void timerEvent( QTimerEvent *e );
private:
void layout();
void startTransferServer();
void preloadApps();
QCopBridge *qcopBridge;
TransferServer *transferServer;
PackageHandler *packageHandler;
QDate last_today_show;
int tid_xfer;
/* ### FIXME two below### */
// int tid_today;
// TempScreenSaverMonitor *tsmMonitor;
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index d38dd97..e4e16f2 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -34,48 +34,49 @@
#ifdef Q_WS_QWS
#include <qgfx_qws.h>
#endif
#ifdef Q_OS_WIN32
#include <io.h>
#include <process.h>
#else
#include <unistd.h>
#endif
#include <qmessagebox.h>
#include <qtimer.h>
#include <qpainter.h>
#include <qfile.h>
#include <qpixmapcache.h>
#include <stdlib.h>
#include "screensaver.h"
static ServerApplication *serverApp = 0;
static int loggedin=0;
using namespace Opie;
+using namespace Opie::Core;
QCopKeyRegister::QCopKeyRegister()
: m_keyCode( 0 ) {
}
QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m )
:m_keyCode( k ), m_channel( c ), m_message( m ) {
}
int QCopKeyRegister::keyCode()const {
return m_keyCode;
}
QCString QCopKeyRegister::channel()const {
return m_channel;
}
QCString QCopKeyRegister::message()const {
return m_message;
}
bool QCopKeyRegister::send() {
if (m_channel.isNull() )
return false;
@@ -176,49 +177,49 @@ bool KeyFilter::keyRegistered( int key ) {
bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepeat)
{
if ( !loggedin
// Permitted keys
&& keycode != Key_F34 // power
&& keycode != Key_F30 // select
&& keycode != Key_Enter
&& keycode != Key_Return
&& keycode != Key_Space
&& keycode != Key_Left
&& keycode != Key_Right
&& keycode != Key_Up
&& keycode != Key_Down )
return TRUE;
/* check if it was registered */
if (!db ) {
if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) )
return true;
}else {
// First check to see if DeviceButtonManager knows something about this button:
- const Opie::ODeviceButton* button = Opie::ODevice::inst()->buttonForKeycode(keycode);
+ const ODeviceButton* button = ODevice::inst()->buttonForKeycode(keycode);
if (button && !autoRepeat) {
if ( held_tid ) {
killTimer(held_tid);
held_tid = 0;
}
if ( button->heldAction().isNull() ) {
if ( press )
emit activate(button, FALSE);
} else if ( press ) {
heldButton = button;
held_tid = startTimer( ODevice::inst ()->buttonHoldTime () );
} else if ( heldButton ) {
heldButton = 0;
emit activate(button, FALSE);
}
QWSServer::screenSaverActivate(FALSE);
return TRUE;
}
return false;
}
if ( keycode == HardKey_Suspend ) {
if ( press ) emit power();
return TRUE;
}
@@ -310,66 +311,66 @@ ServerApplication::ServerApplication( int& argc, char **argv, Type t )
m_screensaver = new OpieScreenSaver();
m_screensaver->setInterval( -1 );
QWSServer::setScreenSaver( m_screensaver );
connect( qApp, SIGNAL( volumeChanged(bool) ),
this, SLOT( rereadVolumes() ) );
/* ### PluginLoader libqtopia SafeMode */
#if 0
if ( PluginLoader::inSafeMode() )
QTimer::singleShot(500, this, SLOT(showSafeMode()) );
QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) );
#endif
kf = new KeyFilter(this);
connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) );
connect( kf, SIGNAL(power()), this, SIGNAL(power()) );
connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) );
connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol()));
connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle()));
connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle()));
- connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
- this,SIGNAL(activate(const Opie::ODeviceButton*,bool)));
+ connect( kf, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)),
+ this,SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)));
connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) );
connect( this, SIGNAL(power() ),
SLOT(togglePower() ) );
rereadVolumes();
serverApp = this;
apmTimeout();
grabKeyboard();
/* make sure the event filter is installed */
- const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 );
+ const ODeviceButton* but = ODevice::inst()->buttonForKeycode( -1 );
}
ServerApplication::~ServerApplication()
{
ungrabKeyboard();
delete pa;
delete m_ps;
delete m_ps_last;
}
void ServerApplication::apmTimeout() {
serverApp-> checkMemory( ); // in case no events are generated
*m_ps_last = *m_ps;
*m_ps = PowerStatusManager::readStatus();
if ( m_ps->acStatus() != m_ps_last-> acStatus() )
m_screensaver-> powerStatusChanged( *m_ps );
if ( m_ps->acStatus() == PowerStatus::Online ) {
return;
}
diff --git a/core/launcher/serverapp.h b/core/launcher/serverapp.h
index 4d9f808..916d83c 100644
--- a/core/launcher/serverapp.h
+++ b/core/launcher/serverapp.h
@@ -14,127 +14,129 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef SERVERAPP_H
#define SERVERAPP_H
#include <qtopia/qpeapplication.h>
#include <qwidget.h>
#ifdef QWS
#include <qwindowsystem_qws.h>
#endif
#include "shutdownimpl.h"
class PowerStatus;
class DesktopPowerAlerter;
class OpieScreenSaver;
namespace Opie {
+namespace Core {
class ODeviceButton;
}
+}
struct QCopKeyRegister {
QCopKeyRegister();
QCopKeyRegister( int k, const QCString&, const QCString& );
int keyCode()const;
QCString channel()const;
QCString message()const;
inline bool send();
private:
int m_keyCode;
QCString m_channel, m_message;
};
typedef QMap<int, QCopKeyRegister> KeyRegisterList;
class KeyFilter : public QObject {
Q_OBJECT
public:
KeyFilter(QObject* parent);
void registerKey( const QCopKeyRegister& );
void unregisterKey( const QCopKeyRegister& );
bool checkButtonAction( bool, int, int, int );
protected:
void timerEvent(QTimerEvent*);
signals:
void launch();
void power();
void backlight();
void symbol();
void numLockStateToggle();
void capsLockStateToggle();
- void activate(const Opie::ODeviceButton*,bool);
+ void activate(const Opie::Core::ODeviceButton*,bool);
private:
bool keyRegistered( int key );
int held_tid;
- const Opie::ODeviceButton* heldButton;
+ const Opie::Core::ODeviceButton* heldButton;
KeyRegisterList m_keys;
};
class ServerApplication : public QPEApplication
{
Q_OBJECT
public:
ServerApplication( int& argc, char **argv, Type t );
~ServerApplication();
static bool doRestart;
static bool allowRestart;
static bool screenLocked();
static void login(bool at_poweron);
-
+
static bool isStarting();
static void switchLCD ( bool on ); // only for togglePower in Desktop
static void soundAlarm(); // only because QCop soundAlarm() is defined in QPE/TaskBar
void restart();
int exec();
signals:
void menu();
void home();
void launch();
void power();
void backlight();
void symbol();
void numLockStateToggle();
void capsLockStateToggle();
void prepareForRestart();
- void activate(const Opie::ODeviceButton*,bool);
+ void activate(const Opie::Core::ODeviceButton*,bool);
public slots:
virtual void systemMessage( const QCString& msg, const QByteArray& );
virtual void launcherMessage( const QCString& msg, const QByteArray& );
void rereadVolumes();
protected:
bool eventFilter( QObject*, QEvent* );
#ifdef Q_WS_QWS
bool qwsEventFilter( QWSEvent * );
#endif
void shutdown();
void checkMemory();
bool recoverMemory();
void keyClick(int keycode, bool press, bool repeat);
void screenClick(bool press);
protected slots:
void shutdown(ShutdownImpl::Type);
void apmTimeout();
void showSafeMode();
void clearSafeMode();
void togglePower();
void toggleLight();
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index a5e20b2..e32cf41 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -38,48 +38,49 @@
#include <time.h>
#endif
#if defined(_OS_LINUX_)
#include <shadow.h>
#endif
#include <qtextstream.h>
#include <qmessagebox.h>
//#include <qtopia/qcopchannel_qws.h>
#include <qtopia/process.h>
#include <qtopia/private/contact.h>
#include <qtopia/version.h>
#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
#include "transferserver.h"
#include <qtopia/qprocess.h>
const int block_size = 51200;
+using namespace Opie::Core;
TransferServer::TransferServer( Q_UINT16 port, QObject *parent,
const char* name)
: QServerSocket( port, 1, parent, name )
{
connections.setAutoDelete( TRUE );
if ( !ok() )
qWarning( "Failed to bind to port %d", port );
}
void TransferServer::authorizeConnections()
{
QListIterator<ServerPI> it(connections);
while ( it.current() ) {
if ( !it.current()->verifyAuthorised() ) {
disconnect( it.current(), SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) );
connections.removeRef( it.current() );
} else
++it;
}
}
void TransferServer::closed(ServerPI *item)
{
connections.removeRef(item);
diff --git a/core/launcher/wait.cpp b/core/launcher/wait.cpp
index 4148e57..a5b329d 100644
--- a/core/launcher/wait.cpp
+++ b/core/launcher/wait.cpp
@@ -8,48 +8,49 @@
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "wait.h"
#include <qtopia/config.h>
#include <opie2/owait.h>
Wait *lastWaitObject = NULL;
+using namespace Opie::Ui;
Wait::Wait( QWidget *parent ) : QWidget( parent ),
pm( Resource::loadPixmap( "wait" ) ), waiting( FALSE )
{
setFixedSize( pm.size() );
lastWaitObject = this;
m_centralWait = new OWait( 0l );
m_centralWait->hide();
hide();
}
Wait *Wait::getWaitObject()
{
return lastWaitObject;
}
void Wait::setWaiting( bool w )
{
Config cfg ( "Launcher" );
cfg.setGroup("GUI");
waiting = w;
diff --git a/core/launcher/wait.h b/core/launcher/wait.h
index e7294d2..010fcc3 100644
--- a/core/launcher/wait.h
+++ b/core/launcher/wait.h
@@ -6,41 +6,41 @@
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef __WAIT_H__
#define __WAIT_H__
#include <qtopia/resource.h>
#include <qwidget.h>
#include <qpixmap.h>
#include <qpainter.h>
-class OWait;
+namespace Opie {namespace Ui {class OWait;}}
class Wait : public QWidget
{
public:
Wait( QWidget *parent );
void setWaiting( bool w );
void paintEvent( QPaintEvent * );
static Wait *getWaitObject();
private:
QPixmap pm;
bool waiting;
- OWait* m_centralWait;
+ Opie::Ui::OWait* m_centralWait;
};
#endif // __WAIT_H__