mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-18 17:24:01 -04:00
fix(plugins): use plugin ids for management actions (#3284)
(cherry picked from commit 433b13cb0e)
This commit is contained in:
@@ -193,7 +193,7 @@ Item {
|
||||
if (modelData.repo)
|
||||
Qt.openUrlExternally(modelData.repo);
|
||||
}
|
||||
onInstallRequested: PluginService.installFromRegistry(modelData.name, modelData.type === "desktop")
|
||||
onInstallRequested: PluginService.installFromRegistry(modelData.id, modelData.name, modelData.type === "desktop")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,8 +434,8 @@ DankFloatingWindow {
|
||||
ensureSelectedVisible();
|
||||
}
|
||||
|
||||
function installPlugin(pluginName, enableAfterInstall) {
|
||||
PluginService.installFromRegistry(pluginName, enableAfterInstall, success => {
|
||||
function installPlugin(pluginId, pluginName, enableAfterInstall) {
|
||||
PluginService.installFromRegistry(pluginId, pluginName, enableAfterInstall, success => {
|
||||
if (!success)
|
||||
return;
|
||||
refreshPlugins();
|
||||
@@ -471,7 +471,7 @@ DankFloatingWindow {
|
||||
"message": I18n.tr("Install plugin '%1' from the DMS registry?", "plugin installation confirmation").arg(pluginId),
|
||||
"confirmText": I18n.tr("Install", "install action button"),
|
||||
"cancelText": I18n.tr("Cancel"),
|
||||
"onConfirm": () => installPlugin(pluginId, true),
|
||||
"onConfirm": () => installPlugin(pluginId, pluginId, true),
|
||||
"onCancel": () => hide()
|
||||
});
|
||||
}
|
||||
@@ -952,7 +952,7 @@ DankFloatingWindow {
|
||||
installed: cardCell.modelData.installed || false
|
||||
selected: root.keyboardNavigationActive && cardCell.index === root.selectedIndex
|
||||
onClicked: root.openPluginDetail(cardCell.modelData)
|
||||
onInstallRequested: root.installPlugin(cardCell.modelData.name, cardCell.modelData.type === "desktop")
|
||||
onInstallRequested: root.installPlugin(cardCell.modelData.id, cardCell.modelData.name, cardCell.modelData.type === "desktop")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1236,7 +1236,7 @@ DankFloatingWindow {
|
||||
hoverEnabled: true
|
||||
cursorShape: detailInstallButton.buttonState === "available" ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
enabled: detailInstallButton.buttonState === "available"
|
||||
onClicked: root.installPlugin(detailPane.plugin.name, detailPane.plugin.type === "desktop")
|
||||
onClicked: root.installPlugin(detailPane.plugin.id, detailPane.plugin.name, detailPane.plugin.type === "desktop")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ StyledRect {
|
||||
onClicked: {
|
||||
const currentPluginName = root.pluginName;
|
||||
const currentPluginId = root.pluginId;
|
||||
DMSService.update(currentPluginName, response => {
|
||||
DMSService.update(currentPluginId, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Update failed: %1").arg(response.error));
|
||||
return;
|
||||
@@ -244,8 +244,9 @@ StyledRect {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
const currentPluginId = root.pluginId;
|
||||
const currentPluginName = root.pluginName;
|
||||
DMSService.uninstall(currentPluginName, response => {
|
||||
DMSService.uninstall(currentPluginId, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Uninstall failed: %1").arg(response.error));
|
||||
return;
|
||||
|
||||
@@ -52,7 +52,7 @@ StyledRect {
|
||||
isUpdating = true;
|
||||
currentUpdatingPlugin = plugin.name;
|
||||
|
||||
DMSService.update(plugin.name, response => {
|
||||
DMSService.update(plugin.id, response => {
|
||||
isUpdating = false;
|
||||
currentUpdatingPlugin = "";
|
||||
if (response.error) {
|
||||
@@ -89,7 +89,7 @@ StyledRect {
|
||||
var plugin = list[idx];
|
||||
currentUpdatingPlugin = plugin.name;
|
||||
|
||||
DMSService.update(plugin.name, response => {
|
||||
DMSService.update(plugin.id, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Failed to update %1: %2").arg(plugin.name).arg(response.error));
|
||||
} else {
|
||||
|
||||
@@ -1281,16 +1281,17 @@ Singleton {
|
||||
return badges;
|
||||
}
|
||||
|
||||
function installFromRegistry(pluginName, enableAfterInstall, onDone) {
|
||||
ToastService.showInfo(I18n.tr("Installing: %1", "installation progress").arg(pluginName));
|
||||
DMSService.install(pluginName, response => {
|
||||
function installFromRegistry(pluginId, pluginName, enableAfterInstall, onDone) {
|
||||
const displayName = pluginName || pluginId;
|
||||
ToastService.showInfo(I18n.tr("Installing: %1", "installation progress").arg(displayName));
|
||||
DMSService.install(pluginId, response => {
|
||||
if (response.error) {
|
||||
ToastService.showError(I18n.tr("Install failed: %1", "installation error").arg(response.error));
|
||||
if (onDone)
|
||||
onDone(false);
|
||||
return;
|
||||
}
|
||||
ToastService.showInfo(I18n.tr("Installed: %1", "installation success").arg(pluginName));
|
||||
ToastService.showInfo(I18n.tr("Installed: %1", "installation success").arg(displayName));
|
||||
scanPlugins();
|
||||
if (!enableAfterInstall) {
|
||||
if (onDone)
|
||||
@@ -1298,11 +1299,11 @@ Singleton {
|
||||
return;
|
||||
}
|
||||
Qt.callLater(() => {
|
||||
enablePlugin(pluginName);
|
||||
const plugin = availablePlugins[pluginName];
|
||||
enablePlugin(pluginId);
|
||||
const plugin = availablePlugins[pluginId];
|
||||
if (plugin?.type === "desktop") {
|
||||
const defaultConfig = DesktopWidgetRegistry.getDefaultConfig(pluginName);
|
||||
SettingsData.createDesktopWidgetInstance(pluginName, plugin.name || pluginName, defaultConfig);
|
||||
const defaultConfig = DesktopWidgetRegistry.getDefaultConfig(pluginId);
|
||||
SettingsData.createDesktopWidgetInstance(pluginId, plugin.name || displayName, defaultConfig);
|
||||
}
|
||||
if (onDone)
|
||||
onDone(true);
|
||||
|
||||
Reference in New Issue
Block a user