Storage encryption is slowly getting ready

This commit is contained in:
Nicolas Mailloux 2021-10-31 15:48:17 -04:00
parent e0578ee28a
commit cea43a51b4
5 changed files with 175 additions and 0 deletions

View file

@ -67,5 +67,6 @@
<file>resources/hourglass-bottom.png</file>
<file>resources/hourglass-top.png</file>
<file>resources/error.png</file>
<file>resources/alert-triangle.png</file>
</qresource>
</RCC>

View file

@ -8,6 +8,7 @@
#include <QTimer>
#include <QMessageBox>
#include <QDateTime>
#include "usbms_splash.h"
#include "functions.h"
encryptionManager::encryptionManager(QWidget *parent) :
@ -32,6 +33,10 @@ encryptionManager::encryptionManager(QWidget *parent) :
ui->setupAbortBtn->setStyleSheet("background: lightGrey; border: 3px solid black; color: black; padding: 10px; outline: none; font-size: 10pt; font-weight: bold");
ui->exitSuccessBtn->setStyleSheet("background: lightGrey; border: 3px solid black; color: black; padding: 10px; outline: none; font-size: 10pt; font-weight: bold");
ui->failureContinueBtn->setStyleSheet("background: lightGrey; border: 3px solid black; color: black; padding: 10px; outline: none; font-size: 10pt; font-weight: bold");
ui->acceptBtn->setStyleSheet("background: lightGrey; border: 3px solid black; color: black; padding: 10px; outline: none; font-size: 10pt; font-weight: bold");
ui->usbmsBtn->setStyleSheet("background: lightGrey; border: 3px solid black; color: black; padding: 10px; outline: none; font-size: 10pt; font-weight: bold");
ui->warningLabel->setStyleSheet("font-size: 15pt");
ui->warningDescriptionLabel->setStyleSheet("font-size: 9pt");
// Getting the screen's size
float sW = QGuiApplication::screens()[0]->size().width();
@ -59,6 +64,13 @@ encryptionManager::encryptionManager(QWidget *parent) :
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
ui->failureImageLabel->setPixmap(scaledPixmap);
}
{
stdIconWidth = sW / 1.50;
stdIconHeight = sH / 1.50;
QPixmap pixmap(":/resources/alert-triangle.png");
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
ui->warningImageLabel->setPixmap(scaledPixmap);
}
hourglassAnimationWidgetWindow = new hourglassAnimationWidget();
ui->hourglassWidget->insertWidget(0, hourglassAnimationWidgetWindow);
@ -70,6 +82,12 @@ encryptionManager::encryptionManager(QWidget *parent) :
setupPassphraseDialogMode = 1;
QTimer::singleShot(500, this, SLOT(setupPassphraseDialog()));
}
else {
QDir dir("/mnt/onboard/onboard/encfs-dropbox");
if(dir.isEmpty()) {
ui->activityWidget->setCurrentIndex(4);
}
}
}
encryptionManager::~encryptionManager()
@ -294,3 +312,20 @@ void encryptionManager::setupFailedAuthenticationMessageBox() {
QFile::remove("/external_root/run/encfs_mounted");
quit_restart();
}
void encryptionManager::on_acceptBtn_clicked()
{
string_writeconfig(".config/18-encrypted_storage/status", "false");
quit_restart();
}
void encryptionManager::on_usbmsBtn_clicked()
{
global::usbms::launchUsbms = true;
usbmsWindow = new usbms_splash();
usbmsWindow->setAttribute(Qt::WA_DeleteOnClose);
usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
usbmsWindow->show();
}

View file

@ -37,6 +37,8 @@ private slots:
void setupPassphraseDialog();
void unlockEncryptedStorage();
void setupFailedAuthenticationMessageBox();
void on_acceptBtn_clicked();
void on_usbmsBtn_clicked();
private:
Ui::encryptionManager *ui;
@ -44,6 +46,7 @@ private:
toast * toastWindow;
hourglassAnimationWidget * hourglassAnimationWidgetWindow;
alert * alertWindow;
usbms_splash *usbmsWindow;
};
#endif // ENCRYPTIONMANAGER_H

View file

@ -451,6 +451,142 @@ Would you like to enable it?</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_7">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QGridLayout" name="gridLayout_6">
<item row="1" column="0">
<widget class="QLabel" name="warningLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Storage encryption can't be enabled</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_18">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_21">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_19">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="warningImageLabel">
<property name="text">
<string>Warning image</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="9" column="0">
<spacer name="verticalSpacer_22">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_20">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="warningDescriptionLabel">
<property name="text">
<string>To enable storage encryption, please put at least one book in the &quot;encfs-dropbox&quot; folder of your onboard storage.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="acceptBtn">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="usbmsBtn">
<property name="text">
<string>Add via USB</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB