KIdentityManagement

identitycombo.h
1// SPDX-FileCopyrightText: 2002 Marc Mutz <mutz@kde.org>
2// SPDX-FileCopyrightText: 2024 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{
25 Q_OBJECT
26public:
27 /// IdentityCombo contructor
28 explicit IdentityCombo(KIdentityManagementCore::IdentityManager *manager, QWidget *parent = nullptr);
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
42 void setCurrentIdentity(const KIdentityManagementCore::Identity &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
55 [[nodiscard]] KIdentityManagementCore::IdentityManager *identityManager() const;
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
67Q_SIGNALS:
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.
81 void slotIdentityManagerChanged();
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
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 Mon Nov 4 2024 16:33:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.