Enhance logging and edit TODOS

master
JuanJakobo 2022-07-29 17:35:42 +02:00
parent 3822d3197c
commit c6ea754345
3 changed files with 11 additions and 15 deletions

View File

@ -197,10 +197,7 @@ string WebDAV::propfind(const string &pathUrl)
} }
if (!Util::connectToNetwork()) if (!Util::connectToNetwork())
{
Message(ICON_WARNING, "Warning", "Cannot connect to the internet. ", 2000);
return ""; return "";
}
//TODO for upload //TODO for upload
//get etag from current and then send request with FT_ENC_TAG //get etag from current and then send request with FT_ENC_TAG
@ -257,7 +254,7 @@ string WebDAV::propfind(const string &pathUrl)
switch (response_code) switch (response_code)
{ {
case 404: case 404:
Message(ICON_ERROR, "Error", "The URL seems to be incorrect. You can look up the WebDav URL in the files app under settings. ", 4000); Message(ICON_ERROR, "Error", "The URL seems to be incorrect. You can look up the WebDav URL in the settings of the files webapp. ", 4000);
break; break;
case 401: case 401:
Message(ICON_ERROR, "Error", "Username/password incorrect.", 4000); Message(ICON_ERROR, "Error", "Username/password incorrect.", 4000);

View File

@ -93,8 +93,6 @@ void EventHandler::mainMenuHandler(const int index)
//Actualize the current folder //Actualize the current folder
case 101: case 101:
{ {
//TODO startfolder use same as above
//TODO parent path not needed
OpenProgressbar(1, "Actualizing current folder", ("Actualizing path" + _currentPath).c_str(), 0, NULL); OpenProgressbar(1, "Actualizing current folder", ("Actualizing path" + _currentPath).c_str(), 0, NULL);
string childrenPath = _currentPath; string childrenPath = _currentPath;
childrenPath = childrenPath.substr(NEXTCLOUD_ROOT_PATH.length(), childrenPath.length()); childrenPath = childrenPath.substr(NEXTCLOUD_ROOT_PATH.length(), childrenPath.length());
@ -139,7 +137,7 @@ void EventHandler::mainMenuHandler(const int index)
for(auto &item : currentWebDAVItems) for(auto &item : currentWebDAVItems)
{ {
Log::writeInfoLog(item.path); Log::writeInfoLog(item.path);
if(item.state == FileState::IOUTSYNCED || item.state == FileState::ICLOUD) if(item.type == Itemtype::IFOLDER && item.state == FileState::IOUTSYNCED)
{ {
UpdateProgressbar(("Upgrading " + item.path).c_str(), 0); UpdateProgressbar(("Upgrading " + item.path).c_str(), 0);
vector<WebDAVItem> tempWebDAVItems = _webDAV.getDataStructure(item.path); vector<WebDAVItem> tempWebDAVItems = _webDAV.getDataStructure(item.path);
@ -392,7 +390,7 @@ void EventHandler::openItem()
_webDAVView->invertCurrentEntryColor(); _webDAVView->invertCurrentEntryColor();
if (_webDAVView->getCurrentEntry().state == FileState::ICLOUD) if (_webDAVView->getCurrentEntry().state == FileState::ICLOUD)
{ {
Message(ICON_ERROR, "File not found.", "Could not find file.", 1000); Message(ICON_ERROR, "Error", "Could not find file.", 1000);
} }
else if(_webDAVView->getCurrentEntry().fileType.find("application/epub+zip") != string::npos || else if(_webDAVView->getCurrentEntry().fileType.find("application/epub+zip") != string::npos ||
_webDAVView->getCurrentEntry().fileType.find("application/pdf") != string::npos || _webDAVView->getCurrentEntry().fileType.find("application/pdf") != string::npos ||
@ -409,7 +407,7 @@ void EventHandler::openItem()
} }
else else
{ {
Message(ICON_INFORMATION, "Warning", "The filetype is currently not supported.", 1200); Message(ICON_INFORMATION, "Info", "The filetype is currently not supported.", 1200);
} }
} }
@ -566,14 +564,13 @@ void EventHandler::downloadFolder(vector<WebDAVItem> &items, int itemID)
vector<WebDAVItem> tempItems; vector<WebDAVItem> tempItems;
if(items.at(itemID).state == FileState::IOUTSYNCED || items.at(itemID).state == FileState::ICLOUD) if(items.at(itemID).state == FileState::IOUTSYNCED || items.at(itemID).state == FileState::ICLOUD)
{ {
Log::writeInfoLog("outsynced"); Log::writeInfoLog(path + "outsynced");
tempItems = _webDAV.getDataStructure(path); tempItems = _webDAV.getDataStructure(path);
//TODO twice?
updateItems(tempItems); updateItems(tempItems);
} }
else else
{ {
Log::writeInfoLog("synced"); Log::writeInfoLog(path + "synced");
tempItems = _sqllite.getItemsChildren(path); tempItems = _sqllite.getItemsChildren(path);
} }
//first item of the vector is the root path itself //first item of the vector is the root path itself
@ -583,7 +580,7 @@ void EventHandler::downloadFolder(vector<WebDAVItem> &items, int itemID)
downloadFolder(tempItems, i); downloadFolder(tempItems, i);
} }
//TODO remove file parts that are no longer there, check for local path and delete these //TODO remove file parts that are no longer there, check for local path and delete these
//TODO else use offline structure to go down //get items from DB, then compare to downloaded, if is in DB but not downloaded, remove
} }
else else
@ -591,7 +588,7 @@ void EventHandler::downloadFolder(vector<WebDAVItem> &items, int itemID)
if(items.at(itemID).state == FileState::IOUTSYNCED || items.at(itemID).state == FileState::ICLOUD) if(items.at(itemID).state == FileState::IOUTSYNCED || items.at(itemID).state == FileState::ICLOUD)
{ {
Log::writeInfoLog("outsynced"); Log::writeInfoLog("outsynced");
//TODO //TODO both direction
//1. check etag --> if is differnt, cloud has been updated //1. check etag --> if is differnt, cloud has been updated
//2. check modification date and file size locally --> if is different, local has been updated //2. check modification date and file size locally --> if is different, local has been updated
//3. if both --> create conflict //3. if both --> create conflict
@ -630,9 +627,9 @@ void EventHandler::startDownload()
UpdateProgressbar("Download completed", 100); UpdateProgressbar("Download completed", 100);
} }
//TODO implement
//Util::updatePBLibrary(15); //Util::updatePBLibrary(15);
CloseProgressbar(); CloseProgressbar();
//TODO does not work
_webDAVView->reDrawCurrentEntry(); _webDAVView->reDrawCurrentEntry();
} }

View File

@ -43,6 +43,7 @@ bool Util::connectToNetwork()
int result = NetConnect2(network_name, 1); int result = NetConnect2(network_name, 1);
if (result != 0) if (result != 0)
{ {
Message(ICON_WARNING, "Warning", "It was not possible to establish an internet connection.", 2000);
return false; return false;
} }
@ -50,6 +51,7 @@ bool Util::connectToNetwork()
if (netinfo->connected) if (netinfo->connected)
return true; return true;
Message(ICON_WARNING, "Warning", "It was not possible to establish an internet connection.", 2000);
return false; return false;
} }