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