kmail Library API Documentation

ssllabel.cpp

00001 /* -*- mode: C++; c-file-style: "gnu" -*- 00002 * 00003 * This file is part of KMail, the KDE mail client. 00004 * Copyright (c) 2003 Zack Rusin <zack@kde.org> 00005 * 00006 * KMail is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License, version 2, as 00008 * published by the Free Software Foundation. 00009 * 00010 * KMail is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * In addition, as a special exception, the copyright holders give 00020 * permission to link the code of this program with any edition of 00021 * the Qt library by Trolltech AS, Norway (or with modified versions 00022 * of Qt that use the same license as Qt), and distribute linked 00023 * combinations including the two. You must obey the GNU General 00024 * Public License in all respects for all of the code used other than 00025 * Qt. If you modify this file, you may extend this exception to 00026 * your version of the file, but you are not obligated to do so. If 00027 * you do not wish to do so, delete this exception statement from 00028 * your version. 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 //we return because we do not save the state as the only 00087 //action we want to perform is to hide ourself 00088 return; 00089 } 00090 m_lastEncryptionState = state; 00091 } 00092 00093 00094 } //end namespace KMail 00095 00096 //#include "ssllabel.moc"
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:04 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003