summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp11
-rw-r--r--core/launcher/mrulist.cpp46
-rw-r--r--core/launcher/mrulist.h1
3 files changed, 28 insertions, 30 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
@@ -635,99 +635,104 @@ void Launcher::select( const AppLnk *appLnk )
QMessageBox::information(this,tr("No application"),
tr("<p>No application is defined for this document."
"<p>Type is %1.").arg(appLnk->type()));
return;
}
tabs->setBusy(TRUE);
emit executing( appLnk );
appLnk->execute();
}
}
void Launcher::externalSelected(const AppLnk *appLnk)
{
tabs->setBusy(TRUE);
emit executing( appLnk );
}
void Launcher::properties( AppLnk *appLnk )
{
if ( appLnk->type() == "Folder" ) {
// Not supported: flat is simpler for the user
} else {
in_lnk_props = TRUE;
got_lnk_change = FALSE;
LnkProperties prop(appLnk);
connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
prop.showMaximized();
prop.exec();
in_lnk_props = FALSE;
if ( got_lnk_change ) {
updateLink(lnk_change);
}
}
}
void Launcher::updateLink(const QString& link)
{
if (link.isNull())
updateTabs();
else if (link.isEmpty())
updateDocs();
else
tabs->updateLink(link);
}
void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
- if ( msg == "linkChanged(QString)" ) {
- QString link;
- stream >> link;
+ if ( msg == "closing(QString)" ){
+ QString app;
+ stream >> app;
+ qWarning("app closed %s", app.latin1() );
+ MRUList::removeTask( app );
+ }else if ( msg == "linkChanged(QString)" ) {
+ QString link;
+ stream >> link;
if ( in_lnk_props ) {
got_lnk_change = TRUE;
lnk_change = link;
} else {
updateLink(link);
}
} else if ( msg == "busy()" ) {
emit busy();
} else if ( msg == "notBusy(QString)" ) {
QString app;
stream >> app;
tabs->setBusy(FALSE);
emit notBusy(app);
} else if ( msg == "mkdir(QString)" ) {
QString dir;
stream >> dir;
if ( !dir.isEmpty() )
mkdir( dir );
} else if ( msg == "rdiffGenSig(QString,QString)" ) {
QString baseFile, sigFile;
stream >> baseFile >> sigFile;
QRsync::generateSignature( baseFile, sigFile );
} else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
QString baseFile, sigFile, deltaFile;
stream >> baseFile >> sigFile >> deltaFile;
QRsync::generateDiff( baseFile, sigFile, deltaFile );
} else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
QString baseFile, deltaFile;
stream >> baseFile >> deltaFile;
if ( !QFile::exists( baseFile ) ) {
QFile f( baseFile );
f.open( IO_WriteOnly );
f.close();
}
QRsync::applyDiff( baseFile, deltaFile );
QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
e << baseFile;
} else if ( msg == "rdiffCleanup()" ) {
mkdir( "/tmp/rdiff" );
QDir dir;
dir.setPath( "/tmp/rdiff" );
QStringList entries = dir.entryList();
for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
dir.remove( *it );
} else if ( msg == "sendHandshakeInfo()" ) {
QString home = getenv( "HOME" );
QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
e << home;
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
@@ -18,132 +18,124 @@
** not clear to you.
**
**********************************************************************/
#include "mrulist.h"
#include <qpe/global.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
#include <qframe.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qpopupmenu.h>
#include <qpainter.h>
#include <qwindowsystem_qws.h>
QList<MRUList> *MRUList::MRUListWidgets = NULL;
QList<AppLnk> *MRUList::task = NULL;
MRUList::MRUList( QWidget *parent )
: QFrame( parent ), selected(-1), oldsel(-1)
{
setBackgroundMode( PaletteButton );
if (!MRUListWidgets)
MRUListWidgets = new QList<MRUList>;
if (!task)
task = new QList<AppLnk>;
MRUListWidgets->append( this );
}
MRUList::~MRUList()
{
if (MRUListWidgets)
MRUListWidgets->remove( this );
if (task)
task->setAutoDelete( TRUE );
}
QSize MRUList::sizeHint() const
{
return QSize( frameWidth(), 16 );
}
+// thanks to John from Trolltech
+void MRUList::removeTask(const QString &appName )
+{
+ qWarning("MRULList::removeTask( %s)", appName.latin1() );
+ if(appName.isEmpty() )
+ return;
+
+ if(!task ) // at least it should be called once before
+ return;
+ unsigned int i= 0;
+ for ( ; i < task->count(); i++ ) {
+ AppLnk *t = task->at(i);
+ if ( t->exec() == appName )
+ task->remove();
+ }
+ for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
+ MRUListWidgets->at(i)->update();
+}
void MRUList::addTask( const AppLnk *appLnk )
{
+ qWarning("Add Task" );
if ( !appLnk )
return;
unsigned int i = 0;
if ( !task )
return;
- // ok we wan't to delete old icons from the taskbar
- // get the window list and see which windows aren't there any more
- QList<AppLnk> cleanUp;
- cleanUp.setAutoDelete( TRUE );
- const QList<QWSWindow> &list = qwsServer->clientWindows();
- QWSWindow* w;
- bool running = false; // to see what we should do
- for ( ; i < task->count(); i++ ) {
- AppLnk *t = task->at(i);
- running = false;
- for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
- QString app = w->client()->identity();
- if( app == t->exec( ) ){
- running = true;
- break;
- }
- }
- if(!running ) { // gues what we do now
- cleanUp.append( t);
- }
- }
- // no do a clean up of these old icons
- AppLnk *lnk;
- for( lnk = cleanUp.first(); lnk != 0; lnk = cleanUp.next() ){
- task->remove( lnk );
- }
- cleanUp.clear(); // should be deleted too
i = 0;
for ( ; i < task->count(); i++ ) {
AppLnk *t = task->at(i);
if ( t->exec() == appLnk->exec() ) {
if (i != 0) {
task->remove();
task->prepend( t );
}
for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
MRUListWidgets->at(i)->update();
return;
}
}
// check which tasks are running and delete them from the list
AppLnk *t = new AppLnk( *appLnk );
// DocLnks have an overloaded virtual function exec()
t->setExec( appLnk->exec() );
task->prepend( t );
if ( task->count() > 6 ) {
t = task->last();
task->remove();
Global::terminate(t);
delete t;
}
for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
MRUListWidgets->at(i)->update();
}
bool MRUList::quitOldApps()
{
QStringList appsstarted;
QStringList appsrunning;
for ( int i=task->count()-1; i>=0; --i ) {
AppLnk *t = task->at(i);
appsstarted.append(t->exec());
}
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
QString app = w->client()->identity();
if ( appsstarted.contains(app) && !appsrunning.contains(app) )
appsrunning.append(app);
}
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
@@ -1,55 +1,56 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** 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 __MRU_LIST_H__
#define __MRU_LIST_H__
#include <qpe/applnk.h>
#include <qframe.h>
#include <qlist.h>
#include <qpixmap.h>
class MRUList : public QFrame
{
public:
MRUList( QWidget *parent );
~MRUList();
virtual QSize sizeHint() const;
static void addTask( const AppLnk *appLnk );
+ static void removeTask(const QString &appName );
bool quitOldApps();
protected:
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void paintEvent( QPaintEvent *event );
private:
static QList<MRUList> *MRUListWidgets;
static QList<AppLnk> *task;
int selected;
int oldsel;
};
#endif // __MRU_LIST_H__