From e4899b578eea76e4ce1e1d0ab6ce6991e34f2360 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Tue, 15 Sep 2020 22:17:36 +0200 Subject: [PATCH 1/3] add error check for addresslabels --- src/addressbook.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/src/addressbook.cpp b/src/addressbook.cpp index 2a4fb22..93e2481 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -468,9 +468,7 @@ void AddressBook::readFromStorage() void AddressBook::writeToStorage() { - //FileSystem::getInstance()->writeContacts(AddressBook::writeableFile(), DataStore::getContactDataStore()->dump()); - - // FileSystem::getInstance()->writeContactsOldFormat(AddressBook::writeableFile(), allLabels); + QString passphraseHash = DataStore::getChatDataStore()->getPassword(); int length = passphraseHash.length(); @@ -497,7 +495,18 @@ void AddressBook::writeToStorage() FileEncryption::decrypt(target_decaddr_file, target_encaddr_file, pwHash); QFile file(target_decaddr_file); + try { file.open(QIODevice::ReadWrite | QIODevice::Truncate); + + } catch(...) { + + QMessageBox msgWarning; + msgWarning.setText("WARNING!\n Could not open Addressbook."); + msgWarning.setIcon(QMessageBox::Warning); + msgWarning.setWindowTitle("Caution"); + msgWarning.exec(); + } + QDataStream out(&file); // we will serialize the data into the file QList> contacts; @@ -513,19 +522,53 @@ void AddressBook::writeToStorage() } out << QString("v2") << contacts; + +try { + file.close(); +} catch(...) { + + QMessageBox msgWarning; + msgWarning.setText("WARNING!\nCould not close Addressbook."); + msgWarning.setIcon(QMessageBox::Warning); + msgWarning.setWindowTitle("Caution"); + msgWarning.exec(); + +} + try { FileEncryption::encrypt(target_encaddr_file, target_decaddr_file , pwHash); + } + + catch(...) { + + QMessageBox msgWarning; + msgWarning.setText("WARNING!\nCould not encrypt Addressbook."); + msgWarning.setIcon(QMessageBox::Warning); + msgWarning.setWindowTitle("Caution"); + msgWarning.exec(); + } QFile file1(target_decaddr_file); + try { file1.remove(); - + + } catch(...) { + + QMessageBox msgWarning; + msgWarning.setText("WARNING!\nCould not remove Addressbook."); + msgWarning.setIcon(QMessageBox::Warning); + msgWarning.setWindowTitle("Caution"); + msgWarning.exec(); + } } QString AddressBook::writeableFile() { auto filename = QStringLiteral("addresslabels.dat"); auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); + + try { if (!dir.exists()) QDir().mkpath(dir.absolutePath()); @@ -534,6 +577,15 @@ QString AddressBook::writeableFile() else return dir.filePath(filename); + + } catch(...) { + QMessageBox msgWarning; + msgWarning.setText("WARNING!\nCould not write Addressbook."); + msgWarning.setIcon(QMessageBox::Warning); + msgWarning.setWindowTitle("Caution"); + msgWarning.exec(); + + } } From 7362f42e96cd872e5c448ebb97b0a4d93f3fd381 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Tue, 15 Sep 2020 22:18:29 +0200 Subject: [PATCH 2/3] set version to 1.3.10 --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index d9bca91..1f79e63 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "1.4.0" +#define APP_VERSION "1.3.10" From 748a2a4f730eb0842618afce7f498245643f1ef1 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Tue, 15 Sep 2020 22:25:51 +0200 Subject: [PATCH 3/3] add missing ui --- silentdragon-lite.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/silentdragon-lite.pro b/silentdragon-lite.pro index a659d07..be0a719 100644 --- a/silentdragon-lite.pro +++ b/silentdragon-lite.pro @@ -143,6 +143,7 @@ FORMS += \ src/viewalladdresses.ui \ src/connection.ui \ src/addressbook.ui \ + src/memodialog.ui \ src/mobileappconnector.ui \ src/createhushconfdialog.ui \ src/recurringdialog.ui \