diff --git a/TaskNote.pro b/TaskNote.pro
index 2e57e34..84ea27a 100755
--- a/TaskNote.pro
+++ b/TaskNote.pro
@@ -4,8 +4,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
-win32:VERSION = 1.1.1.0 # major.minor.patch.build
-else:VERSION = 1.1.1 # major.minor.patch
+win32:VERSION = 1.1.2.0 # major.minor.patch.build
+else:VERSION = 1.1.2 # major.minor.patch
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
DEFINES += APP_NAME=\"\\\"TaskNote\\\"\"
@@ -41,22 +41,14 @@ macx {
QMAKE_CXXFLAGS_RELEASE -= -O1
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE *= -O3
+ QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
DEFINES += APP_OS=\"\\\"macOS\\\"\"
DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\"
- equals(QMAKE_APPLE_DEVICE_ARCHS, arm64) {
- message("CPU Architecture : aarch64")
- DEFINES += APP_ARCH=\"\\\"aarch64\\\"\"
- QMAKE_CXXFLAGS_RELEASE += -mcpu=apple-a14
- }
+ DEFINES += APP_ARCH=\"\\\"universal\\\"\"
}
linux-g++* {
message("Build for Linux")
-
- #LIBS += -L/usr/lib/crypto++ -lcrypto++
- #INCS += -I/usr/include/crypto++
-
- #DEFINES += __SECURED=1
DEFINES += APP_OS=\"\\\"$$system(cat /etc/issue | cut -d\' \' -f1)\\\"\"
DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\"
DEFINES += APP_ARCH=\"\\\"amd64\\\"\"
diff --git a/src/frames/aboutdialog.ui b/src/frames/aboutdialog.ui
index b1082e9..3a1b1a9 100755
--- a/src/frames/aboutdialog.ui
+++ b/src/frames/aboutdialog.ui
@@ -25,6 +25,9 @@
About TaskNote
+
+ true
+
-
diff --git a/src/frames/mainwindow.cpp b/src/frames/mainwindow.cpp
index dfb7ee8..d19a04f 100755
--- a/src/frames/mainwindow.cpp
+++ b/src/frames/mainwindow.cpp
@@ -14,9 +14,6 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->noteList, &QListWidget::currentRowChanged, this, &MainWindow::selectionChanged);
connect(ui->titleEdit, &QLineEdit::textChanged, this, &MainWindow::titleChanged);
connect(ui->contentEdit, &QPlainTextEdit::textChanged, this, &MainWindow::contentChanged);
- #ifdef __SECURED
- connect(ui->actionEncrypt, &QAction::triggered, this, &MainWindow::encryptNote);
- #endif
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
ui->contentEdit->setFont(fixedFont);
this->savemng = new SaveManager();
@@ -54,21 +51,19 @@ void MainWindow::selectionChanged(int i)
clearAndDisableFields();
return;
}
- ui->actionRemove->setDisabled(false);
+
+ ui->contentEdit->blockSignals(true);
+ ui->titleEdit->blockSignals(true);
+
ui->titleEdit->setDisabled(false);
ui->contentEdit->setDisabled(false);
+ ui->actionRemove->setDisabled(false);
ui->titleEdit->setText(n->getTitle());
-#ifdef __SECURED
- if (n->isEncrypted())
- {
- ui->contentEdit->setPlainText(n->getEncryptedContent("azertyuiop"));
- } else {
- ui->contentEdit->setPlainText(n->getContent());
- }
-#else
ui->contentEdit->setPlainText(n->getContent());
-#endif
ui->markdownViewer->setMarkdown(ui->contentEdit->toPlainText());
+
+ ui->contentEdit->blockSignals(false);
+ ui->titleEdit->blockSignals(false);
}
void MainWindow::removeSelected()
@@ -113,18 +108,6 @@ void MainWindow::showAboutBox()
dialog.exec();
}
-#ifdef __SECURED
-void MainWindow::encryptNote()
-{
- if (this->currentIndex > -1)
- {
- Note *n = this->savemng->getNoteByIndex(this->currentIndex);
- n->encrypt("azertyuiop");
- savemng->flushSave();
- }
-}
-#endif
-
void MainWindow::contentChanged()
{
timer->stop();
@@ -149,6 +132,9 @@ void MainWindow::updateListView()
void MainWindow::clearAndDisableFields()
{
+ ui->contentEdit->blockSignals(true);
+ ui->titleEdit->blockSignals(true);
+
this->currentIndex = -1;
ui->actionRemove->setDisabled(true);
ui->titleEdit->setDisabled(true);
@@ -156,5 +142,8 @@ void MainWindow::clearAndDisableFields()
ui->titleEdit->clear();
ui->contentEdit->clear();
ui->markdownViewer->clear();
+
+ ui->contentEdit->blockSignals(false);
+ ui->titleEdit->blockSignals(false);
}
diff --git a/src/frames/mainwindow.h b/src/frames/mainwindow.h
index 0c39b5c..644b7a9 100755
--- a/src/frames/mainwindow.h
+++ b/src/frames/mainwindow.h
@@ -30,9 +30,6 @@ private slots:
void contentChanged();
void titleChanged();
void showAboutBox();
-#ifdef __SECURED
- void encryptNote();
-#endif
private:
Ui::MainWindow *ui;
diff --git a/src/frames/mainwindow.ui b/src/frames/mainwindow.ui
index 0d2b1d0..7509c03 100755
--- a/src/frames/mainwindow.ui
+++ b/src/frames/mainwindow.ui
@@ -20,8 +20,8 @@
TaskNote
-
-
-
+
+
-
-
@@ -63,55 +63,65 @@
-
-
-
-
-
-
- Markdown editor
-
-
-
- -
-
-
- Viewer
-
-
-
-
-
- -
-
-
-
-
-
- false
-
-
-
- -
-
-
- true
-
-
- QTextEdit::AutoAll
-
-
- QTextEdit::WidgetWidth
-
-
- true
-
-
- false
-
-
- Qt::TextSelectableByMouse
-
-
-
-
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Horizontal
+
+
+ false
+
+
+
+ false
+
+
+
+ 200
+ 0
+
+
+
+
+ false
+
+
+
+ QPlainTextEdit::NoWrap
+
+
+
+
+ true
+
+
+
+ 200
+ 0
+
+
+
+ QTextEdit::AutoAll
+
+
+ QTextEdit::NoWrap
+
+
+ true
+
+
+ false
+
+
+ Qt::TextSelectableByMouse
+
+
+
@@ -129,6 +139,9 @@
96
+
+ Qt::PreventContextMenu
+
toolBar
@@ -138,6 +151,9 @@
Qt::ToolButtonTextUnderIcon
+
+ false
+
TopToolBarArea
@@ -149,10 +165,6 @@
-
-
-
-
@@ -197,42 +209,6 @@
About
-
-
-
- :/icon/resources/outline_lock_black_48dp.png:/icon/resources/outline_lock_black_48dp.png
-
-
- Lock
-
-
- false
-
-
-
-
-
- :/icon/resources/outline_lock_open_black_48dp.png:/icon/resources/outline_lock_open_black_48dp.png
-
-
- Unlock
-
-
- false
-
-
-
-
- false
-
-
-
- :/icon/resources/outline_shield_black_48dp.png:/icon/resources/outline_shield_black_48dp.png
-
-
- Encrypt
-
-
diff --git a/src/models/note.cpp b/src/models/note.cpp
index fbfd6dd..f1f4a32 100755
--- a/src/models/note.cpp
+++ b/src/models/note.cpp
@@ -12,9 +12,6 @@ QJsonObject Note::toJson()
o["uuid"] = this->uuid;
o["title"] = this->title;
o["content"] = this->content;
- #ifdef __SECURED
- o["encrypted"] = this->encrypted;
- #endif
return o;
}
@@ -46,43 +43,6 @@ QString Note::getContent()
}
return "";
}
-#ifdef __SECURED
-QString Note::getEncryptedContent(QString passwd)
-{
- if (this->encrypted)
- {
- using namespace CryptoPP;
- std::string password = passwd.toStdString();
- QString bytes = QByteArray::fromBase64(QByteArray::fromStdString(this->content.toStdString()));
- std::string encoded = bytes.toStdString();
- std::string iv = encoded.substr(0, TAG_SIZE);
- std::string cipher = encoded.substr(TAG_SIZE + 1, encoded.length());
- std::string recovered;
-
- try {
- GCM< AES >::Decryption d;
- d.SetKeyWithIV((const unsigned char*)password.c_str(), sizeof(password.c_str()), (const unsigned char*)iv.c_str(), sizeof(iv.c_str()));
-
- AuthenticatedDecryptionFilter df( d,
- new StringSink(recovered),
- AuthenticatedDecryptionFilter::DEFAULT_FLAGS, TAG_SIZE
- );
- StringSource ss2(cipher, true,
- new Redirector(df)
- );
- return QString::fromStdString(recovered);
- } catch (CryptoPP::Exception& e) {
- std::cout << e.GetWhat() << "\n";
- }
- }
- return "";
-}
-
-bool Note::isEncrypted()
-{
- return this->encrypted;
-}
-#endif
void Note::setTitle(QString value)
{
this->title = value;
@@ -94,53 +54,3 @@ void Note::setContent(QString value)
this->content = value;
}
}
-#ifdef __SECURED
-// TODO encrypt avec le mot de passe
-bool Note::setEncryptedContent(QString value, QString passwd)
-{
- if (this->encrypted) {
- using namespace CryptoPP;
- AutoSeededRandomPool prng;
- std::string password = passwd.toStdString();
- std::string pdata = value.toStdString();
- std::string cipher, encoded;
-
- SecByteBlock key(AES::MAX_KEYLENGTH + AES::BLOCKSIZE);
- SecByteBlock iv(AES::BLOCKSIZE);
- prng.GenerateBlock(iv, iv.size());
- try
- {
- GCM::Encryption e;
- e.SetKeyWithIV(key, sizeof(key), iv, sizeof(iv));
-
- StringSource ss1(pdata, true,
- new AuthenticatedEncryptionFilter(e,
- new StringSink(cipher), false, TAG_SIZE
- )
- );
- std::string s(reinterpret_cast< char const* >(iv.data())) ;
- encoded = s + cipher;
- auto bytes = QByteArray::fromStdString(encoded);
- this->content = bytes.toBase64();
- return true;
- }
- catch(CryptoPP::Exception& e)
- {
- std::cout << e.GetWhat() << "\n";
- return false;
- }
- }
- return false;
-}
-
-void Note::encrypt(QString password)
-{
- if (!this->encrypted && (password.length() >= 6)) {
- this->encrypted = true;
- if (!setEncryptedContent(this->content, password))
- {
- this->encrypted = false;
- }
- }
-}
-#endif
diff --git a/src/models/note.h b/src/models/note.h
index 81f4b95..a0d0659 100755
--- a/src/models/note.h
+++ b/src/models/note.h
@@ -11,18 +11,6 @@
#include
#include
-#ifdef __SECURED
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
-
class Note
{
public:
@@ -35,18 +23,8 @@ public:
QString getTitle();
QString getContent();
- #ifdef __SECURED
- QString getEncryptedContent(QString passwd);
- bool isEncrypted();
- #endif
-
void setTitle(QString value);
void setContent(QString value);
-
- #ifdef __SECURED
- bool setEncryptedContent(QString value, QString passwd);
- void encrypt(QString password);
- #endif
private:
QString uuid;
QString title;