mpviewplugins/mpcollectionviewplugin/src/mpcollectionview.cpp
changeset 42 79c49924ae23
parent 41 ea59c434026a
child 43 0f32e550d9d8
equal deleted inserted replaced
41:ea59c434026a 42:79c49924ae23
   801 {
   801 {
   802     TX_ENTRY
   802     TX_ENTRY
   803     if ( !mMainToolBar ) {
   803     if ( !mMainToolBar ) {
   804         //Create the toolbar.
   804         //Create the toolbar.
   805         mMainToolBar = new HbToolBar();
   805         mMainToolBar = new HbToolBar();
       
   806         mMainToolBar->setObjectName( "MainToolBar" );
   806         mMainToolBar->setOrientation( Qt::Horizontal );
   807         mMainToolBar->setOrientation( Qt::Horizontal );
   807         QActionGroup *actionsGroup = new QActionGroup( mMainToolBar );
   808         QActionGroup *actionsGroup = new QActionGroup( mMainToolBar );
   808         HbAction *action;
   809         HbAction *action;
   809 
   810 
   810         // All Songs
   811         // All Songs
   811         action = createToolBarAction( actionsGroup, "qtg_mono_songs_all" );
   812         action = createToolBarAction( actionsGroup, "qtg_mono_songs_all", "AllSongsAction" );
   812         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openSongs() ) );
   813         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openSongs() ) );
   813         mMainToolBar->addAction( action );
   814         mMainToolBar->addAction( action );
   814         
   815         
   815         // Artists
   816         // Artists
   816         action = createToolBarAction( actionsGroup, "qtg_mono_artists" );
   817         action = createToolBarAction( actionsGroup, "qtg_mono_artists", "ArtistsAction" );
   817         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openArtists() ) );
   818         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openArtists() ) );
   818         mMainToolBar->addAction( action );
   819         mMainToolBar->addAction( action );
   819 
   820 
   820         // Albums
   821         // Albums
   821         action = createToolBarAction( actionsGroup, "qtg_mono_music_albums" );
   822         action = createToolBarAction( actionsGroup, "qtg_mono_music_albums", "AlbumsAction" );
   822         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openAlbums() ) );
   823         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openAlbums() ) );
   823         mMainToolBar->addAction( action );
   824         mMainToolBar->addAction( action );
   824 
   825 
   825         // Playlists
   826         // Playlists
   826         action = createToolBarAction( actionsGroup, "qtg_mono_playlist" );
   827         action = createToolBarAction( actionsGroup, "qtg_mono_playlist", "PlaylistsAction" );
   827         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openPlaylists() ) );
   828         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openPlaylists() ) );
   828         mMainToolBar->addAction( action );
   829         mMainToolBar->addAction( action );
   829         
   830         
   830         if ( mViewMode != MpCommon::FetchView ) {
   831         if ( mViewMode != MpCommon::FetchView ) {
   831             // Music Store
   832             // Music Store
   832             action = createToolBarAction(actionsGroup, "qtg_mono_ovistore" );
   833             action = createToolBarAction(actionsGroup, "qtg_mono_ovistore", "MusicStoreAction" );
   833             connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openMusicStore() ) );
   834             connect( action, SIGNAL( triggered( bool ) ), this, SLOT( openMusicStore() ) );
   834             mMainToolBar->addAction( action );
   835             mMainToolBar->addAction( action );
   835         }
   836         }
   836     }
   837     }
   837     HbAction* action = 0;
   838     HbAction* action = 0;
   870 void MpCollectionView::setPlaylistToolBar()
   871 void MpCollectionView::setPlaylistToolBar()
   871 {
   872 {
   872     TX_ENTRY
   873     TX_ENTRY
   873     if ( !mPlaylistToolBar ) {
   874     if ( !mPlaylistToolBar ) {
   874         mPlaylistToolBar = new HbToolBar();
   875         mPlaylistToolBar = new HbToolBar();
       
   876         mPlaylistToolBar->setObjectName( "PlaylistToolBar" );
   875         mPlaylistToolBar->setOrientation( Qt::Horizontal );
   877         mPlaylistToolBar->setOrientation( Qt::Horizontal );
   876         HbAction *action;
   878         HbAction *action;
   877         HbIcon *icon;
       
   878 
   879 
   879         action = new HbAction( this );
   880         action = new HbAction( this );
   880         icon = new HbIcon( "qtg_mono_plus" );
   881         action->setIcon( HbIcon( "qtg_mono_plus" ) );
   881         action->setIcon( *icon );
       
   882         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( prepareToAddToPlaylist() ) );
   882         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( prepareToAddToPlaylist() ) );
       
   883         action->setObjectName( "AddToPlaylistAction" );
   883         mPlaylistToolBar->addAction( action );
   884         mPlaylistToolBar->addAction( action );
   884 
   885 
   885         action = new HbAction( this );
   886         action = new HbAction( this );
   886         icon = new HbIcon( "qtg_mono_minus" );
   887         action->setIcon( HbIcon( "qtg_mono_minus" ) );
   887         action->setIcon( *icon);
       
   888         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( deleteSongs() ) );
   888         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( deleteSongs() ) );
       
   889         action->setObjectName( "RemoveFromPlaylistAction" );
   889         mPlaylistToolBar->addAction( action );
   890         mPlaylistToolBar->addAction( action );
   890 
   891 
   891         action = new HbAction( this );
   892         action = new HbAction( this );
   892         icon = new HbIcon( "qtg_mono_organize" );
   893         action->setIcon( HbIcon( "qtg_mono_organize" ) );
   893         action->setIcon( *icon );
       
   894         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( arrangeSongs() ) );
   894         connect( action, SIGNAL( triggered( bool ) ), this, SLOT( arrangeSongs() ) );
       
   895         action->setObjectName( "OrganizePlaylistAction" );
   895         mPlaylistToolBar->addAction( action );
   896         mPlaylistToolBar->addAction( action );
   896     }
   897     }
   897 
   898 
   898     int items = mCollectionData->count();
   899     int items = mCollectionData->count();
   899 
   900 
   920  \internal
   921  \internal
   921  Creates action associated with the action group for the toolbar.
   922  Creates action associated with the action group for the toolbar.
   922  */
   923  */
   923 HbAction *MpCollectionView::createToolBarAction(
   924 HbAction *MpCollectionView::createToolBarAction(
   924     QActionGroup *actionsGroup,
   925     QActionGroup *actionsGroup,
   925     const QString& icon )
   926     const QString& icon,
       
   927     const QString& objectName )
   926 {
   928 {
   927     HbIcon actionIcon( icon );
   929     HbIcon actionIcon( icon );
   928 
   930 
   929     HbAction *action = new HbAction( actionsGroup );
   931     HbAction *action = new HbAction( actionsGroup );
   930     action->setIcon( actionIcon );
   932     action->setIcon( actionIcon );
   931     action->setCheckable( true );
   933     action->setCheckable( true );
       
   934     action->setObjectName( objectName );
   932     return action;
   935     return action;
   933 }
   936 }
   934 
   937 
   935 /*!
   938 /*!
   936  \internal
   939  \internal