]> Some of my projects - localmylist.git/commitdiff
Update fileLocationUpdate handling.
authorAPTX <marek321@gmail.com>
Sun, 5 May 2013 13:05:19 +0000 (15:05 +0200)
committerAPTX <marek321@gmail.com>
Sun, 5 May 2013 13:05:19 +0000 (15:05 +0200)
fid was added to the payload but it wasn't handled in the code. This fixes file location updates in the model (Qt5 only).

localmylist/database.cpp
localmylist/database.h
localmylist/mylistmodel.cpp
localmylist/mylistmodel.h

index a1a502f9b62fde19820fb22734907969536cc449..32ca5c0e449e3e2a05397f27f70e223774317635 100644 (file)
@@ -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")
        {
index 0c911044d31f3b3f4e50d023c6035b6d7f3f597c..056216e77436aed4354e8ec0d2ef2cdf43bb0f49 100644 (file)
@@ -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);
index 5cccd260355e4de913ee7e84fb8c3fd9465608da..b2a58b5c59347dc3d98f0e1d35697307ba523b03 100644 (file)
@@ -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;
 
index 9d65dc5c8968d7367d9f3d96a01fa27cbb89b364..836862a81b38bfede8c4b2e5ce7318f3502eba21 100644 (file)
@@ -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);