Commit 92ee380a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile against last qt without deprecated method

parent 2c7cc33f
......@@ -67,7 +67,7 @@ configure_file(console-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/console-versi
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
#add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054600)
endif()
add_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS)
......
......@@ -85,7 +85,7 @@ bool KonsoleKalendar::printCalendarList()
{
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
Akonadi::CollectionFetchJob::Recursive);
QStringList mimeTypes = QStringList() << QStringLiteral("text/calendar")
const QStringList mimeTypes = QStringList() << QStringLiteral("text/calendar")
<< KCalendarCore::Event::eventMimeType()
<< KCalendarCore::Todo::todoMimeType()
<< KCalendarCore::Journal::journalMimeType();
......@@ -105,9 +105,20 @@ bool KonsoleKalendar::printCalendarList()
cout << i18n("There are no calendars available.").toLocal8Bit().data() << endl;
} else {
cout << "--------------------------" << endl;
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
auto mimeTypeSet = mimeTypes.toSet(); // set changes by run method intersect
#else
auto mimeTypeSet = QSet<QString>(mimeTypes.begin(), mimeTypes.end()); // set changes by run method intersect
#endif
foreach (const Akonadi::Collection &collection, collections) {
if (!mimeTypeSet.intersect(collection.contentMimeTypes().toSet()).isEmpty()) {
const QStringList contentMimeTypes = collection.contentMimeTypes();
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
auto collectionMimeTypeSet = contentMimeTypes.toSet();
#else
auto collectionMimeTypeSet = QSet<QString>(contentMimeTypes.begin(), contentMimeTypes.end());
#endif
if (!mimeTypeSet.intersect(collectionMimeTypeSet).isEmpty()) {
QString colId = QString::number(collection.id()).leftJustified(6, QLatin1Char(' '));
colId += QLatin1String("- ");
......
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