MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / onDirEntryLongPressed

Method onDirEntryLongPressed

Tactility/Source/app/files/View.cpp:286–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286void View::onDirEntryLongPressed(int32_t index) {
287 dirent dir_entry;
288 if (!resolveDirentFromListIndex(index, dir_entry)) {
289 return;
290 }
291
292 LOGGER.info("Long-pressed {} {}", dir_entry.d_name, dir_entry.d_type);
293 state->setSelectedChildEntry(dir_entry.d_name);
294
295 if (state->getCurrentPath() == "/") {
296 // At root, only USB mount points support actions (eject).
297 // Other root-level entries intentionally have no context actions.
298 const char* name = dir_entry.d_name;
299 if (strncmp(name, "usb", 3) == 0 && isdigit((unsigned char)name[3])) {
300 showActionsForMountPoint();
301 }
302 return;
303 }
304
305 using namespace file;
306 switch (dir_entry.d_type) {
307 case TT_DT_DIR:
308 case TT_DT_CHR:
309 showActionsForDirectory();
310 break;
311
312 case TT_DT_LNK:
313 LOGGER.warn("Opening links is not supported");
314 break;
315
316 default:
317 showActionsForFile();
318 break;
319 }
320}
321
322void View::createDirEntryWidget(lv_obj_t* list, dirent& dir_entry) {
323 check(list);

Callers 1

Calls 4

infoMethod · 0.80
warnMethod · 0.80
setSelectedChildEntryMethod · 0.45
getCurrentPathMethod · 0.45

Tested by

no test coverage detected