| 506 | } |
| 507 | |
| 508 | PatchReviewPlugin::PatchReviewPlugin(QObject* parent, const KPluginMetaData& metaData, const QVariantList&) |
| 509 | : KDevelop::IPlugin(QStringLiteral("kdevpatchreview"), parent, metaData) |
| 510 | , m_patch(nullptr) |
| 511 | , m_factory(new PatchReviewToolViewFactory(this)) |
| 512 | { |
| 513 | setXMLFile( QStringLiteral("kdevpatchreview.rc") ); |
| 514 | |
| 515 | connect( ICore::self()->documentController(), &IDocumentController::documentClosed, this, &PatchReviewPlugin::documentClosed ); |
| 516 | connect( ICore::self()->documentController(), &IDocumentController::textDocumentCreated, this, &PatchReviewPlugin::textDocumentCreated ); |
| 517 | connect( ICore::self()->documentController(), &IDocumentController::documentSaved, this, &PatchReviewPlugin::documentSaved ); |
| 518 | |
| 519 | m_updateKompareTimer = new QTimer( this ); |
| 520 | m_updateKompareTimer->setSingleShot( true ); |
| 521 | m_updateKompareTimer->setInterval(500); |
| 522 | connect( m_updateKompareTimer, &QTimer::timeout, this, &PatchReviewPlugin::updateKompareModel ); |
| 523 | |
| 524 | m_finishReview = new QAction(i18nc("@action", "Finish Review"), this); |
| 525 | m_finishReview->setIcon( QIcon::fromTheme( QStringLiteral("dialog-ok") ) ); |
| 526 | actionCollection()->setDefaultShortcut( m_finishReview, Qt::CTRL|Qt::Key_Return ); |
| 527 | actionCollection()->addAction(QStringLiteral("commit_or_finish_review"), m_finishReview); |
| 528 | |
| 529 | const auto allAreas = ICore::self()->uiController()->allAreas(); |
| 530 | for (Sublime::Area* area : allAreas) { |
| 531 | if (area->objectName() == QLatin1String("review")) |
| 532 | area->addAction(m_finishReview); |
| 533 | } |
| 534 | |
| 535 | core()->uiController()->addToolView(i18nc("@title:window", "Patch Review"), m_factory, IUiController::None); |
| 536 | |
| 537 | areaChanged(ICore::self()->uiController()->activeArea()); |
| 538 | } |
| 539 | |
| 540 | void PatchReviewPlugin::documentClosed( IDocument* doc ) { |
| 541 | removeHighlighting( doc->url() ); |
nothing calls this directly
no test coverage detected