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

Code refactoring

parent 8099f493
......@@ -8,11 +8,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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
* permission to link the code of portions of this program with the
......
......@@ -8,11 +8,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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
* permission to link the code of portions of this program with the
......@@ -24,7 +24,7 @@
#include <QList>
#include <QUrl>
#include "src/auxiliaries/icloud_helper.h"
#include "src/auxiliaries/ios_helper.h"
#include "src/global.h"
#import "ios/src/doc_picker_controller.h"
......@@ -71,7 +71,7 @@
QUrl tmpUrl = QUrl::fromNSURL(url);
qUrls.append(tmpUrl);
}
GlobInstcs::iCloudHelperPtr->importFilesToAppInbox(qUrls);
GlobInstcs::iOSHelperPtr->importFilesToAppInbox(qUrls);
} else if (controller.documentPickerMode == UIDocumentPickerModeExportToService) {
......
......@@ -8,11 +8,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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
* permission to link the code of portions of this program with the
......
......@@ -8,11 +8,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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
* permission to link the code of portions of this program with the
......
......@@ -90,7 +90,7 @@ TRANSLATIONS_FILES += \
SOURCES += \
src/accounts.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/service/gov_mv_crr_vbh.cpp \
src/datovka_shared/gov_services/service/gov_mv_ir_vp.cpp \
......@@ -212,7 +212,7 @@ SOURCES += \
HEADERS += \
src/accounts.h \
src/auxiliaries/email_helper.h \
src/auxiliaries/icloud_helper.h \
src/auxiliaries/ios_helper.h \
src/common.h \
src/datovka_shared/gov_services/helper.h \
src/datovka_shared/gov_services/service/gov_mv_crr_vbh.h \
......
......@@ -218,7 +218,7 @@ Item {
Component.onDestruction: {
if (iOS) {
iCloudHelper.clearSendDir()
iOSHelper.clearSendDir()
}
statusBar.visible = false
}
......@@ -503,7 +503,7 @@ Item {
Item {
id: tabAttachments
Connections {
target: iCloudHelper
target: iOSHelper
onFileSelectedSig: {
if (filePath !== "") {
appendFileToSendModel(filePath)
......@@ -530,7 +530,7 @@ Item {
font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Storage")
onClicked: {
iCloudHelper.openDocumentPickerController()
iOSHelper.openDocumentPickerController()
}
}
}
......@@ -607,10 +607,10 @@ Item {
}
Text {
text: if (rFilePath != "") {
iOS ? iCloudHelper.getShortSendFilePath(rFilePath) : rFilePath
iOS ? iOSHelper.getShortSendFilePath(rFilePath) : rFilePath
} else {
qsTr("Local database")
}
}
color: datovkaPalette.mid
font.pointSize: textFontSizeSmall
}
......
......@@ -8,11 +8,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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
* permission to link the code of portions of this program with the
......@@ -25,7 +25,7 @@
#include <QFileInfo>
#include <QMessageBox>
#include "src/auxiliaries/icloud_helper.h"
#include "src/auxiliaries/ios_helper.h"
#include "src/io/filesystem.h"
#include "src/datovka_shared/log/log.h"
......@@ -35,12 +35,12 @@
#define SEND_FILE_PATH_PREFIX "Documents/Datovka"
#endif /* Q_OS_IOS */
ICloudHelper::ICloudHelper(QObject *parent)
IosHelper::IosHelper(QObject *parent)
: QObject(parent)
{
}
void ICloudHelper::storeFilesToCloud(const QStringList &srcFilePaths,
void IosHelper::storeFilesToCloud(const QStringList &srcFilePaths,
const QString &targetPath)
{
debugFuncCall();
......@@ -123,10 +123,7 @@ finish:
#endif /* Q_OS_IOS */
}
/*
* Retrun short local send file path.
*/
QString ICloudHelper::getShortSendFilePath(const QString &sandBoxFilePath)
QString IosHelper::getShortSendFilePath(const QString &sandBoxFilePath)
{
#ifdef Q_OS_IOS
......@@ -141,7 +138,7 @@ QString ICloudHelper::getShortSendFilePath(const QString &sandBoxFilePath)
#endif
}
void ICloudHelper::clearSendDir(void)
void IosHelper::clearSendDir(void)
{
debugFuncCall();
......@@ -154,7 +151,7 @@ void ICloudHelper::clearSendDir(void)
*/
}
void ICloudHelper::openDocumentPickerController(void)
void IosHelper::openDocumentPickerController(void)
{
debugFuncCall();
......@@ -165,14 +162,14 @@ void ICloudHelper::openDocumentPickerController(void)
#endif /* Q_OS_IOS */
}
void ICloudHelper::importFilesToAppInbox(QList<QUrl> selectedFileUrls)
void IosHelper::importFilesToAppInbox(QList<QUrl> selectedFileUrls)
{
foreach (const QUrl &fileUrl, selectedFileUrls) {
moveFileToSendDir(fileUrl);
}
}
void ICloudHelper::moveFileToSendDir(const QUrl &sourceFileUrl)
void IosHelper::moveFileToSendDir(const QUrl &sourceFileUrl)
{
#ifdef Q_OS_IOS
......@@ -192,7 +189,7 @@ void ICloudHelper::moveFileToSendDir(const QUrl &sourceFileUrl)
#endif
}
void ICloudHelper::storeFilesToDeviceStorage(const QStringList &srcFilePaths)
void IosHelper::storeFilesToDeviceStorage(const QStringList &srcFilePaths)
{
debugFuncCall();
......
......@@ -8,11 +8,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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
* permission to link the code of portions of this program with the
......@@ -29,9 +29,9 @@
#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
public:
......@@ -41,7 +41,7 @@ public:
*
* @param[in] parent Parent object.
*/
ICloudHelper(QObject *parent = Q_NULLPTR);
IosHelper(QObject *parent = Q_NULLPTR);
/*!
* @brief Store files to iCloud.
......@@ -72,7 +72,7 @@ public:
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.
* @return Short path to app sandbox where send file was stored.
......@@ -81,9 +81,9 @@ public:
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);
......
......@@ -33,7 +33,7 @@
#endif
#include "ios/src/url_opener.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/crypto/crypto.h"
#include "src/datovka_shared/log/log.h"
......@@ -653,9 +653,9 @@ void exportFilesiOS(const QStringList &destFilePaths,
int ret = msgBox.exec();
if (ret == QMessageBox::Yes) {
GlobInstcs::iCloudHelperPtr->storeFilesToCloud(destFilePaths, targetDir);
GlobInstcs::iOSHelperPtr->storeFilesToCloud(destFilePaths, targetDir);
} else if (ret == QMessageBox::No) {
GlobInstcs::iCloudHelperPtr->storeFilesToDeviceStorage(destFilePaths);
GlobInstcs::iOSHelperPtr->storeFilesToDeviceStorage(destFilePaths);
}
}
#endif
......
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* You should have received a copy of the GNU General Public License
......@@ -41,4 +41,4 @@ class AccountsMap *GlobInstcs::acntMapPtr = Q_NULLPTR;
class ImageProvider *GlobInstcs::imgProvPtr = Q_NULLPTR;
class ICloudHelper *GlobInstcs::iCloudHelperPtr = Q_NULLPTR;
class IosHelper *GlobInstcs::iOSHelperPtr = Q_NULLPTR;
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* You should have received a copy of the GNU General Public License
......@@ -43,7 +43,7 @@ class AccountsMap;
class ImageProvider;
class ICloudHelper;
class IosHelper;
/*!
* @brief The namespace holds pointers to all globally accessible structures.
......@@ -78,5 +78,5 @@ namespace GlobInstcs {
class ImageProvider *imgProvPtr; /*!< Image provider. */
extern
class ICloudHelper *iCloudHelperPtr; /*!< iCloud helper. */
class IosHelper *iOSHelperPtr; /*!< iOS helper. */
}
......@@ -36,7 +36,7 @@
#include <QtXml>
#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/io/records_management_db.h"
#include "src/datovka_shared/localisation/localisation.h"
......@@ -455,13 +455,13 @@ int main(int argc, char *argv[])
StringManipulation strManipulation;
Zfo zfo;
ICloudHelper iCloudHelper;
GlobInstcs::iCloudHelperPtr = new (std::nothrow) ICloudHelper;
if (GlobInstcs::iCloudHelperPtr == Q_NULLPTR) {
logErrorNL("%s", "Cannot create iCloud helper.");
IosHelper iOSHelper;
GlobInstcs::iOSHelperPtr = new (std::nothrow) IosHelper;
if (GlobInstcs::iOSHelperPtr == Q_NULLPTR) {
logErrorNL("%s", "Cannot create iOS helper.");
return EXIT_FAILURE;
}
GlobInstcs::iCloudHelperPtr = &iCloudHelper;
GlobInstcs::iOSHelperPtr = &iOSHelper;
/* Inicialize app delegate component for interaction with iOS
* Reaction on the iOS action "Open in..." */
......@@ -470,7 +470,7 @@ int main(int argc, char *argv[])
QtAppDelegateInitialize(&interactionZfoFile);
/* Clear send dir. */
iCloudHelper.clearSendDir();
iOSHelper.clearSendDir();
#endif
/*
......@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
ctx->setContextProperty("messages", &messages);
ctx->setContextProperty("accounts", &accounts);
ctx->setContextProperty("files", &files);
ctx->setContextProperty("iCloudHelper", &iCloudHelper);
ctx->setContextProperty("iOSHelper", &iOSHelper);
ctx->setContextProperty("gov", &gov);
ctx->setContextProperty("settings", &settings);
ctx->setContextProperty("strManipulation", &strManipulation);
......@@ -763,7 +763,7 @@ int main(int argc, char *argv[])
delete GlobInstcs::workPoolPtr; GlobInstcs::workPoolPtr = 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. */
......
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