[pim/korganizer] src/kontactplugin/korganizer: Use KCalendarCore::MimeData for DnD operations
Volker Krause <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 291482c431d34c391b6c4d21b30e9e2a9fdc8df3 by Volker Krause.
Committed on 22/07/2026 at 15:38.
Pushed by vkrause into branch 'master'.
Use KCalendarCore::MimeData for DnD operations
M +9 -0 src/kontactplugin/korganizer/korganizerplugin.cpp
M +13 -0 src/kontactplugin/korganizer/todoplugin.cpp
https://invent.kde.org/pim/korganizer/-/commit/291482c431d34c391b6c4d21b30e9e2a9fdc8df3
diff --git a/src/kontactplugin/korganizer/korganizerplugin.cpp b/src/kontactplugin/korganizer/korganizerplugin.cpp
index e2c761ff9..141bccdfe 100644
--- a/src/kontactplugin/korganizer/korganizerplugin.cpp
+++ b/src/kontactplugin/korganizer/korganizerplugin.cpp
@@ -18,7 +18,11 @@
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
+#if KCALENDARCORE_VERSION < QT_VERSION_CHECK(6, 29, 0)
#include <KCalUtils/ICalDrag>
+#else
+#include <KCalendarCore/MimeData>
+#endif
#include <KMime/Message>
#include <KontactInterface/Core>
@@ -147,9 +151,14 @@ void KOrganizerPlugin::processDropEvent(QDropEvent *event)
return;
}
+#if KCALENDARCORE_VERSION < QT_VERSION_CHECK(6, 29, 0)
if (KCalUtils::ICalDrag::canDecode(event->mimeData())) {
const KCalendarCore::MemoryCalendar::Ptr cal(new KCalendarCore::MemoryCalendar(QTimeZone::systemTimeZone()));
if (KCalUtils::ICalDrag::fromMimeData(event->mimeData(), cal)) {
+#else
+ if (KCalendarCore::MimeData::canDecode(event->mimeData())) {
+ if (const KCalendarCore::Calendar::Ptr cal = KCalendarCore::MimeData::decodeCalendar(event->mimeData()); cal) {
+#endif
KCalendarCore::Incidence::List incidences = cal->incidences();
Q_ASSERT(incidences.count());
if (!incidences.isEmpty()) {
diff --git a/src/kontactplugin/korganizer/todoplugin.cpp b/src/kontactplugin/korganizer/todoplugin.cpp
index ed39cabc0..26548b645 100644
--- a/src/kontactplugin/korganizer/todoplugin.cpp
+++ b/src/kontactplugin/korganizer/todoplugin.cpp
@@ -17,7 +17,11 @@
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
+#if KCALENDARCORE_VERSION < QT_VERSION_CHECK(6, 29, 0)
#include <KCalUtils/ICalDrag>
+#else
+#include <KCalendarCore/MimeData>
+#endif
#include <KMime/Message>
#include <KontactInterface/Core>
@@ -112,7 +116,11 @@ void TodoPlugin::slotNewTodo()
bool TodoPlugin::canDecodeMimeData(const QMimeData *mimeData) const
{
+#if KCALENDARCORE_VERSION < QT_VERSION_CHECK(6, 29, 0)
return mimeData->hasText() || KContacts::VCardDrag::canDecode(mimeData) || KCalUtils::ICalDrag::canDecode(mimeData);
+#else
+ return mimeData->hasText() || KContacts::VCardDrag::canDecode(mimeData) || KCalendarCore::MimeData::canDecode(mimeData);
+#endif
}
bool TodoPlugin::isRunningStandalone() const
@@ -146,9 +154,14 @@ void TodoPlugin::processDropEvent(QDropEvent *event)
return;
}
+#if KCALENDARCORE_VERSION < QT_VERSION_CHECK(6, 29, 0)
if (KCalUtils::ICalDrag::canDecode(event->mimeData())) {
KCalendarCore::MemoryCalendar::Ptr const cal(new KCalendarCore::MemoryCalendar(QTimeZone::systemTimeZone()));
if (KCalUtils::ICalDrag::fromMimeData(event->mimeData(), cal)) {
+#else
+ if (KCalendarCore::MimeData::canDecode(event->mimeData())) {
+ if (KCalendarCore::Calendar::Ptr const cal = KCalendarCore::MimeData::decodeCalendar(event->mimeData()); cal) {
+#endif
KCalendarCore::Incidence::List incidences = cal->incidences();
Q_ASSERT(incidences.count());
if (!incidences.isEmpty()) {