show current location on first item
parent
83aa3b6eb4
commit
98365f54a8
|
@ -88,7 +88,7 @@ void WebDAV::logout(bool deleteFiles)
|
|||
|
||||
//_url.clear();
|
||||
//TODO where?
|
||||
//_items.clear();
|
||||
//tempItems.clear();
|
||||
}
|
||||
|
||||
//TODO pas as reversne and no return
|
||||
|
@ -105,18 +105,6 @@ string WebDAV::getLocalPath(string path)
|
|||
///TODO rename function
|
||||
vector<WebDAVItem> WebDAV::getDataStructure(const string &pathUrl)
|
||||
{
|
||||
/*
|
||||
*TODO resize item one and make clickable, what to do with the start?
|
||||
//resize item 1
|
||||
string header = _items.at(0).getPath();
|
||||
header = header.substr(0, header.find_last_of("/"));
|
||||
header = header.substr(0, header.find_last_of("/") + 1);
|
||||
_items.at(0).setPath(header);
|
||||
_items.at(0).setTitle("...");
|
||||
_items.at(0).setLastEditDate("");
|
||||
if (_items.at(0).getPath().compare(NEXTCLOUD_ROOT_PATH) == 0)
|
||||
_items.erase(_items.begin());
|
||||
*/
|
||||
string xmlItem = propfind(pathUrl);
|
||||
if(!xmlItem.empty())
|
||||
{
|
||||
|
@ -207,6 +195,16 @@ vector<WebDAVItem> WebDAV::getDataStructure(const string &pathUrl)
|
|||
if (tempItems.empty())
|
||||
return {};
|
||||
|
||||
//resize item 1
|
||||
string header = tempItems.at(0).path;
|
||||
header = header.substr(0, header.find_last_of("/"));
|
||||
header = header.substr(0, header.find_last_of("/") + 1);
|
||||
tempItems.at(0).path = header;
|
||||
tempItems.at(0).title += "\nclick to go back";
|
||||
tempItems.at(0).lastEditDate = "";
|
||||
if (tempItems.at(0).path.compare(NEXTCLOUD_ROOT_PATH) == 0)
|
||||
tempItems.erase(tempItems.begin());
|
||||
|
||||
string localPath = getLocalPath(pathUrl);
|
||||
|
||||
//if the current folder does not exist locally, create it
|
||||
|
@ -298,7 +296,7 @@ void Nextcloud::download(int itemID)
|
|||
return;
|
||||
}
|
||||
|
||||
this->downloadFolder(_items, itemID);
|
||||
this->downloadFolder(tempItems, itemID);
|
||||
|
||||
UpdateProgressbar("Download completed", 100);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ using std::vector;
|
|||
|
||||
WebDAVView::WebDAVView(const irect &contentRect, const vector<WebDAVItem> &items, int page) : ListView(contentRect, page)
|
||||
{
|
||||
//TODO add line above!
|
||||
auto pageHeight = 0;
|
||||
auto contentHeight = _contentRect.h - _footerHeight;
|
||||
auto entrycount = items.size();
|
||||
|
@ -26,11 +25,17 @@ WebDAVView::WebDAVView(const irect &contentRect, const vector<WebDAVItem> &items
|
|||
auto i = 0;
|
||||
while (i < entrycount)
|
||||
{
|
||||
auto entrySize = TextRectHeight(contentRect.w, items.at(i).title.c_str(), 0) + 2.5 * _entryFontHeight;
|
||||
auto entrySize = TextRectHeight(contentRect.w, items.at(i).title.c_str(), 0);
|
||||
|
||||
if(items.at(i).type == IFILE)
|
||||
{
|
||||
entrySize += _entryFontHeight;
|
||||
}
|
||||
|
||||
if(items.at(i).title.find("click to go back") != std::string::npos)
|
||||
entrySize += 0.5 * _entryFontHeight;
|
||||
else
|
||||
entrySize += 2.5 * _entryFontHeight;
|
||||
|
||||
|
||||
if ((pageHeight + entrySize) > contentHeight)
|
||||
{
|
||||
pageHeight = 0;
|
||||
|
|
|
@ -17,56 +17,56 @@ WebDAVViewEntry::WebDAVViewEntry(int page, const irect &position, const WebDAVIt
|
|||
|
||||
void WebDAVViewEntry::draw(const ifont *entryFont, const ifont *entryFontBold, int fontHeight)
|
||||
{
|
||||
|
||||
SetFont(entryFontBold, BLACK);
|
||||
int heightOfTitle = TextRectHeight(_position.w, _entry.title.c_str(), 0);
|
||||
DrawTextRect(_position.x, _position.y, _position.w, heightOfTitle, _entry.title.c_str(), ALIGN_LEFT);
|
||||
|
||||
SetFont(entryFont, BLACK);
|
||||
|
||||
//DrawTextRect(_position.x, _position.y + heightOfTitle, _position.w, fontHeight, _entry.name.c_str(), ALIGN_LEFT);
|
||||
//DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, _entry.path.c_str(), ALIGN_LEFT);
|
||||
//std::string type = "File";
|
||||
//if(_entry.type == _entrytype::FOLDER)
|
||||
//type = "Folder";
|
||||
//DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, type.c_str(), ALIGN_RIGHT);
|
||||
|
||||
if (_entry.state == FileState::ILOCAL)
|
||||
{
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Local", ALIGN_RIGHT);
|
||||
}
|
||||
if(_entry.title.find("click to go back") != std::string::npos)
|
||||
DrawTextRect(_position.x, _position.y, _position.w, heightOfTitle, _entry.title.c_str(), ALIGN_CENTER);
|
||||
else
|
||||
{
|
||||
if (_entry.type == IFILE)
|
||||
DrawTextRect(_position.x, _position.y, _position.w, heightOfTitle, _entry.title.c_str(), ALIGN_LEFT);
|
||||
|
||||
SetFont(entryFont, BLACK);
|
||||
|
||||
|
||||
if (_entry.state == FileState::ILOCAL)
|
||||
{
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle, _position.w, fontHeight, _entry.fileType.c_str(), ALIGN_LEFT);
|
||||
|
||||
switch(_entry.state)
|
||||
{
|
||||
case FileState::ISYNCED:
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Synced", ALIGN_RIGHT);
|
||||
break;
|
||||
case FileState::IOUTSYNCED:
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Out of sync", ALIGN_RIGHT);
|
||||
break;
|
||||
default:
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Click to Download", ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, _entry.lastEditDate.c_str(), ALIGN_LEFT);
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, _entry.size.c_str(), ALIGN_LEFT);
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Local", ALIGN_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_entry.state == FileState::ISYNCED)
|
||||
if (_entry.type == IFILE)
|
||||
{
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, "Folder synced", ALIGN_RIGHT);
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle, _position.w, fontHeight, _entry.fileType.c_str(), ALIGN_LEFT);
|
||||
|
||||
switch(_entry.state)
|
||||
{
|
||||
case FileState::ISYNCED:
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Synced", ALIGN_RIGHT);
|
||||
break;
|
||||
case FileState::IOUTSYNCED:
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Out of sync", ALIGN_RIGHT);
|
||||
break;
|
||||
default:
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, "Click to Download", ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, _entry.lastEditDate.c_str(), ALIGN_LEFT);
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + 2 * fontHeight, _position.w, fontHeight, _entry.size.c_str(), ALIGN_LEFT);
|
||||
}
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle, _position.w, fontHeight, _entry.lastEditDate.c_str(), ALIGN_LEFT);
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, _entry.size.c_str(), ALIGN_LEFT);
|
||||
else
|
||||
{
|
||||
if (_entry.state == FileState::ISYNCED)
|
||||
{
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, "Folder synced", ALIGN_RIGHT);
|
||||
}
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle, _position.w, fontHeight, _entry.lastEditDate.c_str(), ALIGN_LEFT);
|
||||
DrawTextRect(_position.x, _position.y + heightOfTitle + fontHeight, _position.w, fontHeight, _entry.size.c_str(), ALIGN_LEFT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int line = (_position.y + _position.h) - 1;
|
||||
DrawLine(0, line, ScreenWidth(), line, BLACK);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue