author | harlekin <harlekin> | 2002-11-27 14:35:21 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-11-27 14:35:21 (UTC) |
commit | 4d7272423782dc2f9f7dbde36b848f55eb323c79 (patch) (unidiff) | |
tree | 93fee7538aca84be74f81406776cec7c6867cc4a | |
parent | 5f0c90d4b6972c1ad22ba20b45cd1d3f88298099 (diff) | |
download | opie-4d7272423782dc2f9f7dbde36b848f55eb323c79.zip opie-4d7272423782dc2f9f7dbde36b848f55eb323c79.tar.gz opie-4d7272423782dc2f9f7dbde36b848f55eb323c79.tar.bz2 |
fix for bug #494 which is imho a flat style bug
-rw-r--r-- | core/pim/today/today.cpp | 1 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 6 |
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 | |||
@@ -27,129 +27,128 @@ | |||
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 | ||
41 | struct TodayPlugin { | 41 | struct 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 | ||
53 | static QValueList<TodayPlugin> pluginList; | 53 | static QValueList<TodayPlugin> pluginList; |
54 | 54 | ||
55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 55 | Today::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 | */ |
80 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 80 | void 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 | ||
89 | void Today::setRefreshTimer( int interval ) { | 89 | void 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 | */ |
105 | void Today::setOwnerField() { | 104 | void 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 | */ |
119 | void Today::setOwnerField( QString &message ) { | 118 | void 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 | */ |
129 | void Today::init() { | 128 | void 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 | */ |
146 | void Today::loadPlugins() { | 145 | void 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) ); |
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 | ||
29 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) | 29 | TodayBase::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 | */ |
104 | TodayBase::~TodayBase() { | 104 | TodayBase::~TodayBase() { |
105 | } | 105 | } |
106 | 106 | ||