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

Delete tmp files after export

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