mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 09:13:08 -07:00
WebUI: Implement removing categories
This commit is contained in:
parent
a4dca52617
commit
50f2437ac3
6 changed files with 35 additions and 1 deletions
|
@ -116,6 +116,7 @@ QMap<QString, QMap<QString, WebApplication::Action> > WebApplication::initialize
|
||||||
ADD_ACTION(command, recheck);
|
ADD_ACTION(command, recheck);
|
||||||
ADD_ACTION(command, setCategory);
|
ADD_ACTION(command, setCategory);
|
||||||
ADD_ACTION(command, addCategory);
|
ADD_ACTION(command, addCategory);
|
||||||
|
ADD_ACTION(command, removeCategory);
|
||||||
ADD_ACTION(command, getSavePath);
|
ADD_ACTION(command, getSavePath);
|
||||||
ADD_ACTION(version, api);
|
ADD_ACTION(version, api);
|
||||||
ADD_ACTION(version, api_min);
|
ADD_ACTION(version, api_min);
|
||||||
|
@ -744,6 +745,15 @@ void WebApplication::action_command_addCategory()
|
||||||
BitTorrent::Session::instance()->addCategory(category);
|
BitTorrent::Session::instance()->addCategory(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebApplication::action_command_removeCategory()
|
||||||
|
{
|
||||||
|
CHECK_URI(0);
|
||||||
|
CHECK_PARAMETERS("category");
|
||||||
|
|
||||||
|
QString category = request().posts["category"].trimmed();
|
||||||
|
BitTorrent::Session::instance()->removeCategory(category);
|
||||||
|
}
|
||||||
|
|
||||||
void WebApplication::action_command_getSavePath()
|
void WebApplication::action_command_getSavePath()
|
||||||
{
|
{
|
||||||
CHECK_URI(0);
|
CHECK_URI(0);
|
||||||
|
|
|
@ -89,6 +89,7 @@ private:
|
||||||
void action_command_recheck();
|
void action_command_recheck();
|
||||||
void action_command_setCategory();
|
void action_command_setCategory();
|
||||||
void action_command_addCategory();
|
void action_command_addCategory();
|
||||||
|
void action_command_removeCategory();
|
||||||
void action_command_getSavePath();
|
void action_command_getSavePath();
|
||||||
void action_version_api();
|
void action_version_api();
|
||||||
void action_version_api_min();
|
void action_version_api_min();
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<ul id="categoriesFilterMenu" class="contextMenu">
|
<ul id="categoriesFilterMenu" class="contextMenu">
|
||||||
<li><a href="#CreateCategory"><img src="theme/list-add" alt="QBT_TR(Add category...)QBT_TR"/> QBT_TR(Add category...)QBT_TR</a></li>
|
<li><a href="#CreateCategory"><img src="theme/list-add" alt="QBT_TR(Add category...)QBT_TR"/> QBT_TR(Add category...)QBT_TR</a></li>
|
||||||
|
<li><a href="#DeleteCategory"><img src="theme/list-remove" alt="QBT_TR(Remove category)QBT_TR"/> QBT_TR(Remove category)QBT_TR</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="desktopFooterWrapper">
|
<div id="desktopFooterWrapper">
|
||||||
<div id="desktopFooter">
|
<div id="desktopFooter">
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
actions : {
|
actions : {
|
||||||
CreateCategory : function (element, ref) {
|
CreateCategory : function (element, ref) {
|
||||||
createCategoryFN();
|
createCategoryFN();
|
||||||
|
},
|
||||||
|
DeleteCategory : function (element, ref) {
|
||||||
|
removeCategoryFN(element.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
offsets : {
|
offsets : {
|
||||||
|
|
|
@ -315,5 +315,12 @@ var TorrentsTableContextMenu = new Class({
|
||||||
});
|
});
|
||||||
|
|
||||||
var CategoriesFilterContextMenu = new Class({
|
var CategoriesFilterContextMenu = new Class({
|
||||||
Extends: ContextMenu
|
Extends: ContextMenu,
|
||||||
|
updateMenuItems: function () {
|
||||||
|
var id = this.options.element.id;
|
||||||
|
if (id != CATEGORIES_ALL && id != CATEGORIES_UNCATEGORIZED)
|
||||||
|
this.showItem('DeleteCategory');
|
||||||
|
else
|
||||||
|
this.hideItem('DeleteCategory');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -357,6 +357,18 @@ initializeWindows = function() {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
removeCategoryFN = function (categoryHash) {
|
||||||
|
var categoryName = category_list[categoryHash].name;
|
||||||
|
new Request({
|
||||||
|
url: 'command/removeCategory',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
category: categoryName
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
|
setCategoryFilter(CATEGORIES_ALL);
|
||||||
|
};
|
||||||
|
|
||||||
['pauseAll', 'resumeAll'].each(function(item) {
|
['pauseAll', 'resumeAll'].each(function(item) {
|
||||||
addClickEvent(item, function(e) {
|
addClickEvent(item, function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue