diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 0b23e1e94..ac2b1c028 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -856,3 +856,18 @@ void TorrentsController::removeCategoriesAction() for (const QString &category : categories) BitTorrent::Session::instance()->removeCategory(category); } + +void TorrentsController::categoriesAction() +{ + QJsonObject categories; + const auto categoriesList = BitTorrent::Session::instance()->categories(); + for (auto it = categoriesList.cbegin(); it != categoriesList.cend(); ++it) { + const auto &key = it.key(); + categories[key] = QJsonObject { + {"name", key}, + {"savePath", it.value()} + }; + } + + setResult(categories); +} diff --git a/src/webui/api/torrentscontroller.h b/src/webui/api/torrentscontroller.h index 5ddcaf6b0..bf4caf8f5 100644 --- a/src/webui/api/torrentscontroller.h +++ b/src/webui/api/torrentscontroller.h @@ -55,6 +55,7 @@ private slots: void createCategoryAction(); void editCategoryAction(); void removeCategoriesAction(); + void categoriesAction(); void addAction(); void deleteAction(); void addTrackersAction();