diff --git a/src/librssguard/miscellaneous/systemfactory.cpp b/src/librssguard/miscellaneous/systemfactory.cpp index f86c2aff9..401ef933a 100644 --- a/src/librssguard/miscellaneous/systemfactory.cpp +++ b/src/librssguard/miscellaneous/systemfactory.cpp @@ -247,7 +247,7 @@ bool SystemFactory::isVersionNewer(const QString& new_version, const QString& ba const int new_number = new_version_tkn.takeFirst().toInt(); if (new_number > base_number) { - // New version is indeed higher thatn current version. + // New version is indeed higher that current version. return true; } else if (new_number < base_number) { @@ -277,7 +277,7 @@ bool SystemFactory::isVersionEqualOrNewer(const QString& new_version, const QStr bool SystemFactory::openFolderFile(const QString& file_path) { #if defined(Q_OS_WIN) return QProcess::startDetached(QSL("explorer.exe"), - { "/select,", QDir::toNativeSeparators(file_path)}); + { "/select,", QDir::toNativeSeparators(file_path) }); #else const QString folder = QDir::toNativeSeparators(QFileInfo(file_path).absoluteDir().absolutePath()); diff --git a/src/librssguard/services/owncloud/gui/formowncloudfeeddetails.cpp b/src/librssguard/services/owncloud/gui/formowncloudfeeddetails.cpp index 5f4a593d2..460acede0 100644 --- a/src/librssguard/services/owncloud/gui/formowncloudfeeddetails.cpp +++ b/src/librssguard/services/owncloud/gui/formowncloudfeeddetails.cpp @@ -54,7 +54,7 @@ void FormOwnCloudFeedDetails::apply() { else { const RootItem* parent = static_cast(m_ui->m_cmbParentCategory->itemData( m_ui->m_cmbParentCategory->currentIndex()).value()); - const int category_id = parent->kind() == RootItem::Kind::ServiceRoot ? 0 : parent->customId().toInt(); + const int category_id = parent->kind() == RootItem::Kind::ServiceRoot ? 0 : parent->customNumericId(); const bool response = qobject_cast(m_serviceRoot)->network()->createFeed(m_ui->m_txtUrl->lineEdit()->text(), category_id); diff --git a/src/librssguard/services/owncloud/network/owncloudnetworkfactory.cpp b/src/librssguard/services/owncloud/network/owncloudnetworkfactory.cpp index 8827f2e68..1c09c200d 100644 --- a/src/librssguard/services/owncloud/network/owncloudnetworkfactory.cpp +++ b/src/librssguard/services/owncloud/network/owncloudnetworkfactory.cpp @@ -184,7 +184,15 @@ bool OwnCloudNetworkFactory::createFeed(const QString& url, int parent_id) { QJsonObject json; json["url"] = url; - json["folderId"] = parent_id; + + auto nextcloud_version = status().version(); + + if (SystemFactory::isVersionEqualOrNewer(nextcloud_version, QSL("15.1.0"))) { + json["folderId"] = parent_id == 0 ? QJsonValue::Null : parent_id; + } + else { + json["folderId"] = parent_id; + } QByteArray result_raw; QList> headers; @@ -461,7 +469,7 @@ RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons) auto* parent = new RootItem(); QMap cats; - // Top-level feed have "folderId" set to "0". + // Top-level feed have "folderId" set to "0" or JSON "null" value. cats.insert(QSL("0"), parent); // Process categories first, then process feeds. @@ -524,6 +532,8 @@ RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons) } } + // NOTE: Starting with News 15.1.0, top-level feeds do not have parent folder ID 0, but JSON "null". + // Luckily, if folder ID is not convertible to int, then default 0 value is returned. cats.value(QString::number(item["folderId"].toInt()))->appendChild(feed); qDebugNN << LOGSEC_NEXTCLOUD << "Custom ID of next fetched processed feed is"