Minor cleanups in model and connect
[squawker.git] / w_connect.cpp
blobbf576f47a8e5b715b32332945f51b13d54d13edb
1 #include <QtGui>
3 #include "w_connect.h"
4 #include "twittersocket.h"
6 w_Connect::w_Connect(QWidget *parent) : QDialog(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 le_password->setEnabled(false);
19 le_user->setEnabled(false);
20 pb_connect->setText(QLatin1String("Connecting"));
22 twittersocket = new TwitterSocket(le_user->text(), le_password->text());
23 QObject::connect( twittersocket, SIGNAL( result( bool, QString, QString) ), this, SLOT( status( bool, QString) ) );
24 twittersocket->accountValid();
27 void w_Connect::status( bool error, QString errorString )
29 if (error == false)
31 w_timeline = new w_Timeline(le_user->text(), le_password->text(), this->parentWidget());
32 w_timeline->show();
33 deleteLater();
35 else
37 QMessageBox::critical(this, QLatin1String("Uh-oh."),
38 "<b>An error occured:</b><br>" + errorString,
39 QMessageBox::Ok);
41 pb_connect->setText(QLatin1String("Connect"));
42 pb_connect->setEnabled(true);
43 le_password->setEnabled(true);
44 le_user->setEnabled(true);
46 le_password->clear();
48 qDebug() << "error in w_Connect::status:" << errorString;