Actually connects, and can now post messages
[squawker.git] / w_connect.cpp
blobd1274b241b5bec00b9b74a249d3a2e57ab25adef
1 #include <QtGui>
3 #include "w_connect.h"
4 #include "twittersocket.h"
6 w_Connect::w_Connect(QWidget *parent)
8 setupUi(this);
10 le_user->setFocus();
12 QObject::connect(pb_connect, SIGNAL(clicked()), this, SLOT(connect()));
15 void w_Connect::connect()
17 pb_connect->setEnabled(false);
18 pb_connect->setText(QLatin1String("Connecting"));
20 twittersocket = new TwitterSocket(le_user->text(), le_password->text());
21 QObject::connect( twittersocket, SIGNAL( result( bool, QString) ), this, SLOT( status( bool, QString) ) );
22 twittersocket->accountValid();
25 void w_Connect::status( bool error, QString errorString )
27 if (error == false)
29 w_timeline = new w_Timeline(twittersocket, this->parentWidget());
30 w_timeline->show();
31 this->destroy();
32 delete this;
34 else
36 QMessageBox::critical(this, QLatin1String("Uh-oh."),
37 "<b>An error occured:</b><br>" + errorString,
38 QMessageBox::Ok);
40 pb_connect->setText(QLatin1String("Connect"));
41 pb_connect->setEnabled(true);
43 le_password->clear();
45 qDebug() << "error:" << error << " and " << errorString;