2023-05-15 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in rdcastmanager(1) which broke display
	of superfeed items in the 'Podcast Item List' dialog.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2023-05-15 14:17:32 -04:00
parent ff63adcf3c
commit cccf4d39c8
3 changed files with 39 additions and 6 deletions

View File

@@ -27,7 +27,31 @@
RDPodcastListModel::RDPodcastListModel(unsigned feed_id,QObject *parent)
: QAbstractTableModel(parent)
{
d_feed_id=feed_id;
QString sql=QString("select ")+
"`IS_SUPERFEED` "+ // 00
"from `FEEDS` where "+
QString::asprintf("`ID`=%u",feed_id);
RDSqlQuery *q=new RDSqlQuery(sql);
if(q->first()) {
if(q->value(0).toString()=="Y") {
sql=QString("select ")+
"`MEMBER_FEED_ID` "+ // 00
"from `SUPERFEED_MAPS` where "+
QString::asprintf("`FEED_ID`=%u ",feed_id);
RDSqlQuery *q1=new RDSqlQuery(sql);
while(q1->next()) {
d_feed_ids.push_back(q1->value(0).toUInt());
}
delete q1;
}
else {
d_feed_ids.push_back(feed_id);
}
}
else {
d_feed_ids.push_back(feed_id);
}
d_font_metrics=NULL;
d_bold_font_metrics=NULL;
d_sort_column=0;
@@ -304,7 +328,8 @@ void RDPodcastListModel::processNotification(RDNotification *notify)
case RDNotification::AddAction:
cast_id=notify->id().toUInt();
cast=new RDPodcast(rda->config(),cast_id);
if(cast->feedId()==d_feed_id) {
// if(cast->feedId()==d_feed_id) {
if(d_feed_ids.contains(cast->feedId())) {
addCast(cast_id);
}
delete cast;
@@ -333,9 +358,13 @@ void RDPodcastListModel::updateModel()
RDSqlQuery *q=NULL;
QString sql=sqlFields()+
"where "+
QString::asprintf("`PODCASTS`.`FEED_ID`=%u ",d_feed_id)+
d_filter_sql+
"where ";
// sql+=QString::asprintf("`PODCASTS`.`FEED_ID`=%u ",d_feed_ids.at(0));
for(int i=0;i<d_feed_ids.size();i++) {
sql+=(QString::asprintf("`PODCASTS`.`FEED_ID`=%u || ",d_feed_ids.at(i)));
}
sql=sql.left(sql.length()-3);
sql+=d_filter_sql+
" order by "+d_column_fields.at(d_sort_column)+" ";
if(d_sort_order==Qt::DescendingOrder) {
sql+="desc ";

View File

@@ -77,7 +77,8 @@ class RDPodcastListModel : public QAbstractTableModel
QList<QList<QVariant> > d_texts;
QList<int> d_item_image_ids;
QList<QVariant> d_status_pixmaps;
unsigned d_feed_id;
// unsigned d_feed_id;
QList<unsigned> d_feed_ids;
QString d_filter_sql;
QStringList d_column_fields;
int d_sort_column;