Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / protocols / groupwise / libgroupwise / task.h
blobb2c7446a7816a89db32793d5b96bc6f26882b0eb
1 /*
2 task.h - Kopete Groupwise Protocol
4 Copyright (c) 2004 SUSE Linux AG http://www.suse.com
6 Based on Iris, Copyright (C) 2003 Justin Karneges <justin@affinix.com>
8 Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
10 *************************************************************************
11 * *
12 * This library is free software; you can redistribute it and/or *
13 * modify it under the terms of the GNU Lesser General Public *
14 * License as published by the Free Software Foundation; either *
15 * version 2 of the License, or (at your option) any later version. *
16 * *
17 *************************************************************************
20 #ifndef GW_TASK_H
21 #define GW_TASK_H
23 #include <qobject.h>
25 #include "gwerror.h"
26 #include "gwfield.h"
27 #include "libgroupwise_export.h"
28 #include "transfer.h"
30 class Client;
31 class Request;
33 class LIBGROUPWISE_EXPORT Task : public QObject
35 Q_OBJECT
36 public:
37 enum { ErrDisc };
38 Task(Task *parent);
39 Task( Client *, bool isRoot );
40 virtual ~Task();
42 Task *parent() const;
43 Client *client() const;
44 Transfer *transfer() const;
46 QString id() const;
48 bool success() const;
49 int statusCode() const;
50 const QString & statusString() const;
52 void go( bool autoDelete=false );
53 /**
54 * Allows a task to examine an incoming Transfer and decide whether to 'take' it
55 * for further processing.
57 virtual bool take( Transfer* transfer );
58 void safeDelete();
60 signals:
61 void finished();
63 protected:
64 virtual void onGo();
65 virtual void onDisconnect();
66 void send( Request * request );
67 void setSuccess( int code=0, const QString &str="" );
68 /**
69 * If an empty string is passed, this sets the error string based on the error code using GroupWise::errorCodeToString
71 void setError( int code=0, const QString &str="" );
72 // void debug( const char *, ... );
73 void debug( const QString & );
74 /**
75 * Used in take() to check if the offered transfer is for this Task
76 * @return true if this Task should take the Transfer. Default impl always returns false.
78 virtual bool forMe( const Transfer * transfer ) const;
79 /**
80 * Creates a transfer with the given command and field list
82 void createTransfer( const QString & command, const Field::FieldList fields );
83 /**
84 * Direct setter for Tasks which don't have any fields
86 void setTransfer( Transfer * transfer );
87 private slots:
88 void clientDisconnected();
89 void done();
91 private:
92 void init();
94 class TaskPrivate;
95 TaskPrivate *d;
98 #endif