Commit 25fc8328 authored by Martin Straka's avatar Martin Straka

Delete tmp files after export

parent 9b0be45f
...@@ -62,7 +62,6 @@ Dialog { ...@@ -62,7 +62,6 @@ Dialog {
property int selectedFileIndex: -1 property int selectedFileIndex: -1
property bool showDirs: true property bool showDirs: true
property bool showFiles: true property bool showFiles: true
property bool iOS: false
signal finished(variant pathListModel) signal finished(variant pathListModel)
...@@ -70,8 +69,7 @@ Dialog { ...@@ -70,8 +69,7 @@ Dialog {
return (root.showDirs && !root.showFiles); return (root.showDirs && !root.showFiles);
} }
function raise(title, filters, showFiles, targetLocation, isiOS) { function raise(title, filters, showFiles, targetLocation) {
iOS = isiOS
if (targetLocation !== "") { if (targetLocation !== "") {
folderNavigation.visible = false folderNavigation.visible = false
folderModel.folder = "file://" + targetLocation folderModel.folder = "file://" + targetLocation
...@@ -82,9 +80,6 @@ Dialog { ...@@ -82,9 +80,6 @@ Dialog {
if (filters !== "") { if (filters !== "") {
folderModel.nameFilters = filters folderModel.nameFilters = filters
} }
if (iOS) {
folderModel.folder = standardLocationUrl(InteractionFilesystem.DOCUMENTS_LOCATION)
}
selectedFileIndex = -1 selectedFileIndex = -1
// clear add path list model // clear add path list model
pathListModel.clear() pathListModel.clear()
...@@ -133,7 +128,6 @@ Dialog { ...@@ -133,7 +128,6 @@ Dialog {
ColumnLayout { ColumnLayout {
id: folderNavigation id: folderNavigation
AccessibleComboBox { AccessibleComboBox {
visible: !iOS
anchors { anchors {
left: parent.left; left: parent.left;
right: parent.right; right: parent.right;
......
...@@ -218,7 +218,7 @@ Item { ...@@ -218,7 +218,7 @@ Item {
Component.onDestruction: { Component.onDestruction: {
if (iOS) { if (iOS) {
iOSHelper.clearSendDir() iOSHelper.clearSendAndTmpDirs()
} }
statusBar.visible = false statusBar.visible = false
} }
...@@ -510,28 +510,14 @@ Item { ...@@ -510,28 +510,14 @@ Item {
} }
} }
} }
Row {
id: buttonBar
spacing: formItemVerticalSpacing * 2
anchors.horizontalCenter: parent.horizontalCenter
AccessibleButton { AccessibleButton {
id: addFile id: addFile
height: inputItemHeight height: inputItemHeight
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: defaultTextFont.font.pointSize font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Add file") text: qsTr("Add file")
onClicked: { onClicked: {
fileDialogue.raise(qsTr("Select files"), ["*.*"], true, "", iOS) iOS ? iOSHelper.openDocumentPickerController() : fileDialogue.raise(qsTr("Select files"), ["*.*"], true, "")
}
}
AccessibleButton {
id: storage
visible: iOS
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
text: qsTr("Storage")
onClicked: {
iOSHelper.openDocumentPickerController()
}
} }
} }
Component { Component {
...@@ -674,7 +660,7 @@ Item { ...@@ -674,7 +660,7 @@ Item {
color: datovkaPalette.text color: datovkaPalette.text
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: defaultMargin anchors.leftMargin: defaultMargin
anchors.top: buttonBar.bottom anchors.top: addFile.bottom
anchors.topMargin: defaultMargin anchors.topMargin: defaultMargin
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: defaultMargin anchors.rightMargin: defaultMargin
......
...@@ -138,17 +138,14 @@ QString IosHelper::getShortSendFilePath(const QString &sandBoxFilePath) ...@@ -138,17 +138,14 @@ QString IosHelper::getShortSendFilePath(const QString &sandBoxFilePath)
#endif #endif
} }
void IosHelper::clearSendDir(void) void IosHelper::clearSendAndTmpDirs(void)
{ {
debugFuncCall(); debugFuncCall();
QDir dir(appSendDirPath()); QDir dir(appSendDirPath());
dir.removeRecursively(); dir.removeRecursively();
/* dir.setPath(appTmpDirPath());
// TODO - used for experiments and testing only dir.removeRecursively();
QDir dir2(dfltAttachSavingLoc());
dir2.removeRecursively();
*/
} }
void IosHelper::openDocumentPickerController(void) void IosHelper::openDocumentPickerController(void)
......
...@@ -60,10 +60,10 @@ public: ...@@ -60,10 +60,10 @@ public:
void storeFilesToDeviceStorage(const QStringList &srcFilePaths); void storeFilesToDeviceStorage(const QStringList &srcFilePaths);
/*! /*!
* @brief Clear send folder. * @brief Clear send and tmp folder.
*/ */
Q_INVOKABLE Q_INVOKABLE
void clearSendDir(void); void clearSendAndTmpDirs(void);
/*! /*!
* @brief Create and open document picker controller. * @brief Create and open document picker controller.
......
...@@ -726,12 +726,21 @@ void Files::saveMsgFilesToDisk(const QString &userName, ...@@ -726,12 +726,21 @@ void Files::saveMsgFilesToDisk(const QString &userName,
documents.append(document); documents.append(document);
} }
QString filePath(appMsgAttachDirPath(msgIdStr)); QString targetPath;
#ifdef Q_OS_IOS
targetPath = appMsgAttachDirPathiOS(msgIdStr);
#else
targetPath = appMsgAttachDirPath(msgIdStr);
#endif
QString destFilePath; QString destFilePath;
QStringList destFilePaths; QStringList destFilePaths;
foreach (const Isds::Document &document, documents) { foreach (const Isds::Document &document, documents) {
destFilePath = writeFile(filePath, document.fileDescr(), destFilePath = writeFile(targetPath, document.fileDescr(),
document.binaryContent()); document.binaryContent());
if (!destFilePath.isEmpty()) { if (!destFilePath.isEmpty()) {
destFilePaths.append(destFilePath); destFilePaths.append(destFilePath);
...@@ -762,7 +771,16 @@ void Files::saveAttachmentsToDiskZfo(const QVariant &attachModelVariant, ...@@ -762,7 +771,16 @@ void Files::saveAttachmentsToDiskZfo(const QVariant &attachModelVariant,
return; return;
} }
QString targetPath(appMsgAttachDirPath(msgIdStr)); QString targetPath;
#ifdef Q_OS_IOS
targetPath = appMsgAttachDirPathiOS(msgIdStr);
#else
targetPath = appMsgAttachDirPath(msgIdStr);
#endif
QString destFilePath; QString destFilePath;
QStringList destFilePaths; QStringList destFilePaths;
......
...@@ -72,6 +72,12 @@ QString appMsgAttachDirPath(const QString &msgIdStr) ...@@ -72,6 +72,12 @@ QString appMsgAttachDirPath(const QString &msgIdStr)
return existingAppPath(dfltAttachSavingLoc(), msgIdStr); return existingAppPath(dfltAttachSavingLoc(), msgIdStr);
} }
QString appMsgAttachDirPathiOS(const QString &msgIdStr)
{
return existingAppPath(dfltAttachSavingLoc(),
QStringLiteral(DATOVKA_TEMP_DIR_NAME) + QDir::separator() + msgIdStr);
}
QString appTmpDirPath(void) QString appTmpDirPath(void)
{ {
return existingAppPath(dfltAttachSavingLoc(), DATOVKA_TEMP_DIR_NAME); return existingAppPath(dfltAttachSavingLoc(), DATOVKA_TEMP_DIR_NAME);
......
...@@ -88,6 +88,15 @@ QString appLogDirPath(void); ...@@ -88,6 +88,15 @@ QString appLogDirPath(void);
*/ */
QString appMsgAttachDirPath(const QString &msgIdStr); QString appMsgAttachDirPath(const QString &msgIdStr);
/*!
* @brief Return path to location where attachments of a particular message
* can be stored for iOS.
*
* @param[in] msgIdStr String containing message identifier.
* @return Full path containing the supplied identifier.
*/
QString appMsgAttachDirPathiOS(const QString &msgIdStr);
/*! /*!
* @brief Return path to location where temporary files can be stored. * @brief Return path to location where temporary files can be stored.
* *
......
...@@ -470,8 +470,8 @@ int main(int argc, char *argv[]) ...@@ -470,8 +470,8 @@ int main(int argc, char *argv[])
GlobInstcs::iOSHelperPtr = &iOSHelper; GlobInstcs::iOSHelperPtr = &iOSHelper;
/* Clear send dir. */ /* Clear send and tmp dir (iOS only). */
iOSHelper.clearSendDir(); iOSHelper.clearSendAndTmpDirs();
#endif #endif
/* /*
......
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