summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/configwidget.h4
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp8
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h1
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp3
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h6
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h2
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.h1
-rw-r--r--core/pim/today/today.cpp167
-rw-r--r--core/pim/today/today.h10
-rw-r--r--core/pim/today/todayconfig.cpp15
10 files changed, 105 insertions, 112 deletions
diff --git a/core/pim/today/configwidget.h b/core/pim/today/configwidget.h
index f449db4..02ce37a 100644
--- a/core/pim/today/configwidget.h
+++ b/core/pim/today/configwidget.h
@@ -1,17 +1,17 @@
#ifndef CONFIG_WIDGET_H
#define CONFIG_WIDGET_H
-
class ConfigWidget : public QWidget {
+
public:
- ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {};
+ ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ;
virtual ~ConfigWidget() {};
virtual void writeConfig() = 0;
};
#endif
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index d2a73df..9800e61 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -1,73 +1,69 @@
/*
* datebookplugin.cpp
*
* 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. *
* *
***************************************************************************/
#include "datebookevent.h"
#include "datebookplugin.h"
#include "datebookpluginwidget.h"
#include "datebookpluginconfig.h"
-#include "../../configwidget.h"
-
-#include <qpe/timestring.h>
-#include <qpe/config.h>
-
DatebookPlugin::DatebookPlugin() {
}
DatebookPlugin::~DatebookPlugin() {
}
QString DatebookPlugin::pluginName() const {
return "Datebook plugin";
}
double DatebookPlugin::versionNumber() const {
return 0.1;
}
QString DatebookPlugin::pixmapNameWidget() const {
return "DateBook";
}
QWidget* DatebookPlugin::widget( QWidget* wid ) {
return new DatebookPluginWidget( wid, "Datebook" );
}
QString DatebookPlugin::pixmapNameConfig() const {
return "DateBook";
}
ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) {
return new DatebookPluginConfig( wid , "Datebook" );
}
QString DatebookPlugin::appName() const {
return "datebook";
}
int DatebookPlugin::minHeight() const {
return 10;
}
int DatebookPlugin::maxHeight() const {
return 100;
}
-
+int main() {
+}
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h
index f2c4446..61dc9f3 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.h
+++ b/core/pim/today/plugins/datebook/datebookplugin.h
@@ -1,47 +1,46 @@
/*
* datebookplugin.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 DATEBOOK_PLUGIN_H
#define DATEBOOK_PLUGIN_H
#include <qstring.h>
#include <qwidget.h>
-#include <qpe/datebookdb.h>
#include <opie/oclickablelabel.h>
#include "../../todayplugininterface.h"
class DatebookPlugin : public TodayPluginObject {
public:
DatebookPlugin();
~DatebookPlugin();
QString pluginName() const;
double versionNumber() const;
QString pixmapNameWidget() const;
QWidget* widget( QWidget *);
QString pixmapNameConfig() const;
ConfigWidget* configWidget( QWidget *);
QString appName() const;
virtual int minHeight() const;
virtual int maxHeight() const;
};
#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
index 7482f5e..51be40e 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
@@ -1,39 +1,38 @@
#include "datebookpluginconfig.h"
-
#include <qpe/config.h>
#include <qlayout.h>
#include <qtoolbutton.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qvbox.h>
DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name)
- : ConfigWidget( parent, name ) {
+ : ConfigWidget( parent, name ) {
QVBoxLayout * layout = new QVBoxLayout( this );
QHBox *box1 = new QHBox( this );
QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" );
TextLabel4->setText( tr( "Show location" ) );
CheckBox1 = new QCheckBox( box1, "CheckBox1" );
QHBox *box2 = new QHBox( this );
QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" );
TextLabel5->setText( tr( "Show notes" ) );
CheckBox2 = new QCheckBox( box2, "CheckBox2" );
QHBox *box3 = new QHBox( this );
QLabel* TextLabel6 = new QLabel( box3, "All Day");
TextLabel6->setText( tr( "Show only later\n"
"appointments") );
CheckBox3 = new QCheckBox ( box3, "CheckBox3" );
QHBox *box4 = new QHBox( this );
QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" );
TextLabel3->setText( tr( "How many \nappointment\n"
"should be \nshown?" ) );
SpinBox1 = new QSpinBox( box4, "SpinBox1" );
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h
index 33d3c4e..9505a2d 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.h
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -1,41 +1,41 @@
#ifndef DATEBOOK_PLUGIN_CONFIG_H
#define DATEBOOK_PLUGIN_CONFIG_H
-#include <qwidget.h>
+//#include <qwidget.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include "../../configwidget.h"
class DatebookPluginConfig : public ConfigWidget {
- Q_OBJECT
+
public:
DatebookPluginConfig( QWidget *parent, const char *name );
- ~DatebookPluginConfig();
+ ~DatebookPluginConfig();
void writeConfig();
private:
/**
* if changed then save
*/
bool changed();
void readConfig();
QCheckBox* CheckBox2;
QCheckBox* CheckBox1;
QCheckBox* CheckBox3;
QSpinBox* SpinBox1;
// how many lines should be showed in the datebook section
int m_max_lines_meet;
// If location is to be showed too, 1 to activate it.
int m_show_location;
// if notes should be shown
int m_show_notes;
// should only later appointments be shown or all for the current day.
int m_only_later;
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h
index 77889d6..7e5006f 100644
--- a/core/pim/today/plugins/todolist/todoplugin.h
+++ b/core/pim/today/plugins/todolist/todoplugin.h
@@ -3,45 +3,43 @@
*
* 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 TODOLIST_PLUGIN_H
#define TODOLIST_PLUGIN_H
#include <qstring.h>
#include <qwidget.h>
#include <opie/tododb.h>
#include <opie/oclickablelabel.h>
#include "../../todayplugininterface.h"
-#include "../../configwidget.h"
class TodolistPlugin : public TodayPluginObject {
-
public:
TodolistPlugin();
~TodolistPlugin();
QString pluginName() const;
double versionNumber() const;
QString pixmapNameWidget() const;
QWidget* widget(QWidget *);
QString pixmapNameConfig() const;
ConfigWidget* configWidget(QWidget *);
QString appName() const;
virtual int minHeight() const;
virtual int maxHeight() const;
};
#endif
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h
index a46cc7c..6be4b1e 100644
--- a/core/pim/today/plugins/todolist/todopluginconfig.h
+++ b/core/pim/today/plugins/todolist/todopluginconfig.h
@@ -3,49 +3,48 @@
*
* 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 TODOLIST_PLUGIN_CONFIG_H
#define TODOLIST_PLUGIN_CONFIG_H
#include <qwidget.h>
#include <qspinbox.h>
#include "../../configwidget.h"
class TodolistPluginConfig : public ConfigWidget {
- Q_OBJECT
public:
TodolistPluginConfig( QWidget *parent, const char *name );
~TodolistPluginConfig();
private:
/**
* if changed then save
*/
bool changed();
void readConfig();
void writeConfig();
QSpinBox* SpinBox2;
// how many lines should be showed in the todolist section
int m_max_lines_task;
};
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 09540bd..d78b5b5 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -11,73 +11,85 @@
* 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. *
* *
***************************************************************************/
#include "today.h"
#include "configwidget.h"
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
#include <qpe/global.h>
#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 <qhbox.h>
#include <qtabwidget.h>
#include <qdialog.h>
+struct TodayPlugin {
+ QLibrary *library;
+ TodayPluginInterface *iface;
+ TodayPluginObject *guiPart;
+ QHBox *guiBox;
+ QString name;
+ bool active;
+ int pos;
+};
+
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;
+ // pluginLayout = 0l;
setOwnerField();
init();
- refresh();
+ loadPlugins();
+ draw();
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>" );
@@ -103,196 +115,197 @@ 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() {
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() );
+ qDebug( QString(*it) );
TodayPlugin plugin;
plugin.library = lib;
plugin.iface = iface;
- plugin.name = QString(*it).latin1();
+ plugin.name = QString(*it);
if ( m_excludeApplets.grep( *it ).isEmpty() ) {
plugin.active = true;
} else {
plugin.active = false;
}
plugin.guiPart = plugin.iface->guiPart();
+
+ plugin.guiBox = new QHBox( this );
+ QPixmap plugPix;
+ plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
+ OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
+ plugIcon->setPixmap( plugPix );
+ QScrollView* sv = new QScrollView( plugin.guiBox );
+ QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
+ 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 );
+
+ //plugin.guiBox->addWidget( plugIcon, 0, AlignTop );
+ //plugin.guiBox->addWidget( sv, 0, AlignTop );
+ plugin.guiBox->setStretchFactor( plugIcon, 1 );
+ plugin.guiBox->setStretchFactor( sv, 9 );
+ layout->addWidget( plugin.guiBox );
+
pluginList.append( plugin );
count++;
} else {
qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
delete lib;
}
}
}
/**
* 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++;
- }
+ qDebug( plugin.name + " is ACTIVE " );
+ // QHBoxLayout* plugLayout = new QHBoxLayout( this );
+ plugin.guiBox->show();
+ } else {
+ // plugin.guiWidget->hide();
+ qDebug( plugin.name + " is INACTIVE" );
+ plugin.guiBox->hide();
+ }
+ 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(),
+
+ TodayConfig conf( this, "dialog", true );
+
+ 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 );
+ 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() ) );
- count++;
- }
+ }
- conf->showMaximized();
+ conf.exec();
+ if ( conf.exec() == QDialog::Accepted ) {
+ conf.writeConfig();
+ ConfigWidget *confWidget;
+ for ( confWidget = configWidgetList.first(); confWidget != 0;
+ confWidget = configWidgetList.next() ) {
+ confWidget->writeConfig();
+ }
+ init();
- if ( conf->exec() == QDialog::Accepted ) {
- ConfigWidget *confWidget;
- for ( confWidget=configWidgetList.first(); confWidget != 0;
- confWidget = configWidgetList.next() ) {
- confWidget->writeConfig();
- }
- conf->writeConfig();
- init();
- loadPlugins();
- draw();
- }
- delete conf;
+ TodayPlugin plugin;
+ for ( uint i = 0; i < pluginList.count(); i++ ) {
+ plugin = pluginList[i];
+
+ if ( m_excludeApplets.grep( plugin.name ).isEmpty() ) {
+ qDebug("CONFIG" + plugin.name + "ACTIVE");
+ plugin.active = true;
+ } else {
+ qDebug("CONFIG" + plugin.name + "INACTIVE");
+
+ plugin.active = false;
+ }
+ }
+
+ draw();
+ }
}
void Today::startAddressbook() {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << QString( "addressbook" );
}
/**
* launch addressbook (personal card)
*/
void Today::editCard() {
startAddressbook();
while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) {
qApp->processEvents();
}
QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" );
}
/*
* launches an App
*/
void Today::launchApp( QString appName ) {
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index ca17020..0a9a705 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -1,81 +1,73 @@
/*
* today.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 TODAY_H
#define TODAY_H
#include <opie/tododb.h>
#include <qdatetime.h>
#include <qlist.h>
+#include <qhbox.h>
#include <qpe/qlibrary.h>
#include <qpe/event.h>
#include "todayconfig.h"
#include "todaybase.h"
#include "todayplugininterface.h"
class QVBoxLayout;
-struct TodayPlugin {
- QLibrary *library;
- TodayPluginInterface *iface;
- TodayPluginObject *guiPart;
- QString name;
- bool active;
- int pos;
-};
class Today : public TodayBase {
Q_OBJECT
public:
Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~Today();
private slots:
void startConfig();
void startAddressbook();
void launchApp( QString appName );
void editCard();
void draw();
- void refresh();
private:
void init();
void setOwnerField();
void setOwnerField(QString &string);
void loadPlugins();
private slots:
void channelReceived(const QCString &msg, const QByteArray & data);
private:
TodayConfig *conf;
QStringList m_excludeApplets;
QVBoxLayout *pluginLayout;
// QString m_autoStartTimer;
int m_newStart;
// int m_autoStart;
int m_maxCharClip;
};
#endif
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 08e59c0..79c4d1f 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -9,125 +9,122 @@
* *
* 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. *
* *
***************************************************************************/
#include "todayconfig.h"
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qspinbox.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qheader.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qtoolbutton.h>
-// for getenv
-#include <stdlib.h>
-
class ToolButton : public QToolButton {
+
public:
ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
: QToolButton( parent, name ) {
- setTextLabel( name );
+ // setTextLabel( name );
setPixmap( Resource::loadPixmap( icon ) );
setAutoRaise( TRUE );
setFocusPolicy( QWidget::NoFocus );
setToggleButton( t );
connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
}
};
/**
* The class has currently quite some duplicate code.
* By that way it would be real easy to have it as seperate app in settings tab
*
*/
-TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl )
+TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
- if ( !name ) {
- setName( "todayconfig" );
- }
setCaption( tr( "Today config" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
TabWidget3 = new QTabWidget( this, "TabWidget3" );
- TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) );
+ // TabWidget3->setFrameShape( QFrame::NoFrame );
+ //TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) );
TabWidget3->setAutoMask( FALSE );
TabWidget3->setTabShape( QTabWidget::Rounded );
layout->addWidget( TabWidget3 );
tab_2 = new QWidget( TabWidget3, "tab_2" );
QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 );
QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 );
tab2Layout->addWidget( l );
QHBox *hbox1 = new QHBox( tab_2 );
m_appletListView = new QListView( hbox1 );
m_appletListView->addColumn( "PluginList" );
m_appletListView->header()->hide();
QVBox *vbox1 = new QVBox( hbox1 );
new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) );
new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) );
tab2Layout->addWidget( hbox1 );
TabWidget3->insertTab( tab_2, tr( "active/order" ) );
tab_3 = new QWidget( TabWidget3, "tab_3" );
QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
QHBox *hbox_clip = new QHBox( tab_3 );
TextLabel1 = new QLabel( hbox_clip, "TextLabel1" );
TextLabel1->setText( tr( "Clip after how\n"
"many letters" ) );
SpinBox7 = new QSpinBox( hbox_clip, "SpinBox7" );
SpinBox7->setMaxValue( 80 );
QHBox *hbox_auto = new QHBox( tab_3 );
TextLabel2 = new QLabel( hbox_auto, "AutoStart" );
TextLabel2->setText( tr( "autostart on \nresume? (Opie only)" ) );
CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" );
QHBox *hbox_inactive = new QHBox( tab_3 );
TimeLabel = new QLabel( hbox_inactive , "TimeLabel" );
TimeLabel->setText( tr( "minutes inactive" ) );
SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner");
tab3Layout->addWidget( hbox_clip );
tab3Layout->addWidget( hbox_auto );
tab3Layout->addWidget( hbox_inactive );
TabWidget3->insertTab( tab_3, tr( "Misc" ) );
m_applets_changed = false;
connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) );
readConfig();
+ showMaximized();
}
/**
* Autostart, uses the new (opie only) autostart method in the launcher code.
* If registered against that today ist started on each resume.
*/
void TodayConfig::setAutoStart() {
Config cfg( "today" );
cfg.setGroup( "Autostart" );
int autostart = cfg.readNumEntry( "autostart", 1);
if ( autostart ) {
QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
e << QString( "add" );
e << QString( "today" );
e << m_autoStartTimer;
} else {
QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
e << QString( "remove");
e << QString( "today" );
}
}
/**