00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
#ifdef HAVE_CONFIG_H
00034
#include <config.h>
00035
#endif
00036
00037
#include "htmlstatusbar.h"
00038
00039
#ifndef KMAIL_TESTING
00040
#include "kmkernel.h"
00041
#else
00042
#include <kapplication.h>
00043
#endif
00044
00045
#include <klocale.h>
00046
#include <kconfig.h>
00047
00048
#include <qcolor.h>
00049
#include <qstring.h>
00050
00051 KMail::HtmlStatusBar::HtmlStatusBar(
QWidget * parent,
const char * name, WFlags f )
00052 :
QLabel( parent, name, f ),
00053 mMode( Normal )
00054 {
00055 setAlignment( AlignHCenter|AlignTop );
00056 upd();
00057 }
00058
00059 KMail::HtmlStatusBar::~HtmlStatusBar() {}
00060
00061
void KMail::HtmlStatusBar::upd() {
00062 setEraseColor( bgColor() );
00063 setPaletteForegroundColor( fgColor() );
00064 setText( message() );
00065 }
00066
00067 void KMail::HtmlStatusBar::setNormalMode() {
00068
setMode( Normal );
00069 }
00070
00071 void KMail::HtmlStatusBar::setHtmlMode() {
00072
setMode( Html );
00073 }
00074
00075 void KMail::HtmlStatusBar::setNeutralMode() {
00076
setMode( Neutral );
00077 }
00078
00079 void KMail::HtmlStatusBar::setMode( Mode m ) {
00080
if ( m ==
mode() )
00081
return;
00082 mMode = m;
00083 upd();
00084 }
00085
00086
QString KMail::HtmlStatusBar::message()
const {
00087
switch (
mode() ) {
00088
case Html:
00089
return i18n(
"<qt><b><br>H<br>T<br>M<br>L<br> "
00090
"<br>M<br>e<br>s<br>s<br>a<br>g<br>e</b></qt>" );
00091
case Normal:
00092
return i18n(
"<qt><br>N<br>o<br> "
00093
"<br>H<br>T<br>M<br>L<br> "
00094
"<br>M<br>e<br>s<br>s<br>a<br>g<br>e</qt>" );
00095
default:
00096
case Neutral:
00097
return QString::null;
00098 }
00099 }
00100
00101
namespace {
00102
inline KConfig * config() {
00103
#ifndef KMAIL_TESTING
00104
return KMKernel::config();
00105
#else
00106
return kApp->config();
00107
#endif
00108
}
00109 }
00110
00111
QColor KMail::HtmlStatusBar::fgColor()
const {
00112 KConfigGroup conf( config(),
"Reader" );
00113
switch (
mode() ) {
00114
case Html:
00115
return conf.readColorEntry(
"ColorbarForegroundHTML", &Qt::white );
00116
case Normal:
00117
return conf.readColorEntry(
"ColorbarForegroundPlain", &Qt::black );
00118
default:
00119
case Neutral:
00120
return Qt::black;
00121 }
00122 }
00123
00124
QColor KMail::HtmlStatusBar::bgColor()
const {
00125 KConfigGroup conf( config(),
"Reader" );
00126
00127
switch (
mode() ) {
00128
case Html:
00129
return conf.readColorEntry(
"ColorbarBackgroundHTML", &Qt::black );
00130
case Normal:
00131
return conf.readColorEntry(
"ColorbarBackgroundPlain", &Qt::lightGray );
00132
default:
00133
case Neutral:
00134
return Qt::white;
00135 }
00136 }
00137
00138
#include "htmlstatusbar.moc"