KIdentityManagement

identitycombo.h
1// SPDX-FileCopyrightText: 2002 Marc Mutz <mutz@kde.org>
2// SPDX-License-Identifier: LGPL-2.0-or-later
3
4#pragma once
5
6#include "kidentitymanagementwidgets_export.h"
7#include <KIdentityManagementCore/Identity>
8
9#include <QComboBox>
10
11namespace KIdentityManagementCore
12{
13class IdentityManager;
14class Identity;
15}
16namespace KIdentityManagementWidgets
17{
18class IdentityComboPrivate;
19
20/// \brief A combo box that always shows the up-to-date identity list.
21/// \author Marc Mutz <mutz@kde.org>
22class KIDENTITYMANAGEMENTWIDGETS_EXPORT IdentityCombo : public QComboBox
23{
24 Q_OBJECT
25public:
26 /// IdentityCombo contructor
27 explicit IdentityCombo(KIdentityManagementCore::IdentityManager *manager, QWidget *parent = nullptr);
28
29 ~IdentityCombo() override;
30
31 /// Return the current identity name.
32 [[nodiscard]] QString currentIdentityName() const;
33
34 /// Return the current identity id
35 [[nodiscard]] KIdentityManagementCore::Identity::Id currentIdentity() const;
36
37 /// Return whether the current identity is the default identity.
38 [[nodiscard]] bool isDefaultIdentity() const;
39
40 /// Set the current identity
41 void setCurrentIdentity(const KIdentityManagementCore::Identity &identity);
42
43 /// Set the current identity by name.
44 void setCurrentIdentity(const QString &identityName);
45
46 /// Set the current identity by Id
47 void setCurrentIdentity(KIdentityManagementCore::Identity::Id uoid);
48
49 /// Show (default) on the default identity. By default this behavior is disabled.
50 void setShowDefault(bool showDefault);
51
52 /// Returns the IdentityManager used in this combo box.
53 /// @since 4.5
54 [[nodiscard]] KIdentityManagementCore::IdentityManager *identityManager() const;
55
56Q_SIGNALS:
57
58 /// \em Really emitted whenever the current identity changes. Either
59 /// by user intervention or on setCurrentIdentity() or if the
60 /// current identity disappears.
61 ///
62 /// You might also want to listen to IdentityManager::changed,
63 /// IdentityManager::deleted and IdentityManager::added.
64 void identityChanged(KIdentityManagementCore::Identity::Id uoid);
65 void identityDeleted(KIdentityManagementCore::Identity::Id uoid);
66 void invalidIdentity();
67
68public Q_SLOTS:
69 /// Connected to IdentityManager::changed(). Reloads the list of identities.
70 void slotIdentityManagerChanged();
71
72protected Q_SLOTS:
73 void slotEmitChanged(int);
74 void slotUpdateTooltip(uint uoid);
75
76private:
77 //@cond PRIVATE
78 std::unique_ptr<IdentityComboPrivate> const d;
79 //@endcond
80};
81}
Manages the list of identities.
User identity information.
Definition identity.h:72
A combo box that always shows the up-to-date identity list.
void identityChanged(KIdentityManagementCore::Identity::Id uoid)
Really emitted whenever the current identity changes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:09 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.