summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-11 13:26:52 (UTC)
committer llornkcor <llornkcor>2002-06-11 13:26:52 (UTC)
commitd7be88ed0355e32f15da6ecbf56f2d825c530d2a (patch) (unidiff)
treeb8badca1426dd9128126b1af620541c89bb14d42
parente9b7ffa394fa30bea063fbed68b36800e9ebee6d (diff)
downloadopie-d7be88ed0355e32f15da6ecbf56f2d825c530d2a.zip
opie-d7be88ed0355e32f15da6ecbf56f2d825c530d2a.tar.gz
opie-d7be88ed0355e32f15da6ecbf56f2d825c530d2a.tar.bz2
follow up to the follow up for custom.h related things
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp3
-rw-r--r--core/launcher/taskbar.cpp6
2 files changed, 6 insertions, 3 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 693e77f..974de0c 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -1,137 +1,140 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "desktop.h" 21#include "desktop.h"
22#include "info.h" 22#include "info.h"
23#include "launcher.h" 23#include "launcher.h"
24#include "mrulist.h" 24#include "mrulist.h"
25#include "qcopbridge.h" 25#include "qcopbridge.h"
26#include "shutdownimpl.h" 26#include "shutdownimpl.h"
27#include "startmenu.h" 27#include "startmenu.h"
28#include "taskbar.h" 28#include "taskbar.h"
29#include "transferserver.h" 29#include "transferserver.h"
30#include "irserver.h" 30#include "irserver.h"
31#include "packageslave.h" 31#include "packageslave.h"
32 32
33#include <qpe/applnk.h> 33#include <qpe/applnk.h>
34#include <qpe/mimetype.h> 34#include <qpe/mimetype.h>
35#include <qpe/password.h> 35#include <qpe/password.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/power.h> 37#include <qpe/power.h>
38#include <qpe/timeconversion.h> 38#include <qpe/timeconversion.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/global.h> 40#include <qpe/global.h>
41
42#ifdef QT_QWS_CUSTOM
41#include <qpe/custom.h> 43#include <qpe/custom.h>
44#endif
42 45
43#include <qgfx_qws.h> 46#include <qgfx_qws.h>
44#include <qmainwindow.h> 47#include <qmainwindow.h>
45#include <qmessagebox.h> 48#include <qmessagebox.h>
46#include <qtimer.h> 49#include <qtimer.h>
47#include <qwindowsystem_qws.h> 50#include <qwindowsystem_qws.h>
48 51
49#include <qvaluelist.h> 52#include <qvaluelist.h>
50 53
51#include <stdlib.h> 54#include <stdlib.h>
52#include <unistd.h> 55#include <unistd.h>
53 56
54class QCopKeyRegister 57class QCopKeyRegister
55{ 58{
56public: 59public:
57 QCopKeyRegister() : keyCode(0) { } 60 QCopKeyRegister() : keyCode(0) { }
58 QCopKeyRegister(int k, const QString &c, const QString &m) 61 QCopKeyRegister(int k, const QString &c, const QString &m)
59 : keyCode(k), channel(c), message(m) { } 62 : keyCode(k), channel(c), message(m) { }
60 63
61 int getKeyCode() const { return keyCode; } 64 int getKeyCode() const { return keyCode; }
62 QString getChannel() const { return channel; } 65 QString getChannel() const { return channel; }
63 QString getMessage() const { return message; } 66 QString getMessage() const { return message; }
64 67
65private: 68private:
66 int keyCode; 69 int keyCode;
67 QString channel, message; 70 QString channel, message;
68}; 71};
69 72
70typedef QValueList<QCopKeyRegister> KeyRegisterList; 73typedef QValueList<QCopKeyRegister> KeyRegisterList;
71KeyRegisterList keyRegisterList; 74KeyRegisterList keyRegisterList;
72 75
73static Desktop* qpedesktop = 0; 76static Desktop* qpedesktop = 0;
74static int loggedin=0; 77static int loggedin=0;
75static void login(bool at_poweron) 78static void login(bool at_poweron)
76{ 79{
77 if ( !loggedin ) { 80 if ( !loggedin ) {
78 Global::terminateBuiltin("calibrate"); 81 Global::terminateBuiltin("calibrate");
79 Password::authenticate(at_poweron); 82 Password::authenticate(at_poweron);
80 loggedin=1; 83 loggedin=1;
81 QCopEnvelope e( "QPE/Desktop", "unlocked()" ); 84 QCopEnvelope e( "QPE/Desktop", "unlocked()" );
82 } 85 }
83} 86}
84 87
85bool Desktop::screenLocked() 88bool Desktop::screenLocked()
86{ 89{
87 return loggedin == 0; 90 return loggedin == 0;
88} 91}
89 92
90/* 93/*
91 Priority is number of alerts that are needed to pop up 94 Priority is number of alerts that are needed to pop up
92 alert. 95 alert.
93 */ 96 */
94class DesktopPowerAlerter : public QMessageBox 97class DesktopPowerAlerter : public QMessageBox
95{ 98{
96public: 99public:
97 DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) 100 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
98 : QMessageBox( tr("Battery Status"), "Low Battery", 101 : QMessageBox( tr("Battery Status"), "Low Battery",
99 QMessageBox::Critical, 102 QMessageBox::Critical,
100 QMessageBox::Ok | QMessageBox::Default, 103 QMessageBox::Ok | QMessageBox::Default,
101 QMessageBox::NoButton, QMessageBox::NoButton, 104 QMessageBox::NoButton, QMessageBox::NoButton,
102 parent, name, FALSE ) 105 parent, name, FALSE )
103 { 106 {
104 currentPriority = INT_MAX; 107 currentPriority = INT_MAX;
105 alertCount = 0; 108 alertCount = 0;
106 } 109 }
107 110
108 void alert( const QString &text, int priority ); 111 void alert( const QString &text, int priority );
109 void hideEvent( QHideEvent * ); 112 void hideEvent( QHideEvent * );
110private: 113private:
111 int currentPriority; 114 int currentPriority;
112 int alertCount; 115 int alertCount;
113}; 116};
114 117
115void DesktopPowerAlerter::alert( const QString &text, int priority ) 118void DesktopPowerAlerter::alert( const QString &text, int priority )
116{ 119{
117 alertCount++; 120 alertCount++;
118 if ( alertCount < priority ) 121 if ( alertCount < priority )
119 return; 122 return;
120 if ( priority > currentPriority ) 123 if ( priority > currentPriority )
121 return; 124 return;
122 currentPriority = priority; 125 currentPriority = priority;
123 setText( text ); 126 setText( text );
124 show(); 127 show();
125} 128}
126 129
127 130
128void DesktopPowerAlerter::hideEvent( QHideEvent *e ) 131void DesktopPowerAlerter::hideEvent( QHideEvent *e )
129{ 132{
130 QMessageBox::hideEvent( e ); 133 QMessageBox::hideEvent( e );
131 alertCount = 0; 134 alertCount = 0;
132 currentPriority = INT_MAX; 135 currentPriority = INT_MAX;
133} 136}
134 137
135 138
136 139
137DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 140DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index b69d165..bff2a1c 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,133 +1,133 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19*********************************************************************/ 19*********************************************************************/
20 20
21#include "startmenu.h" 21#include "startmenu.h"
22#include "inputmethods.h" 22#include "inputmethods.h"
23#include "mrulist.h" 23#include "mrulist.h"
24#include "systray.h" 24#include "systray.h"
25#include "calibrate.h" 25#include "calibrate.h"
26#include "wait.h" 26#include "wait.h"
27#include "appicons.h" 27#include "appicons.h"
28 28
29#include "taskbar.h" 29#include "taskbar.h"
30#include "desktop.h" 30#include "desktop.h"
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 34#include <qpe/global.h>
35//#ifdef QT_QWS_CUSTOM 35#ifdef QT_QWS_CUSTOM
36//#include <qpe/custom.h> 36#include <qpe/custom.h>
37//#endif 37#endif
38#if defined(QT_QWS_IPAQ) 38#if defined(QT_QWS_IPAQ)
39#include "qpe/custom-ipaq.h" 39#include "qpe/custom-ipaq.h"
40#endif 40#endif
41 41
42 42
43#include <qlabel.h> 43#include <qlabel.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qtimer.h> 45#include <qtimer.h>
46#include <qwindowsystem_qws.h> 46#include <qwindowsystem_qws.h>
47#include <qwidgetstack.h> 47#include <qwidgetstack.h>
48 48
49#if defined( Q_WS_QWS ) 49#if defined( Q_WS_QWS )
50#include <qwsdisplay_qws.h> 50#include <qwsdisplay_qws.h>
51#include <qgfx_qws.h> 51#include <qgfx_qws.h>
52#endif 52#endif
53 53
54 54
55#define FACTORY(T) \ 55#define FACTORY(T) \
56 static QWidget *new##T( bool maximized ) { \ 56 static QWidget *new##T( bool maximized ) { \
57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
58 if ( maximized ) { \ 58 if ( maximized ) { \
59 if ( qApp->desktop()->width() <= 350 ) { \ 59 if ( qApp->desktop()->width() <= 350 ) { \
60 w->showMaximized(); \ 60 w->showMaximized(); \
61 } else { \ 61 } else { \
62 w->resize( QSize( 300, 300 ) ); \ 62 w->resize( QSize( 300, 300 ) ); \
63 } \ 63 } \
64 } \ 64 } \
65 w->show(); \ 65 w->show(); \
66 return w; \ 66 return w; \
67 } 67 }
68 68
69 69
70#ifdef SINGLE_APP 70#ifdef SINGLE_APP
71#define APP(a,b,c,d) FACTORY(b) 71#define APP(a,b,c,d) FACTORY(b)
72#include "../launcher/apps.h" 72#include "../launcher/apps.h"
73#undef APP 73#undef APP
74#endif // SINGLE_APP 74#endif // SINGLE_APP
75 75
76static Global::Command builtins[] = { 76static Global::Command builtins[] = {
77 77
78#ifdef SINGLE_APP 78#ifdef SINGLE_APP
79#define APP(a,b,c,d) { a, new##b, c }, 79#define APP(a,b,c,d) { a, new##b, c },
80#include "../launcher/apps.h" 80#include "../launcher/apps.h"
81#undef APP 81#undef APP
82#endif 82#endif
83 83
84#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) 84#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
85 { "calibrate", TaskBar::calibrate, 1, 0 }, 85 { "calibrate", TaskBar::calibrate, 1, 0 },
86#endif 86#endif
87#if !defined(QT_QWS_CASSIOPEIA) 87#if !defined(QT_QWS_CASSIOPEIA)
88 { "shutdown", Global::shutdown, 1, 0 }, 88 { "shutdown", Global::shutdown, 1, 0 },
89// { "run", run, 1, 0 }, 89// { "run", run, 1, 0 },
90#endif 90#endif
91 91
92 { 0, TaskBar::calibrate, 0, 0 }, 92 { 0, TaskBar::calibrate, 0, 0 },
93}; 93};
94 94
95static bool initNumLock() 95static bool initNumLock()
96{ 96{
97#ifdef QPE_INITIAL_NUMLOCK_STATE 97#ifdef QPE_INITIAL_NUMLOCK_STATE
98 QPE_INITIAL_NUMLOCK_STATE 98 QPE_INITIAL_NUMLOCK_STATE
99#endif 99#endif
100 return FALSE; 100 return FALSE;
101} 101}
102 102
103class LockKeyState : public QWidget 103class LockKeyState : public QWidget
104{ 104{
105public: 105public:
106 LockKeyState( QWidget *parent ) : 106 LockKeyState( QWidget *parent ) :
107 QWidget(parent), 107 QWidget(parent),
108 nl(initNumLock()), cl(FALSE) 108 nl(initNumLock()), cl(FALSE)
109 { 109 {
110 nl_pm = Resource::loadPixmap("numlock"); 110 nl_pm = Resource::loadPixmap("numlock");
111 cl_pm = Resource::loadPixmap("capslock"); 111 cl_pm = Resource::loadPixmap("capslock");
112 } 112 }
113 QSize sizeHint() const 113 QSize sizeHint() const
114 { 114 {
115 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 115 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
116 } 116 }
117 void toggleNumLockState() 117 void toggleNumLockState()
118 { 118 {
119 nl = !nl; repaint(); 119 nl = !nl; repaint();
120 } 120 }
121 void toggleCapsLockState() 121 void toggleCapsLockState()
122 { 122 {
123 cl = !cl; repaint(); 123 cl = !cl; repaint();
124 } 124 }
125 void paintEvent( QPaintEvent * ) 125 void paintEvent( QPaintEvent * )
126 { 126 {
127 int y = (height()-sizeHint().height())/2; 127 int y = (height()-sizeHint().height())/2;
128 QPainter p(this); 128 QPainter p(this);
129 if ( nl ) 129 if ( nl )
130 p.drawPixmap(1,y,nl_pm); 130 p.drawPixmap(1,y,nl_pm);
131 if ( cl ) 131 if ( cl )
132 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 132 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
133 } 133 }