Skip to content

Commit 8a04e1e

Browse files
committed
#3403 refactor: fix Qt6 build errors below Qt 6.5
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent 6ef80f4 commit 8a04e1e

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/services/owncloudservice.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,9 +1351,14 @@ QList<CalDAVCalendarData> OwnCloudService::parseCalendarData(QString &data) {
13511351
QDomDocument doc;
13521352
qDebug() << __func__ << " - 'data': " << data;
13531353

1354-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1354+
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
1355+
// Qt6.5+: use ParseOption enum
13551356
doc.setContent(data, QDomDocument::ParseOption::UseNamespaceProcessing);
1357+
#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1358+
// Qt6.0-6.4: ParseOptions doesn't exist, fall back to bool overload
1359+
doc.setContent(data, true);
13561360
#else
1361+
// Qt5: use the bool overload (namespace processing)
13571362
doc.setContent(data, true);
13581363
#endif
13591364

@@ -1471,9 +1476,14 @@ QList<CalDAVCalendarData> OwnCloudService::parseCalendarData(QString &data) {
14711476

14721477
void OwnCloudService::loadTodoItems(const QString &calendarName, QString &data) {
14731478
QDomDocument doc;
1474-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1479+
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
1480+
// Qt6.5+: use ParseOption enum
14751481
doc.setContent(data, QDomDocument::ParseOption::UseNamespaceProcessing);
1482+
#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1483+
// Qt6.0-6.4: ParseOptions doesn't exist, fall back to bool overload
1484+
doc.setContent(data, true);
14761485
#else
1486+
// Qt5: use the bool overload (namespace processing)
14771487
doc.setContent(data, true);
14781488
#endif
14791489

@@ -1936,9 +1946,14 @@ void OwnCloudService::updateNoteShareStatus(QDomNodeList &dataElements, bool upd
19361946

19371947
void OwnCloudService::loadDirectory(QString &data) {
19381948
QDomDocument doc;
1939-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1949+
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
1950+
// Qt6.5+: use ParseOption enum
19401951
doc.setContent(data, QDomDocument::ParseOption::UseNamespaceProcessing);
1952+
#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1953+
// Qt6.0-6.4: ParseOptions doesn't exist, fall back to bool overload
1954+
doc.setContent(data, true);
19411955
#else
1956+
// Qt5: use the bool overload (namespace processing)
19421957
doc.setContent(data, true);
19431958
#endif
19441959

@@ -2443,9 +2458,14 @@ QString OwnCloudService::fetchNoteFileId(const Note &note) {
24432458
QString data = QString(reply->readAll());
24442459

24452460
QDomDocument doc;
2446-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2461+
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
2462+
// Qt6.5+: use ParseOption enum
24472463
doc.setContent(data, QDomDocument::ParseOption::UseNamespaceProcessing);
2464+
#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2465+
// Qt6.0-6.4: ParseOptions doesn't exist, fall back to bool overload
2466+
doc.setContent(data, true);
24482467
#else
2468+
// Qt5: use the bool overload (namespace processing)
24492469
doc.setContent(data, true);
24502470
#endif
24512471

0 commit comments

Comments
 (0)