1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Clean up from working branch, disable playlist links until ready.

This commit is contained in:
Leo Franchi
2012-04-27 19:04:03 -04:00
parent 91ebe57dd2
commit ab641c88e0
2 changed files with 20 additions and 20 deletions

View File

@@ -170,8 +170,8 @@ GlobalActionManager::getShortLink( const playlist_ptr& pl )
QJson::Serializer s;
QByteArray msg = s.serialize( jspf );
qDebug() << "POSTING DATA:" << msg;
// No built-in Qt facilities for doing a FORM POST. So we build the payload ourselves...
const QByteArray boundary = "----------------------------2434992cccab";
QByteArray data(QByteArray("--" + boundary + "\r\n"));
data += "Content-Disposition: form-data; name=\"data\"; filename=\"playlist.jspf\"\r\n";
@@ -180,9 +180,8 @@ GlobalActionManager::getShortLink( const playlist_ptr& pl )
data += "\r\n\r\n";
data += "--" + boundary + "--\r\n\r\n";
const QUrl url( QString( "%1/playlist/").arg( hostname() ) );
const QUrl url( QString( "%1/p/").arg( hostname() ) );
QNetworkRequest req( url );
qDebug() << "POSTING TO:" << url.toString();
req.setHeader( QNetworkRequest::ContentTypeHeader, QString( "multipart/form-data; boundary=%1" ).arg( QString::fromLatin1( boundary ) ) );
QNetworkReply *reply = TomahawkUtils::nam()->post( req, data );
@@ -1233,7 +1232,7 @@ GlobalActionManager::waitingForResolved( bool /* success */ )
QString
GlobalActionManager::hostname() const
{
return QString( "http://stage.toma.hk" );
return QString( "http://toma.hk" );
}

View File

@@ -226,8 +226,8 @@ SourceTreeView::setupMenus()
}
// if ( type == SourcesModel::StaticPlaylist )
// copyPlaylistAction->setText( tr( "&Export Playlist" ) );
if ( type == SourcesModel::StaticPlaylist )
copyPlaylistAction->setText( tr( "&Export Playlist" ) );
connect( loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
connect( renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
@@ -358,20 +358,21 @@ SourceTreeView::copyPlaylistLink()
else if ( type == SourcesModel::StaticPlaylist )
{
// Disable toma.hk playlist mode until ready
// GlobalActionManager::instance()->getShortLink( playlist );
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
playlist_ptr playlist = item->playlist();
GlobalActionManager::instance()->getShortLink( playlist );
// QString suggestedFilename = TomahawkSettings::instance()->playlistDefaultPath() + "/" + playlist->title();
// QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
// suggestedFilename, tr( "Playlists (*.xspf)" ) );
// if ( !filename.isEmpty() )
// {
// QFileInfo playlistAbsoluteFilePath = filename;
// TomahawkSettings::instance()->setPlaylistDefaultPath( playlistAbsoluteFilePath.absolutePath() );
// GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
// }
QString suggestedFilename = TomahawkSettings::instance()->playlistDefaultPath() + "/" + playlist->title();
QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
suggestedFilename, tr( "Playlists (*.xspf)" ) );
if ( !filename.isEmpty() )
{
QFileInfo playlistAbsoluteFilePath = filename;
TomahawkSettings::instance()->setPlaylistDefaultPath( playlistAbsoluteFilePath.absolutePath() );
GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
}
}
}