Commit 4207598a authored by Martin Straka's avatar Martin Straka

Code refactoring

parent 8099f493
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* In addition, as a special exception, the copyright holders give * In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the * permission to link the code of portions of this program with the
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* In addition, as a special exception, the copyright holders give * In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the * permission to link the code of portions of this program with the
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <QList> #include <QList>
#include <QUrl> #include <QUrl>
#include "src/auxiliaries/icloud_helper.h" #include "src/auxiliaries/ios_helper.h"
#include "src/global.h" #include "src/global.h"
#import "ios/src/doc_picker_controller.h" #import "ios/src/doc_picker_controller.h"
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
QUrl tmpUrl = QUrl::fromNSURL(url); QUrl tmpUrl = QUrl::fromNSURL(url);
qUrls.append(tmpUrl); qUrls.append(tmpUrl);
} }
GlobInstcs::iCloudHelperPtr->importFilesToAppInbox(qUrls); GlobInstcs::iOSHelperPtr->importFilesToAppInbox(qUrls);
} else if (controller.documentPickerMode == UIDocumentPickerModeExportToService) { } else if (controller.documentPickerMode == UIDocumentPickerModeExportToService) {
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* In addition, as a special exception, the copyright holders give * In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the * permission to link the code of portions of this program with the
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* In addition, as a special exception, the copyright holders give * In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the * permission to link the code of portions of this program with the
......
...@@ -90,7 +90,7 @@ TRANSLATIONS_FILES += \ ...@@ -90,7 +90,7 @@ TRANSLATIONS_FILES += \
SOURCES += \ SOURCES += \
src/accounts.cpp \ src/accounts.cpp \
src/auxiliaries/email_helper.cpp \ src/auxiliaries/email_helper.cpp \
src/auxiliaries/icloud_helper.cpp \ src/auxiliaries/ios_helper.cpp \
src/datovka_shared/gov_services/helper.cpp \ src/datovka_shared/gov_services/helper.cpp \
src/datovka_shared/gov_services/service/gov_mv_crr_vbh.cpp \ src/datovka_shared/gov_services/service/gov_mv_crr_vbh.cpp \
src/datovka_shared/gov_services/service/gov_mv_ir_vp.cpp \ src/datovka_shared/gov_services/service/gov_mv_ir_vp.cpp \
...@@ -212,7 +212,7 @@ SOURCES += \ ...@@ -212,7 +212,7 @@ SOURCES += \
HEADERS += \ HEADERS += \
src/accounts.h \ src/accounts.h \
src/auxiliaries/email_helper.h \ src/auxiliaries/email_helper.h \
src/auxiliaries/icloud_helper.h \ src/auxiliaries/ios_helper.h \
src/common.h \ src/common.h \
src/datovka_shared/gov_services/helper.h \ src/datovka_shared/gov_services/helper.h \
src/datovka_shared/gov_services/service/gov_mv_crr_vbh.h \ src/datovka_shared/gov_services/service/gov_mv_crr_vbh.h \
......
...@@ -218,7 +218,7 @@ Item { ...@@ -218,7 +218,7 @@ Item {
Component.onDestruction: { Component.onDestruction: {
if (iOS) { if (iOS) {
iCloudHelper.clearSendDir() iOSHelper.clearSendDir()
} }
statusBar.visible = false statusBar.visible = false
} }
...@@ -503,7 +503,7 @@ Item { ...@@ -503,7 +503,7 @@ Item {
Item { Item {
id: tabAttachments id: tabAttachments
Connections { Connections {
target: iCloudHelper target: iOSHelper
onFileSelectedSig: { onFileSelectedSig: {
if (filePath !== "") { if (filePath !== "") {
appendFileToSendModel(filePath) appendFileToSendModel(filePath)
...@@ -530,7 +530,7 @@ Item { ...@@ -530,7 +530,7 @@ Item {
font.pointSize: defaultTextFont.font.pointSize font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Storage") text: qsTr("Storage")
onClicked: { onClicked: {
iCloudHelper.openDocumentPickerController() iOSHelper.openDocumentPickerController()
} }
} }
} }
...@@ -607,10 +607,10 @@ Item { ...@@ -607,10 +607,10 @@ Item {
} }
Text { Text {
text: if (rFilePath != "") { text: if (rFilePath != "") {
iOS ? iCloudHelper.getShortSendFilePath(rFilePath) : rFilePath iOS ? iOSHelper.getShortSendFilePath(rFilePath) : rFilePath
} else { } else {
qsTr("Local database") qsTr("Local database")
} }
color: datovkaPalette.mid color: datovkaPalette.mid
font.pointSize: textFontSizeSmall font.pointSize: textFontSizeSmall
} }
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* In addition, as a special exception, the copyright holders give * In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the * permission to link the code of portions of this program with the
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
#include "src/auxiliaries/icloud_helper.h" #include "src/auxiliaries/ios_helper.h"
#include "src/io/filesystem.h" #include "src/io/filesystem.h"
#include "src/datovka_shared/log/log.h" #include "src/datovka_shared/log/log.h"
...@@ -35,12 +35,12 @@ ...@@ -35,12 +35,12 @@
#define SEND_FILE_PATH_PREFIX "Documents/Datovka" #define SEND_FILE_PATH_PREFIX "Documents/Datovka"
#endif /* Q_OS_IOS */ #endif /* Q_OS_IOS */
ICloudHelper::ICloudHelper(QObject *parent) IosHelper::IosHelper(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
} }
void ICloudHelper::storeFilesToCloud(const QStringList &srcFilePaths, void IosHelper::storeFilesToCloud(const QStringList &srcFilePaths,
const QString &targetPath) const QString &targetPath)
{ {
debugFuncCall(); debugFuncCall();
...@@ -123,10 +123,7 @@ finish: ...@@ -123,10 +123,7 @@ finish:
#endif /* Q_OS_IOS */ #endif /* Q_OS_IOS */
} }
/* QString IosHelper::getShortSendFilePath(const QString &sandBoxFilePath)
* Retrun short local send file path.
*/
QString ICloudHelper::getShortSendFilePath(const QString &sandBoxFilePath)
{ {
#ifdef Q_OS_IOS #ifdef Q_OS_IOS
...@@ -141,7 +138,7 @@ QString ICloudHelper::getShortSendFilePath(const QString &sandBoxFilePath) ...@@ -141,7 +138,7 @@ QString ICloudHelper::getShortSendFilePath(const QString &sandBoxFilePath)
#endif #endif
} }
void ICloudHelper::clearSendDir(void) void IosHelper::clearSendDir(void)
{ {
debugFuncCall(); debugFuncCall();
...@@ -154,7 +151,7 @@ void ICloudHelper::clearSendDir(void) ...@@ -154,7 +151,7 @@ void ICloudHelper::clearSendDir(void)
*/ */
} }
void ICloudHelper::openDocumentPickerController(void) void IosHelper::openDocumentPickerController(void)
{ {
debugFuncCall(); debugFuncCall();
...@@ -165,14 +162,14 @@ void ICloudHelper::openDocumentPickerController(void) ...@@ -165,14 +162,14 @@ void ICloudHelper::openDocumentPickerController(void)
#endif /* Q_OS_IOS */ #endif /* Q_OS_IOS */
} }
void ICloudHelper::importFilesToAppInbox(QList<QUrl> selectedFileUrls) void IosHelper::importFilesToAppInbox(QList<QUrl> selectedFileUrls)
{ {
foreach (const QUrl &fileUrl, selectedFileUrls) { foreach (const QUrl &fileUrl, selectedFileUrls) {
moveFileToSendDir(fileUrl); moveFileToSendDir(fileUrl);
} }
} }
void ICloudHelper::moveFileToSendDir(const QUrl &sourceFileUrl) void IosHelper::moveFileToSendDir(const QUrl &sourceFileUrl)
{ {
#ifdef Q_OS_IOS #ifdef Q_OS_IOS
...@@ -192,7 +189,7 @@ void ICloudHelper::moveFileToSendDir(const QUrl &sourceFileUrl) ...@@ -192,7 +189,7 @@ void ICloudHelper::moveFileToSendDir(const QUrl &sourceFileUrl)
#endif #endif
} }
void ICloudHelper::storeFilesToDeviceStorage(const QStringList &srcFilePaths) void IosHelper::storeFilesToDeviceStorage(const QStringList &srcFilePaths)
{ {
debugFuncCall(); debugFuncCall();
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* In addition, as a special exception, the copyright holders give * In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the * permission to link the code of portions of this program with the
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#include <QUrl> #include <QUrl>
/*! /*!
* @brief Provides iCloud interface for iOS. * @brief Provides QT interface for some iOS objective-C based methods.
*/ */
class ICloudHelper : public QObject { class IosHelper : public QObject {
Q_OBJECT Q_OBJECT
public: public:
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
* *
* @param[in] parent Parent object. * @param[in] parent Parent object.
*/ */
ICloudHelper(QObject *parent = Q_NULLPTR); IosHelper(QObject *parent = Q_NULLPTR);
/*! /*!
* @brief Store files to iCloud. * @brief Store files to iCloud.
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
void openDocumentPickerController(void); void openDocumentPickerController(void);
/*! /*!
* @brief Retrun short local send file path. * @brief Retrun short local send file path (without full sandbox path).
* *
* @param[in] sandBoxFilePath Send file path. * @param[in] sandBoxFilePath Send file path.
* @return Short path to app sandbox where send file was stored. * @return Short path to app sandbox where send file was stored.
...@@ -81,9 +81,9 @@ public: ...@@ -81,9 +81,9 @@ public:
QString getShortSendFilePath(const QString &sandBoxFilePath); QString getShortSendFilePath(const QString &sandBoxFilePath);
/*! /*!
* @brief Is activated when iCloud hierarchy has been received. * @brief Is activated when files have been selected with iOS file picker.
* *
* @param[in] selectedFileUrls Path file list of iCloud for QML. * @param[in] selectedFileUrls Path file list for QML.
*/ */
void importFilesToAppInbox(QList<QUrl> selectedFileUrls); void importFilesToAppInbox(QList<QUrl> selectedFileUrls);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#endif #endif
#include "ios/src/url_opener.h" #include "ios/src/url_opener.h"
#include "src/auxiliaries/email_helper.h" #include "src/auxiliaries/email_helper.h"
#include "src/auxiliaries/icloud_helper.h" #include "src/auxiliaries/ios_helper.h"
#include "src/common.h" #include "src/common.h"
#include "src/crypto/crypto.h" #include "src/crypto/crypto.h"
#include "src/datovka_shared/log/log.h" #include "src/datovka_shared/log/log.h"
...@@ -653,9 +653,9 @@ void exportFilesiOS(const QStringList &destFilePaths, ...@@ -653,9 +653,9 @@ void exportFilesiOS(const QStringList &destFilePaths,
int ret = msgBox.exec(); int ret = msgBox.exec();
if (ret == QMessageBox::Yes) { if (ret == QMessageBox::Yes) {
GlobInstcs::iCloudHelperPtr->storeFilesToCloud(destFilePaths, targetDir); GlobInstcs::iOSHelperPtr->storeFilesToCloud(destFilePaths, targetDir);
} else if (ret == QMessageBox::No) { } else if (ret == QMessageBox::No) {
GlobInstcs::iCloudHelperPtr->storeFilesToDeviceStorage(destFilePaths); GlobInstcs::iOSHelperPtr->storeFilesToDeviceStorage(destFilePaths);
} }
} }
#endif #endif
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
...@@ -41,4 +41,4 @@ class AccountsMap *GlobInstcs::acntMapPtr = Q_NULLPTR; ...@@ -41,4 +41,4 @@ class AccountsMap *GlobInstcs::acntMapPtr = Q_NULLPTR;
class ImageProvider *GlobInstcs::imgProvPtr = Q_NULLPTR; class ImageProvider *GlobInstcs::imgProvPtr = Q_NULLPTR;
class ICloudHelper *GlobInstcs::iCloudHelperPtr = Q_NULLPTR; class IosHelper *GlobInstcs::iOSHelperPtr = Q_NULLPTR;
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
...@@ -43,7 +43,7 @@ class AccountsMap; ...@@ -43,7 +43,7 @@ class AccountsMap;
class ImageProvider; class ImageProvider;
class ICloudHelper; class IosHelper;
/*! /*!
* @brief The namespace holds pointers to all globally accessible structures. * @brief The namespace holds pointers to all globally accessible structures.
...@@ -78,5 +78,5 @@ namespace GlobInstcs { ...@@ -78,5 +78,5 @@ namespace GlobInstcs {
class ImageProvider *imgProvPtr; /*!< Image provider. */ class ImageProvider *imgProvPtr; /*!< Image provider. */
extern extern
class ICloudHelper *iCloudHelperPtr; /*!< iCloud helper. */ class IosHelper *iOSHelperPtr; /*!< iOS helper. */
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <QtXml> #include <QtXml>
#include "src/accounts.h" #include "src/accounts.h"
#include "src/auxiliaries/icloud_helper.h" #include "src/auxiliaries/ios_helper.h"
#include "src/datovka_shared/crypto/crypto_trusted_certs.h" #include "src/datovka_shared/crypto/crypto_trusted_certs.h"
#include "src/datovka_shared/io/records_management_db.h" #include "src/datovka_shared/io/records_management_db.h"
#include "src/datovka_shared/localisation/localisation.h" #include "src/datovka_shared/localisation/localisation.h"
...@@ -455,13 +455,13 @@ int main(int argc, char *argv[]) ...@@ -455,13 +455,13 @@ int main(int argc, char *argv[])
StringManipulation strManipulation; StringManipulation strManipulation;
Zfo zfo; Zfo zfo;
ICloudHelper iCloudHelper; IosHelper iOSHelper;
GlobInstcs::iCloudHelperPtr = new (std::nothrow) ICloudHelper; GlobInstcs::iOSHelperPtr = new (std::nothrow) IosHelper;
if (GlobInstcs::iCloudHelperPtr == Q_NULLPTR) { if (GlobInstcs::iOSHelperPtr == Q_NULLPTR) {
logErrorNL("%s", "Cannot create iCloud helper."); logErrorNL("%s", "Cannot create iOS helper.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
GlobInstcs::iCloudHelperPtr = &iCloudHelper; GlobInstcs::iOSHelperPtr = &iOSHelper;
/* Inicialize app delegate component for interaction with iOS /* Inicialize app delegate component for interaction with iOS
* Reaction on the iOS action "Open in..." */ * Reaction on the iOS action "Open in..." */
...@@ -470,7 +470,7 @@ int main(int argc, char *argv[]) ...@@ -470,7 +470,7 @@ int main(int argc, char *argv[])
QtAppDelegateInitialize(&interactionZfoFile); QtAppDelegateInitialize(&interactionZfoFile);
/* Clear send dir. */ /* Clear send dir. */
iCloudHelper.clearSendDir(); iOSHelper.clearSendDir();
#endif #endif
/* /*
...@@ -519,7 +519,7 @@ int main(int argc, char *argv[]) ...@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
ctx->setContextProperty("messages", &messages); ctx->setContextProperty("messages", &messages);
ctx->setContextProperty("accounts", &accounts); ctx->setContextProperty("accounts", &accounts);
ctx->setContextProperty("files", &files); ctx->setContextProperty("files", &files);
ctx->setContextProperty("iCloudHelper", &iCloudHelper); ctx->setContextProperty("iOSHelper", &iOSHelper);
ctx->setContextProperty("gov", &gov); ctx->setContextProperty("gov", &gov);
ctx->setContextProperty("settings", &settings); ctx->setContextProperty("settings", &settings);
ctx->setContextProperty("strManipulation", &strManipulation); ctx->setContextProperty("strManipulation", &strManipulation);
...@@ -763,7 +763,7 @@ int main(int argc, char *argv[]) ...@@ -763,7 +763,7 @@ int main(int argc, char *argv[])
delete GlobInstcs::workPoolPtr; GlobInstcs::workPoolPtr = Q_NULLPTR; delete GlobInstcs::workPoolPtr; GlobInstcs::workPoolPtr = Q_NULLPTR;
delete GlobInstcs::msgProcEmitterPtr; GlobInstcs::msgProcEmitterPtr = Q_NULLPTR; delete GlobInstcs::msgProcEmitterPtr; GlobInstcs::msgProcEmitterPtr = Q_NULLPTR;
delete GlobInstcs::iCloudHelperPtr; GlobInstcs::iCloudHelperPtr = Q_NULLPTR; delete GlobInstcs::iOSHelperPtr; GlobInstcs::iOSHelperPtr = Q_NULLPTR;
} }
/* Finally, destroy global log object. */ /* Finally, destroy global log object. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment