File indexing completed on 2023-12-03 08:28:33

0001 /*
0002  * Copyright (C) 2013  Daniel Vrátil <dvratil@redhat.com>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
0017  *
0018  */
0019 
0020 #include "pending-logger-operation.h"
0021 #include "log-manager-private.h"
0022 
0023 using namespace KTp;
0024 
0025 class PendingLoggerOperation::Private
0026 {
0027   public:
0028     Private(PendingLoggerOperation *parent);
0029     QString error;
0030 
0031     void __k__doEmitFinished();
0032 
0033   private:
0034     PendingLoggerOperation *q;
0035 };
0036 
0037 PendingLoggerOperation::Private::Private(PendingLoggerOperation *parent):
0038     q(parent)
0039 {
0040 }
0041 
0042 void PendingLoggerOperation::Private::__k__doEmitFinished()
0043 {
0044     Q_EMIT q->finished(q);
0045     q->deleteLater();
0046 }
0047 
0048 
0049 PendingLoggerOperation::PendingLoggerOperation(QObject *parent):
0050     QObject(parent),
0051     d(new Private(this))
0052 {
0053 }
0054 
0055 PendingLoggerOperation::~PendingLoggerOperation()
0056 {
0057     delete d;
0058 }
0059 
0060 bool PendingLoggerOperation::hasError() const
0061 {
0062     return !d->error.isEmpty();
0063 }
0064 
0065 QString PendingLoggerOperation::error() const
0066 {
0067     return d->error;
0068 }
0069 
0070 void PendingLoggerOperation::setError(const QString &error)
0071 {
0072     d->error = error;
0073 }
0074 
0075 void PendingLoggerOperation::emitFinished()
0076 {
0077     QTimer::singleShot(0, this, SLOT(__k__doEmitFinished()));
0078 }
0079 
0080 QList<AbstractLoggerPlugin*> PendingLoggerOperation::plugins() const
0081 {
0082     return LogManager::instance()->d->plugins;
0083 }
0084 
0085 #include "moc_pending-logger-operation.cpp"