]> Some of my projects - localmylist.git/commitdiff
When adding a file to AniDB MyList, update file with default my* data.
authorAPTX <marek321@gmail.com>
Sat, 27 Apr 2013 15:28:22 +0000 (17:28 +0200)
committerAPTX <marek321@gmail.com>
Sat, 27 Apr 2013 15:28:22 +0000 (17:28 +0200)
localmylist/requesthandler.cpp

index f764ff23a2e5b54fd7d88302873a4b6ad8c4e3be..c296f36b64a8c33c590de755239d18660d656aea 100644 (file)
@@ -539,6 +539,29 @@ void RequestHandler::myListAddReplyRecieved(bool success)
 
        db->transaction();
 
+       if (reply->command().fid())
+       {
+               File f = db->getFile(reply->command().fid());
+
+               if (!f.fid)
+               {
+                       qWarning("File added to MyList not in DB!");
+                       return;
+               }
+
+               f.entryUpdate = QDateTime::currentDateTime();
+               f.myUpdate = QDateTime::currentDateTime();
+
+               if (MyList::instance()->settings()->get("myListDefaultViewed", false))
+                       f.myWatched = QDateTime::currentDateTime();
+
+               f.myState = State(MyList::instance()->settings()->get("myListDefaultState", 1));
+               f.mySource = MyList::instance()->settings()->get("myListDefaultSource", QString());
+               f.myStorage = MyList::instance()->settings()->get("myListDefaultStorage", QString());
+               f.myOther = MyList::instance()->settings()->get("myListDefaultOther", QString());
+               db->setFile(f);
+       }
+
        qDebug() << "Clearing fid/ed2k&size" << reply->command().fid() << "/" << reply->command().ed2k() << "&" << reply->command().size();
        PendingRequest request;
        request.fid = reply->command().fid();