MCPcopy Create free account
hub / github.com/KDE/kdevelop / registerJob

Method registerJob

kdevplatform/shell/runcontroller.cpp:608–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608void KDevelop::RunController::registerJob(KJob * job)
609{
610 Q_D(RunController);
611
612 if (!job)
613 return;
614
615 if (!(job->capabilities() & KJob::Killable)) {
616 // see e.g. https://bugs.kde.org/show_bug.cgi?id=314187
617 qCWarning(SHELL) << "non-killable job" << job << "registered - this might lead to crashes on shutdown.";
618 }
619
620 if (!d->jobs.contains(job)) {
621 QAction* stopJobAction = nullptr;
622 if (Core::self()->setupFlags() != Core::NoUi) {
623 stopJobAction = new QAction(job->objectName().isEmpty() ? i18nc("@item:inmenu", "<%1> Unnamed job", QString::fromUtf8(job->staticMetaObject.className())) : job->objectName(), this);
624 stopJobAction->setData(QVariant::fromValue(static_cast<void*>(job)));
625 d->stopJobsMenu->addAction(stopJobAction);
626 connect (stopJobAction, &QAction::triggered, this, &RunController::slotKillJob);
627
628 job->setUiDelegate( new KDialogJobUiDelegate() );
629 }
630
631 d->jobs.insert(job, stopJobAction);
632
633 connect( job, &KJob::finished, this, &RunController::finished );
634 connect(job, &KJob::percentChanged, this, &RunController::jobPercentChanged);
635
636 IRunController::registerJob(job);
637
638 emit jobRegistered(job);
639 }
640
641 const QPointer thisGuard(this);
642 job->start();
643 if (!thisGuard) {
644 return; // already destroyed (KDevelop is probably exiting now)
645 }
646
647 checkState();
648}
649
650void KDevelop::RunController::unregisterJob(KJob * job)
651{

Callers 15

formatFilesMethod · 0.80
checkoutVcsProjectMethod · 0.80
reparseProjectMethod · 0.80
reloadModelMethod · 0.80
openMethod · 0.80
changesMethod · 0.80
revertMethod · 0.80
diffForRevMethod · 0.80
pushMethod · 0.80
pullMethod · 0.80
finishReviewMethod · 0.80

Calls 9

checkStateFunction · 0.85
setupFlagsMethod · 0.80
containsMethod · 0.45
isEmptyMethod · 0.45
classNameMethod · 0.45
setDataMethod · 0.45
addActionMethod · 0.45
insertMethod · 0.45
startMethod · 0.45

Tested by 4

runAllTestsMethod · 0.64
runSelectedTestsMethod · 0.64
runClangTidyMethod · 0.64
runClangTidyMethod · 0.64