| 170 | } |
| 171 | |
| 172 | void DocumentSwitcherPlugin::itemActivated( const QModelIndex& idx ) |
| 173 | { |
| 174 | Q_UNUSED( idx ); |
| 175 | if( view->selectionModel()->selectedRows().isEmpty() ) |
| 176 | { |
| 177 | return; |
| 178 | } |
| 179 | const int row = view->selectionModel()->selectedRows().first().row(); |
| 180 | |
| 181 | // Retrieve document from index |
| 182 | auto* activatedDocument = documentLists.value(row); |
| 183 | if( activatedDocument ) { |
| 184 | // Close document |
| 185 | if( QApplication::mouseButtons() & Qt::MiddleButton ) |
| 186 | { |
| 187 | activatedDocument->close(); |
| 188 | fillModel(); |
| 189 | if ( model->rowCount() == 0 ) { |
| 190 | view->hide(); |
| 191 | } else { |
| 192 | view->selectionModel()->select( view->model()->index(0, 0), QItemSelectionModel::ClearAndSelect ); |
| 193 | } |
| 194 | } |
| 195 | // Activate document |
| 196 | else |
| 197 | { |
| 198 | KDevelop::IDocumentController *documentController = KDevelop::ICore::self()->documentController(); |
| 199 | documentController->activateDocument(activatedDocument); |
| 200 | view->hide(); |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | void DocumentSwitcherPlugin::documentOpened(KDevelop::IDocument *document) |
| 206 | { |
no test coverage detected