File indexing completed on 2019-04-16 17:04:20

0001 /*
0002     This file is part of Choqok, the KDE micro-blogging client
0003 
0004     Copyright (C) 2008-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com>
0005 
0006     This program is free software; you can redistribute it and/or
0007     modify it under the terms of the GNU General Public License as
0008     published by the Free Software Foundation; either version 2 of
0009     the License or (at your option) version 3 or any later version
0010     accepted by the membership of KDE e.V. (or its successor approved
0011     by the membership of KDE e.V.), which shall act as a proxy
0012     defined in Section 14 of version 3 of the license.
0013 
0014 
0015     This program is distributed in the hope that it will be useful,
0016     but WITHOUT ANY WARRANTY; without even the implied warranty of
0017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0018     GNU General Public License for more details.
0019 
0020     You should have received a copy of the GNU General Public License
0021     along with this program; if not, see http://www.gnu.org/licenses/
0022 
0023 */
0024 #ifndef CHOQOKACCOUNT_H
0025 #define CHOQOKACCOUNT_H
0026 
0027 #include <QString>
0028 
0029 #include <KConfigGroup>
0030 
0031 #include "choqok_export.h"
0032 
0033 namespace Choqok
0034 {
0035 class MicroBlog;
0036 /**
0037 \brief Account class base
0038 MicroBlog plugins can subclass this class or use it if fill their needs.
0039 
0040 @author Mehrdad Momeny \<mehrdad.momeny@gmail.com\>
0041 */
0042 class CHOQOK_EXPORT Account : public QObject
0043 {
0044     Q_OBJECT
0045 public:
0046     Account(MicroBlog *parent, const QString& alias);
0047 
0048     ~Account();
0049     /**
0050     \brief MicroBlog for this account
0051     */
0052     MicroBlog *microblog() const;
0053 
0054     /**
0055     By default this will return @ref microblog() 's timelineNames()
0056     Some microblogs may need to change this per account base!
0057     */
0058     virtual QStringList timelineNames() const;
0059 
0060     QString username() const;
0061     void setUsername( const QString &name );
0062 
0063     QString password() const;
0064     void setPassword( const QString &pass );
0065 
0066     QString alias() const;
0067     void setAlias( const QString &alias );
0068 
0069     bool isReadOnly() const;
0070     void setReadOnly(bool readonly = true);
0071 
0072     bool isEnabled() const;
0073     void setEnabled(bool enabled = true);
0074 
0075     bool showInQuickPost() const;
0076     void setShowInQuickPost(bool show = true);
0077 
0078     void setPostCharLimit(const uint limit);
0079     /**
0080     Indicate character limit for a post. 0 means no limit.
0081     */
0082     uint postCharLimit() const;
0083 
0084     virtual void writeConfig();
0085     /**
0086     * \brief Get the priority of this account.
0087     *
0088     * Used for sorting mainwindow tab widgets.
0089     */
0090     uint priority() const;
0091 
0092     /**
0093     * \brief Set the priority of this account.
0094     *
0095     * @note This method is called by the UI, and should not be called elsewhere.
0096     */
0097     void setPriority( uint priority );
0098 
0099     /**
0100     * Return the @ref KConfigGroup used to write and read special properties
0101     *
0102     * "MicroBlog", "UserId", "Username" , "Password", "Priority", "Enabled" are reserved keyword
0103     * already in use in that group.
0104     *
0105     * for compatibility, try to not use key that start with a uppercase
0106     */
0107     KConfigGroup *configGroup() const;
0108 
0109 Q_SIGNALS:
0110     void modified( Choqok::Account *theAccount );
0111 
0112 private:
0113     class Private;
0114     Private * const d;
0115 };
0116 
0117 }
0118 #endif