[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Bart Cerneels <bart.cerneels () kde ! org>
Date:       2008-08-21 19:48:49
Message-ID: 1219348129.613131.12522.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 850582 by shanachie:

Rename function and add useful debug.


 M  +3 -6      browsers/playlistbrowser/PodcastCategory.cpp  
 M  +7 -3      browsers/playlistbrowser/PodcastModel.cpp  
 M  +2 -1      browsers/playlistbrowser/PodcastModel.h  
 M  +0 -2      podcasts/sql/SqlPodcastMeta.h  
 M  +8 -2      podcasts/sql/SqlPodcastProvider.cpp  


--- trunk/extragear/multimedia/amarok/src/browsers/playlistbrowser/PodcastCategory.cpp \
#850581:850582 @@ -96,8 +96,9 @@
     m_podcastTreeView->setModel( podcastModel );
     m_podcastTreeView->header()->hide();
 
-
     m_podcastTreeView->setAlternatingRowColors( true );
+    m_podcastTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
+    m_podcastTreeView->setSelectionBehavior( QAbstractItemView::SelectRows );
 
     //transparency
     QPalette p = m_podcastTreeView->palette();
@@ -135,23 +136,19 @@
 {
 }
 
-
 void PlaylistBrowserNS::PodcastCategory::showInfo( const QModelIndex & index )
 {
 
     QString description = index.data( ShortDescriptionRole ).toString();
     description.replace( QRegExp("\n "), "\n" );
     description.replace( QRegExp("\n+"), "\n" );
-    
+
     QVariantMap map;
     map["service_name"] = "Podcasts";
     map["main_info"] = description;
     The::serviceInfoProxy()->setInfo( map );
 }
 
-
-
-
 ViewKicker::ViewKicker( QTreeView * treeView )
 {
     DEBUG_BLOCK
--- trunk/extragear/multimedia/amarok/src/browsers/playlistbrowser/PodcastModel.cpp \
#850581:850582 @@ -367,10 +367,14 @@
     foreach( QModelIndex index, list )
     {
         Meta::PodcastMetaCommon *pmc = static_cast<Meta::PodcastMetaCommon \
                *>(index.internalPointer());
-        if( typeid( * pmc ) == typeid( Meta::PodcastEpisode ) )
+        if( pmc->podcastType() ==  Meta::EpisodeType )
         {
             downloadEpisode( Meta::PodcastEpisodePtr( \
reinterpret_cast<Meta::PodcastEpisode *>(pmc) ) );  }
+        else if( pmc->podcastType() ==  Meta::ChannelType )
+        {
+            //TODO: download all (new) episodes
+        }
     }
 }
 
@@ -394,9 +398,9 @@
 }
 
 void
-PlaylistBrowserNS::PodcastModel::configurePodcasts()
+PlaylistBrowserNS::PodcastModel::configureChannels()
 {
-    debug() << "configure Podcasts";
+    debug() << "configure Channels";
 }
 
 void
--- trunk/extragear/multimedia/amarok/src/browsers/playlistbrowser/PodcastModel.h \
#850581:850582 @@ -58,11 +58,12 @@
         void downloadItems(  QModelIndexList list );
         void refreshItems( QModelIndexList list );
 
+        
     public slots:
         void slotUpdate();
         void addPodcast();
         void refreshPodcasts();
-        void configurePodcasts();
+        void configureChannels();
         void setPodcastsInterval();
         void emitLayoutChanged();
 
--- trunk/extragear/multimedia/amarok/src/podcasts/sql/SqlPodcastMeta.h \
#850581:850582 @@ -37,8 +37,6 @@
 class SqlPodcastEpisode : public PodcastEpisode
 {
     public:
-//         static SqlPodcastEpisodePtr getEpisode( SqlPodcastProvider *provider );
-        
         SqlPodcastEpisode( const QStringList &queryResult, SqlPodcastChannelPtr \
sqlChannel );  
         /** Copy from another PodcastEpisode
--- trunk/extragear/multimedia/amarok/src/podcasts/sql/SqlPodcastProvider.cpp \
#850581:850582 @@ -197,8 +197,8 @@
 void
 SqlPodcastProvider::downloadEpisode( Meta::PodcastEpisodePtr episode )
 {
+    DEBUG_BLOCK
     SqlPodcastEpisodePtr sqlEpisode = SqlPodcastEpisodePtr( new SqlPodcastEpisode( \
                episode ) );
-    DEBUG_BLOCK
 
     KIO::StoredTransferJob *storedTransferJob = KIO::storedGet( \
sqlEpisode->uidUrl(), KIO::Reload, KIO::HideProgressInfo );  
@@ -273,12 +273,18 @@
     else
     {
         Meta::SqlPodcastEpisodePtr sqlEpisode = m_jobMap.value( job );
+        if( sqlEpisode.isNull() )
+        {
+            debug() << "sqlEpisodePtr is NULL after download";
+            return;
+        }
         QString title = sqlEpisode->channel()->title();
 
         QDir dir( Amarok::saveLocation("podcasts") );
         //save in directory with channels title
         if ( !dir.exists( title ) )
         {
+            debug() << "Making directory " << title;
             dir.mkdir( title );
         }
         dir.cd( title );
@@ -287,7 +293,7 @@
 
         QFile *localFile = new QFile( localUrl.path() );
         if( localFile->open( QIODevice::WriteOnly ) &&
-            localFile->write( static_cast<KIO::StoredTransferJob *>(job)->data() ) \
!= -1 ) +            localFile->write( (static_cast<KIO::StoredTransferJob \
*>(job))->data() ) != -1 )  {
             sqlEpisode->setLocalUrl( localUrl );
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic