| 3174 | // File picker |
| 3175 | |
| 3176 | void LLMChatUI::showAttachFile() { |
| 3177 | if ( getPlugin() == nullptr ) |
| 3178 | return; |
| 3179 | hideSelectModel(); |
| 3180 | hideSelectAgent(); |
| 3181 | auto text = mLocateInput->getText(); |
| 3182 | auto ctx = getPlugin()->getPluginContext(); |
| 3183 | if ( !ctx->isDirTreeReady() ) { |
| 3184 | mLocateTable->setModel( ProjectDirectoryTree::emptyModel( {}, ctx->getCurrentProject() ) ); |
| 3185 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 3186 | } else if ( !mLocateInput->getText().empty() ) { |
| 3187 | ctx->getDirTree()->asyncMatchTree( |
| 3188 | ProjectDirectoryTree::MatchType::Fuzzy, text, 100, |
| 3189 | [this, text]( auto res ) { |
| 3190 | mUISceneNode->runOnMainThread( [this, res] { |
| 3191 | mLocateTable->setModel( res ); |
| 3192 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 3193 | mLocateTable->scrollToTop(); |
| 3194 | updateLocateBarColumns(); |
| 3195 | } ); |
| 3196 | }, |
| 3197 | ctx->getCurrentProject() ); |
| 3198 | } else { |
| 3199 | mLocateTable->setModel( ctx->getDirTree()->asModel( |
| 3200 | 100, {}, ctx->getCurrentProject(), Image::getImageExtensionsSupported() ) ); |
| 3201 | mLocateTable->getSelection().set( mLocateTable->getModel()->index( 0 ) ); |
| 3202 | } |
| 3203 | mLocateBarLayout->setVisible( true ); |
| 3204 | mLocateInput->setFocus(); |
| 3205 | updateLocateBarColumns(); |
| 3206 | } |
| 3207 | |
| 3208 | void LLMChatUI::hideAttachFile() { |
| 3209 | mLocateBarLayout->setVisible( false ); |
nothing calls this directly
no test coverage detected