mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Storage encryption support in progress
This commit is contained in:
parent
4723b3ae4c
commit
116868f615
9 changed files with 455 additions and 113 deletions
1
eink.qrc
1
eink.qrc
|
@ -62,5 +62,6 @@
|
||||||
<file>resources/wifi-standby.png</file>
|
<file>resources/wifi-standby.png</file>
|
||||||
<file>resources/zoom-in.png</file>
|
<file>resources/zoom-in.png</file>
|
||||||
<file>resources/zoom-out.png</file>
|
<file>resources/zoom-out.png</file>
|
||||||
|
<file>resources/encryption.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
104
encryptionmanager.cpp
Normal file
104
encryptionmanager.cpp
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
#include "encryptionmanager.h"
|
||||||
|
#include "ui_encryptionmanager.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
|
encryptionManager::encryptionManager(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::encryptionManager)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
// Stylesheet
|
||||||
|
QFile stylesheetFile(":/resources/eink.qss");
|
||||||
|
stylesheetFile.open(QFile::ReadOnly);
|
||||||
|
this->setStyleSheet(stylesheetFile.readAll());
|
||||||
|
stylesheetFile.close();
|
||||||
|
|
||||||
|
ui->encryptionSetupLabel->setStyleSheet("font-size: 15pt");
|
||||||
|
ui->descriptionLabel->setStyleSheet("font-size: 9pt");
|
||||||
|
ui->setupContinueBtn->setStyleSheet("font-size: 10pt; padding: 10px; font-weight: bold; background: lightGrey");
|
||||||
|
ui->setupAbortBtn->setStyleSheet("font-size: 10pt; padding: 10px; font-weight: bold; background: lightGrey");
|
||||||
|
|
||||||
|
// Getting the screen's size
|
||||||
|
float sW = QGuiApplication::screens()[0]->size().width();
|
||||||
|
float sH = QGuiApplication::screens()[0]->size().height();
|
||||||
|
float stdIconWidth = sW / 1.50;
|
||||||
|
float stdIconHeight = sH / 1.50;
|
||||||
|
|
||||||
|
QPixmap pixmap(":/resources/encryption.png");
|
||||||
|
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||||
|
ui->encryptionImageLabel->setPixmap(scaledPixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
encryptionManager::~encryptionManager()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void encryptionManager::on_setupContinueBtn_clicked()
|
||||||
|
{
|
||||||
|
ui->activityWidget->hide();
|
||||||
|
this->setStyleSheet("background-color: black");
|
||||||
|
global::keyboard::keyboardDialog = true;
|
||||||
|
global::keyboard::encfsDialog = true;
|
||||||
|
global::keyboard::keyboardText = "";
|
||||||
|
generalDialogWindow = new generalDialog();
|
||||||
|
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(refreshScreen()));
|
||||||
|
connect(generalDialogWindow, SIGNAL(destroyed(QObject*)), SLOT(setupEncryptedStorage()));
|
||||||
|
connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString)));
|
||||||
|
generalDialogWindow->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void encryptionManager::on_setupAbortBtn_clicked()
|
||||||
|
{
|
||||||
|
setDefaultWorkDir();
|
||||||
|
string_writeconfig(".config/18-encrypted_storage/config", "false");
|
||||||
|
quit_restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void encryptionManager::quit_restart() {
|
||||||
|
QProcess process;
|
||||||
|
process.startDetached("inkbox", QStringList());
|
||||||
|
qApp->quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void encryptionManager::refreshScreen() {
|
||||||
|
this->repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void encryptionManager::showToast(QString messageToDisplay) {
|
||||||
|
global::toast::message = messageToDisplay;
|
||||||
|
toastWindow = new toast(this);
|
||||||
|
toastWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(toastWindow, SIGNAL(refreshScreen()), SLOT(refreshScreen()));
|
||||||
|
toastWindow->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void encryptionManager::setupEncryptedStorage() {
|
||||||
|
mkEncfsDirs();
|
||||||
|
std::string bootstrapPassphrase = global::encfs::passphrase.toStdString();
|
||||||
|
global::encfs::passphrase = "";
|
||||||
|
string_writeconfig("/external_root/run/encfs/encrypted_storage_create", "true");
|
||||||
|
string_writeconfig("/external_root/run/encfs/encrypted_storage_bootstrap_files_location", "/data/onboard/encfs-dropbox");
|
||||||
|
string_writeconfig("/external_root/run/encfs/encrypted_storage_bootstrap_archive_location", "/data/onboard/data.encfs");
|
||||||
|
string_writeconfig("/external_root/run/encfs/encrypted_storage_bootstrap_passphrase", bootstrapPassphrase);
|
||||||
|
string_writeconfig("/opt/ibxd", "encfs_restart\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void encryptionManager::mkEncfsDirs() {
|
||||||
|
QDir encfsDir;
|
||||||
|
QString encfsPath("/external_root/run/encfs");
|
||||||
|
encfsDir.mkpath(encfsPath);
|
||||||
|
QDir dumpDir;
|
||||||
|
QString dumpPath("/mnt/onboard/onboard/encfs-dropbox");
|
||||||
|
dumpDir.mkpath(dumpPath);
|
||||||
|
QDir decDir;
|
||||||
|
QString decPath("/mnt/onboard/onboard/encfs-decrypted");
|
||||||
|
}
|
35
encryptionmanager.h
Normal file
35
encryptionmanager.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#ifndef ENCRYPTIONMANAGER_H
|
||||||
|
#define ENCRYPTIONMANAGER_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "generaldialog.h"
|
||||||
|
#include "toast.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class encryptionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
class encryptionManager : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit encryptionManager(QWidget *parent = nullptr);
|
||||||
|
~encryptionManager();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_setupContinueBtn_clicked();
|
||||||
|
void on_setupAbortBtn_clicked();
|
||||||
|
void quit_restart();
|
||||||
|
void refreshScreen();
|
||||||
|
void showToast(QString messageToDisplay);
|
||||||
|
void setupEncryptedStorage();
|
||||||
|
void mkEncfsDirs();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::encryptionManager *ui;
|
||||||
|
generalDialog * generalDialogWindow;
|
||||||
|
toast * toastWindow;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ENCRYPTIONMANAGER_H
|
161
encryptionmanager.ui
Normal file
161
encryptionmanager.ui
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>encryptionManager</class>
|
||||||
|
<widget class="QWidget" name="encryptionManager">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>460</width>
|
||||||
|
<height>467</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="activityWidget">
|
||||||
|
<widget class="QWidget" name="page">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="encryptionImageLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Encryption image</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<spacer name="verticalSpacer_4">
|
||||||
|
<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">
|
||||||
|
<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_2">
|
||||||
|
<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="descriptionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Encrypted storage permits you to keep your most important files and data safe from anyone else than you.
|
||||||
|
Would you want to enable it?</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="setupAbortBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>No</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="setupContinueBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Yes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="encryptionSetupLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Inter</family>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Setup encrypted storage</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<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="8" column="0">
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_2"/>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -66,6 +66,7 @@ namespace global {
|
||||||
inline bool keyboardDialog;
|
inline bool keyboardDialog;
|
||||||
inline bool keypadDialog;
|
inline bool keypadDialog;
|
||||||
inline bool searchDialog;
|
inline bool searchDialog;
|
||||||
|
inline bool encfsDialog;
|
||||||
inline bool vncDialog;
|
inline bool vncDialog;
|
||||||
inline bool wifiPassphraseDialog;
|
inline bool wifiPassphraseDialog;
|
||||||
inline QString keyboardText;
|
inline QString keyboardText;
|
||||||
|
@ -88,6 +89,9 @@ namespace global {
|
||||||
inline bool isUpdateOta;
|
inline bool isUpdateOta;
|
||||||
inline bool downloadOta;
|
inline bool downloadOta;
|
||||||
}
|
}
|
||||||
|
namespace encfs {
|
||||||
|
inline QString passphrase;
|
||||||
|
}
|
||||||
inline QString systemInfoText;
|
inline QString systemInfoText;
|
||||||
inline bool forbidOpenSearchDialog;
|
inline bool forbidOpenSearchDialog;
|
||||||
inline bool isN705;
|
inline bool isN705;
|
||||||
|
|
|
@ -323,7 +323,7 @@ void generalDialog::on_okBtn_clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(global::keyboard::vncDialog == true) {
|
else if(global::keyboard::vncDialog == true) {
|
||||||
if(global::keyboard::keyboardText != "") {
|
if(!global::keyboard::keyboardText.isEmpty()) {
|
||||||
if(vncServerSet != true) {
|
if(vncServerSet != true) {
|
||||||
vncServerAddress = global::keyboard::keyboardText;
|
vncServerAddress = global::keyboard::keyboardText;
|
||||||
vncServerSet = true;
|
vncServerSet = true;
|
||||||
|
@ -349,7 +349,7 @@ void generalDialog::on_okBtn_clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(global::keyboard::wifiPassphraseDialog == true) {
|
else if(global::keyboard::wifiPassphraseDialog == true) {
|
||||||
if(global::keyboard::keyboardText != "") {
|
if(!global::keyboard::keyboardText.isEmpty()) {
|
||||||
this->hide();
|
this->hide();
|
||||||
wifiPassphrase = global::keyboard::keyboardText;
|
wifiPassphrase = global::keyboard::keyboardText;
|
||||||
global::toast::indefiniteToast = true;
|
global::toast::indefiniteToast = true;
|
||||||
|
@ -363,6 +363,18 @@ void generalDialog::on_okBtn_clicked()
|
||||||
QMessageBox::critical(this, tr("Invalid argument"), tr("Please type in the required argument."));
|
QMessageBox::critical(this, tr("Invalid argument"), tr("Please type in the required argument."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(global::keyboard::encfsDialog == true) {
|
||||||
|
if(!global::keyboard::keyboardText.isEmpty()) {
|
||||||
|
this->close();
|
||||||
|
global::encfs::passphrase = global::keyboard::keyboardText;
|
||||||
|
global::keyboard::encfsDialog = false;
|
||||||
|
global::keyboard::keyboardText = "";
|
||||||
|
global::keyboard::keyboardDialog = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QMessageBox::critical(this, tr("Invalid argument"), tr("Please type in the required argument."));
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
global::keyboard::keyboardDialog = false;
|
global::keyboard::keyboardDialog = false;
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
|
@ -428,6 +440,11 @@ void generalDialog::setupKeyboardDialog() {
|
||||||
ui->okBtn->setText("Connect");
|
ui->okBtn->setText("Connect");
|
||||||
ui->cancelBtn->setText("Cancel");
|
ui->cancelBtn->setText("Cancel");
|
||||||
}
|
}
|
||||||
|
else if(global::keyboard::encfsDialog == true) {
|
||||||
|
ui->headerLabel->setText("Enter a new encryption key");
|
||||||
|
ui->okBtn->setText("OK");
|
||||||
|
ui->cancelBtn->setText("Cancel");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ui->headerLabel->setText("Enter a string");
|
ui->headerLabel->setText("Enter a string");
|
||||||
ui->okBtn->setText("OK");
|
ui->okBtn->setText("OK");
|
||||||
|
|
|
@ -16,6 +16,7 @@ SOURCES += \
|
||||||
brightnessdialog.cpp \
|
brightnessdialog.cpp \
|
||||||
calendarapp.cpp \
|
calendarapp.cpp \
|
||||||
dictionarywidget.cpp \
|
dictionarywidget.cpp \
|
||||||
|
encryptionmanager.cpp \
|
||||||
generaldialog.cpp \
|
generaldialog.cpp \
|
||||||
koboxappsdialog.cpp \
|
koboxappsdialog.cpp \
|
||||||
koboxsettings.cpp \
|
koboxsettings.cpp \
|
||||||
|
@ -41,6 +42,7 @@ HEADERS += \
|
||||||
brightnessdialog.h \
|
brightnessdialog.h \
|
||||||
calendarapp.h \
|
calendarapp.h \
|
||||||
dictionarywidget.h \
|
dictionarywidget.h \
|
||||||
|
encryptionmanager.h \
|
||||||
functions.h \
|
functions.h \
|
||||||
generaldialog.h \
|
generaldialog.h \
|
||||||
koboxappsdialog.h \
|
koboxappsdialog.h \
|
||||||
|
@ -66,6 +68,7 @@ FORMS += \
|
||||||
brightnessdialog.ui \
|
brightnessdialog.ui \
|
||||||
calendarapp.ui \
|
calendarapp.ui \
|
||||||
dictionarywidget.ui \
|
dictionarywidget.ui \
|
||||||
|
encryptionmanager.ui \
|
||||||
generaldialog.ui \
|
generaldialog.ui \
|
||||||
koboxappsdialog.ui \
|
koboxappsdialog.ui \
|
||||||
koboxsettings.ui \
|
koboxsettings.ui \
|
||||||
|
|
239
main.cpp
239
main.cpp
|
@ -20,6 +20,7 @@
|
||||||
#include "generaldialog.h"
|
#include "generaldialog.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
|
#include "encryptionmanager.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -30,134 +31,150 @@
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Tell scripts that we're currently running
|
setDefaultWorkDir();
|
||||||
string_writeconfig("/tmp/inkbox_running", "true");
|
string_checkconfig_ro(".config/18-encrypted_storage/status");
|
||||||
|
if(checkconfig_str_val.isEmpty() == true) {
|
||||||
|
string_writeconfig(".config/18-encrypted_storage/status", "true");
|
||||||
|
}
|
||||||
|
if(checkconfig(".config/18-encrypted_storage/status") == true and checkconfig("/run/encfs_mounted") == false) {
|
||||||
|
// Open Encryption Manager to unlock encrypted storage
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
encryptionManager w;
|
||||||
|
const QScreen * screen = qApp->primaryScreen();
|
||||||
|
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Tell scripts that we're currently running
|
||||||
|
string_writeconfig("/tmp/inkbox_running", "true");
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
global::reader::startBatteryWatchdog = false;
|
global::reader::startBatteryWatchdog = false;
|
||||||
global::reader::startUsbmsPrompt = false;
|
global::reader::startUsbmsPrompt = false;
|
||||||
|
|
||||||
// Checking if battery level is critical; if true (and if it is not charging), then display a "Please charge your eReader" splash and power off.
|
// Checking if battery level is critical; if true (and if it is not charging), then display a "Please charge your eReader" splash and power off.
|
||||||
if(isBatteryCritical() == true) {
|
if(isBatteryCritical() == true) {
|
||||||
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");
|
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");
|
||||||
if(checkconfig_str_val == "Charging\n") {
|
if(checkconfig_str_val == "Charging\n") {
|
||||||
;
|
;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
global::battery::showCriticalBatteryAlert = true;
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
alert w;
|
||||||
|
|
||||||
|
const QScreen* screen = qApp->primaryScreen();
|
||||||
|
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
global::battery::showCriticalBatteryAlert = true;
|
// Checking if there has been an ALERT flag set up, and if there is, show a big warning
|
||||||
|
if(checkconfig("/external_root/boot/flags/ALERT") == true) {
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
alert w;
|
alert w;
|
||||||
|
|
||||||
|
const QScreen * screen = qApp->primaryScreen();
|
||||||
|
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
|
// If we're waking from sleep and we have the lockscreen enabled, we'll "resume" the book from scratch
|
||||||
|
else if(checkconfig("/tmp/suspendBook") == true && checkconfig("/inkbox/bookIsEpub") == false) {
|
||||||
|
// Start the low/critical battery alert timer from the Reader framework since MainWindow is not going to be shown
|
||||||
|
global::runningInstanceIsReaderOnly = true;
|
||||||
|
global::reader::startBatteryWatchdog = true;
|
||||||
|
global::reader::startUsbmsPrompt = true;
|
||||||
|
global::reader::skipOpenDialog = true;
|
||||||
|
|
||||||
|
string_writeconfig("/inkbox/skip_opendialog", "true");
|
||||||
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
|
if(checkconfig_str_val == "n705\n") {
|
||||||
|
global::isN705 = true;
|
||||||
|
global::isN905C = false;
|
||||||
|
global::isN613 = false;
|
||||||
|
global::isN873 = false;
|
||||||
|
}
|
||||||
|
else if(checkconfig_str_val == "n905\n") {
|
||||||
|
global::isN705 = false;
|
||||||
|
global::isN905C = true;
|
||||||
|
global::isN613 = false;
|
||||||
|
global::isN873 = false;
|
||||||
|
}
|
||||||
|
else if(checkconfig_str_val == "n613\n") {
|
||||||
|
global::isN705 = false;
|
||||||
|
global::isN905C = false;
|
||||||
|
global::isN613 = true;
|
||||||
|
global::isN873 = false;
|
||||||
|
}
|
||||||
|
else if(checkconfig_str_val == "n873\n") {
|
||||||
|
global::isN705 = false;
|
||||||
|
global::isN905C = false;
|
||||||
|
global::isN613 = false;
|
||||||
|
global::isN873 = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
reader w;
|
||||||
|
|
||||||
const QScreen* screen = qApp->primaryScreen();
|
const QScreen* screen = qApp->primaryScreen();
|
||||||
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
|
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checking if there has been an ALERT flag set up, and if there is, show a big warning
|
|
||||||
if(checkconfig("/external_root/boot/flags/ALERT") == true) {
|
|
||||||
QApplication a(argc, argv);
|
|
||||||
alert w;
|
|
||||||
|
|
||||||
const QScreen * screen = qApp->primaryScreen();
|
|
||||||
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
|
|
||||||
w.show();
|
|
||||||
return a.exec();
|
|
||||||
}
|
|
||||||
// If we're waking from sleep and we have the lockscreen enabled, we'll "resume" the book from scratch
|
|
||||||
else if(checkconfig("/tmp/suspendBook") == true && checkconfig("/inkbox/bookIsEpub") == false) {
|
|
||||||
// Start the low/critical battery alert timer from the Reader framework since MainWindow is not going to be shown
|
|
||||||
global::runningInstanceIsReaderOnly = true;
|
|
||||||
global::reader::startBatteryWatchdog = true;
|
|
||||||
global::reader::startUsbmsPrompt = true;
|
|
||||||
global::reader::skipOpenDialog = true;
|
|
||||||
|
|
||||||
string_writeconfig("/inkbox/skip_opendialog", "true");
|
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
|
||||||
if(checkconfig_str_val == "n705\n") {
|
|
||||||
global::isN705 = true;
|
|
||||||
global::isN905C = false;
|
|
||||||
global::isN613 = false;
|
|
||||||
global::isN873 = false;
|
|
||||||
}
|
|
||||||
else if(checkconfig_str_val == "n905\n") {
|
|
||||||
global::isN705 = false;
|
|
||||||
global::isN905C = true;
|
|
||||||
global::isN613 = false;
|
|
||||||
global::isN873 = false;
|
|
||||||
}
|
|
||||||
else if(checkconfig_str_val == "n613\n") {
|
|
||||||
global::isN705 = false;
|
|
||||||
global::isN905C = false;
|
|
||||||
global::isN613 = true;
|
|
||||||
global::isN873 = false;
|
|
||||||
}
|
|
||||||
else if(checkconfig_str_val == "n873\n") {
|
|
||||||
global::isN705 = false;
|
|
||||||
global::isN905C = false;
|
|
||||||
global::isN613 = false;
|
|
||||||
global::isN873 = true;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
;
|
if(checkconfig("/inkbox/bookIsEpub") == true) {
|
||||||
}
|
global::reader::bookIsEpub = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
global::reader::bookIsEpub = false;
|
||||||
|
}
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
reader w;
|
MainWindow w;
|
||||||
|
|
||||||
const QScreen* screen = qApp->primaryScreen();
|
QApplication::setStyle("windows");
|
||||||
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
|
QFile stylesheetFile(":/resources/eink.qss");
|
||||||
w.show();
|
stylesheetFile.open(QFile::ReadOnly);
|
||||||
return a.exec();
|
w.setStyleSheet(stylesheetFile.readAll());
|
||||||
|
stylesheetFile.close();
|
||||||
|
|
||||||
}
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
else {
|
if(checkconfig_str_val == "n705\n") {
|
||||||
if(checkconfig("/inkbox/bookIsEpub") == true) {
|
global::isN705 = true;
|
||||||
global::reader::bookIsEpub = true;
|
global::isN905C = false;
|
||||||
}
|
global::isN613 = false;
|
||||||
else {
|
}
|
||||||
global::reader::bookIsEpub = false;
|
else if(checkconfig_str_val == "n905\n") {
|
||||||
}
|
global::isN705 = false;
|
||||||
|
global::isN905C = true;
|
||||||
|
global::isN613 = false;
|
||||||
|
}
|
||||||
|
else if(checkconfig_str_val == "n613\n") {
|
||||||
|
global::isN705 = false;
|
||||||
|
global::isN905C = false;
|
||||||
|
global::isN613 = true;
|
||||||
|
}
|
||||||
|
else if(checkconfig_str_val == "n873\n") {
|
||||||
|
global::isN705 = false;
|
||||||
|
global::isN905C = false;
|
||||||
|
global::isN613 = false;
|
||||||
|
global::isN873 = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
const QScreen * screen = qApp->primaryScreen();
|
||||||
MainWindow w;
|
w.setGeometry(QRect(QPoint(0,0), screen->geometry ().size()));
|
||||||
|
w.show();
|
||||||
QApplication::setStyle("windows");
|
return a.exec();
|
||||||
QFile stylesheetFile(":/resources/eink.qss");
|
|
||||||
stylesheetFile.open(QFile::ReadOnly);
|
|
||||||
w.setStyleSheet(stylesheetFile.readAll());
|
|
||||||
stylesheetFile.close();
|
|
||||||
|
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
|
||||||
if(checkconfig_str_val == "n705\n") {
|
|
||||||
global::isN705 = true;
|
|
||||||
global::isN905C = false;
|
|
||||||
global::isN613 = false;
|
|
||||||
}
|
}
|
||||||
else if(checkconfig_str_val == "n905\n") {
|
|
||||||
global::isN705 = false;
|
|
||||||
global::isN905C = true;
|
|
||||||
global::isN613 = false;
|
|
||||||
}
|
|
||||||
else if(checkconfig_str_val == "n613\n") {
|
|
||||||
global::isN705 = false;
|
|
||||||
global::isN905C = false;
|
|
||||||
global::isN613 = true;
|
|
||||||
}
|
|
||||||
else if(checkconfig_str_val == "n873\n") {
|
|
||||||
global::isN705 = false;
|
|
||||||
global::isN905C = false;
|
|
||||||
global::isN613 = false;
|
|
||||||
global::isN873 = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QScreen * screen = qApp->primaryScreen();
|
|
||||||
w.setGeometry(QRect(QPoint(0,0), screen->geometry ().size()));
|
|
||||||
w.show();
|
|
||||||
return a.exec();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
resources/encryption.png
Normal file
BIN
resources/encryption.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
Loading…
Reference in a new issue