summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp6
-rw-r--r--core/launcher/launcher.cpp6
-rw-r--r--core/launcher/launcher.pro2
-rw-r--r--core/launcher/runningappbar.cpp287
-rw-r--r--core/launcher/runningappbar.h88
-rw-r--r--core/launcher/startmenu.cpp4
-rw-r--r--core/launcher/taskbar.cpp21
-rw-r--r--core/launcher/taskbar.h10
8 files changed, 405 insertions, 19 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index a19e4c6..bca95b2 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -12,25 +12,25 @@
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>
@@ -309,25 +309,25 @@ private:
309 309
310 bool m_lcd_status; 310 bool m_lcd_status;
311 311
312 int m_backlight_bright; 312 int m_backlight_bright;
313 bool m_backlight_forcedoff; 313 bool m_backlight_forcedoff;
314}; 314};
315 315
316 316
317void DesktopApplication::switchLCD ( bool on ) 317void DesktopApplication::switchLCD ( bool on )
318{ 318{
319 if ( qApp ) { 319 if ( qApp ) {
320 DesktopApplication *dapp = (DesktopApplication *) qApp; 320 DesktopApplication *dapp = (DesktopApplication *) qApp;
321 321
322 if ( dapp-> m_screensaver ) 322 if ( dapp-> m_screensaver )
323 dapp-> m_screensaver-> setBacklight ( on ? -3 : -1 ); 323 dapp-> m_screensaver-> setBacklight ( on ? -3 : -1 );
324 } 324 }
325} 325}
326 326
327 327
328DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 328DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
329 : QPEApplication( argc, argv, appType ) 329 : QPEApplication( argc, argv, appType )
330{ 330{
331 331
332 QTimer * t = new QTimer( this ); 332 QTimer * t = new QTimer( this );
333 connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) ); 333 connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) );
@@ -718,25 +718,25 @@ void Desktop::raiseLauncher()
718 QCopEnvelope e( "QPE/System", "execute(QString)" ); 718 QCopEnvelope e( "QPE/System", "execute(QString)" );
719 e << tempItem; 719 e << tempItem;
720 } 720 }
721} 721}
722 722
723void Desktop::executeOrModify( const QString& appLnkFile ) 723void Desktop::executeOrModify( const QString& appLnkFile )
724{ 724{
725 AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); 725 AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile );
726 if ( lnk.isValid() ) { 726 if ( lnk.isValid() ) {
727 QCString app = lnk.exec().utf8(); 727 QCString app = lnk.exec().utf8();
728 Global::terminateBuiltin( "calibrate" ); 728 Global::terminateBuiltin( "calibrate" );
729 if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { 729 if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) {
730 MRUList::addTask( &lnk ); 730 //MRUList::addTask( &lnk );
731 if ( hasVisibleWindow( app ) ) 731 if ( hasVisibleWindow( app ) )
732 QCopChannel::send( "QPE/Application/" + app, "nextView()" ); 732 QCopChannel::send( "QPE/Application/" + app, "nextView()" );
733 else 733 else
734 QCopChannel::send( "QPE/Application/" + app, "raise()" ); 734 QCopChannel::send( "QPE/Application/" + app, "raise()" );
735 } 735 }
736 else { 736 else {
737 lnk.execute(); 737 lnk.execute();
738 } 738 }
739 } 739 }
740} 740}
741 741
742void Desktop::raiseDatebook() 742void Desktop::raiseDatebook()
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index effcd24..fd89410 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -49,25 +49,25 @@
49#include <qregexp.h> 49#include <qregexp.h>
50#include <qmessagebox.h> 50#include <qmessagebox.h>
51#include <qframe.h> 51#include <qframe.h>
52#include <qpainter.h> 52#include <qpainter.h>
53#include <qlabel.h> 53#include <qlabel.h>
54#include <qtextstream.h> 54#include <qtextstream.h>
55 55
56#include "launcherview.h" 56#include "launcherview.h"
57#include "launcher.h" 57#include "launcher.h"
58#include "syncdialog.h" 58#include "syncdialog.h"
59#include "desktop.h" 59#include "desktop.h"
60#include <qpe/lnkproperties.h> 60#include <qpe/lnkproperties.h>
61#include "mrulist.h" 61//#include "mrulist.h"
62#include "qrsync.h" 62#include "qrsync.h"
63#include <stdlib.h> 63#include <stdlib.h>
64#include <unistd.h> 64#include <unistd.h>
65 65
66#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 66#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
67#include <stdio.h> 67#include <stdio.h>
68#include <sys/vfs.h> 68#include <sys/vfs.h>
69#include <mntent.h> 69#include <mntent.h>
70#endif 70#endif
71 71
72#include <qpe/storage.h> 72#include <qpe/storage.h>
73#include "mediummountgui.h" 73#include "mediummountgui.h"
@@ -721,26 +721,26 @@ void Launcher::updateLink(const QString& link)
721 else if (link.isEmpty()) 721 else if (link.isEmpty())
722 updateDocs(); 722 updateDocs();
723 else 723 else
724 tabs->updateLink(link); 724 tabs->updateLink(link);
725} 725}
726 726
727void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 727void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
728{ 728{
729 QDataStream stream( data, IO_ReadOnly ); 729 QDataStream stream( data, IO_ReadOnly );
730 if ( msg == "closing(QString)" ){ 730 if ( msg == "closing(QString)" ){
731 QString app; 731 QString app;
732 stream >> app; 732 stream >> app;
733 qWarning("app closed %s", app.latin1() ); 733 //qWarning("app closed %s", app.latin1() );
734 MRUList::removeTask( app ); 734 // MRUList::removeTask( app );
735 }else if ( msg == "linkChanged(QString)" ) { 735 }else if ( msg == "linkChanged(QString)" ) {
736 QString link; 736 QString link;
737 stream >> link; 737 stream >> link;
738 if ( in_lnk_props ) { 738 if ( in_lnk_props ) {
739 got_lnk_change = TRUE; 739 got_lnk_change = TRUE;
740 lnk_change = link; 740 lnk_change = link;
741 } else { 741 } else {
742 updateLink(link); 742 updateLink(link);
743 } 743 }
744 } else if ( msg == "busy()" ) { 744 } else if ( msg == "busy()" ) {
745 emit busy(); 745 emit busy();
746 } else if ( msg == "notBusy(QString)" ) { 746 } else if ( msg == "notBusy(QString)" ) {
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro
index 5b32bc3..0e557aa 100644
--- a/core/launcher/launcher.pro
+++ b/core/launcher/launcher.pro
@@ -1,24 +1,25 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 DESTDIR = ../../bin 3 DESTDIR = ../../bin
4 HEADERS = background.h \ 4 HEADERS = background.h \
5 desktop.h \ 5 desktop.h \
6 qprocess.h \ 6 qprocess.h \
7 mediummountgui.h \ 7 mediummountgui.h \
8 info.h \ 8 info.h \
9 appicons.h \ 9 appicons.h \
10 taskbar.h \ 10 taskbar.h \
11 sidething.h \ 11 sidething.h \
12 mrulist.h \ 12 mrulist.h \
13 runningappbar.h \
13 stabmon.h \ 14 stabmon.h \
14 inputmethods.h \ 15 inputmethods.h \
15 systray.h \ 16 systray.h \
16 wait.h \ 17 wait.h \
17 shutdownimpl.h \ 18 shutdownimpl.h \
18 launcher.h \ 19 launcher.h \
19 launcherview.h \ 20 launcherview.h \
20 ../../core/apps/calibrate/calibrate.h \ 21 ../../core/apps/calibrate/calibrate.h \
21 startmenu.h \ 22 startmenu.h \
22 transferserver.h \ 23 transferserver.h \
23 qcopbridge.h \ 24 qcopbridge.h \
24 packageslave.h \ 25 packageslave.h \
@@ -42,24 +43,25 @@ HEADERS = background.h \
42 ../../rsync/config_rsync.h \ 43 ../../rsync/config_rsync.h \
43 ../../rsync/qrsync.h 44 ../../rsync/qrsync.h
44 # quicklauncher.h \ 45 # quicklauncher.h \
45 SOURCES = background.cpp \ 46 SOURCES = background.cpp \
46 desktop.cpp \ 47 desktop.cpp \
47 mediummountgui.cpp \ 48 mediummountgui.cpp \
48 qprocess.cpp qprocess_unix.cpp \ 49 qprocess.cpp qprocess_unix.cpp \
49 info.cpp \ 50 info.cpp \
50 appicons.cpp \ 51 appicons.cpp \
51 taskbar.cpp \ 52 taskbar.cpp \
52 sidething.cpp \ 53 sidething.cpp \
53 mrulist.cpp \ 54 mrulist.cpp \
55 runningappbar.cpp \
54 stabmon.cpp \ 56 stabmon.cpp \
55 inputmethods.cpp \ 57 inputmethods.cpp \
56 systray.cpp \ 58 systray.cpp \
57 wait.cpp \ 59 wait.cpp \
58 shutdownimpl.cpp \ 60 shutdownimpl.cpp \
59 launcher.cpp \ 61 launcher.cpp \
60 launcherview.cpp \ 62 launcherview.cpp \
61 ../../core/apps/calibrate/calibrate.cpp \ 63 ../../core/apps/calibrate/calibrate.cpp \
62 transferserver.cpp \ 64 transferserver.cpp \
63 packageslave.cpp \ 65 packageslave.cpp \
64 irserver.cpp \ 66 irserver.cpp \
65 qcopbridge.cpp \ 67 qcopbridge.cpp \
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp
new file mode 100644
index 0000000..298f671
--- a/dev/null
+++ b/core/launcher/runningappbar.cpp
@@ -0,0 +1,287 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************
20*/
21
22#define QTOPIA_INTERNAL_PRELOADACCESS
23
24// For "kill"
25#include <sys/types.h>
26#include <signal.h>
27
28#include <qtimer.h>
29#include <qpopupmenu.h>
30#include <qmessagebox.h>
31#include <qpainter.h>
32#include "qprocess.h"
33#include <qpe/qpeapplication.h>
34#include <qpe/applnk.h>
35#include <qpe/qcopenvelope_qws.h>
36#include <qpe/global.h>
37#include <qwindowsystem_qws.h>
38#include "runningappbar.h"
39
40RunningAppBar::RunningAppBar(QWidget* parent)
41 : QFrame(parent), m_AppLnkSet(0L), m_SelectedAppIndex(-1)
42{
43 m_AppLnkSet = new AppLnkSet( QPEApplication::qpeDir() + "apps" );
44
45 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&)));
46 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&)));
47 QCopChannel* channel = new QCopChannel( "QPE/System", this );
48 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
49 this, SLOT(received(const QCString&, const QByteArray&)) );
50
51 spacing = AppLnk::smallIconSize()+3;
52}
53
54RunningAppBar::~RunningAppBar() {
55}
56
57void RunningAppBar::newQcopChannel(const QString& channelName) {
58 QString prefix("QPE/Application/");
59 if (channelName.startsWith(prefix)) {
60 QString appName = channelName.mid(prefix.length());
61// qDebug("App %s just connected!", appName.latin1());
62 const AppLnk* newGuy = m_AppLnkSet->findExec(appName);
63 if (newGuy && !newGuy->isPreloaded()) {
64 addTask(*newGuy);
65 }
66 }
67}
68
69void RunningAppBar::removedQcopChannel(const QString& channelName) {
70 QString prefix("QPE/Application/");
71 if (channelName.startsWith(prefix)) {
72 QString appName = channelName.mid(prefix.length());
73 qDebug("App %s just disconnected!", appName.latin1());
74 const AppLnk* newGuy = m_AppLnkSet->findExec(appName);
75 if (newGuy) {
76 removeTask(*newGuy);
77 }
78 }
79}
80
81void RunningAppBar::received(const QCString& msg, const QByteArray& data) {
82 // Since fast apps appear and disappear without disconnecting from their
83 // channel we need to watch for the showing/hiding events and update according.
84 QDataStream stream( data, IO_ReadOnly );
85 if ( msg == "fastAppShowing(QString)") {
86 QString appName;
87 stream >> appName;
88 addTask(*m_AppLnkSet->findExec(appName));
89 } else if ( msg == "fastAppHiding(QString)") {
90 QString appName;
91 stream >> appName;
92 removeTask(*m_AppLnkSet->findExec(appName));
93 }
94}
95
96void RunningAppBar::addTask(const AppLnk& appLnk) {
97// qDebug("Added %s to app list.", appLnk.name().latin1());
98 AppLnk* newApp = new AppLnk(appLnk);
99 newApp->setExec(appLnk.exec());
100 m_AppList.prepend(newApp);
101 update();
102}
103
104void RunningAppBar::removeTask(const AppLnk& appLnk) {
105 unsigned int i = 0;
106 for (; i < m_AppList.count() ; i++) {
107 AppLnk* target = m_AppList.at(i);
108 if (target->exec() == appLnk.exec()) {
109 qDebug("Removing %s from app list.", appLnk.name().latin1());
110 m_AppList.remove();
111 delete target;
112 }
113 }
114 update();
115}
116
117void RunningAppBar::mousePressEvent(QMouseEvent *e)
118{
119 // Find out if the user is clicking on an app icon...
120 // If so, snag the index so when we repaint we show it
121 // as highlighed.
122 m_SelectedAppIndex = 0;
123 int x=0;
124 QListIterator<AppLnk> it( m_AppList );
125 for ( ; it.current(); ++it,++m_SelectedAppIndex,x+=spacing ) {
126 if ( x + spacing <= width() ) {
127 if ( e->x() >= x && e->x() < x+spacing ) {
128 if ( m_SelectedAppIndex < (int)m_AppList.count() ) {
129 repaint(FALSE);
130 return;
131 }
132 }
133 } else {
134 break;
135 }
136 }
137 m_SelectedAppIndex = -1;
138 repaint( FALSE );
139}
140
141void RunningAppBar::mouseReleaseEvent(QMouseEvent *e)
142{
143 if (e->button() == QMouseEvent::RightButton) {
144 return;
145 }
146 if ( m_SelectedAppIndex >= 0 ) {
147 QString channel = QString("QPE/Application/") + m_AppList.at(m_SelectedAppIndex)->exec();
148 if (QCopChannel::isRegistered(channel.latin1())) {
149// qDebug("%s is running!", m_AppList.at(m_SelectedAppIndex)->exec().latin1());
150 QCopEnvelope e(channel.latin1(), "raise()");
151 // This class will delete itself after hearing from the app or the timer expiring
152 (void)new AppMonitor(*m_AppList.at(m_SelectedAppIndex), *this);
153 }
154 else {
155 removeTask(*m_AppList.at(m_SelectedAppIndex));
156 }
157
158 m_SelectedAppIndex = -1;
159 update();
160 }
161}
162
163void RunningAppBar::paintEvent( QPaintEvent * )
164{
165 QPainter p( this );
166 AppLnk *curApp;
167 int x = 0;
168 int y = (height() - AppLnk::smallIconSize()) / 2;
169 int i = 0;
170
171 p.fillRect( 0, 0, width(), height(), colorGroup().background() );
172
173 QListIterator<AppLnk> it(m_AppList);
174
175 for (; it.current(); i++, ++it ) {
176 if ( x + spacing <= width() ) {
177 curApp = it.current();
178 if ( (int)i == m_SelectedAppIndex )
179 p.fillRect( x, y, spacing, curApp->pixmap().height()+1, colorGroup().highlight() );
180 else
181 p.eraseRect( x, y, spacing, curApp->pixmap().height()+1 );
182 p.drawPixmap( x, y, curApp->pixmap() );
183 x += spacing;
184 }
185 }
186}
187
188QSize RunningAppBar::sizeHint() const
189{
190 return QSize( frameWidth(), AppLnk::smallIconSize()+frameWidth()*2+3 );
191}
192
193const int AppMonitor::RAISE_TIMEOUT_MS = 500;
194
195AppMonitor::AppMonitor(const AppLnk& app, RunningAppBar& owner)
196 : QObject(0L), m_Owner(owner), m_App(app), m_PsProc(0L), m_AppKillerBox(0L) {
197 QCopChannel* channel = new QCopChannel( "QPE/System", this );
198 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
199 this, SLOT(received(const QCString&, const QByteArray&)) );
200 connect(&m_Timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
201 m_Timer.start(RAISE_TIMEOUT_MS, TRUE);
202}
203
204AppMonitor::~AppMonitor() {
205 if (m_AppKillerBox) {
206 delete m_AppKillerBox;
207 m_AppKillerBox = 0L;
208 }
209}
210
211void AppMonitor::received(const QCString& msg, const QByteArray& data) {
212 QDataStream stream( data, IO_ReadOnly );
213
214 if (msg == "appRaised(QString)") {
215 QString appName;
216 stream >> appName;
217 if (appName == m_App.exec()) {
218 // qDebug("Got a heartbeat from %s", appName.latin1());
219 m_Timer.stop();
220 // Check to make sure we're not waiting on user input...
221 if (m_AppKillerBox) {
222 // If we are, we kill the dialog box, and the code waiting on the result
223 // will clean us up (basically the user said "no").
224 delete m_AppKillerBox;
225 m_AppKillerBox = 0L;
226 }
227 else {
228 // Ok, we're not waiting on user input, so clean us up now.
229 // WE DELETE OURSELVES HERE! Don't do anything else!!
230 delete this;
231 }
232 }
233 }
234}
235
236void AppMonitor::timerExpired() {
237 // qDebug("Checking in on %s", m_App.name().latin1());
238 // We store this incase the application responds while we're
239 // waiting for user input so we know not to delete ourselves. This
240 // will be cleaned up in the destructor.
241 m_AppKillerBox = new QMessageBox(tr("Application Problem"),
242 tr("<p>%1 is not responding.</p>").arg(m_App.name()) +
243 tr("<p>Would you like to force the application to exit?</p>"),
244 QMessageBox::Warning, QMessageBox::Yes,
245 QMessageBox::No | QMessageBox::Default,
246 QMessageBox::NoButton);
247 if (m_AppKillerBox->exec() == QMessageBox::Yes) {
248 // qDebug("Killing the app!!! Bwuhahahaha!");
249 m_PsProc = new QProcess(QString("ps"));
250 m_PsProc->addArgument("h");
251 m_PsProc->addArgument("-C");
252 m_PsProc->addArgument(m_App.exec());
253 m_PsProc->addArgument("-o");
254 m_PsProc->addArgument("pid");
255 connect(m_PsProc, SIGNAL(processExited()), this, SLOT(psProcFinished()));
256 m_PsProc->start();
257 }
258 else {
259 // qDebug("Wuss..");
260 // WE DELETE OURSELVES HERE! Don't do anything else!!
261 delete this;
262 }
263}
264
265void AppMonitor::psProcFinished() {
266 QString pid = m_PsProc->readLineStdout();
267 delete m_PsProc;
268 m_PsProc = 0L;
269
270 // qDebug("Killing app %s", pid.latin1());
271 if (pid.isEmpty()) {
272 // Hmm.. did the application bail before we got there?
273 qDebug("AppMonitor: Tried to kill application %s but ps couldn't find it.", m_App.exec().latin1());
274 }
275 else {
276 int success = kill(pid.toUInt(), SIGKILL);
277 if (success == 0) {
278 m_Owner.removeTask(m_App);
279 }
280 else {
281 qWarning("Could not kill task %s", m_App.exec().latin1());
282 }
283 }
284
285 // WE DELETE OURSELVES HERE! Don't do anything else!!
286 delete this;
287}
diff --git a/core/launcher/runningappbar.h b/core/launcher/runningappbar.h
new file mode 100644
index 0000000..880bb69
--- a/dev/null
+++ b/core/launcher/runningappbar.h
@@ -0,0 +1,88 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef RUNNING_APP_BAR_H
22#define RUNNING_APP_BAR_H
23
24#include <qframe.h>
25#include <qlist.h>
26#include <qtimer.h>
27
28class AppLnk;
29class AppLnkSet;
30class QCString;
31class QProcess;
32class QMessageBox;
33
34class RunningAppBar : public QFrame {
35 Q_OBJECT
36
37 public:
38 RunningAppBar(QWidget* parent);
39 ~RunningAppBar();
40
41 void addTask(const AppLnk& appLnk);
42 void removeTask(const AppLnk& appLnk);
43 void paintEvent(QPaintEvent* event);
44 void mousePressEvent(QMouseEvent*);
45 void mouseReleaseEvent(QMouseEvent*);
46 QSize sizeHint() const;
47
48 private slots:
49 void newQcopChannel(const QString& channel);
50 void removedQcopChannel(const QString& channel);
51 void received(const QCString& msg, const QByteArray& data);
52
53 private:
54 AppLnkSet* m_AppLnkSet;
55 QList<AppLnk> m_AppList;
56 int m_SelectedAppIndex;
57 int spacing;
58};
59
60/**
61 * Internal class that checks back in on the process when timerExpired is called
62 * to make sure the process is on top. If it's not it displays a dialog
63 * box asking permission to kill it.
64 */
65class AppMonitor : public QObject {
66 Q_OBJECT
67
68 public:
69 static const int RAISE_TIMEOUT_MS;
70
71 AppMonitor(const AppLnk& app, RunningAppBar& owner);
72 ~AppMonitor();
73
74 private slots:
75 void timerExpired();
76 void received(const QCString& msg, const QByteArray& data);
77 void psProcFinished();
78
79 private:
80 RunningAppBar& m_Owner;
81 const AppLnk& m_App;
82 QTimer m_Timer;
83 QProcess* m_PsProc;
84 QMessageBox* m_AppKillerBox;
85};
86
87#endif
88
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index 5bac874..5506c55 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -11,25 +11,25 @@
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 "sidething.h" 22#include "sidething.h"
23#include "mrulist.h" 23//#include "mrulist.h"
24#include "info.h" 24#include "info.h"
25 25
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/config.h> 27#include <qpe/config.h>
28#include <qpe/applnk.h> 28#include <qpe/applnk.h>
29#include <qpe/global.h> 29#include <qpe/global.h>
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31 31
32#include <qdict.h> 32#include <qdict.h>
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
@@ -66,25 +66,25 @@ StartMenu::~StartMenu()
66 66
67 67
68void StartMenu::loadOptions() 68void StartMenu::loadOptions()
69{ 69{
70#ifdef USE_CONFIG_FILE 70#ifdef USE_CONFIG_FILE
71 // Read configuration file 71 // Read configuration file
72 Config config("StartMenu"); 72 Config config("StartMenu");
73 config.setGroup( "StartMenu" ); 73 config.setGroup( "StartMenu" );
74 QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); 74 QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" );
75 useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; 75 useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE;
76 QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); 76 QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" );
77 startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; 77 startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE;
78 QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); 78// QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" );
79 popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); 79 popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" );
80 startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); 80 startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" );
81#else 81#else
82 // Basically just #include the .qpe_menu.conf file settings 82 // Basically just #include the .qpe_menu.conf file settings
83 useWidePopupMenu = FALSE; 83 useWidePopupMenu = FALSE;
84 popupMenuSidePixmap = "lauchner/sidebar"; 84 popupMenuSidePixmap = "lauchner/sidebar";
85 startButtonIsFlat = TRUE; 85 startButtonIsFlat = TRUE;
86 startButtonPixmap = "launcher/start_button"; 86 startButtonPixmap = "launcher/start_button";
87#endif 87#endif
88} 88}
89 89
90 90
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index e38b9fe..9f397eb 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -12,24 +12,25 @@
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 "runningappbar.h"
24#include "systray.h" 25#include "systray.h"
25#include "calibrate.h" 26#include "calibrate.h"
26#include "wait.h" 27#include "wait.h"
27#include "appicons.h" 28#include "appicons.h"
28 29
29#include "taskbar.h" 30#include "taskbar.h"
30#include "desktop.h" 31#include "desktop.h"
31 32
32#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 35#include <qpe/global.h>
35 36
@@ -146,36 +147,39 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn
146 147
147 sm = new StartMenu( this ); 148 sm = new StartMenu( this );
148 149
149 inputMethods = new InputMethods( this ); 150 inputMethods = new InputMethods( this );
150 connect( inputMethods, SIGNAL(inputToggled(bool)), 151 connect( inputMethods, SIGNAL(inputToggled(bool)),
151 this, SLOT(calcMaxWindowRect()) ); 152 this, SLOT(calcMaxWindowRect()) );
152 //new QuickLauncher( this ); 153 //new QuickLauncher( this );
153 154
154 stack = new QWidgetStack( this ); 155 stack = new QWidgetStack( this );
155 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 156 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
156 label = new QLabel(stack); 157 label = new QLabel(stack);
157 158
158 mru = new MRUList( stack ); 159 //mru = new MRUList( stack );
159 stack->raiseWidget( mru ); 160 //stack->raiseWidget( mru );
161
162 runningAppBar = new RunningAppBar(stack);
163 stack->raiseWidget(runningAppBar);
160 164
161 waitIcon = new Wait( this ); 165 waitIcon = new Wait( this );
162 (void) new AppIcons( this ); 166 (void) new AppIcons( this );
163 167
164 sysTray = new SysTray( this ); 168 sysTray = new SysTray( this );
165 169
166 // ## make customizable in some way? 170 // ## make customizable in some way?
167#ifdef QT_QWS_CUSTOM 171#ifdef QT_QWS_CUSTOM
168 lockState = new LockKeyState( this ); 172 lockState = new LockKeyState( this );
169#else 173y#else
170 lockState = 0; 174 lockState = 0;
171#endif 175#endif
172 176
173#if defined(Q_WS_QWS) 177#if defined(Q_WS_QWS)
174#if !defined(QT_NO_COP) 178#if !defined(QT_NO_COP)
175 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 179 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
176 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
177 this, SLOT(receive(const QCString&, const QByteArray&)) ); 181 this, SLOT(receive(const QCString&, const QByteArray&)) );
178#endif 182#endif
179#endif 183#endif
180 waitTimer = new QTimer( this ); 184 waitTimer = new QTimer( this );
181 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 185 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
@@ -187,44 +191,46 @@ TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOn
187void TaskBar::setStatusMessage( const QString &text ) 191void TaskBar::setStatusMessage( const QString &text )
188{ 192{
189 label->setText( text ); 193 label->setText( text );
190 stack->raiseWidget( label ); 194 stack->raiseWidget( label );
191 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 195 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
192 sysTray->hide(); 196 sysTray->hide();
193 clearer->start( 3000 ); 197 clearer->start( 3000 );
194} 198}
195 199
196void TaskBar::clearStatusBar() 200void TaskBar::clearStatusBar()
197{ 201{
198 label->clear(); 202 label->clear();
199 stack->raiseWidget( mru ); 203 stack->raiseWidget(runningAppBar);
204 // stack->raiseWidget( mru );
200} 205}
201 206
202void TaskBar::startWait() 207void TaskBar::startWait()
203{ 208{
204 waitIcon->setWaiting( true ); 209 waitIcon->setWaiting( true );
205 // a catchall stop after 10 seconds... 210 // a catchall stop after 10 seconds...
206 waitTimer->start( 10 * 1000, true ); 211 waitTimer->start( 10 * 1000, true );
207} 212}
208 213
209void TaskBar::stopWait(const QString& app) 214void TaskBar::stopWait(const QString& app)
210{ 215{
211 waitTimer->stop(); 216 waitTimer->stop();
212 mru->addTask(sm->execToLink(app)); 217 //mru->addTask(sm->execToLink(app));
213 waitIcon->setWaiting( false ); 218 waitIcon->setWaiting( false );
214} 219}
215 220
216void TaskBar::stopWait() 221void TaskBar::stopWait()
217{ 222{
218 waitTimer->stop(); 223 waitTimer->stop();
224
219 waitIcon->setWaiting( false ); 225 waitIcon->setWaiting( false );
220} 226}
221 227
222void TaskBar::resizeEvent( QResizeEvent *e ) 228void TaskBar::resizeEvent( QResizeEvent *e )
223{ 229{
224 QHBox::resizeEvent( e ); 230 QHBox::resizeEvent( e );
225 calcMaxWindowRect(); 231 calcMaxWindowRect();
226} 232}
227 233
228void TaskBar::styleChange( QStyle &s ) 234void TaskBar::styleChange( QStyle &s )
229{ 235{
230 QHBox::styleChange( s ); 236 QHBox::styleChange( s );
@@ -265,25 +271,25 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data )
265 } else if ( msg == "showInputMethod()" ) { 271 } else if ( msg == "showInputMethod()" ) {
266 inputMethods->showInputMethod(); 272 inputMethods->showInputMethod();
267 } else if ( msg == "reloadInputMethods()" ) { 273 } else if ( msg == "reloadInputMethods()" ) {
268 inputMethods->loadInputMethods(); 274 inputMethods->loadInputMethods();
269 } else if ( msg == "reloadApplets()" ) { 275 } else if ( msg == "reloadApplets()" ) {
270 sysTray->loadApplets(); 276 sysTray->loadApplets();
271 } else if ( msg == "soundAlarm()" ) { 277 } else if ( msg == "soundAlarm()" ) {
272 Desktop::soundAlarm(); 278 Desktop::soundAlarm();
273 } 279 }
274 else if ( msg == "setLed(int,bool)" ) { 280 else if ( msg == "setLed(int,bool)" ) {
275 int led, status; 281 int led, status;
276 stream >> led >> status; 282 stream >> led >> status;
277 283
278 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off );
279 } 285 }
280} 286}
281 287
282QWidget *TaskBar::calibrate(bool) 288QWidget *TaskBar::calibrate(bool)
283{ 289{
284#ifdef Q_WS_QWS 290#ifdef Q_WS_QWS
285 Calibrate *c = new Calibrate; 291 Calibrate *c = new Calibrate;
286 c->show(); 292 c->show();
287 return c; 293 return c;
288#else 294#else
289 return 0; 295 return 0;
@@ -302,15 +308,16 @@ void TaskBar::toggleCapsLockState()
302 308
303void TaskBar::toggleSymbolInput() 309void TaskBar::toggleSymbolInput()
304{ 310{
305 if ( inputMethods->currentShown() == "Unicode" ) { 311 if ( inputMethods->currentShown() == "Unicode" ) {
306 inputMethods->hideInputMethod(); 312 inputMethods->hideInputMethod();
307 } else { 313 } else {
308 inputMethods->showInputMethod("Unicode"); 314 inputMethods->showInputMethod("Unicode");
309 } 315 }
310} 316}
311 317
312bool TaskBar::recoverMemory() 318bool TaskBar::recoverMemory()
313{ 319{
314 return mru->quitOldApps(); 320 //eturn mru->quitOldApps();
321 return true;
315} 322}
316 323
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index 40983af..cd631ef 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -19,25 +19,26 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef __TASKBAR_H__ 21#ifndef __TASKBAR_H__
22#define __TASKBAR_H__ 22#define __TASKBAR_H__
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25 25
26class QLabel; 26class QLabel;
27class QTimer; 27class QTimer;
28class InputMethods; 28class InputMethods;
29class Wait; 29class Wait;
30class SysTray; 30class SysTray;
31class MRUList; 31//class MRUList;
32class RunningAppBar;
32class QWidgetStack; 33class QWidgetStack;
33class QTimer; 34class QTimer;
34class QLabel; 35class QLabel;
35class StartMenu; 36class StartMenu;
36class LockKeyState; 37class LockKeyState;
37 38
38class TaskBar : public QHBox { 39class TaskBar : public QHBox {
39 Q_OBJECT 40 Q_OBJECT
40public: 41public:
41 TaskBar(); 42 TaskBar();
42 ~TaskBar(); 43 ~TaskBar();
43 44
@@ -50,33 +51,34 @@ public slots:
50 void startWait(); 51 void startWait();
51 void stopWait(const QString&); 52 void stopWait(const QString&);
52 void stopWait(); 53 void stopWait();
53 void clearStatusBar(); 54 void clearStatusBar();
54 void toggleNumLockState(); 55 void toggleNumLockState();
55 void toggleCapsLockState(); 56 void toggleCapsLockState();
56 void toggleSymbolInput(); 57 void toggleSymbolInput();
57 58
58protected: 59protected:
59 void resizeEvent( QResizeEvent * ); 60 void resizeEvent( QResizeEvent * );
60 void styleChange( QStyle & ); 61 void styleChange( QStyle & );
61 void setStatusMessage( const QString &text ); 62 void setStatusMessage( const QString &text );
62 63
63private slots: 64private slots:
64 void calcMaxWindowRect(); 65 void calcMaxWindowRect();
65 void receive( const QCString &msg, const QByteArray &data ); 66 void receive( const QCString &msg, const QByteArray &data );
66 67
67private: 68private:
68 69
69 QTimer *waitTimer; 70 QTimer *waitTimer;
70 Wait *waitIcon; 71 Wait *waitIcon;
71 InputMethods *inputMethods; 72 InputMethods *inputMethods;
72 SysTray *sysTray; 73 SysTray *sysTray;
73 MRUList *mru; 74 // MRUList *mru;
75 RunningAppBar* runningAppBar;
74 QWidgetStack *stack; 76 QWidgetStack *stack;
75 QTimer *clearer; 77 QTimer *clearer;
76 QLabel *label; 78 QLabel *label;
77 LockKeyState* lockState; 79 LockKeyState* lockState;
78 StartMenu *sm; 80 StartMenu *sm;
79}; 81};
80 82
81 83
82#endif // __TASKBAR_H__ 84#endif // __TASKBAR_H__