mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-18 23:09:42 +01:00
Remove special case for shortened query links, toma.hk shortener only supports toma.hk/tomahawk:// links
This commit is contained in:
parent
dc502d61d2
commit
3138ec9f40
@ -76,24 +76,21 @@ void
|
||||
LinkGenerator::copyScriptJobResultToClipboard( const QVariantMap& data )
|
||||
{
|
||||
m_clipboardLongUrl = data[ "url" ].toUrl();
|
||||
copyToClipboardReady( m_clipboardLongUrl, m_clipboardLongUrl );
|
||||
|
||||
sender()->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LinkGenerator::copyScriptJobResultToClipboardShortened( const QVariantMap& data )
|
||||
{
|
||||
m_clipboardLongUrl = data[ "url" ].toUrl();
|
||||
|
||||
Tomahawk::Utils::ShortLinkHelper* slh = new Tomahawk::Utils::ShortLinkHelper();
|
||||
connect( slh, SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ),
|
||||
SLOT( copyToClipboardReady( QUrl, QUrl, QVariant ) ) );
|
||||
connect( slh, SIGNAL( done() ),
|
||||
slh, SLOT( deleteLater() ),
|
||||
Qt::QueuedConnection );
|
||||
slh->shortenLink( m_clipboardLongUrl );
|
||||
if ( data[ "shortenLink" ].toBool() )
|
||||
{
|
||||
Tomahawk::Utils::ShortLinkHelper* slh = new Tomahawk::Utils::ShortLinkHelper();
|
||||
connect( slh, SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ),
|
||||
SLOT( copyToClipboardReady( QUrl, QUrl, QVariant ) ) );
|
||||
connect( slh, SIGNAL( done() ),
|
||||
slh, SLOT( deleteLater() ),
|
||||
Qt::QueuedConnection );
|
||||
slh->shortenLink( m_clipboardLongUrl );
|
||||
}
|
||||
else
|
||||
{
|
||||
copyToClipboardReady( m_clipboardLongUrl, m_clipboardLongUrl );
|
||||
}
|
||||
|
||||
sender()->deleteLater();
|
||||
}
|
||||
|
@ -82,16 +82,6 @@ public:
|
||||
}
|
||||
|
||||
// Fire and forget
|
||||
|
||||
// the query link is shortened automatically
|
||||
void copyOpenLink( const query_ptr& query ) const
|
||||
{
|
||||
ScriptJob* job = openLink( query );
|
||||
connect( job, SIGNAL( done( QVariantMap ) ), SLOT( copyScriptJobResultToClipboardShortened( QVariantMap ) ), Qt::QueuedConnection );
|
||||
job->start();
|
||||
}
|
||||
|
||||
// all others are not
|
||||
template <typename T> void copyOpenLink( const T& item ) const
|
||||
{
|
||||
ScriptJob* job = openLink( item );
|
||||
@ -102,7 +92,6 @@ public:
|
||||
private slots:
|
||||
void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj = QVariant() );
|
||||
void copyScriptJobResultToClipboard( const QVariantMap& data );
|
||||
void copyScriptJobResultToClipboardShortened( const QVariantMap& data );
|
||||
|
||||
private:
|
||||
explicit LinkGenerator( QObject* parent = 0 );
|
||||
|
@ -52,6 +52,7 @@ Tomahawk::Utils::TomaHkLinkGeneratorPlugin::openLink( const QString& title, cons
|
||||
|
||||
QVariantMap data;
|
||||
data[ "url" ] = link;
|
||||
data[ "shortenLink" ] = true;
|
||||
|
||||
return new SyncScriptJob( data );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user