2022-12-06 Fred Gleason <fredg@paravelsystems.com>

* 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 <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-12-06 10:05:34 -05:00
parent 9bae0c81ab
commit 76c8ca80c7
4 changed files with 41 additions and 31 deletions

View File

@ -23745,3 +23745,8 @@
2022-12-05 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the log rendering code that caused voicetracks to
be faded during the trailing transition.
2022-12-06 Fred Gleason <fredg@paravelsystems.com>
* 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.

View File

@ -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;
}

View File

@ -92,6 +92,7 @@ class RDPodcast
void SetRow(const QString &param,const QDateTime &datetime,
const QString &value) const;
QString podcast_keyname;
unsigned podcast_feed_id;
unsigned podcast_id;
RDConfig *podcast_config;
};

View File

@ -185,18 +185,23 @@ unsigned RDPodcastListModel::castId(const QModelIndex &row) const
QModelIndex RDPodcastListModel::addCast(unsigned cast_id)
{
beginInsertRows(QModelIndex(),0,0);
QList<QVariant> list;
for(int i=0;i<columnCount();i++) {
list.push_back(QVariant());
}
d_cast_ids.insert(0,cast_id);
d_texts.insert(0,list);
d_icons.insert(0,list);
updateRowLine(0);
endInsertRows();
QModelIndex ret;
return createIndex(0,0);
if(!d_cast_ids.contains(cast_id)) {
beginInsertRows(QModelIndex(),0,0);
QList<QVariant> list;
for(int i=0;i<columnCount();i++) {
list.push_back(QVariant());
}
d_cast_ids.insert(0,cast_id);
d_texts.insert(0,list);
d_icons.insert(0,list);
updateRowLine(0);
endInsertRows();
ret=createIndex(0,0);
}
return ret;
}
@ -268,25 +273,22 @@ void RDPodcastListModel::processNotification(RDNotification *notify)
if(notify->type()==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;
}