File indexing completed on 2020-10-01 13:12:03
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 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program; if not, see http://www.gnu.org/licenses/ 0021 */ 0022 #ifndef COMPOSERWIDGET_H 0023 #define COMPOSERWIDGET_H 0024 0025 #include <QPointer> 0026 #include <QWidget> 0027 0028 #include "account.h" 0029 #include "choqoktypes.h" 0030 #include "choqok_export.h" 0031 0032 class QLabel; 0033 class QPushButton; 0034 0035 namespace Choqok 0036 { 0037 namespace UI 0038 { 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 = nullptr); 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<QPushButton> btnCancelReply(); 0070 Account *currentAccount(); 0071 QWidget *editorContainer(); 0072 Choqok::Post *postToSubmit(); 0073 QPointer<QLabel> replyToUsernameLabel(); 0074 void setPostToSubmit(Choqok::Post *post); 0075 0076 QString replyToId; 0077 QString replyToUsername; 0078 QPointer<QPushButton> btnAbort; 0079 0080 private: 0081 class Private; 0082 Private *const d; 0083 }; 0084 } 0085 } 0086 #endif // COMPOSERWIDGET_H