MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / OnSubmit

Method OnSubmit

LibLemon/src/gui/fileview.cpp:267–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265 }
266
267 void FileView::OnSubmit(std::string& path){
268 std::string absPath;
269
270 if(path[0] == '/'){ // Absolute Path
271 absPath = path;
272 } else { // Relative Path
273 absPath = currentPath + path;
274 }
275
276 struct stat statResult;
277 int ret = lstat(absPath.c_str(), &statResult);
278
279 if(ret){
280 perror("GUI: FileView: OnSubmit: Stat:");
281 char msg[512];
282 sprintf(msg, "Error opening file %s (Error Code: %d)", absPath.c_str(), ret);
283 DisplayMessageBox("Open...", msg, MsgButtonsOK);
284 return;
285 }
286
287 if(S_ISDIR(statResult.st_mode)){
288 currentPath = absPath;
289
290 Refresh();
291 } else if(OnFileOpened) {
292 OnFileOpened(absPath.c_str(), this);
293 }
294 }
295
296 void FileView::OnListSubmit(GridItem& item, GridView* list){
297 FileView* fv = (FileView*)list->GetParent();

Callers 3

OnListSubmitMethod · 0.80
OnTextBoxSubmitMethod · 0.80

Calls 2

DisplayMessageBoxFunction · 0.85
OnFileOpenedFunction · 0.85

Tested by

no test coverage detected