Skip to content

Commit

Permalink
Avoid deprecated version of setEmail vs addEmail
Browse files Browse the repository at this point in the history
  • Loading branch information
dragotin committed Oct 15, 2024
1 parent 5b67a2a commit 0422fd9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/myidentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <KLocalizedString>
#include <QFile>

#include <kcontacts_version.h>
#include <kcontacts/resourcelocatorurl.h>
#include <kcontacts/vcardconverter.h>

Expand Down Expand Up @@ -55,12 +56,15 @@ KContacts::Addressee MyIdentity::UIToAddressee(Ui::manualOwnIdentity ui)
resUrl.setUrl(QUrl(ui.leWebsite->text()));
add.setUrl(resUrl);

#if KContacts_VERSION >= QT_VERSION_CHECK(5, 88, 0)
KContacts::Email email;
email.setEmail(ui.leEmail->text());
email.setPreferred(true);
email.setType(KContacts::Email::TypeFlag::Work);
add.addEmail(email);

#else
add.insertEmail(ui.leEmail->text(), true /* prefered */ );
#endif
return add;
}

Expand Down

0 comments on commit 0422fd9

Please sign in to comment.