Commit a1f65a7e authored by Carl Schwan's avatar Carl Schwan 🚴 Committed by Laurent Montel
Browse files

Add api to show (default) in combobox

parent 95b967f6
Pipeline #75123 canceled with stage
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.18.40")
set(PIM_VERSION "5.18.41")
project(KIdentityManagement VERSION ${PIM_VERSION})
......
......@@ -44,11 +44,22 @@ public:
QList<uint> mUoidList;
IdentityManager *const mIdentityManager;
IdentityCombo *const q;
bool showDefault = false;
};
void KIdentityManagement::IdentityComboPrivate::reloadCombo()
{
const QStringList identities = mIdentityManager->identities();
QStringList identities;
identities.reserves(mIdentityManager->count());
IdentityManager::ConstIterator it;
IdentityManager::ConstIterator end(mIdentityManager->end());
for (it = mIdentityManager->begin(); it != end; ++it) {
if (showDefault && it->isDefault()) {
identities << QString(it->identityName() + i18nc("Default identity", " (default)"));
} else {
identities << it->identityName();
}
}
// the IM should prevent this from happening:
assert(!identities.isEmpty());
q->clear();
......@@ -182,3 +193,8 @@ IdentityManager *IdentityCombo::identityManager() const
{
return d->mIdentityManager;
}
void IdentityCombo::showDefault(bool showDefault)
{
d->showDefault = showDefault;
}
......@@ -41,6 +41,8 @@ public:
void setCurrentIdentity(const QString &identityName);
void setCurrentIdentity(const Identity &identity);
void setCurrentIdentity(uint uoid);
/// Show (default) on the default identity. By default this behavior is disabled.
void showDefault(bool showDefault);
/**
Returns the IdentityManager used in this combo box.
@since 4.5
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment