Changeset View
Changeset View
Standalone View
Standalone View
plugins/subversion/kdevsvnplugin.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | #include "svncopyjob.h" | 51 | #include "svncopyjob.h" | ||
52 | #include "svnmovejob.h" | 52 | #include "svnmovejob.h" | ||
53 | #include "svnlogjob.h" | 53 | #include "svnlogjob.h" | ||
54 | #include "svnblamejob.h" | 54 | #include "svnblamejob.h" | ||
55 | #include "svnimportjob.h" | 55 | #include "svnimportjob.h" | ||
56 | #include "svncheckoutjob.h" | 56 | #include "svncheckoutjob.h" | ||
57 | 57 | | |||
58 | #include "svnimportmetadatawidget.h" | 58 | #include "svnimportmetadatawidget.h" | ||
59 | #include "svncheckoutmetadatawidget.h" | | |||
60 | #include <vcs/vcspluginhelper.h> | 59 | #include <vcs/vcspluginhelper.h> | ||
61 | #include <vcs/widgets/standardvcslocationwidget.h> | 60 | #include <vcs/widgets/standardvcslocationwidget.h> | ||
62 | #include "svnlocationwidget.h" | 61 | #include "svnlocationwidget.h" | ||
63 | #include "debug.h" | 62 | #include "debug.h" | ||
64 | 63 | | |||
65 | K_PLUGIN_FACTORY_WITH_JSON(KDevSvnFactory, "kdevsubversion.json", registerPlugin<KDevSvnPlugin>();) | 64 | K_PLUGIN_FACTORY_WITH_JSON(KDevSvnFactory, "kdevsubversion.json", registerPlugin<KDevSvnPlugin>();) | ||
66 | 65 | | |||
67 | KDevSvnPlugin::KDevSvnPlugin(QObject *parent, const QVariantList &) | 66 | KDevSvnPlugin::KDevSvnPlugin(QObject *parent, const QVariantList &) | ||
▲ Show 20 Lines • Show All 281 Lines • ▼ Show 20 Line(s) | 314 | { | |||
349 | svnmenu->addAction(move_action); | 348 | svnmenu->addAction(move_action); | ||
350 | 349 | | |||
351 | KDevelop::ContextMenuExtension menuExt; | 350 | KDevelop::ContextMenuExtension menuExt; | ||
352 | menuExt.addAction(KDevelop::ContextMenuExtension::VcsGroup, svnmenu->menuAction()); | 351 | menuExt.addAction(KDevelop::ContextMenuExtension::VcsGroup, svnmenu->menuAction()); | ||
353 | 352 | | |||
354 | return menuExt; | 353 | return menuExt; | ||
355 | } | 354 | } | ||
356 | 355 | | |||
357 | void KDevSvnPlugin::ctxInfo() | | |||
358 | { | | |||
359 | QList<QUrl> const & ctxUrlList = m_common->contextUrlList(); | | |||
360 | if (ctxUrlList.count() != 1) { | | |||
361 | KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); | | |||
362 | return; | | |||
363 | } | | |||
364 | } | | |||
365 | | ||||
366 | void KDevSvnPlugin::ctxStatus() | | |||
367 | { | | |||
368 | QList<QUrl> const & ctxUrlList = m_common->contextUrlList(); | | |||
369 | if (ctxUrlList.count() > 1) { | | |||
370 | KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); | | |||
371 | return; | | |||
372 | } | | |||
373 | } | | |||
374 | | ||||
375 | void KDevSvnPlugin::ctxCopy() | 356 | void KDevSvnPlugin::ctxCopy() | ||
376 | { | 357 | { | ||
377 | QList<QUrl> const & ctxUrlList = m_common->contextUrlList(); | 358 | QList<QUrl> const & ctxUrlList = m_common->contextUrlList(); | ||
378 | if (ctxUrlList.count() > 1) { | 359 | if (ctxUrlList.count() > 1) { | ||
379 | KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); | 360 | KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); | ||
380 | return; | 361 | return; | ||
381 | } | 362 | } | ||
382 | 363 | | |||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 418 | if (dlg.exec() == QDialog::Accepted) { // krazy:exclude=crashy | |||
438 | KDevelop::ICore::self()->runController()->registerJob(move(source, dlg.selectedUrl())); | 419 | KDevelop::ICore::self()->runController()->registerJob(move(source, dlg.selectedUrl())); | ||
439 | } | 420 | } | ||
440 | } else { | 421 | } else { | ||
441 | KMessageBox::error(nullptr, i18n("Moving only works on local files/dirs")); | 422 | KMessageBox::error(nullptr, i18n("Moving only works on local files/dirs")); | ||
442 | return; | 423 | return; | ||
443 | } | 424 | } | ||
444 | } | 425 | } | ||
445 | 426 | | |||
446 | void KDevSvnPlugin::ctxCat() | | |||
447 | { | | |||
448 | QList<QUrl> const & ctxUrlList = m_common->contextUrlList(); | | |||
449 | if (ctxUrlList.count() != 1) { | | |||
450 | KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); | | |||
451 | return; | | |||
452 | } | | |||
453 | } | | |||
454 | | ||||
455 | QString KDevSvnPlugin::name() const | 427 | QString KDevSvnPlugin::name() const | ||
456 | { | 428 | { | ||
457 | return i18n("Subversion"); | 429 | return i18n("Subversion"); | ||
458 | } | 430 | } | ||
459 | 431 | | |||
460 | KDevelop::VcsImportMetadataWidget* KDevSvnPlugin::createImportMetadataWidget(QWidget* parent) | 432 | KDevelop::VcsImportMetadataWidget* KDevSvnPlugin::createImportMetadataWidget(QWidget* parent) | ||
461 | { | 433 | { | ||
462 | return new SvnImportMetadataWidget(parent); | 434 | return new SvnImportMetadataWidget(parent); | ||
463 | } | 435 | } | ||
464 | 436 | | |||
465 | void KDevSvnPlugin::ctxImport() | | |||
466 | { | | |||
467 | QList<QUrl> const & ctxUrlList = m_common->contextUrlList(); | | |||
468 | if (ctxUrlList.count() != 1) { | | |||
469 | KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); | | |||
470 | return; | | |||
471 | } | | |||
472 | | ||||
473 | QDialog dlg; | | |||
474 | | ||||
475 | dlg.setWindowTitle(i18n("Import into Subversion repository")); | | |||
476 | SvnImportMetadataWidget* widget = new SvnImportMetadataWidget(&dlg); | | |||
477 | widget->setSourceLocation(KDevelop::VcsLocation(ctxUrlList.first())); | | |||
478 | widget->setSourceLocationEditable(false); | | |||
479 | auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | | |||
480 | auto layout = new QVBoxLayout(); | | |||
481 | dlg.setLayout(layout); | | |||
482 | layout->addWidget(widget); | | |||
483 | layout->addWidget(buttonBox); | | |||
484 | connect(buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept); | | |||
485 | connect(buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject); | | |||
486 | | ||||
487 | if (dlg.exec() == QDialog::Accepted) { | | |||
488 | KDevelop::ICore::self()->runController()->registerJob(import(widget->message(), widget->source(), widget->destination())); | | |||
489 | } | | |||
490 | } | | |||
491 | | ||||
492 | void KDevSvnPlugin::ctxCheckout() | | |||
493 | { | | |||
494 | QList<QUrl> const & ctxUrlList = m_common->contextUrlList(); | | |||
495 | if (ctxUrlList.count() != 1) { | | |||
496 | KMessageBox::error(nullptr, i18n("Please select only one item for this operation")); | | |||
497 | return; | | |||
498 | } | | |||
499 | | ||||
500 | QDialog dlg; | | |||
501 | | ||||
502 | dlg.setWindowTitle(i18n("Checkout from Subversion repository")); | | |||
503 | SvnCheckoutMetadataWidget* widget = new SvnCheckoutMetadataWidget(&dlg); | | |||
504 | QUrl tmp = KIO::upUrl(ctxUrlList.first()); | | |||
505 | widget->setDestinationLocation(tmp); | | |||
506 | auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | | |||
507 | auto layout = new QVBoxLayout(); | | |||
508 | dlg.setLayout(layout); | | |||
509 | layout->addWidget(widget); | | |||
510 | layout->addWidget(buttonBox); | | |||
511 | connect(buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept); | | |||
512 | connect(buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject); | | |||
513 | | ||||
514 | if (dlg.exec() == QDialog::Accepted) { | | |||
515 | KDevelop::ICore::self()->runController()->registerJob(createWorkingCopy(widget->source(), widget->destination(), widget->recursionMode())); | | |||
516 | } | | |||
517 | } | | |||
518 | | ||||
519 | KDevelop::VcsLocationWidget* KDevSvnPlugin::vcsLocation(QWidget* parent) const | 437 | KDevelop::VcsLocationWidget* KDevSvnPlugin::vcsLocation(QWidget* parent) const | ||
520 | { | 438 | { | ||
521 | return new SvnLocationWidget(parent); | 439 | return new SvnLocationWidget(parent); | ||
522 | } | 440 | } | ||
523 | 441 | | |||
524 | ThreadWeaver::Queue* KDevSvnPlugin::jobQueue() const | 442 | ThreadWeaver::Queue* KDevSvnPlugin::jobQueue() const | ||
525 | { | 443 | { | ||
526 | return m_jobQueue; | 444 | return m_jobQueue; | ||
527 | } | 445 | } | ||
528 | 446 | | |||
529 | #include "kdevsvnplugin.moc" | 447 | #include "kdevsvnplugin.moc" |