From d258759ac93a920ad0c01e21e7d2f47c03b3f612 Mon Sep 17 00:00:00 2001 From: "Anselmo L. S. Melo" Date: Sat, 10 Aug 2013 18:19:41 -0300 Subject: [PATCH] Port from KTemporaryFile to QTemporaryFile REVIEW: 112742 --- effects/screenshot/screenshot.cpp | 6 +++--- egl_wayland_backend.cpp | 4 ++-- egl_wayland_backend.h | 4 ++-- kcmkwin/kwincompositing/main.cpp | 1 + kcmkwin/kwincompositing/main.h | 4 ++-- rules.cpp | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index 530a662768..597b7b7ec7 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -21,8 +21,9 @@ along with this program. If not, see . #include "screenshot.h" #include #include -#include #include +#include +#include #include #include #include @@ -304,8 +305,7 @@ QString ScreenShotEffect::blitScreenshot(const QRect &geometry) #endif } - KTemporaryFile temp; - temp.setSuffix(QStringLiteral(".png")); + QTemporaryFile temp(QDir::tempPath() + QDir::separator() + QLatin1String("kwin_screenshot_XXXXXX.png")); temp.setAutoRemove(false); if (!temp.open()) { return QString(); diff --git a/egl_wayland_backend.cpp b/egl_wayland_backend.cpp index b5726ce43a..9d0ff1ecff 100644 --- a/egl_wayland_backend.cpp +++ b/egl_wayland_backend.cpp @@ -26,9 +26,9 @@ along with this program. If not, see . #include // KDE #include -#include // Qt #include +#include // xcb #include // Wayland @@ -398,7 +398,7 @@ ShmPool::ShmPool(wl_shm *shm) , m_pool(NULL) , m_poolData(NULL) , m_size(1024 * 1024) // TODO: useful size? - , m_tmpFile(new KTemporaryFile()) + , m_tmpFile(new QTemporaryFile()) , m_valid(createPool()) , m_offset(0) { diff --git a/egl_wayland_backend.h b/egl_wayland_backend.h index 66519372f9..c2ee2f1554 100644 --- a/egl_wayland_backend.h +++ b/egl_wayland_backend.h @@ -26,7 +26,7 @@ along with this program. If not, see . // xcb #include -class KTemporaryFile; +class QTemporaryFile; struct wl_buffer; struct wl_shm; @@ -89,7 +89,7 @@ private: wl_shm_pool *m_pool; void *m_poolData; size_t m_size; - QScopedPointer m_tmpFile; + QScopedPointer m_tmpFile; bool m_valid; int m_offset; }; diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index c922121101..9013e8b269 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -45,6 +45,7 @@ along with this program. If not, see . #include #include #include +#include #include #include #include diff --git a/kcmkwin/kwincompositing/main.h b/kcmkwin/kwincompositing/main.h index 496c445073..a9612aa499 100644 --- a/kcmkwin/kwincompositing/main.h +++ b/kcmkwin/kwincompositing/main.h @@ -24,7 +24,6 @@ along with this program. If not, see . #include #include -#include #include "kwin_interface.h" @@ -34,6 +33,7 @@ along with this program. If not, see . class KPluginSelector; class KActionCollection; class QLabel; +class QTemporaryFile; namespace KWin { @@ -95,7 +95,7 @@ private: Ui::KWinCompositingConfig ui; QMap mPreviousConfig; - KTemporaryFile mTmpConfigFile; + QTemporaryFile mTmpConfigFile; KSharedConfigPtr mTmpConfig; bool m_showConfirmDialog; KActionCollection* m_actionCollection; diff --git a/rules.cpp b/rules.cpp index 9476c27d9d..212bd0f1dc 100644 --- a/rules.cpp +++ b/rules.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . #include #include #include -#include +#include #include #include #include @@ -86,7 +86,7 @@ Rules::Rules() Rules::Rules(const QString& str, bool temporary) : temporary_state(temporary ? 2 : 0) { - KTemporaryFile file; + QTemporaryFile file; if (file.open()) { QByteArray s = str.toUtf8(); file.write(s.data(), s.length());