extended documentation and cleanup
parent
c32bcc03f0
commit
77521aeeed
|
@ -144,7 +144,6 @@ int EventHandler::pointerHandler(const int type, const int par1, const int par2)
|
|||
_tempPath = _nextcloud.getItems()->at(itemID).getPath();
|
||||
if (!_tempPath.empty())
|
||||
_nextcloud.getDataStructure(_tempPath);
|
||||
|
||||
_listView.reset(new ListView(_menu.getContentRect(), _nextcloud.getItems()));
|
||||
_listView->drawHeader(_tempPath.substr(NEXTCLOUD_ROOT_PATH.length()));
|
||||
}
|
||||
|
@ -162,7 +161,6 @@ int EventHandler::pointerHandler(const int type, const int par1, const int par2)
|
|||
_nextcloud.getItems()->at(itemID).open();
|
||||
break;
|
||||
case 2:
|
||||
//TODO implement upload if local file
|
||||
if (_nextcloud.isWorkOffline())
|
||||
{
|
||||
int dialogResult = DialogSynchro(ICON_QUESTION, "Action", "You are in offline modus. Go back online?", "Yes", "No", "Cancel");
|
||||
|
|
|
@ -51,7 +51,6 @@ ListView::ListView(const irect *contentRect, const std::shared_ptr<vector<Item>>
|
|||
|
||||
_pageIcon = iRect(_contentRect->w - 100, _contentRect->h + _contentRect->y - _footerHeight, 100, _footerHeight, ALIGN_CENTER);
|
||||
|
||||
//TODO draw botton back and next, draw just once?
|
||||
_firstPageButton = iRect(_contentRect->x, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
||||
_lastPageButton = iRect(_contentRect->x + 150, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
||||
_nextPageButton = iRect(_contentRect->x + 300, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
||||
|
|
|
@ -21,7 +21,6 @@ using namespace std;
|
|||
Item::Item(const string &xmlItem)
|
||||
{
|
||||
_path = Util::getXMLAttribute(xmlItem, "d:href");
|
||||
//TODO also test for url
|
||||
if (_path.find(NEXTCLOUD_END_PATH) != std::string::npos)
|
||||
_path.erase(0, NEXTCLOUD_END_PATH.length());
|
||||
|
||||
|
|
|
@ -31,10 +31,29 @@ enum FileState
|
|||
class Item
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Creates an item by receiving the xml from nextcloud and parses it into an object
|
||||
*
|
||||
* @param xmlItem result of the nextcloud request
|
||||
*/
|
||||
Item(const string &xmlItem);
|
||||
|
||||
/**
|
||||
* Creates a new item by receiving localPath from the pocketbook
|
||||
*
|
||||
* @param localPath path where the file is placed
|
||||
* @param FileState state of the file
|
||||
Item(const string &localPath, FileState state);
|
||||
|
||||
/**
|
||||
* Tries to open the item by checking the file format and then executes the fitting action
|
||||
*/
|
||||
void open() const;
|
||||
|
||||
|
||||
bool removeFile();
|
||||
|
||||
void setPath(const string &path) { _path = path; };
|
||||
string getPath() const { return _path; };
|
||||
|
||||
|
@ -55,10 +74,6 @@ public:
|
|||
|
||||
string getFiletype() const { return _fileType; };
|
||||
|
||||
void open() const;
|
||||
|
||||
bool removeFile();
|
||||
|
||||
private:
|
||||
string _path;
|
||||
Itemtype _type;
|
||||
|
@ -69,6 +84,11 @@ private:
|
|||
string _size{"Error"};
|
||||
string _fileType;
|
||||
|
||||
/**
|
||||
* Converts the size to an easier readble format
|
||||
*
|
||||
* @param tempSize Size of the item in bytes
|
||||
*/
|
||||
void setSize(double tempSize);
|
||||
};
|
||||
#endif
|
|
@ -394,7 +394,6 @@ bool Nextcloud::getOfflineStructure(const string &pathUrl)
|
|||
ifstream inFile(localPath);
|
||||
std::stringstream buffer;
|
||||
buffer << inFile.rdbuf();
|
||||
//TODO also show in offline modus all files!
|
||||
|
||||
if (!readInXML(buffer.str()))
|
||||
return false;
|
||||
|
|
|
@ -33,18 +33,29 @@ public:
|
|||
explicit Nextcloud();
|
||||
|
||||
/**
|
||||
* Handles first login to nextcloud, if sucessfull saves userdata
|
||||
*
|
||||
* @param Username the username of the Nextcloud instance
|
||||
* @param Pass the pass of the Nextcloud instance
|
||||
* @return true - sucessfull login, false - failed login
|
||||
*/
|
||||
* Handles first login to nextcloud, if sucessfull saves userdata
|
||||
*
|
||||
* @param Username the username of the Nextcloud instance
|
||||
* @param Pass the pass of the Nextcloud instance
|
||||
* @return true - sucessfull login, false - failed login
|
||||
*/
|
||||
bool login(const string &Url, const string &Username, const string &Pass);
|
||||
|
||||
/**
|
||||
* Handles login by receiving userdat from config
|
||||
*/
|
||||
bool login();
|
||||
|
||||
/**
|
||||
* Deletes the config files and deletes are temp files
|
||||
* @param deleteFiles default false, true - local files are deleted, false local files are kept
|
||||
*/
|
||||
void logout(bool deleteFiles = false);
|
||||
|
||||
/**
|
||||
* Downloads a certain item from the Nextcloud and saves it locally
|
||||
* @param itemID id of the item
|
||||
*/
|
||||
void downloadItem(int itemID);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue