mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Be a bit more resilient in setting the playlist to rename after creating
This commit is contained in:
parent
518546b525
commit
1bb8ff97d4
src/sourcetree/items
@ -201,8 +201,9 @@ CategoryAddItem::dropMimeData( const QMimeData* data, Qt::DropAction )
|
||||
}
|
||||
|
||||
QString name = firstArtist.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( firstArtist );
|
||||
newpl->rename( name );
|
||||
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
||||
newpl->setProperty( "newname", name );
|
||||
connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||
|
||||
ViewManager::instance()->show( newpl );
|
||||
return true;
|
||||
@ -278,6 +279,22 @@ CategoryAddItem::dropMimeData( const QMimeData* data, Qt::DropAction )
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CategoryAddItem::playlistToRenameLoaded()
|
||||
{
|
||||
Playlist* pl = qobject_cast< Playlist* >( sender() );
|
||||
Q_ASSERT( pl );
|
||||
|
||||
QString name = sender()->property( "newname" ).toString();
|
||||
if ( !name.isEmpty() )
|
||||
pl->rename( name );
|
||||
else
|
||||
QTimer::singleShot( 400, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) );
|
||||
|
||||
disconnect( pl, SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
|
||||
{
|
||||
@ -322,8 +339,7 @@ CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
|
||||
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
||||
|
||||
ViewManager::instance()->show( newpl );
|
||||
// Give a shot to try to rename it. The playlist has to be created first. ugly.
|
||||
QTimer::singleShot( 300, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) );
|
||||
connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,13 @@ private slots:
|
||||
void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
|
||||
void dialogClosed( int ret );
|
||||
|
||||
//
|
||||
void playlistToRenameLoaded();
|
||||
private:
|
||||
SourcesModel::CategoryType m_categoryType;
|
||||
QIcon m_icon;
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
class CategoryItem : public SourceTreeItem
|
||||
|
Loading…
x
Reference in New Issue
Block a user