summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/configwidget.h3
-rw-r--r--core/pim/today/today.cpp4
-rw-r--r--core/pim/today/today.pro2
-rw-r--r--core/pim/today/todaybase.h17
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 @@
1 1
2#ifndef CONFIG_WIDGET_H 2#ifndef CONFIG_WIDGET_H
3#define CONFIG_WIDGET_H 3#define CONFIG_WIDGET_H
4 4
5#include <qwidget.h>
6 5
7 6
8class ConfigWidget : public QWidget { 7class ConfigWidget : public QWidget {
9 Q_OBJECT 8
10public: 9public:
11 10
12 ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {}; 11 ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {};
13 virtual ~ConfigWidget() {}; 12 virtual ~ConfigWidget() {};
14 13
15 virtual void writeConfig() = 0; 14 virtual void writeConfig() = 0;
16}; 15};
17 16
18#endif 17#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
@@ -73,138 +73,136 @@ void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
73} 73}
74 74
75/** 75/**
76 * Initialises the owner field with the default value, the username 76 * Initialises the owner field with the default value, the username
77 */ 77 */
78void Today::setOwnerField() { 78void Today::setOwnerField() {
79 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 79 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
80 if ( QFile::exists( file ) ) { 80 if ( QFile::exists( file ) ) {
81 Contact cont = Contact::readVCard( file )[0]; 81 Contact cont = Contact::readVCard( file )[0];
82 QString returnString = cont.fullName(); 82 QString returnString = cont.fullName();
83 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 83 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
84 } else { 84 } else {
85 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 85 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
86 } 86 }
87} 87}
88 88
89/** 89/**
90 * Set the owner field with a given QString, for example per qcop. 90 * Set the owner field with a given QString, for example per qcop.
91 */ 91 */
92void Today::setOwnerField( QString &message ) { 92void Today::setOwnerField( QString &message ) {
93 if ( !message.isEmpty() ) { 93 if ( !message.isEmpty() ) {
94 OwnerField->setText( "<b>" + message + "</b>" ); 94 OwnerField->setText( "<b>" + message + "</b>" );
95 } 95 }
96} 96}
97 97
98 98
99/** 99/**
100 * Init stuff needed for today. Reads the config file. 100 * Init stuff needed for today. Reads the config file.
101 */ 101 */
102void Today::init() { 102void Today::init() {
103 103
104 QDate date = QDate::currentDate(); 104 QDate date = QDate::currentDate();
105 QString time = ( tr( date.toString() ) ); 105 QString time = ( tr( date.toString() ) );
106 106
107 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); 107 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
108 108
109 // read config 109 // read config
110 Config cfg( "today" ); 110 Config cfg( "today" );
111 111
112 cfg.setGroup( "Applets" ); 112 cfg.setGroup( "Applets" );
113 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 113 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
114} 114}
115 115
116 116
117/** 117/**
118 * Load the plugins 118 * Load the plugins
119 */ 119 */
120void Today::loadPlugins() { 120void Today::loadPlugins() {
121 qWarning("pluginList count %d", pluginList.count() ); 121
122 QValueList<TodayPlugin>::Iterator tit; 122 QValueList<TodayPlugin>::Iterator tit;
123 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 123 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
124 (*tit).library->unload(); 124 (*tit).library->unload();
125 delete (*tit).library; 125 delete (*tit).library;
126 } 126 }
127 pluginList.clear();
128 127
129 QString path = QPEApplication::qpeDir() + "/plugins/today"; 128 QString path = QPEApplication::qpeDir() + "/plugins/today";
130 QDir dir( path, "lib*.so" ); 129 QDir dir( path, "lib*.so" );
131 130
132 QStringList list = dir.entryList(); 131 QStringList list = dir.entryList();
133 QStringList::Iterator it; 132 QStringList::Iterator it;
134 133
135 uint count = 0; 134 uint count = 0;
136 for ( it = list.begin(); it != list.end(); ++it ) { 135 for ( it = list.begin(); it != list.end(); ++it ) {
137 TodayPluginInterface *iface = 0; 136 TodayPluginInterface *iface = 0;
138 QLibrary *lib = new QLibrary( path + "/" + *it ); 137 QLibrary *lib = new QLibrary( path + "/" + *it );
139 138
140 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 139 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
141 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 140 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
142 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 141 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
143 qDebug( QString(*it).latin1() ); 142 qDebug( QString(*it).latin1() );
144 TodayPlugin plugin; 143 TodayPlugin plugin;
145 plugin.library = lib; 144 plugin.library = lib;
146 plugin.iface = iface; 145 plugin.iface = iface;
147 plugin.name = QString(*it).latin1(); 146 plugin.name = QString(*it).latin1();
148 147
149 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 148 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
150 plugin.active = true; 149 plugin.active = true;
151 } else { 150 } else {
152 plugin.active = false; 151 plugin.active = false;
153 } 152 }
154 plugin.guiPart = plugin.iface->guiPart(); 153 plugin.guiPart = plugin.iface->guiPart();
155 pluginList.append( plugin ); 154 pluginList.append( plugin );
156 count++; 155 count++;
157 } else { 156 } else {
158 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 157 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
159 delete lib; 158 delete lib;
160 } 159 }
161 } 160 }
162 qWarning("pluginList count end %d", pluginList.count() );
163} 161}
164 162
165 163
166/** 164/**
167 * Repaint method. Reread all fields. 165 * Repaint method. Reread all fields.
168 */ 166 */
169void Today::draw() { 167void Today::draw() {
170 168
171 if ( pluginLayout ) { 169 if ( pluginLayout ) {
172 delete pluginLayout; 170 delete pluginLayout;
173 } 171 }
174 pluginLayout = new QVBoxLayout( layout ); 172 pluginLayout = new QVBoxLayout( layout );
175 173
176 if ( pluginList.count() == 0 ) { 174 if ( pluginList.count() == 0 ) {
177 QLabel *noPlugins = new QLabel( this ); 175 QLabel *noPlugins = new QLabel( this );
178 noPlugins->setText( tr( "No plugins found" ) ); 176 noPlugins->setText( tr( "No plugins found" ) );
179 layout->addWidget( noPlugins ); 177 layout->addWidget( noPlugins );
180 return; 178 return;
181 } 179 }
182 180
183 uint count = 0; 181 uint count = 0;
184 TodayPlugin plugin; 182 TodayPlugin plugin;
185 for ( uint i = 0; i < pluginList.count(); i++ ) { 183 for ( uint i = 0; i < pluginList.count(); i++ ) {
186 plugin = pluginList[i]; 184 plugin = pluginList[i];
187 185
188 if ( plugin.active ) { 186 if ( plugin.active ) {
189 QHBoxLayout* plugLayout = new QHBoxLayout( this ); 187 QHBoxLayout* plugLayout = new QHBoxLayout( this );
190 QPixmap plugPix; 188 QPixmap plugPix;
191 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); 189 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
192 OClickableLabel* plugIcon = new OClickableLabel( this ); 190 OClickableLabel* plugIcon = new OClickableLabel( this );
193 plugIcon->setPixmap( plugPix ); 191 plugIcon->setPixmap( plugPix );
194 QScrollView* sv = new QScrollView( this ); 192 QScrollView* sv = new QScrollView( this );
195 QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() ); 193 QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() );
196 // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) ); 194 // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) );
197 sv->setMinimumHeight( plugin.guiPart->minHeight() ); 195 sv->setMinimumHeight( plugin.guiPart->minHeight() );
198 //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); 196 //sv->setMaximumHeight( plugin.guiPart->maxHeight() );
199 197
200 sv->setResizePolicy( QScrollView::AutoOneFit ); 198 sv->setResizePolicy( QScrollView::AutoOneFit );
201 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 199 sv->setHScrollBarMode( QScrollView::AlwaysOff );
202 sv->setFrameShape( QFrame::NoFrame ); 200 sv->setFrameShape( QFrame::NoFrame );
203 sv->addChild( plugWidget ); 201 sv->addChild( plugWidget );
204 202
205 plugLayout->addWidget( plugIcon, 0, AlignTop ); 203 plugLayout->addWidget( plugIcon, 0, AlignTop );
206 plugLayout->addWidget( sv, 0, AlignTop ); 204 plugLayout->addWidget( sv, 0, AlignTop );
207 plugLayout->setStretchFactor( plugIcon, 1 ); 205 plugLayout->setStretchFactor( plugIcon, 1 );
208 plugLayout->setStretchFactor( sv, 9 ); 206 plugLayout->setStretchFactor( sv, 9 );
209 pluginLayout->addLayout( plugLayout ); 207 pluginLayout->addLayout( plugLayout );
210 count++; 208 count++;
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 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on debug 2 CONFIG = qt warn_on debug
3 #CONFIG = qt warn_on release 3 #CONFIG = qt warn_on release
4 HEADERS = today.h todaybase.h todayconfig.h configwidget.h 4 HEADERS = today.h todaybase.h todayconfig.h
5 SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp 5 SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include 6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include 7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe -lopie 8LIBS += -lqpe -lopie
9 INTERFACES= 9 INTERFACES=
10 TARGET = today 10 TARGET = today
11 DESTDIR = $(OPIEDIR)/bin 11 DESTDIR = $(OPIEDIR)/bin
12 12
13TRANSLATIONS = ../../../i18n/de/today.ts \ 13TRANSLATIONS = ../../../i18n/de/today.ts \
14 ../../../i18n/en/today.ts \ 14 ../../../i18n/en/today.ts \
15 ../../../i18n/es/today.ts \ 15 ../../../i18n/es/today.ts \
16 ../../../i18n/fr/today.ts \ 16 ../../../i18n/fr/today.ts \
17 ../../../i18n/hu/today.ts \ 17 ../../../i18n/hu/today.ts \
18 ../../../i18n/ja/today.ts \ 18 ../../../i18n/ja/today.ts \
19 ../../../i18n/ko/today.ts \ 19 ../../../i18n/ko/today.ts \
20 ../../../i18n/no/today.ts \ 20 ../../../i18n/no/today.ts \
21 ../../../i18n/pl/today.ts \ 21 ../../../i18n/pl/today.ts \
22 ../../../i18n/pt/today.ts \ 22 ../../../i18n/pt/today.ts \
23 ../../../i18n/pt_BR/today.ts \ 23 ../../../i18n/pt_BR/today.ts \
24 ../../../i18n/sl/today.ts \ 24 ../../../i18n/sl/today.ts \
25 ../../../i18n/zh_CN/today.ts \ 25 ../../../i18n/zh_CN/today.ts \
26 ../../../i18n/zh_TW/today.ts \ 26 ../../../i18n/zh_TW/today.ts \
27 ../../../i18n/it/today.ts \ No newline at end of file 27 ../../../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 @@
1/* 1/*
2 * todaybase.h 2 * todaybase.h
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef TODAYBASE_H 17#ifndef TODAYBASE_H
18#define TODAYBASE_H 18#define TODAYBASE_H
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qguardedptr.h>
22#include <opie/oclickablelabel.h> 21#include <opie/oclickablelabel.h>
23 22
24class QVBox; 23class QVBox;
25class QGridLayout; 24class QGridLayout;
26class QFrame; 25class QFrame;
27class QLabel; 26class QLabel;
28class QPushButton; 27class QPushButton;
29class QBoxLayout; 28class QBoxLayout;
30 29
31 30
32class TodayBase : public QWidget 31class TodayBase : public QWidget
33{ 32{
34 Q_OBJECT 33 Q_OBJECT
35 34
36public: 35public:
37 TodayBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 36 TodayBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
38 ~TodayBase(); 37 ~TodayBase();
39 38
40 QGuardedPtr<QFrame> Frame4; 39 QFrame* Frame4;
41 QGuardedPtr<QPushButton> DatesButton; 40 QPushButton* DatesButton;
42 QGuardedPtr<QVBoxLayout> layout; 41 QVBoxLayout* layout;
43 QGuardedPtr<OClickableLabel> OwnerField; 42 OClickableLabel* OwnerField;
44 QGuardedPtr<QLabel> Frame; 43 QLabel* Frame;
45 QGuardedPtr<QLabel> DateLabel; 44 QLabel* DateLabel;
46 QGuardedPtr<QFrame> Frame15; 45 QFrame* Frame15;
47 QGuardedPtr<OClickableLabel> ConfigButton; 46 OClickableLabel* ConfigButton;
48 47
49protected: 48protected:
50 49
51 50
52}; 51};
53 52
54#endif 53#endif