Fix status for local items

master
JuanJakobo 2022-08-06 12:56:16 +02:00
parent 4ea9873ddc
commit c24199420e
2 changed files with 13 additions and 12 deletions

View File

@ -167,11 +167,6 @@ vector<WebDAVItem> WebDAV::getDataStructure(const string &pathUrl)
{ {
tempItem.type = Itemtype::IFILE; tempItem.type = Itemtype::IFILE;
tempItem.fileType = Util::getXMLAttribute(xmlItem, "d:getcontenttype"); tempItem.fileType = Util::getXMLAttribute(xmlItem, "d:getcontenttype");
if (iv_access(tempItem.localPath.c_str(), W_OK) != 0)
tempItem.state = FileState::ICLOUD;
else
tempItem.state = FileState::ISYNCED;
} }
tempItem.title = tempItem.title.substr(tempItem.title.find_last_of("/") + 1, tempItem.title.length()); tempItem.title = tempItem.title.substr(tempItem.title.find_last_of("/") + 1, tempItem.title.length());

View File

@ -678,20 +678,26 @@ void EventHandler::updateItems(vector<WebDAVItem> &items)
{ {
item.state = _sqllite.getState(item.path); item.state = _sqllite.getState(item.path);
if (iv_access(item.localPath.c_str(), W_OK) != 0) if (iv_access(item.localPath.c_str(), W_OK) == 0)
{ {
if (item.type == Itemtype::IFILE) item.state = FileState::ISYNCED;
item.state = FileState::ICLOUD; }
else else
{
if(item.type == Itemtype::IFOLDER)
{
iv_mkdir(item.localPath.c_str(), 0777); iv_mkdir(item.localPath.c_str(), 0777);
}
else
{
item.state = FileState::ICLOUD;
}
} }
if (_sqllite.getEtag(item.path).compare(item.etag) != 0) if (_sqllite.getEtag(item.path).compare(item.etag) != 0)
{
item.state = (item.state == FileState::ISYNCED) ? FileState::IOUTSYNCED : FileState::ICLOUD; item.state = (item.state == FileState::ISYNCED) ? FileState::IOUTSYNCED : FileState::ICLOUD;
}
} }
items.at(0).state =FileState::ISYNCED; items.at(0).state = FileState::ISYNCED;
_sqllite.saveItemsChildren(items); _sqllite.saveItemsChildren(items);
//TODO sync delete when not parentPath existend --> "select * from metadata where parentPath NOT IN (Select //TODO sync delete when not parentPath existend --> "select * from metadata where parentPath NOT IN (Select