Libkdepim

ssllabel.cpp
1/*
2 *
3 * This file is part of KMail, the KDE mail client.
4 *
5 * SPDX-FileCopyrightText: 2003 Zack Rusin <zack@kde.org>
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10#include "ssllabel.h"
11
12#include <KLocalizedString>
13
14#include <QIcon>
15#include <QStyle>
16
17using namespace KPIM;
18
19SSLLabel::SSLLabel(QWidget *parent)
20 : QLabel(parent)
21{
22 setState(Done);
23}
24
25void SSLLabel::setEncrypted(SSLLabel::State state)
26{
27 m_lastEncryptionState = state;
28}
29
30SSLLabel::State SSLLabel::lastState() const
31{
32 return m_lastEncryptionState;
33}
34
35void SSLLabel::setState(State state)
36{
37 switch (state) {
38 case Encrypted:
39 setToolTip(i18nc("@info:tooltip", "Connection is encrypted"));
40 setPixmap(QIcon::fromTheme(QStringLiteral("security-high")).pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize)));
41 show();
42 break;
43 case Unencrypted:
44 setToolTip(i18nc("@info:tooltip", "Connection is unencrypted"));
45 setPixmap(QIcon::fromTheme(QStringLiteral("security-low")).pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize)));
46 show();
47 break;
48 case Unknown:
49 case Done:
51 hide();
52 break;
53 case Clean:
55 hide();
56 // we return because we do not save the state as the only
57 // action we want to perform is to hide ourself
58 return;
59 }
60 m_lastEncryptionState = state;
61}
62
63#include "moc_ssllabel.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
Class KCheckComboBox::KCheckComboBoxPrivate.
QIcon fromTheme(const QString &name)
void setPixmap(const QPixmap &)
PM_SmallIconSize
void hide()
void show()
QStyle * style() const const
void setToolTip(const QString &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.