Add repair button
This commit is contained in:
@@ -127,6 +127,13 @@ Page {
|
||||
x: -width
|
||||
id: addonMenu
|
||||
visible: false
|
||||
MenuItem {
|
||||
id: repairButton
|
||||
text: qsTr("repair")
|
||||
icon.name: "document-edit-decrypt"
|
||||
onTriggered: addon.reset()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
enabled: addon.status == Addon.Status.Ready
|
||||
id: deleteButton
|
||||
|
||||
@@ -472,6 +472,19 @@ void Addon::confirmFileRemove(bool confirmed)
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
void Addon::reset()
|
||||
{
|
||||
removeSubfolders();
|
||||
delegate("Reset", [this](){
|
||||
git_reference *ref = nullptr;
|
||||
git_repository_head(&ref, m_repo.get());
|
||||
git_object *obj = nullptr;
|
||||
git_object_lookup(&obj, m_repo.get(), git_reference_target(ref), GIT_OBJ_ANY);
|
||||
git_reset(m_repo.get(), obj, GIT_RESET_HARD, nullptr);
|
||||
});
|
||||
unpackSubfolders();
|
||||
}
|
||||
|
||||
QStringList Addon::branches() const
|
||||
{
|
||||
return m_branches;
|
||||
|
||||
@@ -178,6 +178,7 @@ public slots:
|
||||
void unpackSubfolders();
|
||||
void setFilesToRemove(QString filesToRemove);
|
||||
void confirmFileRemove(bool confirmed);
|
||||
void reset();
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Addon::GitStatus)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<defs id="defs3051">
|
||||
<style type="text/css" id="current-color-scheme">
|
||||
.ColorScheme-Text {
|
||||
color:#4d4d4d;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none"
|
||||
d="M 3 2 L 3 4 L 5 4 L 5 2 L 3 2 z M 7 2 L 7 4 L 9 4 L 9 2 L 7 2 z M 11 2 L 11 4 L 13 4 L 13 2 L 11 2 z M 5 5 L 5 7 L 7 7 L 7 5 L 5 5 z M 9 5 L 9 7 L 11 7 L 11 5 L 9 5 z M 3 7 L 3 14 L 9 14 L 10 14 L 13 11 L 13 10 L 13 7 L 12 7 L 12 10 L 9 10 L 9 13 L 4 13 L 4 7 L 3 7 z "
|
||||
class="ColorScheme-Text"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 604 B |
Reference in New Issue
Block a user