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

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