-rw-r--r-- | core/pim/today/today.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 3ddb88d..0a6269e 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -161,195 +161,195 @@ void Today::init() { } if ( m_big_box ) { delete m_big_box; } m_big_box = new QWidget( m_sv->viewport() ); m_sv->addChild( m_big_box ); m_bblayout = new QVBoxLayout ( m_big_box ); } /** * Load the plugins */ void Today::loadPlugins() { init(); QValueList<TodayPlugin>::Iterator tit; if ( !pluginList.isEmpty() ) { for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { (*tit).guiBox->hide(); (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); delete (*tit).guiBox; (*tit).library->unload(); delete (*tit).library; } pluginList.clear(); } QString path = QPEApplication::qpeDir() + "/plugins/today"; #ifdef Q_OS_MACX - Opie::Core::owarn << "Searching for Plugins in: " << path << oendl; + owarn << "Searching for Plugins in: " << path << oendl; QDir dir( path, "lib*.dylib" ); #else QDir dir( path, "lib*.so" ); #endif QStringList list = dir.entryList(); QStringList::Iterator it; // QMap<QString, TodayPlugin> tempList; for ( it = list.begin(); it != list.end(); ++it ) { QInterfacePtr<TodayPluginInterface> iface; QLibrary *lib = new QLibrary( path + "/" + *it ); - Opie::Core::odebug << "querying: " << path + "/" + *it << oendl; + odebug << "querying: " << path + "/" + *it << oendl; if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { - Opie::Core::odebug << "accepted: " << path + "/" + *it << oendl; - Opie::Core::odebug << *it << oendl; + odebug << "accepted: " << path + "/" + *it << oendl; + odebug << *it << oendl; TodayPlugin plugin; plugin.library = lib; plugin.iface = iface; plugin.name = QString(*it); QString type = (*it).left( (*it).find(".") ); QString lang; Config config("locale"); config.setGroup("Language"); lang = config.readEntry( "Language", "en" ); - Opie::Core::odebug << "Languages: " << lang << oendl; + odebug << "Languages: " << lang << oendl; QTranslator * trans = new QTranslator( qApp ); QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; if ( trans->load( tfn ) ) { qApp->installTranslator( trans ); } else { delete trans; } // find out if plugins should be shown if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; } else { plugin.active = false; } plugin.guiPart = plugin.iface->guiPart(); plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); // package the whole thing into a qwidget so it can be shown and hidden plugin.guiBox = new QWidget( m_big_box ); QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); QPixmap plugPix; plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); plugIcon->setPixmap( plugPix ); QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); plugIcon->setName( plugin.guiPart->appName() ); connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); boxLayout->addWidget( plugIcon, 0, AlignTop ); boxLayout->addWidget( plugWidget, 0, AlignTop ); boxLayout->setStretchFactor( plugIcon, 1 ); boxLayout->setStretchFactor( plugWidget, 9 ); // "prebuffer" it in one more list, to get the sorting done tempList.insert( plugin.name, plugin ); // on first start the list is off course empty if ( m_allApplets.isEmpty() ) { pluginList.append( plugin ); m_bblayout->addWidget( plugin.guiBox ); } // if plugin is not yet in the list, add it to the layout too else if ( !m_allApplets.contains( plugin.name ) ) { pluginList.append( plugin ); } } else { - Opie::Core::odebug << "could not recognize " << path + "/" + *it << oendl; + odebug << "could not recognize " << path + "/" + *it << oendl; delete lib; } } if ( !m_allApplets.isEmpty() ) { TodayPlugin tempPlugin; QStringList::Iterator stringit; for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { tempPlugin = ( tempList.find( *stringit ) ).data(); if ( !( (tempPlugin.name).isEmpty() ) ) { pluginList.append( tempPlugin ); m_bblayout->addWidget( tempPlugin.guiBox ); } } } m_bblayout->addStretch( 2 ); draw(); } /** * Repaint method. Reread all fields. */ void Today::draw() { 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 ) { - //Opie::Core::odebug << plugin.name << " is ACTIVE " << oendl; + //odebug << plugin.name << " is ACTIVE " << oendl; plugin.guiBox->show(); } else { - //Opie::Core::odebug << plugin.name << " is INACTIVE " << oendl; + //odebug << plugin.name << " is INACTIVE " << oendl; plugin.guiBox->hide(); } count++; } if ( count == 0 ) { QLabel *noPluginsActive = new QLabel( this ); noPluginsActive->setText( tr( "No plugins activated" ) ); layout->addWidget( noPluginsActive ); } repaint(); } /** * The method for the configuration dialog. */ void Today::startConfig() { // disconnect timer to prevent problems while being on config dialog disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); m_refreshTimer->stop( ); TodayConfig conf( this, "dialog", true ); TodayPlugin plugin; QList<TodayConfigWidget> configWidgetList; for ( int i = pluginList.count() - 1; i >= 0; i-- ) { plugin = pluginList[i]; // load the config widgets in the tabs @@ -368,111 +368,111 @@ void Today::startConfig() { conf.writeConfig(); TodayConfigWidget *confWidget; for ( confWidget = configWidgetList.first(); confWidget != 0; confWidget = configWidgetList.next() ) { confWidget->writeConfig(); } // make the plugins to reinitialize ( reread its configs ) reinitialize(); draw(); } else { // since refresh is not called in that case , reconnect the signal m_refreshTimer->start( 15000 ); // get the config value in here later connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); } } void Today::reinitialize() { Config cfg( "today" ); cfg.setGroup( "Plugins" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); m_allApplets = cfg.readListEntry( "AllApplets", ',' ); /* reinitialize all plugins */ QValueList<TodayPlugin>::Iterator it; for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { if ( !(*it).excludeRefresh ) { (*it).guiPart->reinitialize(); - Opie::Core::odebug << "reinit" << oendl; + odebug << "reinit" << oendl; } /* check if plugins is still to be shown */ if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) { (*it).active = true; } else { (*it).active = false; } } cfg.setGroup( "General" ); m_iconSize = cfg.readNumEntry( "IconSize", 18 ); m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); // set the date in top label QDate date = QDate::currentDate(); DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); if ( m_hideBanner ) { Opiezilla->hide(); TodayLabel->hide(); } else { Opiezilla->show(); TodayLabel->show(); } delete m_bblayout; m_bblayout = new QVBoxLayout( m_big_box ); TodayPlugin tempPlugin; QStringList::Iterator stringit; for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { tempPlugin = ( tempList.find( *stringit ) ).data(); if ( !( (tempPlugin.name).isEmpty() ) ) { m_bblayout->addWidget( tempPlugin.guiBox ); } } m_bblayout->addStretch( 2 ); } /** * Refresh for the view. Reload all applets * */ void Today::refresh() { QValueList<TodayPlugin>::Iterator it; for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { if ( !(*it).excludeRefresh ) { (*it).guiPart->refresh(); - Opie::Core::odebug << "refresh" << oendl; + odebug << "refresh" << oendl; } } DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); updateGeometry(); repaint(); } void Today::startApplication() { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( sender()->name() ); } /** * launch addressbook (personal card) */ void Today::editCard() { QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); } Today::~Today() { } |