Added some general usability fixes.
[squawker.git] / w_timeline.cpp
blob290af6a7c8be6e725deca2b250808caacb1abbaf
1 #include <QtGui>
3 #include "w_timeline.h"
5 w_Timeline::w_Timeline(QString usr, QString pass, QWidget *parent)
7 setupUi(this);
8 le_message->setFocus();
10 user = usr;
11 password = pass;
13 // Send message button (Squawk!)
14 QObject::connect(pb_update, SIGNAL(clicked()), this, SLOT(sendUpdate()));
15 //Result of the button press
16 // QObject::connect( twitterSocket, SIGNAL( result(bool,QString) ), this, SLOT( updateResult(bool, QString) ) );
18 //Refresh the timeline ever so often...
19 timer = new QTimer(this);
20 QObject::connect(timer, SIGNAL(timeout()), this, SLOT(refresh()));
21 //30 seconds
22 timer->start(30000);
25 void w_Timeline::sendUpdate()
27 pb_update->setEnabled(false);
28 le_message->setEnabled(false);
30 TwitterSocket *tmp = new TwitterSocket(user,password);
31 QObject::connect( tmp, SIGNAL( result(bool,QString,QString) ), this, SLOT( updateResult(bool, QString) ) );
32 tmp->update(le_message->text());
35 void w_Timeline::updateResult(bool error, QString errorstring)
37 le_message->setEnabled(true);
38 pb_update->setEnabled(true);
39 le_message->clear();
42 void w_Timeline::refresh()
44 TwitterSocket *tmp = new TwitterSocket(user,password);
45 QObject::connect( tmp, SIGNAL( result(bool,QString,QString) ), this, SLOT( refreshResult(bool, QString, QString) ) );
46 tmp->timeline();
49 void w_Timeline::refreshResult(bool error, QString errorstring, QString contents)
51 qDebug() << "Refresh result:" << error;
52 qDebug() << "Contents:" << contents;