KIdentityManagement

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

KDE's Doxygen guidelines are available online.