summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp1
-rw-r--r--core/pim/today/todaybase.cpp6
2 files changed, 3 insertions, 4 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index e6f8c93..76bd6de 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,283 +1,282 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
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 17
18#include "today.h" 18#include "today.h"
19#include <opie/todayconfigwidget.h> 19#include <opie/todayconfigwidget.h>
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/contact.h> 26#include <qpe/contact.h>
27 27
28#include <qdir.h> 28#include <qdir.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qpixmap.h> 33#include <qpixmap.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <opie/otabwidget.h> 36#include <opie/otabwidget.h>
37#include <qdialog.h> 37#include <qdialog.h>
38#include <qwhatsthis.h> 38#include <qwhatsthis.h>
39 39
40 40
41struct TodayPlugin { 41struct TodayPlugin {
42 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 42 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
43 QLibrary *library; 43 QLibrary *library;
44 QInterfacePtr<TodayPluginInterface> iface; 44 QInterfacePtr<TodayPluginInterface> iface;
45 TodayPluginObject *guiPart; 45 TodayPluginObject *guiPart;
46 QWidget *guiBox; 46 QWidget *guiBox;
47 QString name; 47 QString name;
48 bool active; 48 bool active;
49 bool excludeRefresh; 49 bool excludeRefresh;
50 int pos; 50 int pos;
51}; 51};
52 52
53static QValueList<TodayPlugin> pluginList; 53static QValueList<TodayPlugin> pluginList;
54 54
55Today::Today( QWidget* parent, const char* name, WFlags fl ) 55Today::Today( QWidget* parent, const char* name, WFlags fl )
56 : TodayBase( parent, name, fl ) { 56 : TodayBase( parent, name, fl ) {
57 57
58 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 58 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
59 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 59 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
60 60
61#if defined(Q_WS_QWS) 61#if defined(Q_WS_QWS)
62#if !defined(QT_NO_COP) 62#if !defined(QT_NO_COP)
63 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 63 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
64 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 64 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
65 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 65 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
66#endif 66#endif
67#endif 67#endif
68 68
69 setOwnerField(); 69 setOwnerField();
70 m_refreshTimer = new QTimer( this ); 70 m_refreshTimer = new QTimer( this );
71 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 71 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
72 m_refreshTimer->start( 15000 ); 72 m_refreshTimer->start( 15000 );
73 refresh(); 73 refresh();
74 showMaximized(); 74 showMaximized();
75} 75}
76 76
77/** 77/**
78 * Qcop receive method. 78 * Qcop receive method.
79 */ 79 */
80void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 80void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
81 QDataStream stream( data, IO_ReadOnly ); 81 QDataStream stream( data, IO_ReadOnly );
82 if ( msg == "message(QString)" ) { 82 if ( msg == "message(QString)" ) {
83 QString message; 83 QString message;
84 stream >> message; 84 stream >> message;
85 setOwnerField( message ); 85 setOwnerField( message );
86 } 86 }
87} 87}
88 88
89void Today::setRefreshTimer( int interval ) { 89void Today::setRefreshTimer( int interval ) {
90 90
91
92 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 91 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
93 92
94 // 0 is "never" case 93 // 0 is "never" case
95 if ( !interval == 0 ) { 94 if ( !interval == 0 ) {
96 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 95 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
97 m_refreshTimer->changeInterval( interval ); 96 m_refreshTimer->changeInterval( interval );
98 } 97 }
99} 98}
100 99
101 100
102/** 101/**
103 * Initialises the owner field with the default value, the username 102 * Initialises the owner field with the default value, the username
104 */ 103 */
105void Today::setOwnerField() { 104void Today::setOwnerField() {
106 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 105 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
107 if ( QFile::exists( file ) ) { 106 if ( QFile::exists( file ) ) {
108 Contact cont = Contact::readVCard( file )[0]; 107 Contact cont = Contact::readVCard( file )[0];
109 QString returnString = cont.fullName(); 108 QString returnString = cont.fullName();
110 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 109 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
111 } else { 110 } else {
112 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 111 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
113 } 112 }
114} 113}
115 114
116/** 115/**
117 * Set the owner field with a given QString, for example per qcop. 116 * Set the owner field with a given QString, for example per qcop.
118 */ 117 */
119void Today::setOwnerField( QString &message ) { 118void Today::setOwnerField( QString &message ) {
120 if ( !message.isEmpty() ) { 119 if ( !message.isEmpty() ) {
121 OwnerField->setText( "<b>" + message + "</b>" ); 120 OwnerField->setText( "<b>" + message + "</b>" );
122 } 121 }
123} 122}
124 123
125 124
126/** 125/**
127 * Init stuff needed for today. Reads the config file. 126 * Init stuff needed for today. Reads the config file.
128 */ 127 */
129void Today::init() { 128void Today::init() {
130 // read config 129 // read config
131 Config cfg( "today" ); 130 Config cfg( "today" );
132 131
133 cfg.setGroup( "Plugins" ); 132 cfg.setGroup( "Plugins" );
134 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 133 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
135 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 134 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
136 135
137 cfg.setGroup( "General" ); 136 cfg.setGroup( "General" );
138 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 137 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
139 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 138 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
140} 139}
141 140
142 141
143/** 142/**
144 * Load the plugins 143 * Load the plugins
145 */ 144 */
146void Today::loadPlugins() { 145void Today::loadPlugins() {
147 146
148 // extra list for plugins that exclude themself from periodic refresh 147 // extra list for plugins that exclude themself from periodic refresh
149 QMap<QString, TodayPlugin> pluginListRefreshExclude; 148 QMap<QString, TodayPlugin> pluginListRefreshExclude;
150 149
151 QValueList<TodayPlugin>::Iterator tit; 150 QValueList<TodayPlugin>::Iterator tit;
152 if ( !pluginList.isEmpty() ) { 151 if ( !pluginList.isEmpty() ) {
153 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 152 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
154 if ( (*tit).excludeRefresh ) { 153 if ( (*tit).excludeRefresh ) {
155 pluginListRefreshExclude.insert( (*tit).name , (*tit) ); 154 pluginListRefreshExclude.insert( (*tit).name , (*tit) );
156 qDebug( "Found an plugin that does not want refresh feature" ); 155 qDebug( "Found an plugin that does not want refresh feature" );
157 } else { 156 } else {
158 (*tit).library->unload(); 157 (*tit).library->unload();
159 delete (*tit).library; 158 delete (*tit).library;
160 } 159 }
161 } 160 }
162 pluginList.clear(); 161 pluginList.clear();
163 } 162 }
164 163
165 QString path = QPEApplication::qpeDir() + "/plugins/today"; 164 QString path = QPEApplication::qpeDir() + "/plugins/today";
166 QDir dir( path, "lib*.so" ); 165 QDir dir( path, "lib*.so" );
167 166
168 QStringList list = dir.entryList(); 167 QStringList list = dir.entryList();
169 QStringList::Iterator it; 168 QStringList::Iterator it;
170 169
171 QMap<QString, TodayPlugin> tempList; 170 QMap<QString, TodayPlugin> tempList;
172 171
173 for ( it = list.begin(); it != list.end(); ++it ) { 172 for ( it = list.begin(); it != list.end(); ++it ) {
174 //TodayPluginInterface *iface = 0; 173 //TodayPluginInterface *iface = 0;
175 QInterfacePtr<TodayPluginInterface> iface; 174 QInterfacePtr<TodayPluginInterface> iface;
176 QLibrary *lib = new QLibrary( path + "/" + *it ); 175 QLibrary *lib = new QLibrary( path + "/" + *it );
177 176
178 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 177 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
179 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 178 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
180 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 179 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
181 qDebug( QString(*it) ); 180 qDebug( QString(*it) );
182 181
183 // If plugin is exludes from refresh, get it in the list again here. 182 // If plugin is exludes from refresh, get it in the list again here.
184 183
185 if ( pluginListRefreshExclude.contains( (*it) ) ) { 184 if ( pluginListRefreshExclude.contains( (*it) ) ) {
186 // if its not in allApplets list, add it to a layout 185 // if its not in allApplets list, add it to a layout
187 if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { 186 if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) {
188 layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); 187 layout->addWidget( pluginListRefreshExclude[(*it)].guiBox );
189 pluginList.append( pluginListRefreshExclude[(*it)] ); 188 pluginList.append( pluginListRefreshExclude[(*it)] );
190 } else { 189 } else {
191 tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); 190 tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] );
192 } 191 }
193 } else { 192 } else {
194 193
195 TodayPlugin plugin; 194 TodayPlugin plugin;
196 plugin.library = lib; 195 plugin.library = lib;
197 plugin.iface = iface; 196 plugin.iface = iface;
198 plugin.name = QString(*it); 197 plugin.name = QString(*it);
199 198
200 // find out if plugins should be shown 199 // find out if plugins should be shown
201 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 200 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
202 plugin.active = true; 201 plugin.active = true;
203 } else { 202 } else {
204 plugin.active = false; 203 plugin.active = false;
205 } 204 }
206 205
207 plugin.guiPart = plugin.iface->guiPart(); 206 plugin.guiPart = plugin.iface->guiPart();
208 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); 207 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh();
209 208
210 // package the whole thing into a qwidget so it can be shown and hidden 209 // package the whole thing into a qwidget so it can be shown and hidden
211 plugin.guiBox = new QWidget( this ); 210 plugin.guiBox = new QWidget( this );
212 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 211 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
213 QPixmap plugPix; 212 QPixmap plugPix;
214 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); 213 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 );
215 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 214 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
216 plugIcon->setPixmap( plugPix ); 215 plugIcon->setPixmap( plugPix );
217 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); 216 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") );
218 plugIcon->setName( plugin.guiPart->appName() ); 217 plugIcon->setName( plugin.guiPart->appName() );
219 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); 218 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) );
220 // a scrollview for each plugin 219 // a scrollview for each plugin
221 QScrollView* sv = new QScrollView( plugin.guiBox ); 220 QScrollView* sv = new QScrollView( plugin.guiBox );
222 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); 221 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
223 // not sure if that is good .-) 222 // not sure if that is good .-)
224 sv->setMinimumHeight( 10 ); 223 sv->setMinimumHeight( 10 );
225 sv->setResizePolicy( QScrollView::AutoOneFit ); 224 sv->setResizePolicy( QScrollView::AutoOneFit );
226 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 225 sv->setHScrollBarMode( QScrollView::AlwaysOff );
227 sv->setFrameShape( QFrame::NoFrame ); 226 sv->setFrameShape( QFrame::NoFrame );
228 sv->addChild( plugWidget ); 227 sv->addChild( plugWidget );
229 // make sure the icon is on the top alligned 228 // make sure the icon is on the top alligned
230 boxLayout->addWidget( plugIcon, 0, AlignTop ); 229 boxLayout->addWidget( plugIcon, 0, AlignTop );
231 boxLayout->addWidget( sv, 0, AlignTop ); 230 boxLayout->addWidget( sv, 0, AlignTop );
232 boxLayout->setStretchFactor( plugIcon, 1 ); 231 boxLayout->setStretchFactor( plugIcon, 1 );
233 boxLayout->setStretchFactor( sv, 9 ); 232 boxLayout->setStretchFactor( sv, 9 );
234 // "prebuffer" it in one more list, to get the sorting done 233 // "prebuffer" it in one more list, to get the sorting done
235 tempList.insert( plugin.name, plugin ); 234 tempList.insert( plugin.name, plugin );
236 235
237 // on first start the list is off course empty 236 // on first start the list is off course empty
238 if ( m_allApplets.isEmpty() ) { 237 if ( m_allApplets.isEmpty() ) {
239 layout->addWidget( plugin.guiBox ); 238 layout->addWidget( plugin.guiBox );
240 pluginList.append( plugin ); 239 pluginList.append( plugin );
241 } 240 }
242 241
243 // if plugin is not yet in the list, add it to the layout too 242 // if plugin is not yet in the list, add it to the layout too
244 else if ( !m_allApplets.contains( plugin.name ) ) { 243 else if ( !m_allApplets.contains( plugin.name ) ) {
245 layout->addWidget( plugin.guiBox ); 244 layout->addWidget( plugin.guiBox );
246 pluginList.append( plugin ); 245 pluginList.append( plugin );
247 } 246 }
248 } 247 }
249 } else { 248 } else {
250 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 249 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
251 delete lib; 250 delete lib;
252 } 251 }
253 } 252 }
254 253
255 if ( !m_allApplets.isEmpty() ) { 254 if ( !m_allApplets.isEmpty() ) {
256 TodayPlugin tempPlugin; 255 TodayPlugin tempPlugin;
257 QStringList::Iterator stringit; 256 QStringList::Iterator stringit;
258 257
259 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 258 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
260 tempPlugin = ( tempList.find( *stringit ) ).data(); 259 tempPlugin = ( tempList.find( *stringit ) ).data();
261 if ( !( (tempPlugin.name).isEmpty() ) ) { 260 if ( !( (tempPlugin.name).isEmpty() ) ) {
262 layout->addWidget( tempPlugin.guiBox ); 261 layout->addWidget( tempPlugin.guiBox );
263 pluginList.append( tempPlugin ); 262 pluginList.append( tempPlugin );
264 } 263 }
265 } 264 }
266 } 265 }
267} 266}
268 267
269 268
270/** 269/**
271 * Repaint method. Reread all fields. 270 * Repaint method. Reread all fields.
272 */ 271 */
273void Today::draw() { 272void Today::draw() {
274 273
275 if ( pluginList.count() == 0 ) { 274 if ( pluginList.count() == 0 ) {
276 QLabel *noPlugins = new QLabel( this ); 275 QLabel *noPlugins = new QLabel( this );
277 noPlugins->setText( tr( "No plugins found" ) ); 276 noPlugins->setText( tr( "No plugins found" ) );
278 layout->addWidget( noPlugins ); 277 layout->addWidget( noPlugins );
279 return; 278 return;
280 } 279 }
281 280
282 uint count = 0; 281 uint count = 0;
283 TodayPlugin plugin; 282 TodayPlugin plugin;
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index 12e8411..9a93b56 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -1,106 +1,106 @@
1/* 1/*
2 * todaybase.cpp 2 * todaybase.cpp
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#include "todaybase.h" 17#include "todaybase.h"
18 18
19#include <qframe.h> 19#include <qframe.h>
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qimage.h> 21#include <qimage.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qwhatsthis.h> 24#include <qwhatsthis.h>
25 25
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27 27
28 28
29TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) 29TodayBase::TodayBase( QWidget* parent, const char* name, WFlags )
30 : QWidget( parent, name, WStyle_ContextHelp ) { 30 : QWidget( parent, name, WStyle_ContextHelp ) {
31 31
32 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo 32 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo
33 QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla 33 QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla
34 QPixmap config = Resource::loadPixmap( "today/config" ); // config icon 34 QPixmap config = Resource::loadPixmap( "today/config" ); // config icon
35 35
36 layout = new QVBoxLayout( this ); 36 layout = new QVBoxLayout( this );
37 37
38 QPalette pal = this->palette(); 38 QPalette pal = this->palette();
39 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 39 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
40 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 40 pal.setColor( QPalette::Active, QColorGroup::Button, col );
41 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 41 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
42 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 42 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
43 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 43 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
44 this->setPalette( pal ); 44 this->setPalette( pal );
45 45
46 // --- logo Section --- 46 // --- logo Section ---
47 QPalette pal2; 47 QPalette pal2;
48 QColorGroup cg; 48 QColorGroup cg;
49 cg.setColor( QColorGroup::Text, white ); 49 cg.setColor( QColorGroup::Text, white );
50 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); 50 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) );
51 pal2.setActive( cg ); 51 pal2.setActive( cg );
52 // today logo 52 // today logo
53 Frame = new QLabel( this, "Frame" ); 53 Frame = new QLabel( this, "Frame" );
54 Frame->setPalette( pal2 ); 54 Frame->setPalette( pal2 );
55 Frame->setFrameShape( QFrame::StyledPanel ); 55 Frame->setFrameShape( QFrame::StyledPanel );
56 Frame->setFrameShadow( QFrame::Raised ); 56 Frame->setFrameShadow( QFrame::Raised );
57 Frame->setLineWidth( 0 ); 57 Frame->setLineWidth( 0 );
58 Frame->setMaximumHeight( 50 ); 58 Frame->setMaximumHeight( 50 );
59 Frame->setMinimumHeight( 50 ); 59 Frame->setMinimumHeight( 50 );
60 60
61 // Today text 61 // Today text
62 QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); 62 QLabel* TodayLabel = new QLabel( Frame, "TodayText" );
63 TodayLabel->setGeometry( QRect( 10, 0, 168, 40 ) ); 63 TodayLabel->setGeometry( QRect( 10, 1, 168, 40 ) );
64 QFont TodayLabel_font( TodayLabel->font() ); 64 QFont TodayLabel_font( TodayLabel->font() );
65 TodayLabel_font.setBold( TRUE ); 65 TodayLabel_font.setBold( TRUE );
66 TodayLabel_font.setPointSize( 40 ); 66 TodayLabel_font.setPointSize( 40 );
67 TodayLabel->setFont( TodayLabel_font ); 67 TodayLabel->setFont( TodayLabel_font );
68 TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); 68 TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin );
69 TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" ); 69 TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" );
70 70
71 // date 71 // date
72 DateLabel = new QLabel( Frame, "TextLabel1" ); 72 DateLabel = new QLabel( Frame, "TextLabel1" );
73 DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) ); 73 DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) );
74 QFont DateLabel_font( DateLabel->font() ); 74 QFont DateLabel_font( DateLabel->font() );
75 DateLabel_font.setBold( TRUE ); 75 DateLabel_font.setBold( TRUE );
76 DateLabel->setFont( DateLabel_font ); 76 DateLabel->setFont( DateLabel_font );
77 DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); 77 DateLabel->setBackgroundOrigin( QLabel::ParentOrigin );
78 DateLabel->setTextFormat( RichText ); 78 DateLabel->setTextFormat( RichText );
79 79
80 // Opiezilla 80 // Opiezilla
81 QLabel* Opiezilla = new QLabel( Frame, "OpieZilla" ); 81 QLabel* Opiezilla = new QLabel( Frame, "OpieZilla" );
82 Opiezilla->setPixmap( opiezilla ); 82 Opiezilla->setPixmap( opiezilla );
83 Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 ); 83 Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 );
84 QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) ); 84 QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) );
85 Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); 85 Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin );
86 86
87 // Ownerfield 87 // Ownerfield
88 OwnerField = new OClickableLabel( this , "Owner" ); 88 OwnerField = new OClickableLabel( this , "Owner" );
89 OwnerField->setGeometry( QRect( 0, 0, this->width(), 12 ) ); 89 OwnerField->setGeometry( QRect( 0, 0, this->width(), 12 ) );
90 OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); 90 OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) );
91 OwnerField->setMaximumHeight(12); 91 OwnerField->setMaximumHeight(12);
92 92
93 // config 93 // config
94 ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); 94 ConfigButton = new OClickableLabel ( Frame, "PushButton1" );
95 ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 30, 25, 21 ) ); 95 ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 29, 25, 20 ) );
96 ConfigButton->setPixmap( config ); 96 ConfigButton->setPixmap( config );
97 QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) ); 97 QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) );
98 ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); 98 ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin );
99} 99}
100 100
101/** 101/**
102 * D' tor 102 * D' tor
103 */ 103 */
104TodayBase::~TodayBase() { 104TodayBase::~TodayBase() {
105} 105}
106 106