diff --git a/gui/browser.cpp b/gui/browser.cpp
index f4719f4..3cf8bbc 100644
a
|
b
|
void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
|
186 | 186 | int selection = _fileList->getSelected(); |
187 | 187 | if (selection >= 0) { |
188 | 188 | _choice = _nodeContent[selection]; |
| 189 | |
| 190 | // If the user selected a file, when the browser is a directory |
| 191 | // browser, we select the current dir as result instead. |
| 192 | // TODO: We might think of changing this behavior. |
| 193 | if (!_choice.isDirectory() && _isDirBrowser) |
| 194 | _choice = _node; |
189 | 195 | } else { |
190 | 196 | _choice = _node; |
191 | 197 | } |
… |
… |
void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
|
214 | 220 | if (_nodeContent[data].isDirectory()) { |
215 | 221 | _node = _nodeContent[data]; |
216 | 222 | updateListing(); |
217 | | } else { |
| 223 | } else if (!_isDirBrowser) { |
218 | 224 | _choice = _nodeContent[data]; |
219 | 225 | setResult(1); |
220 | 226 | close(); |
… |
… |
void BrowserDialog::updateListing() {
|
233 | 239 | ConfMan.set("browser_lastpath", _node.getPath()); |
234 | 240 | |
235 | 241 | // Read in the data from the file system |
236 | | Common::FSNode::ListMode listMode = |
237 | | _isDirBrowser ? Common::FSNode::kListDirectoriesOnly |
238 | | : Common::FSNode::kListAll; |
239 | | if (!_node.getChildren(_nodeContent, listMode)) { |
| 242 | if (!_node.getChildren(_nodeContent, Common::FSNode::kListAll)) |
240 | 243 | _nodeContent.clear(); |
241 | | } else { |
| 244 | else |
242 | 245 | Common::sort(_nodeContent.begin(), _nodeContent.end()); |
243 | | } |
244 | 246 | |
245 | 247 | // Populate the ListWidget |
246 | 248 | Common::StringList list; |
| 249 | ListWidget::ColorList colors; |
247 | 250 | for (Common::FSList::iterator i = _nodeContent.begin(); i != _nodeContent.end(); ++i) { |
248 | | if (!_isDirBrowser && i->isDirectory()) |
| 251 | if (i->isDirectory()) |
249 | 252 | list.push_back(i->getDisplayName() + "/"); |
250 | 253 | else |
251 | 254 | list.push_back(i->getDisplayName()); |
| 255 | |
| 256 | if (_isDirBrowser) { |
| 257 | if (i->isDirectory()) |
| 258 | colors.push_back(ThemeEngine::kFontColorNormal); |
| 259 | else |
| 260 | colors.push_back(ThemeEngine::kFontColorAlternate); |
| 261 | } |
252 | 262 | } |
253 | | _fileList->setList(list); |
| 263 | |
| 264 | if (_isDirBrowser) |
| 265 | _fileList->setList(list, &colors); |
| 266 | else |
| 267 | _fileList->setList(list); |
254 | 268 | _fileList->scrollTo(0); |
255 | 269 | |
256 | 270 | // Finally, redraw |