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

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 #ifndef COMPOSERWIDGET_H
0024 #define COMPOSERWIDGET_H
0025 
0026 #include <QPointer>
0027 #include <QWidget>
0028 
0029 #include <KPushButton>
0030 
0031 #include "choqoktypes.h"
0032 #include "choqok_export.h"
0033 
0034 class QLabel;
0035 namespace Choqok {
0036 class Account;
0037 
0038 namespace UI {
0039 class TextEdit;
0040 /**
0041 
0042 @author Mehrdad Momeny \<mehrdad.momeny@gmail.com\>
0043 */
0044 class CHOQOK_EXPORT ComposerWidget : public QWidget
0045 {
0046     Q_OBJECT
0047 public:
0048     explicit ComposerWidget(Account *account, QWidget* parent = 0);
0049     virtual ~ComposerWidget();
0050     TextEdit *editor();
0051 
0052 public Q_SLOTS:
0053     virtual void setText(const QString &text, const QString &replyToId = QString(),
0054                          const QString& replyToUsername = QString());
0055     virtual void abort();
0056 
0057 protected Q_SLOTS:
0058     virtual void submitPost( const QString &text );
0059     virtual void slotPostSubmited(Choqok::Account *theAccount, Choqok::Post* post);
0060     virtual void slotErrorPost(Choqok::Account* theAccount,Choqok::Post* post);
0061     virtual void editorTextChanged();
0062     virtual void editorCleared();
0063 
0064 protected:
0065     /**
0066     Sub classes can use another editor! (Should be a subclass of Choqok::Editor)
0067     */
0068     virtual void setEditor( TextEdit *editor );
0069     QPointer<KPushButton> btnCancelReply();
0070     Account *currentAccount();
0071     QWidget *editorContainer();
0072     Choqok::Post *postToSubmit();
0073     QPointer<QLabel> replyToUsernameLabel();
0074     void setPostToSubmit( Choqok::Post *post );
0075 
0076 
0077     QString replyToId;
0078     QString replyToUsername;
0079     QPointer<KPushButton> btnAbort;
0080 
0081 private:
0082     class Private;
0083     Private * const d;
0084 };
0085 }
0086 }
0087 #endif // COMPOSERWIDGET_H