From e06e1dad4a4570e5c1181d05ab6ed7a5d74c6c91 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 3 May 2016 20:24:09 +0200 Subject: A save-as-draft action & action results This patch introduces tracking of actions, so they can be tested. It also provides a save-as-draft action, that looks for the draft folder, and stores the mail accordingly. --- framework/actions/actionresult.h | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 framework/actions/actionresult.h (limited to 'framework/actions/actionresult.h') diff --git a/framework/actions/actionresult.h b/framework/actions/actionresult.h new file mode 100644 index 00000000..cdc6a160 --- /dev/null +++ b/framework/actions/actionresult.h @@ -0,0 +1,66 @@ +/* + Copyright (c) 2016 Christian Mollekopf + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library 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 Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#pragma once + +#include +#include + +namespace Kube { + +struct ActionResultData +{ + ActionResultData() : mError(0), mDone(false) {} + int mError; + bool mDone; +}; + +class ActionResult : public QObject +{ + Q_OBJECT +public: + ActionResult() : QObject(), mData(new ActionResultData()) {} + ActionResult(const ActionResult &rhs) : QObject(), mData(rhs.mData) {} + ActionResult &operator=(const ActionResult &rhs) + { + mData = rhs.mData; + return *this; + } + virtual ~ActionResult() {} + + void setDone() { + mData->mDone = true; + } + + bool isDone() const { + return mData->mDone; + } + + void setError(int error) { + mData->mError = error; + } + + int error() const { + return mData->mError; + } + +private: + QSharedPointer mData; +}; + +} -- cgit v1.2.3