mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp
changeset 48 af3740e3753f
parent 41 ea59c434026a
child 54 c5b304f4d89b
--- a/mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp	Tue Jul 06 14:13:36 2010 +0300
+++ b/mpviewplugins/mpdetailsviewplugin/src/mpdetailsview.cpp	Wed Aug 18 09:46:20 2010 +0300
@@ -23,7 +23,7 @@
 #include <QFile>
 #include <QGraphicsLinearLayout>
 #include <QSizeF>
-
+#include <QDesktopServices>
 
 
 #include <hbinstance.h>
@@ -49,13 +49,10 @@
 #include "mpquerymanager.h"
 #include "mptrace.h"
 
-#ifdef SHARE_FUNC_ENABLED
-#include "mpdetailssharedialog.h"
-#endif
 
-
-const int KRecommendationCount = 2;
-
+const int KOneKiloByteInBytes = 1024;
+const int KOneMegabyteInBytes = 1048576;        
+const int KOneGigaByteInBytes = 134217728;        
 
 /*!
  Constructor
@@ -71,19 +68,13 @@
       mAlbumArt( 0 ),
       mSongDetailsGroupBox(0),
       mInspireMeGroupBox(0),
-      mShareButton(0),
       mDocumentLoader( 0 ),
       mDetailList(0),
       mInspireList(0),
       mInspireMeProgressBar(0),
       mMpQueryManager( 0 ),
       mInspireMeQueryOngoing( false ),
-      mInspireMeQueryRendered( false ),
-      mInspireMeOpen(true),
-      mSongDetailsGbOpen(false)
-#ifdef SHARE_FUNC_ENABLED
-      , mSharePopup( 0 )
-#endif
+      mInspireMeQueryRendered( false )
 {
     TX_ENTRY
     bool widgetsOk = false;
@@ -110,10 +101,6 @@
     TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for <content>: " << (int)(widget) );
     setWidget(  qobject_cast<HbWidget *>(widget) );
 
-    widget = mDocumentLoader->findWidget( QString("shareButton") );
-    mShareButton = qobject_cast<HbPushButton *>(widget);
-    TX_LOG_ARGS("MpDetailsView() <shareButton> widget found mShareButton: " << (int)(mShareButton) );
-
     widget = mDocumentLoader->findWidget( QString("trackTitle") );
     mSongText = qobject_cast<HbLabel *>(widget);
     TX_LOG_ARGS("MpDetailsView() <trackTitle> widget found mSongText: " << (int)(mSongText) );
@@ -155,7 +142,8 @@
     mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), QString( "ShowInspireMe" ), &loadingSectionOk );    
     if( loadingSectionOk ) {
         TX_LOG_ARGS( "Loading ShowInspireMe section is successful." );
-    } else {
+    }
+    else {
         TX_LOG_ARGS( "Loading ShowInspireMe section fails." );
     }
 
@@ -168,13 +156,11 @@
 MpDetailsView::~MpDetailsView()
 {
     TX_ENTRY
+    saveGroupBoxStates();
     delete mSoftKeyBack;
     delete mDocumentLoader;
     delete mMpQueryManager;
 
-#ifdef SHARE_FUNC_ENABLED
-    closeShareDialog();
-#endif
     TX_EXIT
 }
 
@@ -199,19 +185,24 @@
     connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) );
     connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) );
     connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) );
+    connect( mDetailList, SIGNAL( pressed( HbListWidgetItem  * ) ), this, SLOT( handleListItemSelected( HbListWidgetItem  * ) ) );
     connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) );
     connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) );
-    connect( mMpQueryManager, SIGNAL( networkError() ), this ,SLOT( handleNetworkError() ) );
-    connect( mMpQueryManager, SIGNAL(searchUrlRetrieved(const QString&)), this, SLOT(updateSharedData(const QString&)));
-    connect( mMpQueryManager, SIGNAL(recommendationAlbumArtsReady()), this, SLOT(RenderInspireMeGroupBox()));
+    connect( mMpQueryManager, SIGNAL(inspireMeItemsMetadataRetrieved()), this, SLOT(renderInspireMeMetadata()));
+    connect( mMpQueryManager, SIGNAL(inspireMeItemAlbumArtReady()), this, SLOT(renderInspireMeAlbumArts()));    
+    connect( mMpQueryManager, SIGNAL(localMusicStoreRetrieved(bool)), this, SLOT(queryInspireMe(bool)), Qt::QueuedConnection);
+    connect( mMpQueryManager, SIGNAL(localMusicStoreRetrievalError()), this, SLOT(abortInspireMeProcess()));
+    connect( mMpQueryManager, SIGNAL(inspireMeItemsRetrievalError()), this, SLOT(queryLocalMusicStore()), Qt::QueuedConnection);
 
-#ifdef SHARE_FUNC_ENABLED
-    connect( mShareButton, SIGNAL( clicked() ), this, SLOT( share() ) );
+    TX_EXIT
+}
 
-    // Preload the share popup
-    preloadShareDialog();
-#endif
-    TX_EXIT
+void MpDetailsView::queryLocalMusicStore()
+{
+    TX_ENTRY
+    mMpQueryManager->reset();
+    mMpQueryManager->queryLocalMusicStore(); 
+    TX_EXIT        
 }
 
 /*!
@@ -221,15 +212,12 @@
 {
     TX_ENTRY
     setNavigationAction( mSoftKeyBack );
-    mMpEngine->retrieveSong();
 
     mActivated = true;
-    mInspireMeOpen = MpSettingsManager::inspireMe();
-    mSongDetailsGbOpen = MpSettingsManager::songDetailsGb();
-    TX_LOG_ARGS( "InspireMeVal: " << mInspireMeOpen );
-    TX_LOG_ARGS( "SongDetailsGbVal: " << mSongDetailsGbOpen );
-    mInspireMeGroupBox->setCollapsed(!mInspireMeOpen);
-    mSongDetailsGroupBox->setCollapsed(!mSongDetailsGbOpen);
+    TX_LOG_ARGS( "InspireMeVal: " << MpSettingsManager::inspireMe() );
+    TX_LOG_ARGS( "SongDetailsGbVal: " << MpSettingsManager::songDetailsGb() );
+    mInspireMeGroupBox->setCollapsed(!MpSettingsManager::inspireMe());
+    mSongDetailsGroupBox->setCollapsed(!MpSettingsManager::songDetailsGb());
     TX_EXIT
 }
 
@@ -239,23 +227,31 @@
 void MpDetailsView::deactivateView()
 {
     TX_ENTRY
-    if (mInspireMeGroupBox->isCollapsed() ) {
-      MpSettingsManager::setInspireMe(false);
-      } else {
-      MpSettingsManager::setInspireMe(true);
-      }
-
-    if (mSongDetailsGroupBox->isCollapsed() ) {
-      MpSettingsManager::setSongDetailsGb(false);
-      } else {
-      MpSettingsManager::setSongDetailsGb(true);
-      }
-
+    saveGroupBoxStates();
     setNavigationAction( 0 );
     mActivated = false;
     TX_EXIT
 }
 
+void MpDetailsView::saveGroupBoxStates()
+{
+    TX_ENTRY
+    if (mInspireMeGroupBox->isCollapsed() ) {
+        MpSettingsManager::setInspireMe(false);
+    }
+    else {
+        MpSettingsManager::setInspireMe(true);
+    }
+
+    if (mSongDetailsGroupBox->isCollapsed() ) {
+        MpSettingsManager::setSongDetailsGb(false);
+    }
+    else {
+        MpSettingsManager::setSongDetailsGb(true);
+    }
+    TX_EXIT      
+}
+ 
 /*!
  Setup the menu.
  */
@@ -272,7 +268,7 @@
 void MpDetailsView::back()
 {
     TX_ENTRY
-    emit command( MpCommon::ActivatePlaybackView );
+    emit command( MpCommon::ActivatePreviousView );
     TX_EXIT
 }
 
@@ -291,29 +287,33 @@
 /*!
  Slot to handle network error.
  */
-void MpDetailsView::handleNetworkError()
+void MpDetailsView::abortInspireMeProcess()
 {
     TX_ENTRY
+    mInspireMeProgressBar->hide();    
+    mInspireMeGroupBox->setCollapsed( true );    
     mInspireMeQueryOngoing = false;
     mInspireMeQueryRendered = false;
-    clearInspireMe();
-    mInspireMeGroupBox->setCollapsed( true );
+    // ensure that we dont get callbacks from previous queries. Especially true,
+    // if details view is actived with a quick song change again
+    mMpQueryManager->reset();
+    mInspireList->clear();
     TX_EXIT
 }
 
 /*!
  Render inspireme groupbox after album arts downloaded
  */
-void MpDetailsView::RenderInspireMeGroupBox()
+void MpDetailsView::renderInspireMeMetadata()
 {
     TX_ENTRY
     mInspireMeQueryOngoing = false;
     mInspireMeQueryRendered = true;
     mInspireMeProgressBar->hide();
-    if( mMpQueryManager->recommendationAlbumArtsMap().count() ) {
+    if( mMpQueryManager->recommendationsCount() ) {
         TX_LOG_ARGS( "There are recommendations." )
         // we have recommendations
-        for ( int i = 0; i < KRecommendationCount; i++ ) {
+        for ( int i = 0; i < mMpQueryManager->recommendationsCount(); ++i ) {
             // configure the layout properties
             if(!mInspireList->count()) {
                 // we havent configured the prototype before
@@ -322,15 +322,14 @@
             }
             // create the item
             HbListWidgetItem  *inspireMeItem = new HbListWidgetItem();
-            HbIcon icon( QIcon( mMpQueryManager->recommendationAlbumArtsMap().value(mMpQueryManager->recommendationAlbumArtsLink().at( i ) ) ) );
-            inspireMeItem->setIcon( icon );
-            inspireMeItem->setText( mMpQueryManager->recommendationSongs().at( i ) );
-            inspireMeItem->setSecondaryText( mMpQueryManager->recommendationArtists().at( i ) );
+            inspireMeItem->setIcon( mMpQueryManager->recommendedAlbumArt( i ));
+            inspireMeItem->setText( mMpQueryManager->recommendedSong( i ) );
+            inspireMeItem->setSecondaryText( mMpQueryManager->recommendedArtist( i ) );
             mInspireList->addItem( inspireMeItem );
         }
     }
     else {
-        TX_LOG_ARGS( "There is NO recommendation." )
+        TX_LOG_ARGS( "There are NO recommendations" )
         // we dont have recommendations
         // we havent configured the prototype before
         HbListViewItem *prototype = mInspireList->listItemPrototype();
@@ -339,40 +338,40 @@
         prototype->setSecondaryTextRowCount(minTextRowCount,maxTextRowCount);
 
         HbListWidgetItem  *inspireMeItem = new HbListWidgetItem();
-        QString info(tr("There are no recommendations for this track, but you can always discover new music on Ovi"));
-        inspireMeItem->setText( QString( " " ) );
-        inspireMeItem->setSecondaryText( info );
+        inspireMeItem->setSecondaryText( hbTrId( "txt_mus_dblist_val_there_are_no_recommendations" ) );
         mInspireList->addItem( inspireMeItem );
     }
 
     TX_EXIT
 }
 
-bool MpDetailsView::canQueryRecommendations() const
+void MpDetailsView::renderInspireMeAlbumArts()
+{
+    TX_ENTRY    
+    for( int i = 0; i < mInspireList->count(); ++i) {
+        mInspireList->item(i)->setIcon( mMpQueryManager->recommendedAlbumArt( i ) );
+    }
+    TX_EXIT    
+}
+   
+bool MpDetailsView::isMetadata() const
 {
     bool result = ( ( !mSongData->album().isEmpty() ) ||
-                    ( !mSongData->artist().isEmpty() ) ) &&
-                  !( mInspireMeGroupBox->isCollapsed() );
-    TX_LOG_ARGS( "Can query recommendations:" << result );
+                    ( !mSongData->artist().isEmpty() ) );
+    TX_LOG_ARGS( "Inspire Me Query metadata available:" << result );
     return result;
 }
 
-bool MpDetailsView::canQuerySharePlayerLink() const
-{
-  bool result = ( !mSongData->title().isEmpty() ) &&
-                ( !mSongData->artist().isEmpty() ) ;
-  TX_LOG_ARGS( "Can query share player link:" << result );
-  return result;
-}
-
 /*!
  Slot to handle basic song information
  */
 void MpDetailsView::handlePlaybackInfoChanged()
 {
     TX_ENTRY
-    mMpQueryManager->clearNetworkReplies();
-    clearInspireMe();
+    // ensure that we dont get callbacks from previous queries. Especially true,
+    // if details view is actived with a quick song change again
+    mMpQueryManager->reset();
+    mInspireList->clear();
     mInspireMeQueryRendered = false;
 
     // Clear the song data link until new query has been made.
@@ -380,50 +379,53 @@
 
     if ( !mSongData->title().isEmpty () ) {
         mSongText->setPlainText( mSongData->title() );
-    } else {
+    }
+    else {
         mSongText->setPlainText( mSongData->fileName() );
     }
 
     if ( !mSongData->album().isEmpty () ) {
         mAlbumText->setPlainText( mSongData->album() );
-    } else {
-        mAlbumText->setPlainText( tr( "Unknown") );
+    }
+    else {
+        mAlbumText->setPlainText( hbTrId( "txt_mus_other_unknown7") );
     }
 
     if ( !mSongData->artist().isEmpty() ) {
         mArtistText->setPlainText( mSongData->artist() );
-    } else {
-        mArtistText->setPlainText( tr( "Unknown") );
     }
-
-    if (canQuerySharePlayerLink() ) {
-        mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title());
+    else {
+        mArtistText->setPlainText( hbTrId( "txt_mus_other_unknown6") );
     }
 
-    if (canQueryRecommendations()) {
-        // start inspire me area progress bar
-        // TODO: currently, till we get to this callback from MPX the bar not shown
-        // TODO: check if inspireMe is ON, if not, dont show
-        mInspireMeProgressBar->show();
-        mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
-        mInspireMeQueryOngoing = true;
-    }
-    else {
-        // metadata to query for inspire me items not available
-        // show information note
-      if (!mInspireMeGroupBox->isCollapsed())
-        RenderInspireMeGroupBox();
+    if(!mInspireMeGroupBox->isCollapsed()) {
+        startInspireMe();
     }
     TX_EXIT
 }
 
-void MpDetailsView::clearInspireMe()
+void MpDetailsView::startInspireMe()
 {
-    TX_ENTRY
-    mInspireList->clear();
-    mMpQueryManager->clearRecommendations();
-    TX_EXIT
+    TX_ENTRY    
+    if(isMetadata()) {
+        // show progress bar, start store query or inspire me query process
+        mInspireMeProgressBar->show();
+        mInspireMeQueryOngoing = true;
+        if( mMpQueryManager->isLocalMusicStore() ) {
+            mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
+        }
+        else {
+            // no local store information present
+            mMpQueryManager->queryLocalMusicStore();
+        }
+    }
+    else {
+        // no metadata. show no recommendations
+        renderInspireMeMetadata();
+    }
+    TX_EXIT    
 }
+    
 /*!
  Slot to handle detail song information
  */
@@ -434,7 +436,7 @@
 
     if ( !mSongData->albumTrack().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Song number" ) );
+        item->setText( hbTrId( "txt_mus_dblist_song_number" ) );
         item->setSecondaryText( mSongData->albumTrack() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -442,7 +444,7 @@
 
     if ( !mSongData->year().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Year" ) );
+        item->setText( hbTrId( "txt_mus_dblist_year" ) );
         item->setSecondaryText( mSongData->year() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -450,7 +452,7 @@
 
     if ( !mSongData->genre().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Genre" ) );
+        item->setText( hbTrId( "txt_mus_dblist_genre" ) );
         item->setSecondaryText( mSongData->genre() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -458,7 +460,7 @@
 
     if ( !mSongData->composer().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Composer" ) );
+        item->setText( hbTrId( "txt_mus_dblist_composer" ) );
         item->setSecondaryText( mSongData->composer() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -466,7 +468,7 @@
 
     if ( !mSongData->fileName().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "File name" ) );
+        item->setText( hbTrId( "txt_mus_dblist_file_name" ) );
         item->setSecondaryText( mSongData->fileName() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -474,7 +476,7 @@
 
     if ( !mSongData->mimeType().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Format" ) );
+        item->setText( hbTrId( "txt_mus_dblist_format" ) );
         item->setSecondaryText( mSongData->mimeType() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -482,7 +484,7 @@
 
     if ( !mSongData->duration().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Duration" ) );
+        item->setText( hbTrId( "txt_mus_dblist_duration" ) );
         item->setSecondaryText( mSongData->duration() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -490,31 +492,62 @@
 
     if ( !mSongData->bitRate().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Bitrate" ) );
-        item->setSecondaryText( mSongData->bitRate().append( " Kbps" ) );
+        item->setText( hbTrId( "txt_mus_dblist_bitrate" ) );
+        bool ok = false;
+        int bitRate = mSongData->bitRate().toInt(&ok);
+        TX_LOG_ARGS("Warning: If zero, bitrate is not read correctly. It wont show up in details" << ok);
+        if(ok) {
+            item->setSecondaryText( hbTrId("txt_mus_dblist_bitrate_val_ln_kbps", bitRate) );
+        }
         item->setEnabled( false );
         mDetailList->addItem( item );
     }
 
     if ( !mSongData->sampleRate().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Sampling rate" ) );
-        item->setSecondaryText( mSongData->sampleRate().append( " hz" ) );
+        item->setText( hbTrId( "txt_mus_dblist_sampling_rate" ) );
+        bool ok = false;
+        int samplingRate = mSongData->sampleRate().toInt(&ok);
+        TX_LOG_ARGS("Warning: If zero, sampling rate is not read correctly. It wont show up in details" << ok);
+        if(ok) {
+            item->setSecondaryText(	hbTrId("txt_mus_dblist_sampling_rate_val_ln_hz", samplingRate) );
+        }
         item->setEnabled( false );
         mDetailList->addItem( item );
     }
 
     if ( !mSongData->size().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Size" ) );
-        item->setSecondaryText( mSongData->size().append( " MB" ) );
+        item->setText( hbTrId( "txt_mus_dblist_size" ) );
+        bool ok = false;
+        long size = mSongData->size().toLong(&ok); // in bytes
+        TX_LOG_ARGS("WARNING: If zero, Cant get song data size right. You wont see the size in details groupbox correctly" << ok );
+        if( size < KOneKiloByteInBytes) {
+            // under 1 KB
+            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_b", size) );
+        }
+        else if( size < KOneMegabyteInBytes ) {
+            // under 1 MB
+            size /= KOneKiloByteInBytes; // turn size into KB
+            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_kb", size) );
+        }
+        else if( size < KOneGigaByteInBytes ) {
+            // under 1 GB
+            size /= KOneMegabyteInBytes; // turn size to MB
+            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_mb", size) );
+        }
+        else {
+            // 1 GB or higher
+            size /= KOneGigaByteInBytes; // turn size to GB
+            item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_gb", size) );            
+        }
         item->setEnabled( false );
         mDetailList->addItem( item );
     }
 
     if ( !mSongData->modified().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Modified" ) );
+        item->setText( hbTrId( "txt_mus_dblist_modified" ) );
         item->setSecondaryText( mSongData->modified() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -522,7 +555,7 @@
 
     if ( !mSongData->copyright().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Copyright" ) );
+        item->setText( hbTrId( "txt_mus_dblist_copyright" ) );
         item->setSecondaryText( mSongData->copyright() );
         item->setEnabled( false );
         mDetailList->addItem( item );
@@ -530,7 +563,7 @@
 
     if ( !mSongData->musicURL().isNull() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Web site" ) );
+        item->setText( hbTrId( "txt_mus_dblist_web_site" ) );
         item->setSecondaryText( mSongData->musicURL() );
         item->setEnabled( true );
         mDetailList->addItem( item );
@@ -538,8 +571,8 @@
 
     if ( mSongData->isDrmProtected() ) {
         HbListWidgetItem *item = new HbListWidgetItem();
-        item->setText( tr( "Licences" ) );
-        item->setSecondaryText( tr( "Click for details" ) );
+        item->setText( hbTrId( "txt_mus_dblist_licences" ) );
+        item->setSecondaryText( hbTrId( "txt_mus_dblist_licences_val_click_for_details" ) );
         item->setEnabled( true );
         mDetailList->addItem( item );
     }
@@ -565,107 +598,52 @@
         if ( mInspireMeQueryOngoing ) {
             TX_LOG_ARGS( "Query is ongoing " )
             mInspireMeProgressBar->show();
-        } else {
+        }
+        else {
             TX_LOG_ARGS( "Query is NOT ongoing " )
             if ( mInspireMeQueryRendered ) {
                 TX_LOG_ARGS( "InspireMe is rendered already. " )
                 mInspireMeProgressBar->hide();
-            } else {
-                if ( canQueryRecommendations() ) {
-                    TX_LOG_ARGS( "InspireMe is NOT rendered yet but can query for recommendations. " )
-                    mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
-                    mInspireMeProgressBar->show();
-                    mInspireMeQueryOngoing = true;
-                } else {
-                    TX_LOG_ARGS( "InspireMe is NOT rendered yet and CANNOT query for recommendations either. " )
-                    RenderInspireMeGroupBox();
-                }
+            }
+            else {
+                startInspireMe();
             }
         }
-    } else {
+    }
+    else {
         TX_LOG_ARGS( "InspireMe is collapsed." )
         mInspireMeProgressBar->hide();
     }
     TX_EXIT
 }
 
-#ifdef SHARE_FUNC_ENABLED
 /*!
- Slot to be called when share button is clicked
- */
-void MpDetailsView::share()
+ Slot to call when URL item in song details is pressed
+*/
+void MpDetailsView::handleListItemSelected( HbListWidgetItem  *item)
 {
-    TX_ENTRY
-    createShareDialog();
-    if (canQuerySharePlayerLink() )
-    {
-        mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title() );
-    }
-    TX_EXIT
-}
-
-/*!
-  Method to create the share dialog on demand.
-  This will cause the share web view to be created and start loading.
-  */
-void MpDetailsView::createShareDialog()
-{
-    TX_ENTRY
-    if ( !mSharePopup )
-    {
-        mSharePopup = new MpDetailsShareDialog();
-    }
-    if ( !mSharePopup->isInitialized() )
-    {
-        connect( mSharePopup, SIGNAL( closeShareDialog() ), this, SLOT( closeShareDialog() ) );
-        mSharePopup->initialize( mSongData, tr( "Unknown" ) );
-    }
+    TX_ENTRY_ARGS( "URL: " << item->secondaryText() );
+    QDesktopServices::openUrl( item->secondaryText() );
     TX_EXIT
 }
 
 /*!
-  Method to create the share dialog on demand and preload publishing player files.
-  This will construct the share dialog but it will still be in "uninitialized" state.
-  */
-void MpDetailsView::preloadShareDialog()
+ Slot to call when MusicStore Info is Received
+*/
+void MpDetailsView::queryInspireMe(bool storeUpdated)
 {
     TX_ENTRY
-    if ( !mSharePopup )
-    {
-        mSharePopup = new MpDetailsShareDialog();
+    // we asked query manager to update its local store information
+    // if that store info didnt change (i.e. from empty string to "fi" or
+    // from "bad old store" to "good new store") then we dont need to pursue a query    
+    if( storeUpdated ) {
+        mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title());
+        mInspireMeQueryOngoing = true;
     }
-    mSharePopup->cachePublishingPlayerFiles();
+    else {
+        mInspireMeQueryOngoing = false;
+        mInspireMeProgressBar->hide();
+    }
     TX_EXIT
 }
 
-/*!
- Slot to be called when ok/close button in share dialog is pressed.
- */
-void MpDetailsView::closeShareDialog()
-{
-    TX_ENTRY
-    if ( mSharePopup )
-    {
-        // Dialog uses WA_DeleteOnClose so no need to delete it explicitely here, just close it.
-        mSharePopup->close();
-        mSharePopup = NULL;
-    }
-    TX_EXIT
-}
-#endif
-
-/*!
- Slot to handle the music store URL retrieval from the query manager.
-*/
-void MpDetailsView::updateSharedData(const QString& url)
-{
-    TX_ENTRY
-    mSongData->setLink( url );
-#ifdef SHARE_FUNC_ENABLED
-    if ( mSharePopup )
-	{
-		mSharePopup->updateSharedData();
-	}
-#endif
-    TX_EXIT
-}