-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7c9528
commit b661c3a
Showing
10 changed files
with
327 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
|
||
import cz.chrastecky.bitsailor 1.0 | ||
|
||
Page { | ||
property var secretsCleared: null | ||
property var loggedOut: null | ||
property var temporaryFilesDeleted: null | ||
property var permanentFilesDeleted: null | ||
property var configFilesDeleted: null | ||
|
||
id: page | ||
allowedOrientations: Orientation.All | ||
|
||
BitwardenCli { | ||
id: cli | ||
onLogoutFinished: { | ||
loggedOut = true; | ||
secretsCleared = true; | ||
} | ||
} | ||
|
||
SecretsHandler { | ||
id: secrets | ||
} | ||
|
||
FileAccessor { | ||
id: fileAccessor | ||
} | ||
|
||
SilicaFlickable { | ||
anchors.fill: parent | ||
contentHeight: column.height | ||
|
||
Column { | ||
id: column | ||
|
||
width: page.width | ||
spacing: Theme.paddingLarge | ||
PageHeader { | ||
title: qsTr("Cleaning Up") | ||
} | ||
|
||
IconTextSwitch { | ||
property alias propertyToCheck: page.secretsCleared | ||
property string iconName: propertyToCheck === null ? "icon-m-clock" : propertyToCheck ? "icon-m-certificates" : "icon-m-cancel" | ||
icon.source: "image://theme/" + iconName | ||
icon.color: propertyToCheck === null ? Theme.primaryColor : propertyToCheck ? Theme.secondaryHighlightColor : Theme.errorColor | ||
text: qsTr("Deleted all secrets") | ||
automaticCheck: false | ||
checked: propertyToCheck | ||
description: qsTr("Includes secrets like your password, username or PIN code.") | ||
} | ||
IconTextSwitch { | ||
property alias propertyToCheck: page.loggedOut | ||
property string iconName: propertyToCheck === null ? "icon-m-clock" : propertyToCheck ? "icon-m-certificates" : "icon-m-cancel" | ||
icon.source: "image://theme/" + iconName | ||
icon.color: propertyToCheck === null ? Theme.primaryColor : propertyToCheck ? Theme.secondaryHighlightColor : Theme.errorColor | ||
text: qsTr("Logged out of Bitwarden CLI") | ||
automaticCheck: false | ||
checked: propertyToCheck | ||
description: qsTr("The Bitwarden CLI could be used on its own even without this app, that's why it's safer to log out.") | ||
} | ||
IconTextSwitch { | ||
property alias propertyToCheck: page.temporaryFilesDeleted | ||
property string iconName: propertyToCheck === null ? "icon-m-clock" : propertyToCheck ? "icon-m-certificates" : "icon-m-cancel" | ||
icon.source: "image://theme/" + iconName | ||
icon.color: propertyToCheck === null ? Theme.primaryColor : propertyToCheck ? Theme.secondaryHighlightColor : Theme.errorColor | ||
text: qsTr("Deleted temporary files") | ||
automaticCheck: false | ||
checked: propertyToCheck | ||
description: qsTr("Temporary files include your cached vault for faster loading.") | ||
} | ||
IconTextSwitch { | ||
property alias propertyToCheck: page.permanentFilesDeleted | ||
property string iconName: propertyToCheck === null ? "icon-m-clock" : propertyToCheck ? "icon-m-certificates" : "icon-m-cancel" | ||
icon.source: "image://theme/" + iconName | ||
icon.color: propertyToCheck === null ? Theme.primaryColor : propertyToCheck ? Theme.secondaryHighlightColor : Theme.errorColor | ||
text: qsTr("Deleted all permanent files") | ||
automaticCheck: false | ||
checked: propertyToCheck | ||
description: qsTr("Permanent files include Bitwarden CLI (if it was installed using this app).") | ||
} | ||
IconTextSwitch { | ||
property alias propertyToCheck: page.configFilesDeleted | ||
property string iconName: propertyToCheck === null ? "icon-m-clock" : propertyToCheck ? "icon-m-certificates" : "icon-m-cancel" | ||
icon.source: "image://theme/" + iconName | ||
icon.color: propertyToCheck === null ? Theme.primaryColor : propertyToCheck ? Theme.secondaryHighlightColor : Theme.errorColor | ||
text: qsTr("Deleted all config files") | ||
automaticCheck: false | ||
checked: propertyToCheck | ||
description: qsTr("Config files include all the settings you have made in this app.") | ||
} | ||
} | ||
} | ||
|
||
onStatusChanged: { | ||
if (status === PageStatus.Active) { | ||
cli.logout(); | ||
temporaryFilesDeleted = fileAccessor.deleteTemporaryFilesDirectory(); | ||
permanentFilesDeleted = fileAccessor.deletePermanentFilesDirectory(); | ||
configFilesDeleted = fileAccessor.deleteConfigDirectory(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "fileaccessor.h" | ||
|
||
#include "pathhelper.h" | ||
|
||
#include <QDir> | ||
#include <QStandardPaths> | ||
|
||
FileAccessor::FileAccessor(QObject *parent) : QObject(parent) | ||
{ | ||
|
||
} | ||
|
||
bool FileAccessor::deleteConfigDirectory() | ||
{ | ||
return deleteDirectory(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)); | ||
} | ||
|
||
bool FileAccessor::deleteTemporaryFilesDirectory() | ||
{ | ||
return deleteDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); | ||
} | ||
|
||
bool FileAccessor::deletePermanentFilesDirectory() | ||
{ | ||
return deleteDirectory(getDataPath()); | ||
} | ||
|
||
bool FileAccessor::deleteDirectory(QString path) | ||
{ | ||
QDir dir(path); | ||
return dir.removeRecursively(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef FILEACCESSOR_H | ||
#define FILEACCESSOR_H | ||
|
||
#include <QObject> | ||
|
||
class FileAccessor : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit FileAccessor(QObject *parent = nullptr); | ||
Q_INVOKABLE bool deleteConfigDirectory(); | ||
Q_INVOKABLE bool deleteTemporaryFilesDirectory(); | ||
Q_INVOKABLE bool deletePermanentFilesDirectory(); | ||
private: | ||
bool deleteDirectory(QString path); | ||
}; | ||
|
||
#endif // FILEACCESSOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.