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
62Q_SIGNALS:
63
64 /// \em Really emitted whenever the current identity changes. Either
65 /// by user intervention or on setCurrentIdentity() or if the
66 /// current identity disappears.
67 ///
68 /// You might also want to listen to IdentityManager::changed,
69 /// IdentityManager::deleted and IdentityManager::added.
70 void identityChanged(KIdentityManagementCore::Identity::Id uoid);
71 void identityDeleted(KIdentityManagementCore::Identity::Id uoid);
72 void invalidIdentity();
73
74public Q_SLOTS:
75 /// Connected to IdentityManager::changed(). Reloads the list of identities.
76 void slotIdentityManagerChanged();
77
78protected Q_SLOTS:
79 void slotEmitChanged(int);
80 void slotUpdateTooltip(uint uoid);
81
82private:
83 //@cond PRIVATE
84 std::unique_ptr<IdentityComboPrivate> const d;
85 //@endcond
86};
87}
Manages the list of identities.
User identity information.
Definition identity.h:73
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 Fri Jul 12 2024 12:03:33 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.