[frameworks/kcontacts] /: Remove dependency on KCoreAddons

Volker Krause <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 767dcd5768de4f881f4a1d1014d21e7f63fc5dc9 by Volker Krause.
Committed on 19/07/2026 at 06:24.
Pushed by vkrause into branch 'master'.

Remove dependency on KCoreAddons

This was only used to initialize a few id fields with a random string, we
can do that with just QtCore as well.

As those id fields seem practically unused anyway, there is no code relying
on the specific values in them either.

Motivated by kcoreaddons new libmount dependency breaking the static build
of the kitinerary extractor used by e.g. Nextcloud.

M  +0    -1    .kde-ci.yml
M  +1    -1    CMakeLists.txt
M  +0    -1    KF6ContactsConfig.cmake.in
M  +0    -1    src/CMakeLists.txt
M  +2    -2    src/address.cpp
M  +2    -2    src/key.cpp
M  +2    -2    src/phonenumber.cpp

https://invent.kde.org/frameworks/kcontacts/-/commit/767dcd5768de4f881f4a1d1014d21e7f63fc5dc9

diff --git a/.kde-ci.yml b/.kde-ci.yml
index 6017f88c..fe116d54 100644
--- a/.kde-ci.yml
+++ b/.kde-ci.yml
@@ -2,7 +2,6 @@ Dependencies:
  - 'on': ['@all']
    'require':
     'frameworks/extra-cmake-modules': '@same'
-    'frameworks/kcoreaddons': '@same'
     'frameworks/ki18n': '@same'
     'frameworks/kconfig': '@same'
     'frameworks/kcodecs': '@same'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50b64cb4..e03a4dd6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,7 @@ set_package_properties(Qt6Gui PROPERTIES
 if (USE_QML)
     find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Qml)
 endif()
-find_package(KF6 ${KF_DEP_VERSION} REQUIRED COMPONENTS CoreAddons I18n Config Codecs)
+find_package(KF6 ${KF_DEP_VERSION} REQUIRED COMPONENTS I18n Config Codecs)
 
 ########### Targets ###########
 
diff --git a/KF6ContactsConfig.cmake.in b/KF6ContactsConfig.cmake.in
index 548fb0b2..8d4b7190 100644
--- a/KF6ContactsConfig.cmake.in
+++ b/KF6ContactsConfig.cmake.in
@@ -2,7 +2,6 @@
 include(CMakeFindDependencyMacro)
 find_dependency(Qt6Gui "@REQUIRED_QT_VERSION@")
 if (NOT @BUILD_SHARED_LIBS@)
-    find_dependency(KF6CoreAddons "@KF_DEP_VERSION@")
     find_dependency(KF6Config "@KF_DEP_VERSION@")
     find_dependency(KF6I18n "@KF_DEP_VERSION@")
     find_dependency(KF6Codecs "@KF_DEP_VERSION@")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c1856fd5..ed7c6337 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -157,7 +157,6 @@ PUBLIC
     Qt6::Core
     Qt6::Gui
 PRIVATE
-    KF6::CoreAddons
     KF6::ConfigCore
     KF6::I18n
     KF6::I18nLocaleData
diff --git a/src/address.cpp b/src/address.cpp
index b74f45af..8689197a 100644
--- a/src/address.cpp
+++ b/src/address.cpp
@@ -13,13 +13,13 @@
 #include <KConfig>
 #include <KCountry>
 #include <KLocalizedString>
-#include <krandom.h>
 
 #include <KConfigGroup>
 
 #include <QDataStream>
 #include <QSharedData>
 #include <QUrlQuery>
+#include <QUuid>
 
 using namespace KContacts;
 
@@ -29,7 +29,7 @@ public:
     Private()
         : mEmpty(true)
     {
-        mId = KRandom::randomString(10);
+        mId = QUuid::createUuid().toString(QUuid::Id128);
     }
 
     Private(const Private &other)
diff --git a/src/key.cpp b/src/key.cpp
index 29d2bbd1..6f9b8460 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -8,9 +8,9 @@
 #include "key.h"
 
 #include <KLocalizedString>
-#include <krandom.h>
 
 #include <QSharedData>
+#include <QUuid>
 
 using namespace KContacts;
 
@@ -18,7 +18,7 @@ class Q_DECL_HIDDEN Key::Private : public QSharedData
 {
 public:
     Private()
-        : mId(KRandom::randomString(8))
+        : mId(QUuid::createUuid().toString(QUuid::Id128))
     {
     }
 
diff --git a/src/phonenumber.cpp b/src/phonenumber.cpp
index 61b2f5d0..24b5fa60 100644
--- a/src/phonenumber.cpp
+++ b/src/phonenumber.cpp
@@ -9,10 +9,10 @@
 #include "parametermap_p.h"
 
 #include <KLocalizedString>
-#include <krandom.h>
 
 #include <QDataStream>
 #include <QSharedData>
+#include <QUuid>
 
 using namespace KContacts;
 
@@ -25,7 +25,7 @@ class Q_DECL_HIDDEN PhoneNumber::Private : public QSharedData
 {
 public:
     Private(Type type)
-        : mId(KRandom::randomString(8))
+        : mId(QUuid::createUuid().toString(QUuid::Id128))
         , mType(type)
     {
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.