From 2eedb967d2a3f8026163bd182e973106e6846a13 Mon Sep 17 00:00:00 2001 From: "jsc@umbraculum.org" Date: Fri, 26 Apr 2013 15:22:49 +0200 Subject: Setting directory to previous selected directory when selecting new file. --- plugingui/filebrowser.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'plugingui/filebrowser.cc') diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc index 39cb565..21e3cc8 100644 --- a/plugingui/filebrowser.cc +++ b/plugingui/filebrowser.cc @@ -72,6 +72,8 @@ static void changeDir(void *ptr) { GUI::LineEdit *le = prv->lineedit; std::string value = lb->selectedValue(); Directory* dir = prv->dir; + + lb->clear(); INFO(filebrowser, "Changing path to '%s'\n", (dir->path() + "/" + value).c_str()); @@ -271,13 +273,16 @@ static bool isDir(std::string d) void GUI::FileBrowser::setPath(std::string path) { - WARN(filebrowser, "Not implemented yet!"); +// WARN(filebrowser, "Not implemented yet!"); // TODO: Remove this check to directoy.cc -// INFO(filebrowser, "Setting path to '%s'\n", path.c_str()); -// if(path.empty()) return; + INFO(filebrowser, "Setting path to '%s'\n", path.c_str()); + if(path.empty()) path = Directory::cwd(); // TODO: Strip path to set path to a directory -// prv->dir->setPath(path); + prv->dir->setPath(Directory::pathDirectory(path)); + prv->listbox->clear(); + + changeDir(prv); /* std::string dir; if(prv->dir->isDir()) { -- cgit v1.2.3