summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Unidiff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 2095174..f052a9f 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -32,48 +32,46 @@
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 <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qdialog.h> 37#include <qdialog.h>
38 38
39 39
40struct TodayPlugin { 40struct TodayPlugin {
41 QLibrary *library; 41 QLibrary *library;
42 TodayPluginInterface *iface; 42 TodayPluginInterface *iface;
43 TodayPluginObject *guiPart; 43 TodayPluginObject *guiPart;
44 QHBox *guiBox; 44 QWidget *guiBox;
45 QString name; 45 QString name;
46 bool active; 46 bool active;
47 int pos; 47 int pos;
48}; 48};
49 49
50static QValueList<TodayPlugin> pluginList; 50static QValueList<TodayPlugin> pluginList;
51 51
52Today::Today( QWidget* parent, const char* name, WFlags fl ) 52Today::Today( QWidget* parent, const char* name, WFlags fl )
53 : TodayBase( parent, name, fl ) { 53 : TodayBase( parent, name, fl ) {
54 54
55 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 55 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
56 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 56 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
57 57
58#if defined(Q_WS_QWS) 58#if defined(Q_WS_QWS)
59#if !defined(QT_NO_COP) 59#if !defined(QT_NO_COP)
60 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 60 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
61 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 61 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
62 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 62 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
63#endif 63#endif
64#endif 64#endif
65 65
66 // pluginLayout = 0l;
67
68 setOwnerField(); 66 setOwnerField();
69 init(); 67 init();
70 loadPlugins(); 68 loadPlugins();
71 draw(); 69 draw();
72 showMaximized(); 70 showMaximized();
73} 71}
74 72
75/** 73/**
76 * Qcop receive method. 74 * Qcop receive method.
77 */ 75 */
78void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 76void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
79 QDataStream stream( data, IO_ReadOnly ); 77 QDataStream stream( data, IO_ReadOnly );
@@ -156,42 +154,48 @@ void Today::loadPlugins() {
156 TodayPlugin plugin; 154 TodayPlugin plugin;
157 plugin.library = lib; 155 plugin.library = lib;
158 plugin.iface = iface; 156 plugin.iface = iface;
159 plugin.name = QString(*it); 157 plugin.name = QString(*it);
160 158
161 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 159 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
162 plugin.active = true; 160 plugin.active = true;
163 } else { 161 } else {
164 plugin.active = false; 162 plugin.active = false;
165 } 163 }
166 plugin.guiPart = plugin.iface->guiPart(); 164 plugin.guiPart = plugin.iface->guiPart();
167 165
168 plugin.guiBox = new QHBox( this ); 166 // package the whole thing into a qwidget so it can be shown and hidden
167 plugin.guiBox = new QWidget( this );
168 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
169
169 QPixmap plugPix; 170 QPixmap plugPix;
170 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); 171 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
171 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 172 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
172 plugIcon->setPixmap( plugPix ); 173 plugIcon->setPixmap( plugPix );
174
175 // a scrollview for each plugin
173 QScrollView* sv = new QScrollView( plugin.guiBox ); 176 QScrollView* sv = new QScrollView( plugin.guiBox );
174 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); 177 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
175 sv->setMinimumHeight( plugin.guiPart->minHeight() ); 178 sv->setMinimumHeight( plugin.guiPart->minHeight() );
176 //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); 179 //sv->setMaximumHeight( plugin.guiPart->maxHeight() );
177 sv->setResizePolicy( QScrollView::AutoOneFit ); 180 sv->setResizePolicy( QScrollView::AutoOneFit );
178 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 181 sv->setHScrollBarMode( QScrollView::AlwaysOff );
179 sv->setFrameShape( QFrame::NoFrame ); 182 sv->setFrameShape( QFrame::NoFrame );
180 sv->addChild( plugWidget ); 183 sv->addChild( plugWidget );
181 184
182 //plugin.guiBox->addWidget( plugIcon, 0, AlignTop ); 185 // make sure the icon is on the top alligned
183 //plugin.guiBox->addWidget( sv, 0, AlignTop ); 186 boxLayout->addWidget( plugIcon, 0, AlignTop );
184 plugin.guiBox->setStretchFactor( plugIcon, 1 ); 187 boxLayout->addWidget( sv, 0, AlignTop );
185 plugin.guiBox->setStretchFactor( sv, 9 ); 188 boxLayout->setStretchFactor( plugIcon, 1 );
189 boxLayout->setStretchFactor( sv, 9 );
186 layout->addWidget( plugin.guiBox ); 190 layout->addWidget( plugin.guiBox );
187 191
188 pluginList.append( plugin ); 192 pluginList.append( plugin );
189 count++; 193 count++;
190 } else { 194 } else {
191 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 195 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
192 delete lib; 196 delete lib;
193 } 197 }
194 } 198 }
195} 199}
196 200
197 201