Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanek Bevendorff <janek@jbev.net>2018-10-19 21:10:37 +0300
committerJanek Bevendorff <janek@jbev.net>2018-10-19 22:49:55 +0300
commit108e4efc8ad280142653d2f6ce3a7e3a630ee2f2 (patch)
treeee0ed6994a84735b5177a75a2612e651dd1394ff /tests/util/TemporaryFile.cpp
parent113c8eb702dbdfefaf23a76bfe69603b54522b28 (diff)
Fix tests on Windows
Diffstat (limited to 'tests/util/TemporaryFile.cpp')
-rw-r--r--tests/util/TemporaryFile.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/util/TemporaryFile.cpp b/tests/util/TemporaryFile.cpp
new file mode 100644
index 000000000..476313b02
--- /dev/null
+++ b/tests/util/TemporaryFile.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * 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
+ * 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/>.
+ */
+
+#include "TemporaryFile.h"
+
+#ifdef Q_OS_WIN
+
+TemporaryFile::TemporaryFile()
+ : TemporaryFile(nullptr)
+{
+}
+
+TemporaryFile::TemporaryFile(const QString& templateName)
+ : TemporaryFile(templateName, nullptr)
+{
+}
+
+TemporaryFile::TemporaryFile(QObject* parent)
+ : QFile(parent)
+{
+ QTemporaryFile tmp;
+ tmp.open();
+ QFile::setFileName(tmp.fileName());
+ tmp.close();
+}
+
+TemporaryFile::TemporaryFile(const QString& templateName, QObject* parent)
+ : QFile(parent)
+{
+ QTemporaryFile tmp(templateName);
+ tmp.open();
+ QFile::setFileName(tmp.fileName());
+ tmp.close();
+}
+
+bool TemporaryFile::open()
+{
+ return QFile::open(QIODevice::ReadWrite);
+}
+
+#endif