diff --git a/gui/browser.cpp b/gui/browser.cpp
index 3aa07d5..e7be115 100644
a
|
b
|
void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
|
184 | 184 | // If nothing is selected in the list widget, choose the current dir. |
185 | 185 | // Else, choose the dir that is selected. |
186 | 186 | int selection = _fileList->getSelected(); |
187 | | if (selection >= 0) { |
| 187 | if (selection >= 0) |
188 | 188 | _choice = _nodeContent[selection]; |
189 | | } else { |
| 189 | else |
190 | 190 | _choice = _node; |
191 | | } |
192 | 191 | setResult(1); |
193 | 192 | close(); |
194 | 193 | } else { |
… |
… |
void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
|
214 | 213 | if (_nodeContent[data].isDirectory()) { |
215 | 214 | _node = _nodeContent[data]; |
216 | 215 | updateListing(); |
217 | | } else { |
| 216 | } else if (!_isDirBrowser) { |
218 | 217 | _choice = _nodeContent[data]; |
219 | 218 | setResult(1); |
220 | 219 | close(); |
221 | 220 | } |
222 | 221 | break; |
| 222 | case kListSelectionChangedCmd: |
| 223 | // We do not allow selecting directories in directory |
| 224 | // browser mode, thus we will invalidate the selection |
| 225 | // when the user selects an directory over here. |
| 226 | if (data != (uint32)-1 && _isDirBrowser && !_nodeContent[data].isDirectory()) |
| 227 | _fileList->setSelected(-1); |
| 228 | break; |
223 | 229 | default: |
224 | 230 | Dialog::handleCommand(sender, cmd, data); |
225 | 231 | } |
… |
… |
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 |