summaryrefslogtreecommitdiff
path: root/core/launcher
authorharlekin <harlekin>2002-04-03 08:12:17 (UTC)
committer harlekin <harlekin>2002-04-03 08:12:17 (UTC)
commit48f7cbcb23cfd4daff6218d8902e0049af674b9f (patch) (unidiff)
tree49cbc6aa015290a143ff3c0652de906ad3c8fc71 /core/launcher
parent14acfe3608e8c57e5cacb08daed8944946e03d42 (diff)
downloadopie-48f7cbcb23cfd4daff6218d8902e0049af674b9f.zip
opie-48f7cbcb23cfd4daff6218d8902e0049af674b9f.tar.gz
opie-48f7cbcb23cfd4daff6218d8902e0049af674b9f.tar.bz2
changed MRUlist to a taskbar, only running apps are shown
Diffstat (limited to 'core/launcher') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp7
-rw-r--r--core/launcher/mrulist.cpp46
-rw-r--r--core/launcher/mrulist.h1
3 files changed, 26 insertions, 28 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 17a30e6..1449269 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -659,49 +659,54 @@ void Launcher::properties( AppLnk *appLnk )
659 LnkProperties prop(appLnk); 659 LnkProperties prop(appLnk);
660 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 660 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
661 prop.showMaximized(); 661 prop.showMaximized();
662 prop.exec(); 662 prop.exec();
663 in_lnk_props = FALSE; 663 in_lnk_props = FALSE;
664 if ( got_lnk_change ) { 664 if ( got_lnk_change ) {
665 updateLink(lnk_change); 665 updateLink(lnk_change);
666 } 666 }
667 } 667 }
668} 668}
669 669
670void Launcher::updateLink(const QString& link) 670void Launcher::updateLink(const QString& link)
671{ 671{
672 if (link.isNull()) 672 if (link.isNull())
673 updateTabs(); 673 updateTabs();
674 else if (link.isEmpty()) 674 else if (link.isEmpty())
675 updateDocs(); 675 updateDocs();
676 else 676 else
677 tabs->updateLink(link); 677 tabs->updateLink(link);
678} 678}
679 679
680void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 680void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
681{ 681{
682 QDataStream stream( data, IO_ReadOnly ); 682 QDataStream stream( data, IO_ReadOnly );
683 if ( msg == "linkChanged(QString)" ) { 683 if ( msg == "closing(QString)" ){
684 QString app;
685 stream >> app;
686 qWarning("app closed %s", app.latin1() );
687 MRUList::removeTask( app );
688 }else if ( msg == "linkChanged(QString)" ) {
684 QString link; 689 QString link;
685 stream >> link; 690 stream >> link;
686 if ( in_lnk_props ) { 691 if ( in_lnk_props ) {
687 got_lnk_change = TRUE; 692 got_lnk_change = TRUE;
688 lnk_change = link; 693 lnk_change = link;
689 } else { 694 } else {
690 updateLink(link); 695 updateLink(link);
691 } 696 }
692 } else if ( msg == "busy()" ) { 697 } else if ( msg == "busy()" ) {
693 emit busy(); 698 emit busy();
694 } else if ( msg == "notBusy(QString)" ) { 699 } else if ( msg == "notBusy(QString)" ) {
695 QString app; 700 QString app;
696 stream >> app; 701 stream >> app;
697 tabs->setBusy(FALSE); 702 tabs->setBusy(FALSE);
698 emit notBusy(app); 703 emit notBusy(app);
699 } else if ( msg == "mkdir(QString)" ) { 704 } else if ( msg == "mkdir(QString)" ) {
700 QString dir; 705 QString dir;
701 stream >> dir; 706 stream >> dir;
702 if ( !dir.isEmpty() ) 707 if ( !dir.isEmpty() )
703 mkdir( dir ); 708 mkdir( dir );
704 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 709 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
705 QString baseFile, sigFile; 710 QString baseFile, sigFile;
706 stream >> baseFile >> sigFile; 711 stream >> baseFile >> sigFile;
707 QRsync::generateSignature( baseFile, sigFile ); 712 QRsync::generateSignature( baseFile, sigFile );
diff --git a/core/launcher/mrulist.cpp b/core/launcher/mrulist.cpp
index 6066dac..5590d38 100644
--- a/core/launcher/mrulist.cpp
+++ b/core/launcher/mrulist.cpp
@@ -42,84 +42,76 @@ MRUList::MRUList( QWidget *parent )
42{ 42{
43 setBackgroundMode( PaletteButton ); 43 setBackgroundMode( PaletteButton );
44 if (!MRUListWidgets) 44 if (!MRUListWidgets)
45 MRUListWidgets = new QList<MRUList>; 45 MRUListWidgets = new QList<MRUList>;
46 if (!task) 46 if (!task)
47 task = new QList<AppLnk>; 47 task = new QList<AppLnk>;
48 MRUListWidgets->append( this ); 48 MRUListWidgets->append( this );
49} 49}
50 50
51 51
52MRUList::~MRUList() 52MRUList::~MRUList()
53{ 53{
54 if (MRUListWidgets) 54 if (MRUListWidgets)
55 MRUListWidgets->remove( this ); 55 MRUListWidgets->remove( this );
56 if (task) 56 if (task)
57 task->setAutoDelete( TRUE ); 57 task->setAutoDelete( TRUE );
58} 58}
59 59
60 60
61QSize MRUList::sizeHint() const 61QSize MRUList::sizeHint() const
62{ 62{
63 return QSize( frameWidth(), 16 ); 63 return QSize( frameWidth(), 16 );
64} 64}
65 65
66// thanks to John from Trolltech
67void MRUList::removeTask(const QString &appName )
68{
69 qWarning("MRULList::removeTask( %s)", appName.latin1() );
70 if(appName.isEmpty() )
71 return;
72
73 if(!task ) // at least it should be called once before
74 return;
75 unsigned int i= 0;
76 for ( ; i < task->count(); i++ ) {
77 AppLnk *t = task->at(i);
78 if ( t->exec() == appName )
79 task->remove();
80 }
81 for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
82 MRUListWidgets->at(i)->update();
83}
66 84
67void MRUList::addTask( const AppLnk *appLnk ) 85void MRUList::addTask( const AppLnk *appLnk )
68{ 86{
87 qWarning("Add Task" );
69 if ( !appLnk ) 88 if ( !appLnk )
70 return; 89 return;
71 unsigned int i = 0; 90 unsigned int i = 0;
72 91
73 if ( !task ) 92 if ( !task )
74 return; 93 return;
75 // ok we wan't to delete old icons from the taskbar
76 // get the window list and see which windows aren't there any more
77 QList<AppLnk> cleanUp;
78 cleanUp.setAutoDelete( TRUE );
79 const QList<QWSWindow> &list = qwsServer->clientWindows();
80 QWSWindow* w;
81 bool running = false; // to see what we should do
82 for ( ; i < task->count(); i++ ) {
83 AppLnk *t = task->at(i);
84 running = false;
85 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
86 QString app = w->client()->identity();
87 if( app == t->exec( ) ){
88 running = true;
89 break;
90 }
91 }
92 if(!running ) { // gues what we do now
93 cleanUp.append( t);
94 }
95 }
96 // no do a clean up of these old icons
97 AppLnk *lnk;
98 for( lnk = cleanUp.first(); lnk != 0; lnk = cleanUp.next() ){
99 task->remove( lnk );
100 }
101 cleanUp.clear(); // should be deleted too
102 94
103 i = 0; 95 i = 0;
104 for ( ; i < task->count(); i++ ) { 96 for ( ; i < task->count(); i++ ) {
105 AppLnk *t = task->at(i); 97 AppLnk *t = task->at(i);
106 if ( t->exec() == appLnk->exec() ) { 98 if ( t->exec() == appLnk->exec() ) {
107 if (i != 0) { 99 if (i != 0) {
108 task->remove(); 100 task->remove();
109 task->prepend( t ); 101 task->prepend( t );
110 } 102 }
111 for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) 103 for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
112 MRUListWidgets->at(i)->update(); 104 MRUListWidgets->at(i)->update();
113 return; 105 return;
114 } 106 }
115 } 107 }
116 // check which tasks are running and delete them from the list 108 // check which tasks are running and delete them from the list
117 AppLnk *t = new AppLnk( *appLnk ); 109 AppLnk *t = new AppLnk( *appLnk );
118 // DocLnks have an overloaded virtual function exec() 110 // DocLnks have an overloaded virtual function exec()
119 t->setExec( appLnk->exec() ); 111 t->setExec( appLnk->exec() );
120 task->prepend( t ); 112 task->prepend( t );
121 113
122 if ( task->count() > 6 ) { 114 if ( task->count() > 6 ) {
123 t = task->last(); 115 t = task->last();
124 task->remove(); 116 task->remove();
125 Global::terminate(t); 117 Global::terminate(t);
diff --git a/core/launcher/mrulist.h b/core/launcher/mrulist.h
index 141a09b..ff111ce 100644
--- a/core/launcher/mrulist.h
+++ b/core/launcher/mrulist.h
@@ -15,41 +15,42 @@
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#ifndef __MRU_LIST_H__ 21#ifndef __MRU_LIST_H__
22#define __MRU_LIST_H__ 22#define __MRU_LIST_H__
23 23
24 24
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlist.h> 28#include <qlist.h>
29#include <qpixmap.h> 29#include <qpixmap.h>
30 30
31 31
32class MRUList : public QFrame 32class MRUList : public QFrame
33{ 33{
34public: 34public:
35 MRUList( QWidget *parent ); 35 MRUList( QWidget *parent );
36 ~MRUList(); 36 ~MRUList();
37 virtual QSize sizeHint() const; 37 virtual QSize sizeHint() const;
38 static void addTask( const AppLnk *appLnk ); 38 static void addTask( const AppLnk *appLnk );
39 static void removeTask(const QString &appName );
39 bool quitOldApps(); 40 bool quitOldApps();
40 41
41protected: 42protected:
42 void mousePressEvent(QMouseEvent *e); 43 void mousePressEvent(QMouseEvent *e);
43 void mouseReleaseEvent(QMouseEvent *e); 44 void mouseReleaseEvent(QMouseEvent *e);
44 void paintEvent( QPaintEvent *event ); 45 void paintEvent( QPaintEvent *event );
45 46
46private: 47private:
47 static QList<MRUList> *MRUListWidgets; 48 static QList<MRUList> *MRUListWidgets;
48 static QList<AppLnk> *task; 49 static QList<AppLnk> *task;
49 int selected; 50 int selected;
50 int oldsel; 51 int oldsel;
51}; 52};
52 53
53 54
54#endif // __MRU_LIST_H__ 55#endif // __MRU_LIST_H__
55 56