Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / libkopete / ui / editaccountwidget.h
blob2ac6fe31866caa3a09a3916b5d6e4e41f26133d0
1 /*
2 editaccountwidget.h - Kopete Account Widget
4 Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
5 Copyright (c) 2003 by Olivier Goffart <ogoffart@kde.org>
7 Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
10 * *
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2 of the License, or (at your option) any later version. *
15 * *
16 *************************************************************************
19 #ifndef EDITACCOUNTWIDGET_H
20 #define EDITACCOUNTWIDGET_H
22 #include "kopete_export.h"
24 namespace Kopete
26 class Account;
29 class KopeteEditAccountWidgetPrivate;
31 /**
32 * @author Olivier Goffart <ogoffart@kde.org>
34 * This class is used by the protocol plugins to add specific protocol fields in the add account wizard,
35 * or in the account preferences. If the given account is 0L, then you will have to create a new account
36 * in @ref apply().
38 * Each protocol has to subclass this class, and the protocol's edit account page MUST inherits from
39 * QWidget too.
41 * We suggest to put at least these fields in the page:
43 * - The User login, or the accountId. you can retrieve it from @ref Kopete::Account::accountId(). This
44 * field has to be marked as ReadOnly or shown as a label if the account already exists. Remember
45 * that accountId should be constant after account creation!
47 * - The password, and the remember password checkboxes.
49 * - The auto connect checkbox: use @ref Kopete::Account::excludeConnect() and
50 * @ref Kopete::Account::setExcludeConnect() to get/set this flag.
52 * You may add other custom fields, e.g. the nickname. To save or retrieve these settings use
53 * @ref Kopete::ContactListElement::pluginData() with your protocol as plugin.
55 class KOPETE_EXPORT KopeteEditAccountWidget
57 public:
58 /**
59 * Constructor.
61 * If 'account' is 0L we are in the 'add account wizard', otherwise
62 * we are editing an existing account.
64 explicit KopeteEditAccountWidget( Kopete::Account *account );
66 /**
67 * Destructor
69 virtual ~KopeteEditAccountWidget();
71 /**
72 * This method must be reimplemented.
73 * It does the same as @ref AddContactPage::validateData()
75 virtual bool validateData() = 0;
77 /**
78 * Create a new account if we are in the 'add account wizard',
79 * otherwise update the existing account.
81 virtual Kopete::Account *apply() = 0;
83 protected:
84 /**
85 * Get a pointer to the Kopete::Account passed to the constructor.
86 * You can modify it any way you like, just don't delete the object.
88 Kopete::Account * account() const;
90 /**
91 * Set the account
93 // FIXME: Is it possible to make the API not require this? A const account
94 // in this widget seems a lot cleaner to me - Martijn
95 void setAccount( Kopete::Account *account );
97 private:
98 KopeteEditAccountWidgetPrivate *d;
101 // vim: set noet ts=4 sts=4 sw=4:
103 #endif