-rw-r--r-- | core/launcher/systray.cpp | 70 | ||||
-rw-r--r-- | core/launcher/systray.h | 12 |
2 files changed, 35 insertions, 47 deletions
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index be55791..64356ca 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp @@ -20,5 +20,5 @@ -#include <qpe/qpeapplication.h> -#include <qpe/qlibrary.h> -#include <qpe/config.h> +#include <qtopia/qpeapplication.h> +#include <qtopia/qlibrary.h> +#include <qtopia/config.h> @@ -26,5 +26,5 @@ #include <qdir.h> +#include <qmessagebox.h> #include <qtranslator.h> -#include "quicklauncher.h" #include "systray.h" @@ -33,4 +33,7 @@ -#ifdef SINGLE_APP -#include "clockappletimpl.h" +/* ### Single build floppies ### */ +#if 0 +#ifdef QT_NO_COMPONENTS +#include "../plugins/applets/clockapplet/clockappletimpl.h" +#endif #endif @@ -39,3 +42,2 @@ SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) { - safety_tid = 0; //setFrameStyle( QFrame::Panel | QFrame::Sunken ); @@ -44,2 +46,7 @@ SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) +SysTray::~SysTray() +{ + clearApplets(); +} + static int compareAppletPositions(const void *a, const void *b) @@ -50,3 +57,3 @@ static int compareAppletPositions(const void *a, const void *b) if ( d ) return d; - return QString::compare(ab->library->library(),aa->library->library()); + return QString::compare(ab->name,aa->name); } @@ -55,2 +62,3 @@ void SysTray::loadApplets() { + hide(); clearApplets(); @@ -61,7 +69,7 @@ void SysTray::clearApplets() { - hide(); -#ifndef SINGLE_APP +#ifndef QT_NO_COMPONENTS + QValueList<TaskbarApplet>::Iterator mit; for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { - (*mit).iface->release(); + (*mit).iface->release(); (*mit).library->unload(); @@ -69,2 +77,3 @@ void SysTray::clearApplets() } + #endif @@ -79,14 +88,6 @@ void SysTray::addApplets() { -#ifndef SINGLE_APP + hide(); +#ifndef QT_NO_COMPONENTS Config cfg( "Taskbar" ); cfg.setGroup( "Applets" ); - - // SafeMode causes too much problems, so we disable it for now -- - // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 - - bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); - if ( safe && !safety_tid ) - return; - cfg.writeEntry("SafeMode",TRUE); - cfg.write(); QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); @@ -110,3 +111,3 @@ void SysTray::addApplets() applet->iface = iface; - + QTranslator *trans = new QTranslator(qApp); @@ -117,3 +118,3 @@ void SysTray::addApplets() else - delete trans; + delete trans; } else { @@ -131,23 +132,10 @@ void SysTray::addApplets() delete [] applets; -#else - TaskbarApplet applet; - applet.iface = new ClockAppletImpl(); - applet.applet = applet.iface->applet( this ); - appletList.append( a ); +#else /* ## FIXME single app */ + TaskbarApplet * const applet = new TaskbarApplet(); + applet->iface = new ClockAppletImpl(); + applet->applet = applet->iface->applet( this ); + appletList.append( applet ); #endif show(); - - if ( !safety_tid ) - safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) } -void SysTray::timerEvent(QTimerEvent* e) -{ - if ( e->timerId() == safety_tid ) { - Config cfg( "Taskbar" ); - cfg.setGroup( "Applets" ); - cfg.writeEntry( "SafeMode", FALSE ); - killTimer(safety_tid); - safety_tid = 0; - } -} diff --git a/core/launcher/systray.h b/core/launcher/systray.h index 5a6849a..77c581f 100644 --- a/core/launcher/systray.h +++ b/core/launcher/systray.h @@ -23,3 +23,5 @@ -#include <qpe/taskbarappletinterface.h> +#ifndef QT_NO_COMPONENT +#include <qtopia/taskbarappletinterface.h> +#endif @@ -35,5 +37,6 @@ struct TaskbarApplet QLibrary *library; -#endif TaskbarAppletInterface *iface; +#endif QWidget *applet; + QString name; }; @@ -44,2 +47,3 @@ public: SysTray( QWidget *parent ); + ~SysTray(); @@ -48,8 +52,4 @@ public: -protected: - void timerEvent(QTimerEvent* e); - private: void loadApplets(); - int safety_tid; QHBoxLayout *layout; |