mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Merge pull request #4661 from buinsky/WebUI_labels_menu
WebUI: Implement labels filter context menu
This commit is contained in:
commit
2a20855c17
11 changed files with 402 additions and 151 deletions
|
@ -115,6 +115,8 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize
|
|||
ADD_ACTION(command, bottomPrio);
|
||||
ADD_ACTION(command, recheck);
|
||||
ADD_ACTION(command, setCategory);
|
||||
ADD_ACTION(command, addCategory);
|
||||
ADD_ACTION(command, removeCategories);
|
||||
ADD_ACTION(command, getSavePath);
|
||||
ADD_ACTION(version, api);
|
||||
ADD_ACTION(version, api_min);
|
||||
|
@ -728,6 +730,31 @@ void WebApplication::action_command_setCategory()
|
|||
}
|
||||
}
|
||||
|
||||
void WebApplication::action_command_addCategory()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
CHECK_PARAMETERS("category");
|
||||
|
||||
QString category = request().posts["category"].trimmed();
|
||||
|
||||
if (!BitTorrent::Session::isValidCategoryName(category) && !category.isEmpty()) {
|
||||
status(400, tr("Incorrect category name"));
|
||||
return;
|
||||
}
|
||||
|
||||
BitTorrent::Session::instance()->addCategory(category);
|
||||
}
|
||||
|
||||
void WebApplication::action_command_removeCategories()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
CHECK_PARAMETERS("categories");
|
||||
|
||||
QStringList categories = request().posts["categories"].split('\n');
|
||||
foreach (const QString &category, categories)
|
||||
BitTorrent::Session::instance()->removeCategory(category);
|
||||
}
|
||||
|
||||
void WebApplication::action_command_getSavePath()
|
||||
{
|
||||
CHECK_URI(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue