Skip to content

Commit 9d51337

Browse files
committed
Added remove button to extension panel
1 parent 585139b commit 9d51337

File tree

4 files changed

+61
-24
lines changed

4 files changed

+61
-24
lines changed

src/framework/extensions/qml/Muse/Extensions/ExtensionsListPanel.qml

+6
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ Item {
198198
extensionsModel.selectExecPoint(selectedPlugin.uri, index)
199199
}
200200

201+
onRemove: function() {
202+
extensionsModel.removeExtension(selectedPlugin.uri)
203+
prv.resetSelectedPlugin()
204+
panel.close()
205+
}
206+
201207
onEditShortcutRequested: {
202208
Qt.callLater(extensionsModel.editShortcut, selectedPlugin.uri)
203209
panel.close()

src/framework/extensions/qml/Muse/Extensions/internal/EnablePanel.qml

+49-24
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ InfoPanel {
3535

3636
signal editShortcutRequested()
3737
signal execPointSelected(int index)
38+
signal remove()
3839

3940
buttonsPanel: RowLayout {
4041
id: buttons
@@ -84,37 +85,61 @@ InfoPanel {
8485
}
8586
}
8687

87-
88-
89-
FlatButton {
90-
id: mainButton
88+
RowLayout {
9189
Layout.alignment: Qt.AlignRight
90+
spacing: 22
91+
92+
FlatButton {
93+
id: removeButton
94+
95+
navigation.name: text + "Button"
96+
navigation.panel: root.contentNavigation
97+
navigation.column: 2
98+
accessible.ignored: true
99+
navigation.onActiveChanged: {
100+
if (!navigation.active) {
101+
accessible.ignored = false
102+
}
103+
}
92104

93-
navigation.name: text + "Button"
94-
navigation.panel: root.contentNavigation
95-
navigation.column: 3
96-
accessible.ignored: true
97-
navigation.onActiveChanged: {
98-
if (!navigation.active) {
99-
accessible.ignored = false
105+
text: qsTrc("workspace", "Remove")
106+
107+
onClicked: {
108+
root.remove()
100109
}
101110
}
102111

103-
text: !root.isEnabled ? qsTrc("extensions", "Enable") : qsTrc("extensions", "Disable")
104112

105-
Component.onCompleted: {
106-
root.mainButton = mainButton
107-
}
108113

109-
onClicked: {
110-
//! NOTE temporary
111-
// The function with the choice of the call point is not ready yet.
112-
// Therefore, here is the previous solution with the button,
113-
// but in fact the choice is made from the list
114-
// 0 - disabled
115-
// 1 - enabled (manual call)
116-
// (here we switch to the opposite state)
117-
root.execPointSelected(root.isEnabled ? 0 : 1)
114+
FlatButton {
115+
id: mainButton
116+
117+
navigation.name: text + "Button"
118+
navigation.panel: root.contentNavigation
119+
navigation.column: 3
120+
accessible.ignored: true
121+
navigation.onActiveChanged: {
122+
if (!navigation.active) {
123+
accessible.ignored = false
124+
}
125+
}
126+
127+
text: !root.isEnabled ? qsTrc("extensions", "Enable") : qsTrc("extensions", "Disable")
128+
129+
Component.onCompleted: {
130+
root.mainButton = mainButton
131+
}
132+
133+
onClicked: {
134+
//! NOTE temporary
135+
// The function with the choice of the call point is not ready yet.
136+
// Therefore, here is the previous solution with the button,
137+
// but in fact the choice is made from the list
138+
// 0 - disabled
139+
// 1 - enabled (manual call)
140+
// (here we switch to the opposite state)
141+
root.execPointSelected(root.isEnabled ? 0 : 1)
142+
}
118143
}
119144
}
120145
}

src/framework/extensions/view/extensionslistmodel.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ void ExtensionsListModel::reloadPlugins()
219219
provider()->reloadExtensions();
220220
}
221221

222+
void ExtensionsListModel::removeExtension(const QString& uri)
223+
{
224+
provider()->removeExtension(Uri(uri.toStdString()));
225+
}
226+
222227
QVariantList ExtensionsListModel::categories() const
223228
{
224229
QVariantList result;

src/framework/extensions/view/extensionslistmodel.h

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class ExtensionsListModel : public QAbstractListModel, public Injectable, public
5858

5959
Q_INVOKABLE void editShortcut(const QString& uri);
6060
Q_INVOKABLE void reloadPlugins();
61+
Q_INVOKABLE void removeExtension(const QString& uri);
6162

6263
Q_INVOKABLE QVariantList categories() const;
6364

0 commit comments

Comments
 (0)