1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

some error caching in sip plugin

This commit is contained in:
Leo Franchi
2011-05-05 08:01:37 -04:00
parent fa18cf9ced
commit 08c78dbd97
3 changed files with 25 additions and 5 deletions

View File

@@ -32,7 +32,8 @@ SipPlugin::SipPlugin( const QString& pluginId, QObject* parent )
: QObject( parent ) : QObject( parent )
, m_pluginId( pluginId ) , m_pluginId( pluginId )
{ {
connect( this, SIGNAL( error( int, QString ) ), this, SLOT( onError( int,QString ) ) );
connect( this, SIGNAL( stateChanged( SipPlugin::ConnectionState ) ), this, SLOT( onStateChange( SipPlugin::ConnectionState ) ) );
} }
QString SipPlugin::pluginId() const QString SipPlugin::pluginId() const
@@ -57,7 +58,7 @@ SipPlugin::configWidget()
QString QString
SipPlugin::errorMessage() const SipPlugin::errorMessage() const
{ {
return QString(); return m_cachedError;
} }
QIcon QIcon
@@ -71,3 +72,16 @@ SipPlugin::setProxy( const QNetworkProxy& proxy )
{ {
qDebug() << Q_FUNC_INFO << "Not implemented"; qDebug() << Q_FUNC_INFO << "Not implemented";
} }
void
SipPlugin::onError( int code, const QString& error )
{
m_cachedError = error;
}
void
SipPlugin::onStateChange( SipPlugin::ConnectionState state )
{
m_cachedError.clear();
}

View File

@@ -104,8 +104,13 @@ signals:
void addMenu( QMenu* menu ); void addMenu( QMenu* menu );
void removeMenu( QMenu* menu ); void removeMenu( QMenu* menu );
private slots:
void onError( int, const QString& );
void onStateChange( SipPlugin::ConnectionState state );
private: private:
QString m_pluginId; QString m_pluginId;
QString m_cachedError;
}; };
Q_DECLARE_INTERFACE( SipPluginFactory, "tomahawk.SipFactory/1.0" ) Q_DECLARE_INTERFACE( SipPluginFactory, "tomahawk.SipFactory/1.0" )

View File

@@ -215,7 +215,7 @@ JabberPlugin::connectPlugin( bool startup )
qDebug() << m_client->server() << m_client->port(); qDebug() << m_client->server() << m_client->port();
//FIXME: we're badly workarounding some missing reconnection api here, to be fixed soon //FIXME: we're badly workarounding some missing reconnection api here, to be fixed soon
QTimer::singleShot(1000, m_client, SLOT( connectToServer() ) ); QTimer::singleShot( 1000, m_client, SLOT( connectToServer() ) );
m_state = Connecting; m_state = Connecting;
@@ -331,7 +331,8 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
removeMenuHelper(); removeMenuHelper();
} }
QString JabberPlugin::errorMessage(Jreen::Client::DisconnectReason reason) QString
JabberPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
{ {
switch( reason ) switch( reason )
{ {
@@ -373,7 +374,7 @@ QString JabberPlugin::errorMessage(Jreen::Client::DisconnectReason reason)
break; break;
} }
m_state == Disconnected; m_state = Disconnected;
emit stateChanged( m_state ); emit stateChanged( m_state );
return QString(); return QString();