Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / libkopete / tasks / kopetedeletecontacttask.h
blobc4eb145e13f905ebb257a0ce055ba2e27e679eb2
1 /*
2 kopetedeletecontacttask.h - Kopete Delete Contact Task
4 Copyright (c) 2007 by Michaël Larouche <larouche@kde.org>
6 Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
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 *************************************************************************
17 #ifndef KOPETE_DELETECONTACTTASK_H
18 #define KOPETE_DELETECONTACTTASK_H
20 #include <kopete_export.h>
21 #include <kopetecontacttaskbase.h>
23 namespace Kopete
26 class Contact;
27 /**
28 * @brief Delete a contact in Kopete
30 * Example code:
31 * @code
32 Kopete::DeleteContactTask *deleteTask = new Kopete::DeleteContactTask(aContact);
33 deleteTask->addSubTask( new JabberDeleteContactTask(aContact) );
34 connect(deleteTask, SIGNAL(result(KJob*)), receiver, SLOT(slotResult(KJob*)));
35 deleteTask->start();
36 * @endcode
38 * @section protocol_delete Implementing protocol subtask for deleting
39 * It is a good idea to inherit from DeleteContactTask. In your implementation
40 * of start() method, please DO NOT call parent start() method from DeleteContactTask.
42 * DeleteContactTask will delete the contact after the subjob,
43 * so you don't need to explicit call deleteLater() on contact.
45 * Also, you don't need to check if the network(or account if you prefer)
46 * is available, DeleteContactTask do it for you.
48 * The name of this task is "DeleteContactTask".
50 * @author Michaël Larouche <larouche@kde.org>
52 class KOPETE_EXPORT DeleteContactTask : public Kopete::ContactTaskBase
54 Q_OBJECT
55 public:
56 /**
57 * @brief Default constructor
59 * You must set the contact to delete with setContact()
61 DeleteContactTask(QObject *parent = 0); //implicit
63 /**
64 * @brief Delete the given contact
65 * @param contact Kopete contact to delete
67 explicit DeleteContactTask(Kopete::Contact *contact);
69 /**
70 * @internal
71 * Destructor
73 ~DeleteContactTask();
75 /**
76 * @brief Begin the task.
77 * Inherited from Kopete::Task::start()
79 virtual void start();
81 protected Q_SLOTS:
82 /**
83 * @brief Execute the next sub job
85 * This slot is called when a subjob has finished.
86 * @param subJob sub job that has been finished.
88 virtual void slotResult(KJob *subJob);
90 protected:
91 /**
92 * @brief Return Task Type
93 * @return DeleteContactTask
95 QString taskType() const;
96 private:
97 class Private;
98 Private * const d;
103 #endif