File indexing completed on 2024-04-28 04:55:41

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 QUICKPOST_H
0010 #define QUICKPOST_H
0011 
0012 #include <QDialog>
0013 
0014 #include "account.h"
0015 #include "choqoktypes.h"
0016 #include "microblog.h"
0017 
0018 namespace Choqok
0019 {
0020 namespace UI
0021 {
0022 
0023 /**
0024 Widget for Quick posting
0025 
0026     @author Mehrdad Momeny \<mehrdad.momeny@gmail.com\>
0027 */
0028 class CHOQOK_EXPORT QuickPost : public QDialog
0029 {
0030     Q_OBJECT
0031 public:
0032     QuickPost(QWidget *parent = nullptr);
0033     virtual ~QuickPost();
0034 
0035 public Q_SLOTS:
0036     void show();
0037     void submitPost(const QString &newStatus);
0038     void setText(const QString &text);
0039     void appendText(const QString &text);
0040 
0041 Q_SIGNALS:
0042     /**
0043     Emitted when a new post submitted. @p postText is the text that submitted,
0044     @p postText will be empty on failure!
0045 
0046     @param result Result of posting, Could be Success or Fail
0047     */
0048     void newPostSubmitted(Choqok::JobResult result, Choqok::Post *newPost = nullptr);
0049 
0050 protected:
0051     void loadAccounts();
0052 
0053 protected Q_SLOTS:
0054     void slotAttachMedium();
0055     void slotCurrentAccountChanged(int);
0056     void checkAll(bool isAll);
0057     virtual void accept() override;
0058     void addAccount(Choqok::Account *account);
0059     void removeAccount(const QString &alias);
0060     void accountModified(Choqok::Account *theAccount);
0061     virtual void slotSubmitPost(Choqok::Account *theAccount, Choqok::Post *post);
0062     void postError(Choqok::Account *theAccount, Choqok::Post *post,
0063                    Choqok::MicroBlog::ErrorType error, const QString &errorMessage);
0064 
0065 private:
0066     void setupUi();
0067     class Private;
0068     Private *const d;
0069 };
0070 
0071 }
0072 
0073 }
0074 #endif