show current location on first item
parent
83aa3b6eb4
commit
98365f54a8
|
@ -88,7 +88,7 @@ void WebDAV::logout(bool deleteFiles)
|
||||||
|
|
||||||
//_url.clear();
|
//_url.clear();
|
||||||
//TODO where?
|
//TODO where?
|
||||||
//_items.clear();
|
//tempItems.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO pas as reversne and no return
|
//TODO pas as reversne and no return
|
||||||
|
@ -105,18 +105,6 @@ string WebDAV::getLocalPath(string path)
|
||||||
///TODO rename function
|
///TODO rename function
|
||||||
vector<WebDAVItem> WebDAV::getDataStructure(const string &pathUrl)
|
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);
|
string xmlItem = propfind(pathUrl);
|
||||||
if(!xmlItem.empty())
|
if(!xmlItem.empty())
|
||||||
{
|
{
|
||||||
|
@ -207,6 +195,16 @@ vector<WebDAVItem> WebDAV::getDataStructure(const string &pathUrl)
|
||||||
if (tempItems.empty())
|
if (tempItems.empty())
|
||||||
return {};
|
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);
|
string localPath = getLocalPath(pathUrl);
|
||||||
|
|
||||||
//if the current folder does not exist locally, create it
|
//if the current folder does not exist locally, create it
|
||||||
|
@ -298,7 +296,7 @@ void Nextcloud::download(int itemID)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->downloadFolder(_items, itemID);
|
this->downloadFolder(tempItems, itemID);
|
||||||
|
|
||||||
UpdateProgressbar("Download completed", 100);
|
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)
|
WebDAVView::WebDAVView(const irect &contentRect, const vector<WebDAVItem> &items, int page) : ListView(contentRect, page)
|
||||||
{
|
{
|
||||||
//TODO add line above!
|
|
||||||
auto pageHeight = 0;
|
auto pageHeight = 0;
|
||||||
auto contentHeight = _contentRect.h - _footerHeight;
|
auto contentHeight = _contentRect.h - _footerHeight;
|
||||||
auto entrycount = items.size();
|
auto entrycount = items.size();
|
||||||
|
@ -26,11 +25,17 @@ WebDAVView::WebDAVView(const irect &contentRect, const vector<WebDAVItem> &items
|
||||||
auto i = 0;
|
auto i = 0;
|
||||||
while (i < entrycount)
|
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)
|
if(items.at(i).type == IFILE)
|
||||||
{
|
|
||||||
entrySize += _entryFontHeight;
|
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)
|
if ((pageHeight + entrySize) > contentHeight)
|
||||||
{
|
{
|
||||||
pageHeight = 0;
|
pageHeight = 0;
|
||||||
|
|
|
@ -17,18 +17,17 @@ WebDAVViewEntry::WebDAVViewEntry(int page, const irect &position, const WebDAVIt
|
||||||
|
|
||||||
void WebDAVViewEntry::draw(const ifont *entryFont, const ifont *entryFontBold, int fontHeight)
|
void WebDAVViewEntry::draw(const ifont *entryFont, const ifont *entryFontBold, int fontHeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
SetFont(entryFontBold, BLACK);
|
SetFont(entryFontBold, BLACK);
|
||||||
int heightOfTitle = TextRectHeight(_position.w, _entry.title.c_str(), 0);
|
int heightOfTitle = TextRectHeight(_position.w, _entry.title.c_str(), 0);
|
||||||
|
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
|
||||||
|
{
|
||||||
DrawTextRect(_position.x, _position.y, _position.w, heightOfTitle, _entry.title.c_str(), ALIGN_LEFT);
|
DrawTextRect(_position.x, _position.y, _position.w, heightOfTitle, _entry.title.c_str(), ALIGN_LEFT);
|
||||||
|
|
||||||
SetFont(entryFont, BLACK);
|
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)
|
if (_entry.state == FileState::ILOCAL)
|
||||||
{
|
{
|
||||||
|
@ -67,6 +66,7 @@ void WebDAVViewEntry::draw(const ifont *entryFont, const ifont *entryFontBold, i
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
int line = (_position.y + _position.h) - 1;
|
int line = (_position.y + _position.h) - 1;
|
||||||
DrawLine(0, line, ScreenWidth(), line, BLACK);
|
DrawLine(0, line, ScreenWidth(), line, BLACK);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue