2020-08-28 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDNotification::FeedType' value to the
	'RDNotification::Type' enumeration.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2020-08-28 13:40:11 -04:00
parent b2809f6aca
commit 288b7a9826
10 changed files with 102 additions and 36 deletions

View File

@@ -383,11 +383,7 @@ void EditCast::okData()
if(!cast_feed->postXmlConditional("RDCastManager",this)) {
return;
}
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::ModifyAction,
cast_cast->id());
rda->ripc()->sendNotification(*notify);
delete notify;
done(0);
}

View File

@@ -249,10 +249,11 @@ void ListCasts::addCartData()
list_casts_view->ensureItemVisible(item);
delete edit_cast;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
}
@@ -281,10 +282,11 @@ void ListCasts::addFileData()
list_casts_view->ensureItemVisible(item);
delete edit_cast;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
}
@@ -314,7 +316,12 @@ void ListCasts::addLogData()
RefreshItem(item);
list_casts_view->setSelected(item,true);
list_casts_view->ensureItemVisible(item);
//delete cast;
delete cast;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
}
else {
QMessageBox::warning(this,"RDCastManager - "+tr("Posting Error"),
@@ -330,11 +337,6 @@ void ListCasts::addLogData()
}
}
delete d;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
}
@@ -347,6 +349,12 @@ void ListCasts::editData()
EditCast *edit_cast=new EditCast(item->id(),this);
if(edit_cast->exec()==0) {
RefreshItem(item);
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::ModifyAction,item->id());
}
delete edit_cast;
}
@@ -413,11 +421,11 @@ void ListCasts::deleteData()
delete pd;
delete cast;
delete item;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::DeleteAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::DeleteAction,cast_id);
}

View File

@@ -100,6 +100,12 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
cast_greencheckmark_map=new QPixmap(greencheckmark_xpm);
cast_redx_map=new QPixmap(redx_xpm);
//
// Notifications
//
connect(rda->ripc(),SIGNAL(notificationReceived(RDNotification *)),
this,SLOT(notificationReceivedData(RDNotification *)));
//
// Feed List
//
@@ -218,6 +224,34 @@ void MainWidget::feedDoubleclickedData(Q3ListViewItem *,const QPoint &,int)
}
void MainWidget::notificationReceivedData(RDNotification *notify)
{
QString keyname;
RDListViewItem *item=NULL;
if(notify->type()==RDNotification::FeedType) {
keyname=notify->id().toString();
switch(notify->action()) {
case RDNotification::ModifyAction:
item=(RDListViewItem *)cast_feed_list->firstChild();
while(item!=NULL) {
if(item->text(1)==keyname) {
RefreshItem(item);
}
item=(RDListViewItem *)item->nextSibling();
}
break;
case RDNotification::NoAction:
case RDNotification::AddAction:
case RDNotification::DeleteAction:
case RDNotification::LastAction:
break;
}
}
}
void MainWidget::quitMainWidget()
{
exit(0);

View File

@@ -43,6 +43,7 @@ class MainWidget : public RDWidget
void userChangedData();
void feedClickedData(Q3ListViewItem *item);
void feedDoubleclickedData(Q3ListViewItem *item,const QPoint &pt,int col);
void notificationReceivedData(RDNotification *notify);
void quitMainWidget();
protected: