1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-24 20:15:21 -04:00

plugins: add startupCheck function

This commit is contained in:
bbedward
2026-06-23 22:11:51 -04:00
parent 99cc3b8449
commit 8b94b149b2
9 changed files with 269 additions and 19 deletions
@@ -94,8 +94,8 @@ FloatingWindow {
return 0;
}
function pluginVerified(plugin) {
return (plugin.status || []).indexOf("verified") !== -1;
function pluginReviewed(plugin) {
return (plugin.status || []).indexOf("reviewed") !== -1;
}
function statusColor(status) {
@@ -104,7 +104,7 @@ FloatingWindow {
return Theme.error;
case "unmaintained":
return Theme.warning;
case "verified":
case "reviewed":
return Theme.info;
default:
return Theme.outline;
@@ -119,8 +119,8 @@ FloatingWindow {
return I18n.tr("unmaintained", "plugin status");
case "deprecated":
return I18n.tr("deprecated", "plugin status");
case "verified":
return I18n.tr("verified", "plugin status");
case "reviewed":
return I18n.tr("reviewed", "plugin status");
default:
return status;
}
@@ -331,8 +331,8 @@ FloatingWindow {
var votesB = b.upvotes || 0;
if (votesA !== votesB)
return votesB - votesA;
var verA = root.pluginVerified(a);
var verB = root.pluginVerified(b);
var verA = root.pluginReviewed(a);
var verB = root.pluginReviewed(b);
if (verA !== verB)
return verA ? -1 : 1;
return comparePluginName(a, b);
@@ -316,11 +316,10 @@ StyledRect {
const currentPluginName = root.pluginName;
if (isChecked) {
if (PluginService.enablePlugin(currentPluginId)) {
ToastService.showInfo(I18n.tr("Plugin enabled: %1").arg(currentPluginName));
return;
}
ToastService.showError(I18n.tr("Failed to enable plugin: %1").arg(currentPluginName));
PluginService.enablePlugin(currentPluginId, ok => {
if (ok)
ToastService.showInfo(I18n.tr("Plugin enabled: %1").arg(currentPluginName));
});
return;
}
if (PluginService.disablePlugin(currentPluginId)) {
+27 -1
View File
@@ -71,6 +71,14 @@ PanelWindow {
property bool expanded: false
function linkify(text) {
if (!text)
return "";
const escaped = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
const linked = escaped.replace(/(https?:\/\/[^\s<]+)/g, '<a href="$1">$1</a>');
return linked.replace(/\n/g, "<br>");
}
Connections {
target: ToastService
function onResetToastState() {
@@ -240,7 +248,18 @@ PanelWindow {
StyledText {
id: detailsText
text: ToastService.currentDetails
readonly property bool hasLink: /https?:\/\//.test(ToastService.currentDetails)
text: hasLink ? toast.linkify(ToastService.currentDetails) : ToastService.currentDetails
textFormat: hasLink ? Text.StyledText : Text.PlainText
linkColor: {
switch (ToastService.currentLevel) {
case ToastService.levelError:
case ToastService.levelWarn:
return SessionData.isLightMode ? Theme.surfaceText : Theme.background;
default:
return Theme.primary;
}
}
font.pixelSize: Theme.fontSizeSmall
color: {
switch (ToastService.currentLevel) {
@@ -255,6 +274,13 @@ PanelWindow {
anchors.right: copyDetailsButton.left
anchors.rightMargin: Theme.spacingS
wrapMode: Text.Wrap
onLinkActivated: url => Qt.openUrlExternally(url)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape: detailsText.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
}
DankActionButton {