2 * CommandoJikkyouSennyou - Commando Jikkyou Sennyou Client for twitter for Qt.
4 * Author: amayav (vamayav@yahoo.co.jp)
7 * CommandoJikkyouSennyou is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * CommandoJikkyouSennyou is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with CommandoJikkyouSennyou. If not, see <http://www.gnu.org/licenses/>.
20 /******************************************************************************
24 ******************************************************************************/
33 #include <QNetworkReply>
35 #include "widgetdomain.h"
36 #include <QNetworkProxy>
38 #include "latesttweetsfortime.h"
42 //class KQOAuthRequest_XAuth;
49 class Widget : public QWidget {
53 explicit Widget(QWidget *parent = 0);
57 void keyPressEvent(QKeyEvent *);
58 void keyReleaseEvent(QKeyEvent *);
59 void resizeEvent(QResizeEvent *);
60 void showEvent(QShowEvent *);
63 void onTemporaryTokenReceived(QString token, QString tokenSecret);
64 void onAuthorizationReceived(QString token, QString verifier);
65 void onAccessTokenReceived(QString token, QString tokenSecret);
66 void onAuthorizedRequestDone();
67 void onRequestReady(QByteArray response);
68 void onRequestReadyTimeline(QByteArray response);
69 void onRequestReadyOwnPosts(QByteArray);
71 void sendTweet(QString tweet);
72 void receiveSSLError(QNetworkReply * reply, const QList<QSslError> & errors);
73 void readOwnPosts(QNetworkReply * r);
75 void countDownClock();
80 Open authorizing web page in twitter.com.
82 void on_authorizationButton_clicked();
85 Start Timeline flowing.
87 void on_showTimeLineButton_clicked();
90 Set authorizing this program with twitter.com.
92 void on_verificationButton_clicked();
95 Post some text to twitter.com.
97 void on_postButton_clicked();
99 void on_lineEdit_2_textChanged(const QString &arg1);
100 void on_lineEdit_3_textChanged(const QString &arg1);
101 void on_lineEdit_4_textChanged(const QString &arg1);
102 void on_lineEdit_5_textChanged(const QString &arg1);
103 void on_lineEdit_6_textChanged(const QString &arg1);
105 void on_proxyButton_clicked();
110 KQOAuthManager *_oauthManager;
111 KQOAuthRequest *_oauthRequest;
112 // KQOAuthRequest_XAuth *oauthRequestX;
113 QSettings *_oauthSettings, *_shortCutKeysSettings, *_sizeSettings;
114 QNetworkProxy *_proxy;
115 QString _consumerKey;
116 QString _consumerSecretKey;
117 QTimer *_clockCountTimer;
118 LatestTweetsForTime _latestTweetsForTime;
120 WidgetDomain *_subject;
122 bool setPostShortcutKeys();
123 bool setJikkyouShortcutKeys();
124 bool setWindowSize();
125 bool setProxyLineEdits();
126 bool setConsumerKeyAndConsumerSecretLineEdits();
127 bool setConsumerKeyAndConsumerSecret();
128 bool initializeKQOAuth();
130 bool setConsumerKeyAndConsumerSecretSettings();
132 void showFatalError(const QString strMsg, const int nNum = 0,
133 const QString strTitle = tr("Fatal Error!"));
134 void showOAuthError(const int nErrNum);
137 Initialize widget which has user own post data.
138 Latest 130 and Latest 10.
140 bool initializeOwnPostsWidgets();
143 Replace text from PlaneTextEdit to twitter.
145 bool replacePlainTextEditContent(int i, QString str);
148 Set shortcut key config.
150 bool setShortCutKeyAndContext(QShortcut *sc, QKeySequence s, Qt::ShortcutContext c);
153 Connect with twitter.com by SSL.
154 This is copied and changed from KQOauthManager::executeRequest(KQOAuthRequest *request)
156 bool SSLconnect(KQOAuthRequest *request);
159 set consumerKey and consumerSecretKey to oauthRequest.
161 bool initializeRequest(QUrl url,
162 KQOAuthRequest::RequestHttpMethod requestMethod = KQOAuthRequest::POST,
163 KQOAuthRequest::RequestType requestType = KQOAuthRequest::AuthorizedRequest);
165 bool setTokenAndSecretTokenToRequest();
167 bool SetButtonsEnable(bool on = true);
168 QByteArray makeAuthHeaderFrom(QList<QByteArray> requestParameters);
170 QString getValueOfMatchedKey();
171 WidgetDomain* getWidgetDomain();
174 void verificationReceived1(QString oauth_verifier);