From 76c8ca80c76e7ca5242ba42d9d5fcd6b984877b5 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 6 Dec 2022 10:05:34 -0500 Subject: [PATCH] 2022-12-06 Fred Gleason * Fixed a regression in rdcastmanager(1) that caused newly added feed items to be listed twice in the 'Podcast Item List' dialog. * Fixed a bug in 'RDPodcastListModel' that broke item delete notifications. Signed-off-by: Fred Gleason --- ChangeLog | 5 ++++ lib/rdpodcast.cpp | 10 ++++--- lib/rdpodcast.h | 1 + lib/rdpodcastlistmodel.cpp | 56 ++++++++++++++++++++------------------ 4 files changed, 41 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index b96a7df7..1e7ccf86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23745,3 +23745,8 @@ 2022-12-05 Fred Gleason * Fixed a bug in the log rendering code that caused voicetracks to be faded during the trailing transition. +2022-12-06 Fred Gleason + * Fixed a regression in rdcastmanager(1) that caused newly added + feed items to be listed twice in the 'Podcast Item List' dialog. + * Fixed a bug in 'RDPodcastListModel' that broke item delete + notifications. diff --git a/lib/rdpodcast.cpp b/lib/rdpodcast.cpp index 4c95a5a3..9e3d6b1f 100644 --- a/lib/rdpodcast.cpp +++ b/lib/rdpodcast.cpp @@ -48,19 +48,22 @@ int __RDPodcast_Debug_Callback(CURL *handle,curl_infotype type,char *data, RDPodcast::RDPodcast(RDConfig *config,unsigned id) { podcast_config=config; + podcast_feed_id=0; RDSqlQuery *q; QString sql; podcast_id=id; sql=QString("select ")+ - "`FEEDS`.KEY_NAME "+ + "`FEEDS`.`ID`,"+ // 00 + "`FEEDS`.KEY_NAME "+ // 01 "from `PODCASTS` left join `FEEDS` "+ "on (`PODCASTS`.`FEED_ID`=`FEEDS`.`ID`) "+ QString::asprintf("where `PODCASTS`.`ID`=%u",id); q=new RDSqlQuery(sql); if(q->first()) { - podcast_keyname=q->value(0).toString(); + podcast_feed_id=q->value(0).toUInt(); + podcast_keyname=q->value(1).toString(); } delete q; } @@ -86,8 +89,7 @@ bool RDPodcast::exists() const unsigned RDPodcast::feedId() const { - return RDGetSqlValue("PODCASTS","ID",podcast_id,"FEED_ID"). - toUInt(); + return podcast_feed_id; } diff --git a/lib/rdpodcast.h b/lib/rdpodcast.h index b56530de..e71fb14d 100644 --- a/lib/rdpodcast.h +++ b/lib/rdpodcast.h @@ -92,6 +92,7 @@ class RDPodcast void SetRow(const QString ¶m,const QDateTime &datetime, const QString &value) const; QString podcast_keyname; + unsigned podcast_feed_id; unsigned podcast_id; RDConfig *podcast_config; }; diff --git a/lib/rdpodcastlistmodel.cpp b/lib/rdpodcastlistmodel.cpp index 21633ff1..a0550252 100644 --- a/lib/rdpodcastlistmodel.cpp +++ b/lib/rdpodcastlistmodel.cpp @@ -185,18 +185,23 @@ unsigned RDPodcastListModel::castId(const QModelIndex &row) const QModelIndex RDPodcastListModel::addCast(unsigned cast_id) { - beginInsertRows(QModelIndex(),0,0); - QList list; - for(int i=0;i list; + for(int i=0;itype()==RDNotification::FeedItemType) { cast_id=notify->id().toUInt(); cast=new RDPodcast(rda->config(),cast_id); - if(cast->feedId()==d_feed_id) { - switch(notify->action()) { - case RDNotification::AddAction: - addCast(cast_id); - break; + switch(notify->action()) { + case RDNotification::AddAction: + addCast(cast_id); + break; - case RDNotification::DeleteAction: - removeCast(cast_id); - break; + case RDNotification::DeleteAction: + removeCast(cast_id); + break; - case RDNotification::ModifyAction: - refresh(cast_id); - break; + case RDNotification::ModifyAction: + refresh(cast_id); + break; - case RDNotification::LastAction: - case RDNotification::NoAction: - break; - - } + case RDNotification::LastAction: + case RDNotification::NoAction: + break; } delete cast; }