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