-rw-r--r-- | core/pim/today/configwidget.h | 3 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/today.pro | 2 | ||||
-rw-r--r-- | core/pim/today/todaybase.h | 17 |
4 files changed, 11 insertions, 15 deletions
diff --git a/core/pim/today/configwidget.h b/core/pim/today/configwidget.h index f3a83f9..f449db4 100644 --- a/core/pim/today/configwidget.h +++ b/core/pim/today/configwidget.h @@ -1,18 +1,17 @@ #ifndef CONFIG_WIDGET_H #define CONFIG_WIDGET_H -#include <qwidget.h> class ConfigWidget : public QWidget { - Q_OBJECT + public: ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {}; virtual ~ConfigWidget() {}; virtual void writeConfig() = 0; }; #endif diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 7decf8e..09540bd 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -25,234 +25,232 @@ #include <qpe/qpeapplication.h> #include <qpe/contact.h> #include <qdir.h> #include <qfile.h> #include <qpushbutton.h> #include <qlabel.h> #include <qtimer.h> #include <qpixmap.h> #include <qlayout.h> #include <qtabwidget.h> #include <qdialog.h> static QValueList<TodayPlugin> pluginList; Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl ) { QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); #endif #endif pluginLayout = 0l; setOwnerField(); init(); refresh(); showMaximized(); } /** * Qcop receive method. */ void Today::channelReceived( const QCString &msg, const QByteArray & data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "message(QString)" ) { QString message; stream >> message; setOwnerField( message ); } } /** * Initialises the owner field with the default value, the username */ void Today::setOwnerField() { QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); if ( QFile::exists( file ) ) { Contact cont = Contact::readVCard( file )[0]; QString returnString = cont.fullName(); OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); } else { OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); } } /** * Set the owner field with a given QString, for example per qcop. */ void Today::setOwnerField( QString &message ) { if ( !message.isEmpty() ) { OwnerField->setText( "<b>" + message + "</b>" ); } } /** * Init stuff needed for today. Reads the config file. */ void Today::init() { QDate date = QDate::currentDate(); QString time = ( tr( date.toString() ) ); DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); // read config Config cfg( "today" ); cfg.setGroup( "Applets" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); } /** * Load the plugins */ void Today::loadPlugins() { - qWarning("pluginList count %d", pluginList.count() ); + QValueList<TodayPlugin>::Iterator tit; for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { (*tit).library->unload(); delete (*tit).library; } - pluginList.clear(); QString path = QPEApplication::qpeDir() + "/plugins/today"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; uint count = 0; for ( it = list.begin(); it != list.end(); ++it ) { TodayPluginInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); qDebug( QString(*it).latin1() ); TodayPlugin plugin; plugin.library = lib; plugin.iface = iface; plugin.name = QString(*it).latin1(); if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; } else { plugin.active = false; } plugin.guiPart = plugin.iface->guiPart(); pluginList.append( plugin ); count++; } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; } } - qWarning("pluginList count end %d", pluginList.count() ); } /** * Repaint method. Reread all fields. */ void Today::draw() { if ( pluginLayout ) { delete pluginLayout; } pluginLayout = new QVBoxLayout( layout ); if ( pluginList.count() == 0 ) { QLabel *noPlugins = new QLabel( this ); noPlugins->setText( tr( "No plugins found" ) ); layout->addWidget( noPlugins ); return; } uint count = 0; TodayPlugin plugin; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; if ( plugin.active ) { QHBoxLayout* plugLayout = new QHBoxLayout( this ); QPixmap plugPix; plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); OClickableLabel* plugIcon = new OClickableLabel( this ); plugIcon->setPixmap( plugPix ); QScrollView* sv = new QScrollView( this ); QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() ); // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) ); sv->setMinimumHeight( plugin.guiPart->minHeight() ); //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setHScrollBarMode( QScrollView::AlwaysOff ); sv->setFrameShape( QFrame::NoFrame ); sv->addChild( plugWidget ); plugLayout->addWidget( plugIcon, 0, AlignTop ); plugLayout->addWidget( sv, 0, AlignTop ); plugLayout->setStretchFactor( plugIcon, 1 ); plugLayout->setStretchFactor( sv, 9 ); pluginLayout->addLayout( plugLayout ); count++; } } if ( count == 0 ) { QLabel *noPluginsActive = new QLabel( this ); noPluginsActive->setText( tr( "No plugins activated" ) ); layout->addWidget( noPluginsActive ); } layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); // how often refresh - later have qcop update calls in *db // QTimer::singleShot( 20*1000, this, SLOT( draw() ) ); } void Today::refresh() { loadPlugins(); draw(); qDebug( "redraw" ); // QTimer::singleShot( 30*1000, this, SLOT( refresh() ) ); } /** * The method for the configuration dialog. */ void Today::startConfig() { conf = new TodayConfig ( this, "", true ); uint count = 0; TodayPlugin plugin; QList<ConfigWidget> configWidgetList; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; // load the config widgets in the tabs if ( plugin.guiPart->configWidget( this ) != 0l ) { ConfigWidget* widget = plugin.guiPart->configWidget( this ); widget->reparent( conf , QPoint( 0,0 ) ); configWidgetList.append( widget ); conf->TabWidget3->insertTab( widget, plugin.guiPart->appName() ); } // set the order/activate tab conf->pluginManagement( plugin.name, plugin.guiPart->pluginName(), Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); diff --git a/core/pim/today/today.pro b/core/pim/today/today.pro index 5328d9f..8596da3 100644 --- a/core/pim/today/today.pro +++ b/core/pim/today/today.pro @@ -1,27 +1,27 @@ TEMPLATE = app CONFIG = qt warn_on debug #CONFIG = qt warn_on release -HEADERS = today.h todaybase.h todayconfig.h configwidget.h +HEADERS = today.h todaybase.h todayconfig.h SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie INTERFACES = TARGET = today DESTDIR = $(OPIEDIR)/bin TRANSLATIONS = ../../../i18n/de/today.ts \ ../../../i18n/en/today.ts \ ../../../i18n/es/today.ts \ ../../../i18n/fr/today.ts \ ../../../i18n/hu/today.ts \ ../../../i18n/ja/today.ts \ ../../../i18n/ko/today.ts \ ../../../i18n/no/today.ts \ ../../../i18n/pl/today.ts \ ../../../i18n/pt/today.ts \ ../../../i18n/pt_BR/today.ts \ ../../../i18n/sl/today.ts \ ../../../i18n/zh_CN/today.ts \ ../../../i18n/zh_TW/today.ts \ ../../../i18n/it/today.ts
\ No newline at end of file diff --git a/core/pim/today/todaybase.h b/core/pim/today/todaybase.h index 0e53510..7c50f32 100644 --- a/core/pim/today/todaybase.h +++ b/core/pim/today/todaybase.h @@ -1,54 +1,53 @@ /* * todaybase.h * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TODAYBASE_H #define TODAYBASE_H #include <qlayout.h> -#include <qguardedptr.h> #include <opie/oclickablelabel.h> class QVBox; class QGridLayout; class QFrame; class QLabel; class QPushButton; class QBoxLayout; class TodayBase : public QWidget { Q_OBJECT public: TodayBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~TodayBase(); - QGuardedPtr<QFrame> Frame4; - QGuardedPtr<QPushButton> DatesButton; - QGuardedPtr<QVBoxLayout> layout; - QGuardedPtr<OClickableLabel> OwnerField; - QGuardedPtr<QLabel> Frame; - QGuardedPtr<QLabel> DateLabel; - QGuardedPtr<QFrame> Frame15; - QGuardedPtr<OClickableLabel> ConfigButton; + QFrame* Frame4; + QPushButton* DatesButton; + QVBoxLayout* layout; + OClickableLabel* OwnerField; + QLabel* Frame; + QLabel* DateLabel; + QFrame* Frame15; + OClickableLabel* ConfigButton; protected: }; #endif |