• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
  • tasks
kopetedeletecontacttask.cpp
Go to the documentation of this file.
1 /*
2  kopetedeletecontacttask.h - Kopete Delete Contact Task
3 
4  Copyright (c) 2007 by MichaĆ«l Larouche <larouche@kde.org>
5 
6  Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
7 
8  *************************************************************************
9  * *
10  * This library is free software; you can redistribute it and/or *
11  * modify it under the terms of the GNU Lesser General Public *
12  * License as published by the Free Software Foundation; either *
13  * version 2 of the License, or (at your option) any later version. *
14  * *
15  *************************************************************************
16 */
17 #include "kopetedeletecontacttask.h"
18 
19 // Qt includes
20 
21 // KDE includes
22 #include <kdebug.h>
23 
24 // Kopete includes
25 #include <kopeteaccount.h>
26 #include <kopetecontact.h>
27 
28 namespace Kopete
29 {
30 
31 class DeleteContactTask::Private
32 {
33 public:
34 };
35 
36 DeleteContactTask::DeleteContactTask(QObject *parent)
37  : Kopete::ContactTaskBase(parent), d(new Private)
38 {
39 }
40 
41 DeleteContactTask::DeleteContactTask(Kopete::Contact *contact)
42  : Kopete::ContactTaskBase(contact), d(new Private)
43 {
44  setContact(contact);
45 }
46 
47 DeleteContactTask::~DeleteContactTask()
48 {
49  delete d;
50 }
51 
52 void DeleteContactTask::start()
53 {
54  Q_ASSERT( contact() );
55 
56  if( contact()->account() && !contact()->account()->isConnected() )
57  {
58  kDebug(14010) << "ERROR: Network is unavailable";
59 
60  setError( DeleteContactTask::NetworkUnavailableError );
61  emitResult();
62 
63  return;
64  }
65 
66  if( subjobs().empty() )
67  {
68  kDebug(14010) << "WARNING: This task does not contain protocol delete children task. Using default behavior, calling obsolete deleteContact()";
69 
70  contact()->deleteContact();
71  emitResult();
72 
73  return;
74  }
75 
76  // Call default implemention which execute sub jobs
77  Kopete::Task::start();
78 }
79 
80 void DeleteContactTask::slotResult(KJob *job)
81 {
82  KCompositeJob::slotResult(job);
83  // We executed all subjobs, delete the contact from memory.
84  // This is the default behavior from Kopete::Contact old deleteContact()
85  // method.
86  if( !job->error() && subjobs().empty() )
87  {
88  kDebug(14010) << "Deleting Kopete::Contact from memory";
89  contact()->deleteLater();
90  emitResult();
91  }
92 }
93 
94 QString DeleteContactTask::taskType() const
95 {
96  return QString("DeleteContactTask");
97 }
98 
99 } // namespace Kopete
100 
101 #include "kopetedeletecontacttask.moc"
Kopete::DeleteContactTask::start
virtual void start()
Begin the task.
Definition: kopetedeletecontacttask.cpp:52
Kopete::DeleteContactTask::slotResult
virtual void slotResult(KJob *subJob)
Execute the next sub job.
Definition: kopetedeletecontacttask.cpp:80
kopeteaccount.h
Kopete::Task::NetworkUnavailableError
The network is unavailable and thus cannot delete the contact.
Definition: kopetetask.h:65
Kopete::DeleteContactTask::DeleteContactTask
DeleteContactTask(QObject *parent=0)
Default constructor.
Definition: kopetedeletecontacttask.cpp:36
Kopete::Task::start
virtual void start()
Execute the task.
Definition: kopetetask.cpp:46
kopetedeletecontacttask.h
QObject
Kopete::ContactTaskBase::contact
Kopete::Contact * contact()
Get access to Kopete::Contact.
Definition: kopetecontacttaskbase.cpp:61
QObject::deleteLater
void deleteLater()
QString
Kopete::Contact
Definition: kopetecontact.h:58
Kopete::DeleteContactTask::taskType
QString taskType() const
Return Task Type.
Definition: kopetedeletecontacttask.cpp:94
Kopete::Contact::deleteContact
virtual KDE_DEPRECATED void deleteContact()
Definition: kopetecontact.cpp:516
Kopete::ContactTaskBase::setContact
void setContact(Kopete::Contact *contact)
Set the contact.
Definition: kopetecontacttaskbase.cpp:48
Kopete::DeleteContactTask::~DeleteContactTask
~DeleteContactTask()
Definition: kopetedeletecontacttask.cpp:47
KJob
kopetecontact.h
Kopete::ContactTaskBase
Base tasks for all contact related tasks.
Definition: kopetecontacttaskbase.h:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal