diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b96413..21e69f3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,7 +81,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/api/ ) -TARGET_LINK_LIBRARIES (Nextcloud.app PRIVATE inkview freetype curl sqlite3) +TARGET_LINK_LIBRARIES (Nextcloud.app PRIVATE inkview freetype curl sqlite3 stdc++fs) INSTALL (TARGETS Nextcloud.app) diff --git a/src/api/sqliteConnector.cpp b/src/api/sqliteConnector.cpp index 3d240fa..8085b58 100644 --- a/src/api/sqliteConnector.cpp +++ b/src/api/sqliteConnector.cpp @@ -156,6 +156,7 @@ std::vector SqliteConnector::getItemsChildren(const string &parentPa void SqliteConnector::deleteChildren(const string &parentPath) { + //TODO missing the onces where parentPath is one folder deeper and also destroyed open(); int rs; sqlite3_stmt *stmt = 0; diff --git a/src/api/webDAV.cpp b/src/api/webDAV.cpp index 817fb43..3fa31d6 100644 --- a/src/api/webDAV.cpp +++ b/src/api/webDAV.cpp @@ -13,6 +13,7 @@ #include "eventHandler.h" #include +#include #include #include #include @@ -81,13 +82,11 @@ void WebDAV::logout(bool deleteFiles) { if (deleteFiles) { - string cmd = "rm -rf " + Util::accessConfig(Action::IReadString, "storageLocation",{}) + "/" + - Util::accessConfig(Action::IReadString,"UUID",{}) + '/'; - system(cmd.c_str()); + std::experimental::filesystem::remove_all(Util::accessConfig(Action::IReadString, "storageLocation",{}) + "/" + Util::accessConfig(Action::IReadString,"UUID",{}) + '/'); } - remove(CONFIG_PATH.c_str()); - remove((CONFIG_PATH + ".back.").c_str()); - remove(DB_PATH.c_str()); + std::experimental::filesystem::remove(CONFIG_PATH.c_str()); + std::experimental::filesystem::remove((CONFIG_PATH + ".back.").c_str()); + std::experimental::filesystem::remove(DB_PATH.c_str()); _url = ""; _password = ""; _username = ""; diff --git a/src/handler/eventHandler.cpp b/src/handler/eventHandler.cpp index 40a88aa..eeeee8b 100644 --- a/src/handler/eventHandler.cpp +++ b/src/handler/eventHandler.cpp @@ -19,6 +19,7 @@ #include "fileView.h" #include "fileModel.h" +#include #include #include @@ -289,16 +290,11 @@ void EventHandler::contextMenuHandler(const int index) { if (_webDAVView->getCurrentEntry().type == Itemtype::IFOLDER) { - Message(ICON_ERROR, "Error", "Currently only files can be deleted.", 2000); - //string cmd = "rm -rf " + _webDAVView->getCurrentEntry().localPath + '/'; - //if (rmdir((_webDAVView->getCurrentEntry().localPath + '/').c_str()) == 0) - //Log::writeInfoLog("okay"); - //if (system(cmd.c_str()) == 0) - //Log::writeInfoLog("success"); + std::experimental::filesystem::remove_all(_webDAVView->getCurrentEntry().localPath); } else { - remove(_webDAVView->getCurrentEntry().localPath.c_str()); + std::experimental::filesystem::remove(_webDAVView->getCurrentEntry().localPath); } vector currentWebDAVItems = _sqllite.getItemsChildren(_currentPath); updateItems(currentWebDAVItems); @@ -306,7 +302,7 @@ void EventHandler::contextMenuHandler(const int index) } else { - Message(ICON_ERROR, "Error", "File is not available.", 1000); + Message(ICON_ERROR, "Error", "File is not available locally.", 1000); _webDAVView->invertCurrentEntryColor(); } break;