diff options
author | Jonas Suhr Christensen <jsc@umbraculum.org> | 2013-06-16 10:18:57 +0200 |
---|---|---|
committer | Jonas Suhr Christensen <jsc@umbraculum.org> | 2013-06-16 10:18:57 +0200 |
commit | d6b684158d3549f343d1f4d22f4eefba7c873837 (patch) | |
tree | 2f995db36c4de42cf953410e2cfcce397f019ceb /plugingui | |
parent | 776544e63ed9a7a2c90c6b26f847b18882ee5146 (diff) |
Handling directories that can not be opened.
Diffstat (limited to 'plugingui')
-rw-r--r-- | plugingui/filebrowser.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc index fcd4b9c..e9eca6c 100644 --- a/plugingui/filebrowser.cc +++ b/plugingui/filebrowser.cc @@ -73,6 +73,10 @@ static void changeDir(void *ptr) std::string value = lb->selectedValue(); Directory* dir = prv->dir; +// if(!Directory::isDir(dir->path() + dir->seperator())) { +// return; +// } + lb->clear(); INFO(filebrowser, "Changing path to '%s'\n", @@ -123,13 +127,19 @@ static void changeDir(void *ptr) return; } + Directory::EntryList entries = dir->entryList(); + + if(entries.empty()) { + dir->cdUp(); + entries = dir->entryList(); + } + DEBUG(filebrowser, "Setting path of lineedit to %s\n", dir->path().c_str()); le->setText(dir->path()); - Directory::EntryList entries = dir->entryList(); for(Directory::EntryList::iterator it = entries.begin(); - it != entries.end(); it++) { + it != entries.end(); it++) { GUI::ListBoxBasic::Item item; std::string name = *it; item.name = name; @@ -150,7 +160,6 @@ static void handleKeyEvent(void *ptr) { lb->clearSelectedValue(); GUI::LineEdit *le = prv->lineedit; - printf("AAA: %s\n", le->text().c_str()); prv->dir->setPath(le->text()); changeDir(ptr); } |