From 7930560be685d178d9c147430f739effd5653684 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 16 Apr 2014 23:41:35 +0200 Subject: [PATCH] refs #209, fileExists method (remote enabled) --- src/blackcore/context_application.h | 3 +++ src/blackcore/context_application_impl.cpp | 9 +++++++++ src/blackcore/context_application_impl.h | 3 +++ src/blackcore/context_application_proxy.h | 3 +++ 4 files changed, 18 insertions(+) diff --git a/src/blackcore/context_application.h b/src/blackcore/context_application.h index f043d72a6..f1d969383 100644 --- a/src/blackcore/context_application.h +++ b/src/blackcore/context_application.h @@ -127,6 +127,9 @@ namespace BlackCore //! Remote enabled version of deleting a file virtual bool removeFile(const QString &fileName) = 0; + //! Remote enabled version of file exists + virtual bool existsFile(const QString &fileName) = 0; + private: //! All contexts, used with messageHandler static QList s_contexts; diff --git a/src/blackcore/context_application_impl.cpp b/src/blackcore/context_application_impl.cpp index 1a632126a..898fe2378 100644 --- a/src/blackcore/context_application_impl.cpp +++ b/src/blackcore/context_application_impl.cpp @@ -99,4 +99,13 @@ namespace BlackCore return QFile::remove(fileName); } + /* + * Check file + */ + bool CContextApplication::existsFile(const QString &fileName) + { + if (fileName.isEmpty()) return false; + return QFile::exists(fileName); + } + } // namespace diff --git a/src/blackcore/context_application_impl.h b/src/blackcore/context_application_impl.h index a8a078dc9..c8862af3e 100644 --- a/src/blackcore/context_application_impl.h +++ b/src/blackcore/context_application_impl.h @@ -45,6 +45,9 @@ namespace BlackCore //! \copydoc IContextApplication::removeFile virtual bool removeFile(const QString &fileName) override; + //! \copydoc IContextApplication::existsFile + virtual bool existsFile(const QString &fileName) override; + protected: //! Constructor CContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime); diff --git a/src/blackcore/context_application_proxy.h b/src/blackcore/context_application_proxy.h index 318aa623a..3626a57fb 100644 --- a/src/blackcore/context_application_proxy.h +++ b/src/blackcore/context_application_proxy.h @@ -46,6 +46,9 @@ namespace BlackCore //! \copydoc IContextApplication::removeFile virtual bool removeFile(const QString &fileName) override; + //! \copydoc IContextApplication::existsFile + virtual bool existsFile(const QString &fileName) override; + protected: //! Constructor CContextApplicationProxy(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : IContextApplication(mode, runtime), m_dBusInterface(nullptr) {}