Browse files

Bring back Twitter, but only for social actions.

SIP is disabled.
  • Loading branch information...
1 parent 49be0e7 commit f134be44b1899d11d6a8fafa4d45d5ce1dc2debc @teo teo committed Apr 1, 2013
View
2 src/accounts/CMakeLists.txt
@@ -9,7 +9,7 @@ foreach(SUBDIRECTORY ${SUBDIRECTORIES})
endif()
elseif(SUBDIRECTORY STREQUAL "twitter")
if(QTWEETLIB_FOUND AND BUILD_GUI)
-# add_subdirectory( twitter )
+ add_subdirectory( twitter )
endif()
else()
add_subdirectory( ${SUBDIRECTORY} )
View
2 src/accounts/twitter/CMakeLists.txt
@@ -9,7 +9,7 @@ tomahawk_add_plugin(twitter
TwitterInfoPlugin.cpp
TwitterConfigWidget.cpp
TomahawkOAuthTwitter.cpp
- sip/TwitterSip.cpp
+# sip/TwitterSip.cpp
UI
TwitterConfigWidget.ui
LINK_LIBRARIES
View
33 src/accounts/twitter/TwitterAccount.cpp
@@ -23,7 +23,7 @@
#include "accounts/twitter/TomahawkOAuthTwitter.h"
#include "libtomahawk/infosystem/InfoSystem.h"
#include "utils/Logger.h"
-#include "sip/SipPlugin.h"
+//#include "sip/SipPlugin.h"
#include <QTweetLib/qtweetaccountverifycredentials.h>
#include <QTweetLib/qtweetuser.h>
@@ -51,7 +51,7 @@ TwitterAccount::TwitterAccount( const QString &accountId )
, m_isAuthenticating( false )
{
setAccountServiceName( "Twitter" );
- setTypes( AccountTypes( StatusPushType | SipType ) );
+ setTypes( AccountTypes( StatusPushType ) );
qDebug() << "Got cached peers:" << configuration() << configuration()[ "cachedpeers" ];
@@ -86,24 +86,25 @@ TwitterAccount::configDialogAuthedSignalSlot( bool authed )
Account::ConnectionState
TwitterAccount::connectionState() const
{
- if ( m_twitterSipPlugin.isNull() )
+// if ( m_twitterSipPlugin.isNull() )
return Account::Disconnected;
- return m_twitterSipPlugin.data()->connectionState();
+// return m_twitterSipPlugin.data()->connectionState();
}
SipPlugin*
TwitterAccount::sipPlugin()
{
- if ( m_twitterSipPlugin.isNull() )
- {
- qDebug() << "CHECKING:" << configuration() << configuration()[ "cachedpeers" ];
- m_twitterSipPlugin = QPointer< TwitterSipPlugin >( new TwitterSipPlugin( this ) );
-
- connect( m_twitterSipPlugin.data(), SIGNAL( stateChanged( Tomahawk::Accounts::Account::ConnectionState ) ), this, SIGNAL( connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ) );
- return m_twitterSipPlugin.data();
- }
- return m_twitterSipPlugin.data();
+// if ( m_twitterSipPlugin.isNull() )
+// {
+// qDebug() << "CHECKING:" << configuration() << configuration()[ "cachedpeers" ];
+// m_twitterSipPlugin = QPointer< TwitterSipPlugin >( new TwitterSipPlugin( this ) );
+
+// connect( m_twitterSipPlugin.data(), SIGNAL( stateChanged( Tomahawk::Accounts::Account::ConnectionState ) ), this, SIGNAL( connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ) );
+// return m_twitterSipPlugin.data();
+// }
+// return m_twitterSipPlugin.data();
+ return 0;
}
@@ -169,8 +170,8 @@ TwitterAccount::deauthenticate()
{
tDebug() << Q_FUNC_INFO;
- if ( m_twitterSipPlugin )
- sipPlugin()->disconnectPlugin();
+// if ( m_twitterSipPlugin )
+// sipPlugin()->disconnectPlugin();
if ( m_twitterInfoPlugin )
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( m_twitterInfoPlugin.data() );
@@ -221,7 +222,7 @@ TwitterAccount::connectAuthVerifyReply( const QTweetUser &user )
setConfiguration( config );
sync();
- sipPlugin()->connectPlugin();
+// sipPlugin()->connectPlugin();
m_isAuthenticated = true;
emit nowAuthenticated( m_twitterAuth, user );
View
6 src/accounts/twitter/TwitterAccount.h
@@ -50,7 +50,7 @@ class ACCOUNTDLLEXPORT TwitterAccountFactory : public AccountFactory
QString factoryId() const { return "twitteraccount"; }
QString description() const { return tr( "Connect to your Twitter followers." ); }
QPixmap icon() const { return QPixmap( ":/twitter-account/twitter-icon.png" ); }
- AccountTypes types() const { return AccountTypes( SipType | StatusPushType ); };
+ AccountTypes types() const { return AccountTypes( StatusPushType ); };
Account* createAccount( const QString& pluginId = QString() );
};
@@ -73,7 +73,7 @@ class ACCOUNTDLLEXPORT TwitterAccount : public Account
Tomahawk::InfoSystem::InfoPluginPtr infoPlugin();
SipPlugin* sipPlugin();
- QWidget* configurationWidget() { return m_configWidget.data(); }
+ AccountConfigWidget* configurationWidget() { return m_configWidget.data(); }
QWidget* aclWidget() { return 0; }
bool refreshTwitterAuth();
@@ -94,7 +94,7 @@ private slots:
bool m_isAuthenticating;
QPointer< TomahawkOAuthTwitter > m_twitterAuth;
QPointer< TwitterConfigWidget > m_configWidget;
- QPointer< TwitterSipPlugin > m_twitterSipPlugin;
+// QPointer< TwitterSipPlugin > m_twitterSipPlugin;
QPointer< Tomahawk::InfoSystem::TwitterInfoPlugin > m_twitterInfoPlugin;
// for settings access
View
4 src/accounts/twitter/TwitterConfigWidget.cpp
@@ -43,7 +43,7 @@ namespace Accounts
{
TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *parent ) :
- QWidget( parent ),
+ AccountConfigWidget( parent ),
m_ui( new Ui::TwitterConfigWidget ),
m_account( account )
{
@@ -294,4 +294,4 @@ TwitterConfigWidget::postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode
}
-}
+}
View
4 src/accounts/twitter/TwitterConfigWidget.h
@@ -27,7 +27,7 @@
#include <QTweetLib/qtweetuser.h>
#include <QTweetLib/qtweetnetbase.h>
-#include <QWidget>
+#include "accounts/AccountConfigWidget.h"
namespace Ui
{
@@ -43,7 +43,7 @@ namespace Accounts
class TwitterAccount;
-class ACCOUNTDLLEXPORT TwitterConfigWidget : public QWidget
+class ACCOUNTDLLEXPORT TwitterConfigWidget : public AccountConfigWidget
{
Q_OBJECT
View
1 src/widgets/AccountListWidget.cpp
@@ -138,6 +138,7 @@ AccountListWidget::insertEntries( const QModelIndex& parent, int start, int end
QPersistentModelIndex idx( m_model->index( i, 0, parent ) );
int count = idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole )
.value< QList< Tomahawk::Accounts::Account* > >().count();
+
QList< AccountWidget* > entryAccounts;
for ( int j = 0; j < count; ++j )
{
View
4 src/widgets/AccountModelFactoryProxy.cpp
@@ -47,6 +47,10 @@ AccountModelFactoryProxy::filterAcceptsRow( int sourceRow, const QModelIndex& so
if ( idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole )
.value< QList< Tomahawk::Accounts::Account* > >().isEmpty() )
return false;
+
+ Tomahawk::Accounts::AccountFactory* factory = qobject_cast< Tomahawk::Accounts::AccountFactory* >( idx.data( Tomahawk::Accounts::AccountModel::AccountData ).value< QObject* >() );
+ if ( factory && factory->factoryId() == "twitteraccount" )
+ return false;
}
return rowType == m_filterRowType;
View
9 src/widgets/AccountWidget.cpp
@@ -314,9 +314,12 @@ AccountWidget::setupConnections( const QPersistentModelIndex& idx, int accountId
connect( m_inviteEdit, SIGNAL( returnPressed() ),
this, SLOT( sendInvite() ) );
- m_inviteEdit->setPlaceholderText( account->sipPlugin()->inviteString() );
- connect( account->sipPlugin(), SIGNAL( inviteSentSuccess( QString ) ), SLOT( onInviteSentSuccess( QString ) ) );
- connect( account->sipPlugin(), SIGNAL( inviteSentFailure( QString ) ), SLOT( onInviteSentFailure( QString ) ) );
+ if ( account->sipPlugin() )
+ {
+ m_inviteEdit->setPlaceholderText( account->sipPlugin()->inviteString() );
+ connect( account->sipPlugin(), SIGNAL( inviteSentSuccess( QString ) ), SLOT( onInviteSentSuccess( QString ) ) );
+ connect( account->sipPlugin(), SIGNAL( inviteSentFailure( QString ) ), SLOT( onInviteSentFailure( QString ) ) );
+ }
}
}

0 comments on commit f134be4

Please sign in to comment.