From: APTX Date: Sun, 5 May 2013 13:05:19 +0000 (+0200) Subject: Update fileLocationUpdate handling. X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=5778820c69f6c0dbd16dea89af0907558a577d4d;p=localmylist.git Update fileLocationUpdate handling. fid was added to the payload but it wasn't handled in the code. This fixes file location updates in the model (Qt5 only). --- diff --git a/localmylist/database.cpp b/localmylist/database.cpp index a1a502f..32ca5c0 100644 --- a/localmylist/database.cpp +++ b/localmylist/database.cpp @@ -1907,9 +1907,17 @@ void Database::handleNotification(const QString &name) } else if (name == "file_location_update") { - int id = payload.toInt(); - if (id) - emit fileLocationUpdate(id); + QStringList ids = payload.toString().split(QChar(','), QString::SkipEmptyParts); + int locationId = 0; + int fid = 0; + + if (ids.count()) + locationId = ids.takeFirst().toInt(); + if (ids.count()) + fid = ids.takeFirst().toInt(); + + if (locationId) + emit fileLocationUpdate(locationId, fid); } else if (name == "anime_insert") { diff --git a/localmylist/database.h b/localmylist/database.h index 0c91104..056216e 100644 --- a/localmylist/database.h +++ b/localmylist/database.h @@ -167,7 +167,7 @@ signals: void animeUpdate(int aid); void episodeUpdate(int eid, int aid); void fileUpdate(int fid, int eid, int aid); - void fileLocationUpdate(int id); + void fileLocationUpdate(int locationId, int fid); void animeInsert(int aid); void episodeInsert(int eid, int aid); diff --git a/localmylist/mylistmodel.cpp b/localmylist/mylistmodel.cpp index 5cccd26..b2a58b5 100644 --- a/localmylist/mylistmodel.cpp +++ b/localmylist/mylistmodel.cpp @@ -17,7 +17,7 @@ MyListModel::MyListModel(QObject *parent) : connect(MyList::instance()->database(), SIGNAL(animeUpdate(int)), this, SLOT(animeUpdate(int))); connect(MyList::instance()->database(), SIGNAL(episodeUpdate(int,int)), this, SLOT(episodeUpdate(int,int))); connect(MyList::instance()->database(), SIGNAL(fileUpdate(int,int,int)), this, SLOT(fileUpdate(int,int,int))); - connect(MyList::instance()->database(), SIGNAL(fileLocationUpdate(int)), this, SLOT(fileLocationUpdate(int))); + connect(MyList::instance()->database(), SIGNAL(fileLocationUpdate(int,int)), this, SLOT(fileLocationUpdate(int,int))); connect(MyList::instance()->database(), SIGNAL(animeInsert(int)), this, SLOT(animeInsert(int))); connect(MyList::instance()->database(), SIGNAL(episodeInsert(int,int)), this, SLOT(episodeInsert(int,int))); @@ -376,9 +376,11 @@ void MyListModel::fileUpdate(int fid, int eid, int aid) updatedNode->parent()->moveChild(updatedNode, MyListNode::UpdateOperation); } -void MyListModel::fileLocationUpdate(int id) +void MyListModel::fileLocationUpdate(int locationId, int fid) { - MyListNode *updatedNode = node(fileLocationIndex(id)); + Q_UNUSED(fid); + + MyListNode *updatedNode = node(fileLocationIndex(locationId)); if (!updatedNode) return; diff --git a/localmylist/mylistmodel.h b/localmylist/mylistmodel.h index 9d65dc5..836862a 100644 --- a/localmylist/mylistmodel.h +++ b/localmylist/mylistmodel.h @@ -81,7 +81,7 @@ private slots: void animeUpdate(int aid); void episodeUpdate(int eid, int aid); void fileUpdate(int fid, int eid, int aid); - void fileLocationUpdate(int id); + void fileLocationUpdate(int locationId, int fid); void animeInsert(int aid); void episodeInsert(int eid, int aid);