ssllabel.cpp
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 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033
00034 #include "ssllabel.h"
00035
00036 #include <kiconloader.h>
00037 #include <klocale.h>
00038
00039 #include <qtooltip.h>
00040
00041 namespace KMail {
00042
00043 SSLLabel::SSLLabel( QWidget* parent )
00044 : QLabel( parent )
00045 {
00046 setState( Done );
00047 }
00048
00049 void SSLLabel::setEncrypted( bool enc )
00050 {
00051 if ( enc ) {
00052 m_lastEncryptionState = Encrypted;
00053 } else {
00054 m_lastEncryptionState = Unencrypted;
00055 }
00056 }
00057
00058 SSLLabel::State SSLLabel::lastState() const
00059 {
00060 return m_lastEncryptionState;
00061 }
00062
00063 void SSLLabel::setState( State state )
00064 {
00065 switch( state ) {
00066 case Encrypted:
00067 QToolTip::remove( this );
00068 QToolTip::add( this, i18n("Connection is encrypted") );
00069 setPixmap( SmallIcon( "encrypted", KGlobal::instance() ) );
00070 show();
00071 break;
00072 case Unencrypted:
00073 QToolTip::remove( this );
00074 QToolTip::add( this, i18n("Connection is unencrypted") );
00075 setPixmap( SmallIcon( "decrypted" ) );
00076 show();
00077 break;
00078 case Done:
00079 QToolTip::remove( this );
00080 hide();
00081 break;
00082 case Clean:
00083 default:
00084 QToolTip::remove( this );
00085 hide();
00086
00087
00088 return;
00089 }
00090 m_lastEncryptionState = state;
00091 }
00092
00093
00094 }
00095
00096
This file is part of the documentation for kmail Library Version 3.2.2.