| 388 | } |
| 389 | |
| 390 | bool UICodeEditorSplitter::loadFileFromPath( const std::string& path, UICodeEditor* codeEditor ) { |
| 391 | if ( FileSystem::isDirectory( path ) ) |
| 392 | return false; |
| 393 | if ( nullptr == codeEditor ) |
| 394 | codeEditor = mCurEditor; |
| 395 | if ( nullptr == codeEditor && !mTabWidgets.empty() ) |
| 396 | codeEditor = createCodeEditorInTabWidget( mTabWidgets[0] ).second; |
| 397 | codeEditor->setColorScheme( mColorSchemes[mCurrentColorScheme] ); |
| 398 | bool isUrl = String::startsWith( path, "https://" ) || String::startsWith( path, "http://" ); |
| 399 | bool ret = isUrl ? codeEditor->loadAsyncFromURL( |
| 400 | path, Http::Request::FieldTable(), |
| 401 | [this, codeEditor, path]( std::shared_ptr<TextDocument>, bool ) { |
| 402 | mClient->onDocumentLoaded( codeEditor, path ); |
| 403 | } ) |
| 404 | : codeEditor->loadFromFile( path ) == TextDocument::LoadStatus::Loaded; |
| 405 | if ( ret && !isUrl ) |
| 406 | mClient->onDocumentLoaded( codeEditor, path ); |
| 407 | return ret; |
| 408 | } |
| 409 | |
| 410 | void UICodeEditorSplitter::loadAsyncFileFromPath( |
| 411 | const std::string& path, UICodeEditor* codeEditor, |
nothing calls this directly
no test coverage detected