summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-06-05 16:07:37 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-06-05 16:07:37 +0200
commitae55044fe476262f68ef8ffddbad168b55bdfe6b (patch)
tree7f61caf12d11c51a189e93107835cb2d217b942f
parent68fa07ac7849934c6245346873147ff9963d22a3 (diff)
downloadkube-ae55044fe476262f68ef8ffddbad168b55bdfe6b.tar.gz
kube-ae55044fe476262f68ef8ffddbad168b55bdfe6b.zip
Unused
-rw-r--r--framework/src/domain/mime/mimetreeparser/CMakeLists.txt1
-rw-r--r--framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.cpp108
-rw-r--r--framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.h57
-rw-r--r--framework/src/domain/mime/mimetreeparser/nodehelper.cpp1
-rw-r--r--framework/src/domain/mime/mimetreeparser/nodehelper.h8
5 files changed, 0 insertions, 175 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/CMakeLists.txt b/framework/src/domain/mime/mimetreeparser/CMakeLists.txt
index 1497c30f..a7e7cd9e 100644
--- a/framework/src/domain/mime/mimetreeparser/CMakeLists.txt
+++ b/framework/src/domain/mime/mimetreeparser/CMakeLists.txt
@@ -51,7 +51,6 @@ set(libmimetreeparser_SRCS
51 mimetreeparser_debug.cpp 51 mimetreeparser_debug.cpp
52 qgpgmejobexecutor.cpp 52 qgpgmejobexecutor.cpp
53 util.cpp 53 util.cpp
54 attachmenttemporaryfilesdirs.cpp
55 ) 54 )
56 55
57add_library(kube_otp ${libmimetreeparser_SRCS}) 56add_library(kube_otp ${libmimetreeparser_SRCS})
diff --git a/framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.cpp b/framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.cpp
deleted file mode 100644
index 364bc422..00000000
--- a/framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 Copyright (c) 2013-2017 Montel Laurent <montel@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18
19*/
20
21#include "attachmenttemporaryfilesdirs.h"
22
23#include <QDir>
24#include <QFile>
25#include <QTimer>
26
27using namespace MimeTreeParser;
28
29class MimeTreeParser::AttachmentTemporaryFilesDirsPrivate
30{
31public:
32 AttachmentTemporaryFilesDirsPrivate()
33 : mDelayRemoveAll(10000)
34 {
35
36 }
37 QStringList mTempFiles;
38 QStringList mTempDirs;
39 int mDelayRemoveAll;
40};
41
42AttachmentTemporaryFilesDirs::AttachmentTemporaryFilesDirs(QObject *parent)
43 : QObject(parent),
44 d(new AttachmentTemporaryFilesDirsPrivate)
45{
46
47}
48
49AttachmentTemporaryFilesDirs::~AttachmentTemporaryFilesDirs()
50{
51 delete d;
52}
53
54void AttachmentTemporaryFilesDirs::setDelayRemoveAllInMs(int ms)
55{
56 d->mDelayRemoveAll = (ms < 0) ? 0 : ms;
57}
58
59void AttachmentTemporaryFilesDirs::removeTempFiles()
60{
61 QTimer::singleShot(d->mDelayRemoveAll, this, &AttachmentTemporaryFilesDirs::slotRemoveTempFiles);
62}
63
64void AttachmentTemporaryFilesDirs::forceCleanTempFiles()
65{
66 QStringList::ConstIterator end = d->mTempFiles.constEnd();
67 for (QStringList::ConstIterator it = d->mTempFiles.constBegin(); it != end; ++it) {
68 QFile::remove(*it);
69 }
70 d->mTempFiles.clear();
71 end = d->mTempDirs.constEnd();
72 for (QStringList::ConstIterator it = d->mTempDirs.constBegin(); it != end; ++it) {
73 QDir(*it).rmdir(*it);
74 }
75 d->mTempDirs.clear();
76}
77
78void AttachmentTemporaryFilesDirs::slotRemoveTempFiles()
79{
80 forceCleanTempFiles();
81 //Delete it after cleaning
82 deleteLater();
83}
84
85void AttachmentTemporaryFilesDirs::addTempFile(const QString &file)
86{
87 if (!d->mTempFiles.contains(file)) {
88 d->mTempFiles.append(file);
89 }
90}
91
92void AttachmentTemporaryFilesDirs::addTempDir(const QString &dir)
93{
94 if (!d->mTempDirs.contains(dir)) {
95 d->mTempDirs.append(dir);
96 }
97}
98
99QStringList AttachmentTemporaryFilesDirs::temporaryFiles() const
100{
101 return d->mTempFiles;
102}
103
104QStringList AttachmentTemporaryFilesDirs::temporaryDirs() const
105{
106 return d->mTempDirs;
107}
108
diff --git a/framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.h b/framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.h
deleted file mode 100644
index bf65fcdb..00000000
--- a/framework/src/domain/mime/mimetreeparser/attachmenttemporaryfilesdirs.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 Copyright (c) 2013-2016 Montel Laurent <montel@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18
19*/
20
21#ifndef ATTACHMENTTEMPORARYFILESDIRS_H
22#define ATTACHMENTTEMPORARYFILESDIRS_H
23
24#include <QObject>
25#include <QStringList>
26
27namespace MimeTreeParser
28{
29class AttachmentTemporaryFilesDirsPrivate;
30
31class AttachmentTemporaryFilesDirs : public QObject
32{
33 Q_OBJECT
34public:
35 explicit AttachmentTemporaryFilesDirs(QObject *parent = nullptr);
36 ~AttachmentTemporaryFilesDirs();
37
38 void addTempFile(const QString &file);
39 void addTempDir(const QString &dir);
40 QStringList temporaryFiles() const;
41 void removeTempFiles();
42 void forceCleanTempFiles();
43
44 QStringList temporaryDirs() const;
45
46 void setDelayRemoveAllInMs(int ms);
47
48private Q_SLOTS:
49 void slotRemoveTempFiles();
50
51private:
52 AttachmentTemporaryFilesDirsPrivate *const d;
53};
54
55}
56
57#endif // ATTACHMENTTEMPORARYFILESDIRS_H
diff --git a/framework/src/domain/mime/mimetreeparser/nodehelper.cpp b/framework/src/domain/mime/mimetreeparser/nodehelper.cpp
index bbd705f9..a8af4e19 100644
--- a/framework/src/domain/mime/mimetreeparser/nodehelper.cpp
+++ b/framework/src/domain/mime/mimetreeparser/nodehelper.cpp
@@ -21,7 +21,6 @@
21#include "mimetreeparser_debug.h" 21#include "mimetreeparser_debug.h"
22#include "partmetadata.h" 22#include "partmetadata.h"
23#include "bodypart.h" 23#include "bodypart.h"
24#include "attachmenttemporaryfilesdirs.h"
25 24
26#include <KMime/Content> 25#include <KMime/Content>
27#include <KMime/Message> 26#include <KMime/Message>
diff --git a/framework/src/domain/mime/mimetreeparser/nodehelper.h b/framework/src/domain/mime/mimetreeparser/nodehelper.h
index 3a39fb6e..6db6de05 100644
--- a/framework/src/domain/mime/mimetreeparser/nodehelper.h
+++ b/framework/src/domain/mime/mimetreeparser/nodehelper.h
@@ -34,14 +34,6 @@ class QTextCodec;
34 34
35namespace MimeTreeParser 35namespace MimeTreeParser
36{ 36{
37class AttachmentTemporaryFilesDirs;
38namespace Interface
39{
40}
41}
42
43namespace MimeTreeParser
44{
45 37
46/** 38/**
47 * @author Andras Mantia <andras@kdab.net> 39 * @author Andras Mantia <andras@kdab.net>