mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Remove special case for shortened query links, toma.hk shortener only supports toma.hk/tomahawk:// links
This commit is contained in:
@@ -76,17 +76,9 @@ void
|
|||||||
LinkGenerator::copyScriptJobResultToClipboard( const QVariantMap& data )
|
LinkGenerator::copyScriptJobResultToClipboard( const QVariantMap& data )
|
||||||
{
|
{
|
||||||
m_clipboardLongUrl = data[ "url" ].toUrl();
|
m_clipboardLongUrl = data[ "url" ].toUrl();
|
||||||
copyToClipboardReady( m_clipboardLongUrl, m_clipboardLongUrl );
|
|
||||||
|
|
||||||
sender()->deleteLater();
|
if ( data[ "shortenLink" ].toBool() )
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
LinkGenerator::copyScriptJobResultToClipboardShortened( const QVariantMap& data )
|
|
||||||
{
|
{
|
||||||
m_clipboardLongUrl = data[ "url" ].toUrl();
|
|
||||||
|
|
||||||
Tomahawk::Utils::ShortLinkHelper* slh = new Tomahawk::Utils::ShortLinkHelper();
|
Tomahawk::Utils::ShortLinkHelper* slh = new Tomahawk::Utils::ShortLinkHelper();
|
||||||
connect( slh, SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ),
|
connect( slh, SIGNAL( shortLinkReady( QUrl, QUrl, QVariant ) ),
|
||||||
SLOT( copyToClipboardReady( QUrl, QUrl, QVariant ) ) );
|
SLOT( copyToClipboardReady( QUrl, QUrl, QVariant ) ) );
|
||||||
@@ -94,6 +86,11 @@ LinkGenerator::copyScriptJobResultToClipboardShortened( const QVariantMap& data
|
|||||||
slh, SLOT( deleteLater() ),
|
slh, SLOT( deleteLater() ),
|
||||||
Qt::QueuedConnection );
|
Qt::QueuedConnection );
|
||||||
slh->shortenLink( m_clipboardLongUrl );
|
slh->shortenLink( m_clipboardLongUrl );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
copyToClipboardReady( m_clipboardLongUrl, m_clipboardLongUrl );
|
||||||
|
}
|
||||||
|
|
||||||
sender()->deleteLater();
|
sender()->deleteLater();
|
||||||
}
|
}
|
||||||
|
@@ -82,16 +82,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fire and forget
|
// 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
|
template <typename T> void copyOpenLink( const T& item ) const
|
||||||
{
|
{
|
||||||
ScriptJob* job = openLink( item );
|
ScriptJob* job = openLink( item );
|
||||||
@@ -102,7 +92,6 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj = QVariant() );
|
void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj = QVariant() );
|
||||||
void copyScriptJobResultToClipboard( const QVariantMap& data );
|
void copyScriptJobResultToClipboard( const QVariantMap& data );
|
||||||
void copyScriptJobResultToClipboardShortened( const QVariantMap& data );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit LinkGenerator( QObject* parent = 0 );
|
explicit LinkGenerator( QObject* parent = 0 );
|
||||||
|
@@ -52,6 +52,7 @@ Tomahawk::Utils::TomaHkLinkGeneratorPlugin::openLink( const QString& title, cons
|
|||||||
|
|
||||||
QVariantMap data;
|
QVariantMap data;
|
||||||
data[ "url" ] = link;
|
data[ "url" ] = link;
|
||||||
|
data[ "shortenLink" ] = true;
|
||||||
|
|
||||||
return new SyncScriptJob( data );
|
return new SyncScriptJob( data );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user