File indexing completed on 2024-04-28 04:55:40
0001 /* 0002 This file is part of Choqok, the KDE micro-blogging client 0003 0004 SPDX-FileCopyrightText: 2008-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0007 */ 0008 0009 #ifndef EDITACCOUNTWIDGET_H 0010 #define EDITACCOUNTWIDGET_H 0011 0012 #include <QWidget> 0013 0014 #include "account.h" 0015 #include "choqok_export.h" 0016 0017 namespace Choqok 0018 { 0019 class Account; 0020 } 0021 0022 class ChoqokEditAccountWidgetPrivate; 0023 0024 /** 0025 * @author Mehrdad Momeny \<mehrdad.momeny@gmail.com\> 0026 * 0027 * This class is used by the microblog plugins to add specific microblog fields in the add account wizard, 0028 * or in the account preferences. If the given account is nullptr, then you will have to create a new account 0029 * in @ref apply(). 0030 * 0031 * Each microblog has to subclass this class. 0032 * 0033 * We suggest to put at least these fields in the page: 0034 * 0035 * - Alias or Account Label 0036 * 0037 * - The User login, or the accountId. you can retrieve it from @ref Choqok::Account::username(). This 0038 * field has to be marked as ReadOnly or shown as a label if the account already exists. Remember 0039 * that accountId should be constant after account creation! 0040 * 0041 * - The password. 0042 * 0043 * 0044 * You may add other custom fields, e.g. the nickname. 0045 */ 0046 class CHOQOK_EXPORT ChoqokEditAccountWidget : public QWidget 0047 { 0048 Q_OBJECT 0049 public: 0050 /** 0051 * Constructor. 0052 * 0053 * If 'account' is nullptr we are in the 'add account wizard', otherwise 0054 * we are editing an existing account. 0055 */ 0056 explicit ChoqokEditAccountWidget(Choqok::Account *account, QWidget *parent); 0057 0058 /** 0059 * Destructor 0060 */ 0061 virtual ~ChoqokEditAccountWidget(); 0062 0063 /** 0064 * Check if the inserted information is valid. 0065 * This method must be reimplemented. 0066 */ 0067 virtual bool validateData(); 0068 0069 /** 0070 * Create a new account if we are in the 'add account wizard', 0071 * otherwise update the existing account. 0072 */ 0073 virtual Choqok::Account *apply() = 0; 0074 0075 /** 0076 * Get a pointer to the Choqok::Account passed to the constructor. 0077 * You can modify it any way you like, just don't delete the object. 0078 */ 0079 Choqok::Account *account() const; 0080 0081 protected: 0082 0083 /** 0084 * Set the account 0085 */ 0086 void setAccount(Choqok::Account *account); 0087 0088 private: 0089 ChoqokEditAccountWidgetPrivate *const d; 0090 }; 0091 0092 #endif 0093