Messagelib

jobbase.cpp
1 /*
2  SPDX-FileCopyrightText: 2009 Constantin Berzan <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "jobbase.h"
8 
9 #include "composer/composer.h"
10 #include "job/jobbase_p.h"
11 
12 #include "messagecomposer_debug.h"
13 
14 using namespace MessageComposer;
15 
16 JobBase::JobBase(QObject *parent)
17  : KCompositeJob(parent)
18  , d_ptr(new JobBasePrivate(this))
19 {
20 }
21 
22 JobBase::JobBase(JobBasePrivate &dd, QObject *parent)
23  : KCompositeJob(parent)
24  , d_ptr(&dd)
25 {
26 }
27 
28 JobBase::~JobBase()
29 {
30  delete d_ptr;
31 }
32 
33 GlobalPart *JobBase::globalPart()
34 {
35  for (QObject *obj = this; obj != nullptr; obj = obj->parent()) {
36  auto composer = qobject_cast<Composer *>(obj);
37  if (composer) {
38  return composer->globalPart();
39  }
40  }
41 
42  qCCritical(MESSAGECOMPOSER_LOG) << "Job is not part of a Composer.";
43  return nullptr;
44 }
The GlobalPart class.
Definition: globalpart.h:18
The Composer class.
Definition: composer.h:33
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
QObject * parent() const const
Item * parent() const
Returns the parent Item in the tree, or 0 if this item isn&#39;t attached to the tree.
Definition: item.cpp:437
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 06:45:32 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.