• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/vcs

  • sources
  • kfour-appscomplete
  • kdevelop
  • kdevplatform
  • vcs
vcspluginhelper.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2008 Andreas Pakulat <[email protected]> *
3  * Copyright 2010 Aleix Pol Gonzalez <[email protected]> *
4  * Copyright 2017-2018 Friedrich W. H. Kossebau <[email protected]> *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  ***************************************************************************/
12 
13 #include "vcspluginhelper.h"
14 
15 #include <QAction>
16 #include <QApplication>
17 #include <QClipboard>
18 #include <QDialogButtonBox>
19 #include <QFileInfo>
20 #include <QMenu>
21 #include <QTimer>
22 #include <QVBoxLayout>
23 #include <QVariant>
24 
25 #include <KLocalizedString>
26 #include <KMessageBox>
27 #include <KParts/MainWindow>
28 #include <KTextEditor/AnnotationInterface>
29 #include <KTextEditor/Document>
30 #include <KTextEditor/ModificationInterface>
31 #include <KTextEditor/View>
32 #include <ktexteditor_version.h>
33 
34 #include <interfaces/context.h>
35 #include <interfaces/contextmenuextension.h>
36 #include <interfaces/icore.h>
37 #include <interfaces/idocument.h>
38 #include <interfaces/idocumentcontroller.h>
39 #include <interfaces/iplugin.h>
40 #include <interfaces/iplugincontroller.h>
41 #include <interfaces/iproject.h>
42 #include <interfaces/iprojectcontroller.h>
43 #include <interfaces/iruncontroller.h>
44 #include <interfaces/isession.h>
45 #include <interfaces/iuicontroller.h>
46 #include <util/path.h>
47 #include <util/scopeddialog.h>
48 #include <vcs/interfaces/ibasicversioncontrol.h>
49 #include <vcs/models/vcsannotationmodel.h>
50 #if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,53,0)
51 #include <vcs/widgets/vcsannotationitemdelegate.h>
52 #endif
53 #include <vcs/widgets/vcseventwidget.h>
54 #include <vcs/widgets/vcscommitdialog.h>
55 #include <vcs/vcsjob.h>
56 #include <vcs/vcsrevision.h>
57 #include <vcs/vcslocation.h>
58 #include <vcs/vcsdiff.h>
59 
60 #include "interfaces/idistributedversioncontrol.h"
61 #include "vcsevent.h"
62 #include "debug.h"
63 #include "widgets/vcsdiffpatchsources.h"
64 
65 namespace KDevelop
66 {
67 
68 class VcsPluginHelperPrivate
69 {
70 public:
71  IPlugin * plugin;
72  IBasicVersionControl * vcs;
73 
74  QList<QUrl> ctxUrls;
75  QAction* commitAction;
76  QAction* addAction;
77  QAction* updateAction;
78  QAction* historyAction;
79  QAction* annotationAction;
80  QAction* diffToBaseAction;
81  QAction* revertAction;
82  QAction* diffForRevAction;
83  QAction* diffForRevGlobalAction;
84  QAction* pushAction;
85  QAction* pullAction;
86 
87  void createActions(VcsPluginHelper* parent) {
88  auto iconWithFallback = [] (const QString &icon, const QString &fallback) {
89  return QIcon::fromTheme(icon, QIcon::fromTheme(fallback));
90  };
91  commitAction = new QAction(iconWithFallback(QStringLiteral("vcs-commit"), QStringLiteral("svn-commit")), i18nc("@action:inmenu", "Commit..."), parent);
92  updateAction = new QAction(iconWithFallback(QStringLiteral("vcs-pull"), QStringLiteral("svn-update")), i18nc("@action:inmenu", "Update"), parent);
93  addAction = new QAction(QIcon::fromTheme(QStringLiteral("list-add")), i18nc("@action:inmenu", "Add"), parent);
94  diffToBaseAction = new QAction(iconWithFallback(QStringLiteral("vcs-diff"), QStringLiteral("text-x-patch")), i18nc("@action:inmenu", "Show Differences..."), parent);
95  revertAction = new QAction(QIcon::fromTheme(QStringLiteral("archive-remove")), i18nc("@action:inmenu", "Revert"), parent);
96  historyAction = new QAction(QIcon::fromTheme(QStringLiteral("view-history")), i18nc("@action:inmenu revision history", "History..."), parent);
97  annotationAction = new QAction(QIcon::fromTheme(QStringLiteral("user-properties")), i18nc("@action:inmenu", "Annotation..."), parent);
98  diffForRevAction = new QAction(iconWithFallback(QStringLiteral("vcs-diff"), QStringLiteral("text-x-patch")), i18nc("@action:inmenu", "Show Diff..."), parent);
99  diffForRevGlobalAction = new QAction(iconWithFallback(QStringLiteral("vcs-diff"), QStringLiteral("text-x-patch")), i18nc("@action:inmenu", "Show Diff (All Files)..."), parent);
100  pushAction = new QAction(iconWithFallback(QStringLiteral("vcs-push"), QStringLiteral("arrow-up-double")), i18nc("@action:inmenu", "Push"), parent);
101  pullAction = new QAction(iconWithFallback(QStringLiteral("vcs-pull"), QStringLiteral("arrow-down-double")), i18nc("@action:inmenu", "Pull"), parent);
102 
103  QObject::connect(commitAction, &QAction::triggered, parent, &VcsPluginHelper::commit);
104  QObject::connect(addAction, &QAction::triggered, parent, &VcsPluginHelper::add);
105  QObject::connect(updateAction, &QAction::triggered, parent, &VcsPluginHelper::update);
106  QObject::connect(diffToBaseAction, &QAction::triggered, parent, &VcsPluginHelper::diffToBase);
107  QObject::connect(revertAction, &QAction::triggered, parent, &VcsPluginHelper::revert);
108  QObject::connect(historyAction, &QAction::triggered, parent, [=] { parent->history(); });
109  QObject::connect(annotationAction, &QAction::triggered, parent, &VcsPluginHelper::annotation);
110  QObject::connect(diffForRevAction, &QAction::triggered, parent, QOverload<>::of(&VcsPluginHelper::diffForRev));
111  QObject::connect(diffForRevGlobalAction, &QAction::triggered, parent, &VcsPluginHelper::diffForRevGlobal);
112  QObject::connect(pullAction, &QAction::triggered, parent, &VcsPluginHelper::pull);
113  QObject::connect(pushAction, &QAction::triggered, parent, &VcsPluginHelper::push);
114  }
115 
116  bool allLocalFiles(const QList<QUrl>& urls)
117  {
118  bool ret=true;
119  for (const QUrl& url : urls) {
120  QFileInfo info(url.toLocalFile());
121  ret &= info.isFile();
122  }
123  return ret;
124  }
125 
126  QMenu* createMenu(QWidget* parent)
127  {
128  bool allVersioned=true;
129  for (const QUrl& url : qAsConst(ctxUrls)) {
130  allVersioned=allVersioned && vcs->isVersionControlled(url);
131 
132  if(!allVersioned)
133  break;
134  }
135 
136  auto* menu = new QMenu(vcs->name(), parent);
137  menu->setIcon(QIcon::fromTheme(ICore::self()->pluginController()->pluginInfo(plugin).iconName()));
138  menu->addAction(commitAction);
139  if(plugin->extension<IDistributedVersionControl>()) {
140  menu->addAction(pushAction);
141  menu->addAction(pullAction);
142  } else {
143  menu->addAction(updateAction);
144  }
145  menu->addSeparator();
146  menu->addAction(addAction);
147  menu->addAction(revertAction);
148  menu->addSeparator();
149  menu->addAction(historyAction);
150  menu->addAction(annotationAction);
151  menu->addAction(diffToBaseAction);
152 
153  const bool singleVersionedFile = ctxUrls.count() == 1 && allVersioned;
154  historyAction->setEnabled(singleVersionedFile);
155  annotationAction->setEnabled(singleVersionedFile && allLocalFiles(ctxUrls));
156  diffToBaseAction->setEnabled(singleVersionedFile);
157  commitAction->setEnabled(singleVersionedFile);
158 
159  return menu;
160  }
161 };
162 
163 
164 VcsPluginHelper::VcsPluginHelper(KDevelop::IPlugin* parent, KDevelop::IBasicVersionControl* vcs)
165  : QObject(parent)
166  , d_ptr(new VcsPluginHelperPrivate())
167 {
168  Q_D(VcsPluginHelper);
169 
170  Q_ASSERT(vcs);
171  Q_ASSERT(parent);
172  d->plugin = parent;
173  d->vcs = vcs;
174  d->createActions(this);
175 }
176 
177 VcsPluginHelper::~VcsPluginHelper()
178 {}
179 
180 void VcsPluginHelper::addContextDocument(const QUrl &url)
181 {
182  Q_D(VcsPluginHelper);
183 
184  d->ctxUrls.append(url);
185 }
186 
187 void VcsPluginHelper::disposeEventually(KTextEditor::View *, bool dont)
188 {
189  if ( ! dont ) {
190  deleteLater();
191  }
192 }
193 
194 void VcsPluginHelper::disposeEventually(KTextEditor::Document *)
195 {
196  deleteLater();
197 }
198 
199 void VcsPluginHelper::setupFromContext(Context* context)
200 {
201  Q_D(VcsPluginHelper);
202 
203  d->ctxUrls = context->urls();
204 }
205 
206 QList<QUrl> VcsPluginHelper::contextUrlList() const
207 {
208  Q_D(const VcsPluginHelper);
209 
210  return d->ctxUrls;
211 }
212 
213 QMenu* VcsPluginHelper::commonActions(QWidget* parent)
214 {
215  Q_D(VcsPluginHelper);
216 
217  /* TODO: the following logic to determine which actions need to be enabled
218  * or disabled does not work properly. What needs to be implemented is that
219  * project items that are vc-controlled enable all except add, project
220  * items that are not vc-controlled enable add action. For urls that cannot
221  * be made into a project item, or if the project has no associated VC
222  * plugin we need to check whether a VC controls the parent dir, if we have
223  * one we assume the urls can be added but are not currently controlled. If
224  * the url is already version controlled then just enable all except add
225  */
226  return d->createMenu(parent);
227 }
228 
229 #define EXECUTE_VCS_METHOD( method ) \
230  d->plugin->core()->runController()->registerJob( d->vcs-> method ( d->ctxUrls ) )
231 
232 #define SINGLEURL_SETUP_VARS \
233  KDevelop::IBasicVersionControl* iface = d->vcs;\
234  const QUrl &url = d->ctxUrls.front();
235 
236 
237 void VcsPluginHelper::revert()
238 {
239  Q_D(VcsPluginHelper);
240 
241  VcsJob* job=d->vcs->revert(d->ctxUrls);
242  connect(job, &VcsJob::finished, this, &VcsPluginHelper::revertDone);
243 
244  for (const QUrl& url : qAsConst(d->ctxUrls)) {
245  IDocument* doc=ICore::self()->documentController()->documentForUrl(url);
246 
247  if(doc && doc->textDocument()) {
248  auto* modif = qobject_cast<KTextEditor::ModificationInterface*>(doc->textDocument());
249  if (modif) {
250  modif->setModifiedOnDiskWarning(false);
251  }
252  doc->textDocument()->setModified(false);
253  }
254  }
255  job->setProperty("urls", QVariant::fromValue(d->ctxUrls));
256 
257  d->plugin->core()->runController()->registerJob(job);
258 }
259 
260 void VcsPluginHelper::revertDone(KJob* job)
261 {
262  auto* modificationTimer = new QTimer;
263  modificationTimer->setInterval(100);
264  connect(modificationTimer, &QTimer::timeout, this, &VcsPluginHelper::delayedModificationWarningOn);
265  connect(modificationTimer, &QTimer::timeout, modificationTimer, &QTimer::deleteLater);
266 
267 
268  modificationTimer->setProperty("urls", job->property("urls"));
269  modificationTimer->start();
270 }
271 
272 void VcsPluginHelper::delayedModificationWarningOn()
273 {
274  QObject* timer = sender();
275  const QList<QUrl> urls = timer->property("urls").value<QList<QUrl>>();
276 
277  for (const QUrl& url : urls) {
278  IDocument* doc=ICore::self()->documentController()->documentForUrl(url);
279 
280  if(doc) {
281  doc->reload();
282 
283  auto* modif = qobject_cast<KTextEditor::ModificationInterface*>(doc->textDocument());
284  modif->setModifiedOnDiskWarning(true);
285  }
286  }
287 }
288 
289 
290 void VcsPluginHelper::diffJobFinished(KJob* job)
291 {
292  auto* vcsjob = qobject_cast<KDevelop::VcsJob*>(job);
293  Q_ASSERT(vcsjob);
294 
295  if (vcsjob->status() == KDevelop::VcsJob::JobSucceeded) {
296  KDevelop::VcsDiff d = vcsjob->fetchResults().value<KDevelop::VcsDiff>();
297  if(d.isEmpty())
298  KMessageBox::information(ICore::self()->uiController()->activeMainWindow(),
299  i18n("There are no differences."),
300  i18nc("@title:window", "VCS Support"));
301  else {
302  auto* patch=new VCSDiffPatchSource(d);
303  showVcsDiff(patch);
304  }
305  } else {
306  KMessageBox::error(ICore::self()->uiController()->activeMainWindow(), vcsjob->errorString(), i18nc("@title:window", "Unable to Get Differences"));
307  }
308 }
309 
310 void VcsPluginHelper::diffToBase()
311 {
312  Q_D(VcsPluginHelper);
313 
314  SINGLEURL_SETUP_VARS
315  ICore::self()->documentController()->saveAllDocuments();
316 
317  auto* patch =new VCSDiffPatchSource(new VCSStandardDiffUpdater(iface, url));
318  showVcsDiff(patch);
319 }
320 
321 void VcsPluginHelper::diffForRev()
322 {
323  Q_D(VcsPluginHelper);
324 
325  if (d->ctxUrls.isEmpty()) {
326  return;
327  }
328  diffForRev(d->ctxUrls.first());
329 }
330 
331 void VcsPluginHelper::diffForRevGlobal()
332 {
333  Q_D(VcsPluginHelper);
334 
335  if (d->ctxUrls.isEmpty()) {
336  return;
337  }
338  QUrl url = d->ctxUrls.first();
339  IProject* project = ICore::self()->projectController()->findProjectForUrl( url );
340  if( project ) {
341  url = project->path().toUrl();
342  }
343 
344  diffForRev(url);
345 }
346 
347 void VcsPluginHelper::diffForRev(const QUrl& url)
348 {
349  Q_D(VcsPluginHelper);
350 
351  auto* action = qobject_cast<QAction*>( sender() );
352  Q_ASSERT(action);
353  Q_ASSERT(action->data().canConvert<VcsRevision>());
354  VcsRevision rev = action->data().value<VcsRevision>();
355 
356  ICore::self()->documentController()->saveAllDocuments();
357  VcsRevision prev = KDevelop::VcsRevision::createSpecialRevision(KDevelop::VcsRevision::Previous);
358  KDevelop::VcsJob* job = d->vcs->diff(url, prev, rev );
359 
360  connect(job, &VcsJob::finished, this, &VcsPluginHelper::diffJobFinished);
361  d->plugin->core()->runController()->registerJob(job);
362 }
363 
364 void VcsPluginHelper::history(const VcsRevision& rev)
365 {
366  Q_D(VcsPluginHelper);
367 
368  SINGLEURL_SETUP_VARS
369  auto* dlg = new QDialog(ICore::self()->uiController()->activeMainWindow());
370  dlg->setAttribute(Qt::WA_DeleteOnClose);
371  dlg->setWindowTitle(i18nc("@title:window %1: path or URL, %2: name of a version control system",
372  "%2 History (%1)", url.toDisplayString(QUrl::PreferLocalFile), iface->name()));
373 
374  auto *mainLayout = new QVBoxLayout(dlg);
375 
376  auto* logWidget = new KDevelop::VcsEventWidget(url, rev, iface, dlg);
377  mainLayout->addWidget(logWidget);
378 
379  auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
380  dlg->connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
381  dlg->connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
382  mainLayout->addWidget(buttonBox);
383 
384  dlg->show();
385 }
386 
387 void VcsPluginHelper::annotation()
388 {
389  Q_D(VcsPluginHelper);
390 
391  SINGLEURL_SETUP_VARS
392  KDevelop::IDocument* doc = ICore::self()->documentController()->documentForUrl(url);
393 
394  if (!doc)
395  doc = ICore::self()->documentController()->openDocument(url);
396 
397  KTextEditor::View* view = doc ? doc->activeTextView() : nullptr;
398  KTextEditor::AnnotationInterface* annotateiface = qobject_cast<KTextEditor::AnnotationInterface*>(doc->textDocument());
399  auto viewiface = qobject_cast<KTextEditor::AnnotationViewInterface*>(view);
400  if (viewiface && viewiface->isAnnotationBorderVisible()) {
401  viewiface->setAnnotationBorderVisible(false);
402  return;
403  }
404 
405  if (doc && doc->textDocument() && iface) {
406  KDevelop::VcsJob* job = iface->annotate(url);
407  if( !job )
408  {
409  qCWarning(VCS) << "Couldn't create annotate job for:" << url << "with iface:" << iface << dynamic_cast<KDevelop::IPlugin*>( iface );
410  return;
411  }
412 
413  QColor foreground(Qt::black);
414  QColor background(Qt::white);
415  if (view) {
416  KTextEditor::Attribute::Ptr style = view->defaultStyleAttribute(KTextEditor::dsNormal);
417  foreground = style->foreground().color();
418  if (style->hasProperty(QTextFormat::BackgroundBrush)) {
419  background = style->background().color();
420  }
421  }
422 
423  if (annotateiface && viewiface) {
424  // TODO: only create model if there is none yet (e.g. from another view)
425  auto* model = new KDevelop::VcsAnnotationModel(job, url, doc->textDocument(),
426  foreground, background);
427  annotateiface->setAnnotationModel(model);
428 
429 #if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,53,0)
430  auto viewifaceV2 = qobject_cast<KTextEditor::AnnotationViewInterfaceV2*>(view);
431  if (viewifaceV2) {
432  // TODO: only create delegate if there is none yet
433  auto delegate = new VcsAnnotationItemDelegate(view, model, view);
434  viewifaceV2->setAnnotationItemDelegate(delegate);
435  viewifaceV2->setAnnotationUniformItemSizes(true);
436  }
437 #endif
438  viewiface->setAnnotationBorderVisible(true);
439  // can't use new signal slot syntax here, AnnotationInterface is not a QObject
440  connect(view, SIGNAL(annotationContextMenuAboutToShow(KTextEditor::View*,QMenu*,int)),
441  this, SLOT(annotationContextMenuAboutToShow(KTextEditor::View*,QMenu*,int)));
442  connect(view, SIGNAL(annotationBorderVisibilityChanged(View*,bool)),
443  this, SLOT(handleAnnotationBorderVisibilityChanged(View*,bool)));
444  } else {
445  KMessageBox::error(nullptr, i18n("Cannot display annotations, missing interface KTextEditor::AnnotationInterface for the editor."));
446  delete job;
447  }
448  } else {
449  KMessageBox::error(nullptr, i18n("Cannot execute annotate action because the "
450  "document was not found, or was not a text document:\n%1", url.toDisplayString(QUrl::PreferLocalFile)));
451  }
452 }
453 
454 void VcsPluginHelper::annotationContextMenuAboutToShow( KTextEditor::View* view, QMenu* menu, int line )
455 {
456  Q_D(VcsPluginHelper);
457 
458 #if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5,53,0)
459  auto viewifaceV2 = qobject_cast<KTextEditor::AnnotationViewInterfaceV2*>(view);
460  if (viewifaceV2) {
461  viewifaceV2->annotationItemDelegate()->hideTooltip(view);
462  }
463 #endif
464 
465  KTextEditor::AnnotationInterface* annotateiface =
466  qobject_cast<KTextEditor::AnnotationInterface*>(view->document());
467 
468  auto* model = qobject_cast<VcsAnnotationModel*>( annotateiface->annotationModel() );
469  Q_ASSERT(model);
470 
471  VcsRevision rev = model->revisionForLine(line);
472  // check if the user clicked on a row without revision information
473  if (rev.revisionType() == VcsRevision::Invalid) {
474  // in this case, do not action depending on revision information
475  return;
476  }
477 
478  d->diffForRevAction->setData(QVariant::fromValue(rev));
479  d->diffForRevGlobalAction->setData(QVariant::fromValue(rev));
480  menu->addSeparator();
481  menu->addAction(d->diffForRevAction);
482  menu->addAction(d->diffForRevGlobalAction);
483 
484  QAction* copyAction = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18nc("@action:inmenu", "Copy Revision Id"));
485  connect(copyAction, &QAction::triggered, this, [rev]() {
486  QApplication::clipboard()->setText(rev.revisionValue().toString());
487  });
488 
489  QAction* historyAction = menu->addAction(QIcon::fromTheme(QStringLiteral("view-history")), i18nc("@action:inmenu revision history", "History..."));
490  connect(historyAction, &QAction::triggered, this, [this, rev]() {
491  history(rev);
492  });
493 }
494 
495 void VcsPluginHelper::handleAnnotationBorderVisibilityChanged(View* view, bool visible)
496 {
497  if (visible) {
498  return;
499  }
500 
501  disconnect(view, SIGNAL(annotationContextMenuAboutToShow(KTextEditor::View*,QMenu*,int)),
502  this, SLOT(annotationContextMenuAboutToShow(KTextEditor::View*,QMenu*,int)));
503 
504  disconnect(view, SIGNAL(annotationBorderVisibilityChanged(View*,bool)),
505  this, SLOT(handleAnnotationBorderVisibilityChanged(View*,bool)));
506 
507  // TODO: remove the model if last user of it
508 }
509 
510 void VcsPluginHelper::update()
511 {
512  Q_D(VcsPluginHelper);
513 
514  EXECUTE_VCS_METHOD(update);
515 }
516 
517 void VcsPluginHelper::add()
518 {
519  Q_D(VcsPluginHelper);
520 
521  EXECUTE_VCS_METHOD(add);
522 }
523 
524 void VcsPluginHelper::commit()
525 {
526  Q_D(VcsPluginHelper);
527 
528  Q_ASSERT(!d->ctxUrls.isEmpty());
529  ICore::self()->documentController()->saveAllDocuments();
530 
531  QUrl url = d->ctxUrls.first();
532 
533  // We start the commit UI no matter whether there is real differences, as it can also be used to commit untracked files
534  auto* patchSource = new VCSCommitDiffPatchSource(new VCSStandardDiffUpdater(d->vcs, url));
535 
536  bool ret = showVcsDiff(patchSource);
537 
538  if(!ret) {
539  ScopedDialog<VcsCommitDialog> commitDialog(patchSource);
540  commitDialog->setCommitCandidates(patchSource->infos());
541  commitDialog->exec();
542  }
543 }
544 
545 void VcsPluginHelper::push()
546 {
547  Q_D(VcsPluginHelper);
548 
549  for (const QUrl& url : qAsConst(d->ctxUrls)) {
550  VcsJob* job = d->plugin->extension<IDistributedVersionControl>()->push(url, VcsLocation());
551  ICore::self()->runController()->registerJob(job);
552  }
553 }
554 
555 void VcsPluginHelper::pull()
556 {
557  Q_D(VcsPluginHelper);
558 
559  for (const QUrl& url : qAsConst(d->ctxUrls)) {
560  VcsJob* job = d->plugin->extension<IDistributedVersionControl>()->pull(VcsLocation(), url);
561  ICore::self()->runController()->registerJob(job);
562  }
563 }
564 
565 }
566 
567 
KDevelop::VcsAnnotationModel
Definition: vcsannotationmodel.h:40
QColor
KDevelop::VcsRevision::revisionValue
QVariant revisionValue() const
Return the value of this revision.
Definition: vcsrevision.cpp:100
QVBoxLayout
QApplication::clipboard
QClipboard * clipboard()
KDevelop::VcsPluginHelper::diffToBase
void diffToBase()
Definition: vcspluginhelper.cpp:319
QTimer
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QDialog::reject
virtual void reject()
QVariant::fromValue
QVariant fromValue(const T &value)
QUrl
KDevelop::VcsPluginHelper::addContextDocument
void addContextDocument(const QUrl &url)
Definition: vcspluginhelper.cpp:189
QList::count
int count(const T &value) const
KDevelop::VcsPluginHelper::history
void history(const VcsRevision &rev=VcsRevision::createSpecialRevision(VcsRevision::Base))
Definition: vcspluginhelper.cpp:373
QVariant::value
T value() const
QWidget
QIcon::fromTheme
QIcon fromTheme(const QString &name, const QIcon &fallback)
VCSDiffPatchSource
Definition: vcsdiffpatchsources.h:66
vcscommitdialog.h
QMenu::addSeparator
QAction * addSeparator()
KDevelop::VcsDiff
A class representing a unified diff, possibly with conflict markers.
Definition: vcsdiff.h:95
KDevelop::VcsRevision::Invalid
The type is not set, this is an invalid revision.
Definition: vcsrevision.h:82
QObject::sender
QObject * sender() const
KDevelop::IBasicVersionControl
This is the basic interface that all Version Control or Source Code Management plugins need to implem...
Definition: ibasicversioncontrol.h:52
QMenu
showVcsDiff
bool showVcsDiff(IPatchSource *vcsDiff)
Sends the diff to the patch-review plugin.
Definition: vcsdiffpatchsources.cpp:291
ibasicversioncontrol.h
IPlugin
KDevelop::VcsRevision
Encapsulates a vcs revision number, date or range of revisions.
Definition: vcsrevision.h:66
KDevelop::VcsPluginHelper::push
void push()
Definition: vcspluginhelper.cpp:554
vcsannotationitemdelegate.h
QList< QUrl >
vcsdiff.h
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QFileInfo::isFile
bool isFile() const
KDevelop::VcsPluginHelper::annotationContextMenuAboutToShow
void annotationContextMenuAboutToShow(KTextEditor::View *view, QMenu *menu, int line)
Definition: vcspluginhelper.cpp:463
KDevelop::VcsEventWidget
Definition: vcseventwidget.h:35
KDevelop::VcsPluginHelper::add
void add()
Definition: vcspluginhelper.cpp:526
KDevelop::VcsPluginHelper::revertDone
void revertDone(KJob *job)
Definition: vcspluginhelper.cpp:269
KDevelop::VcsPluginHelper::diffForRevGlobal
void diffForRevGlobal()
Definition: vcspluginhelper.cpp:340
KDevelop::VcsPluginHelper::revert
void revert()
Definition: vcspluginhelper.cpp:246
QObject::deleteLater
void deleteLater()
KDevelop::IDistributedVersionControl
This interface has methods to support distributed version control systems like git or svk.
Definition: idistributedversioncontrol.h:37
VCSCommitDiffPatchSource
Definition: vcsdiffpatchsources.h:98
SINGLEURL_SETUP_VARS
#define SINGLEURL_SETUP_VARS
Definition: vcspluginhelper.cpp:241
idistributedversioncontrol.h
QObject
KDevelop::VcsRevision::revisionType
RevisionType revisionType() const
returns the type of the revision
Definition: vcsrevision.cpp:89
vcsdiffpatchsources.h
QString
KJob
vcsjob.h
QTimer::timeout
void timeout()
KDevelop::VcsPluginHelper::commonActions
QMenu * commonActions(QWidget *parent)
Creates and returns a menu with common actions.
Definition: vcspluginhelper.cpp:222
KDevelop::VcsPluginHelper::pull
void pull()
Definition: vcspluginhelper.cpp:564
QDialogButtonBox::accepted
void accepted()
QDialog::accept
virtual void accept()
VCSStandardDiffUpdater
Definition: vcsdiffpatchsources.h:53
KDevelop::VcsPluginHelper::~VcsPluginHelper
~VcsPluginHelper() override
Definition: vcspluginhelper.cpp:186
KDevelop::VcsPluginHelper
Definition: vcspluginhelper.h:44
QClipboard::setText
void setText(const QString &text, Mode mode)
KDevelop::VcsRevision::Previous
The version prior the other one (only valid in functions that take two revisions).
Definition: vcsrevision.h:90
KDevelop::VcsDiff::isEmpty
bool isEmpty() const
Definition: vcsdiff.cpp:583
KDevelop::VcsDiff::diff
QString diff() const
Definition: vcsdiff.cpp:588
KDevelop::VcsPluginHelper::disposeEventually
void disposeEventually(KTextEditor::Document *)
Definition: vcspluginhelper.cpp:203
vcslocation.h
QAction::triggered
void triggered(bool checked)
KDevelop::VcsPluginHelper::contextUrlList
QList< QUrl > contextUrlList() const
Definition: vcspluginhelper.cpp:215
QUrl::path
QString path() const
KDevelop::VcsJob
This class provides an extension of KJob to get various VCS-specific information about the job.
Definition: vcsjob.h:43
vcspluginhelper.h
QAction::setEnabled
void setEnabled(bool)
QDialogButtonBox::rejected
void rejected()
EXECUTE_VCS_METHOD
#define EXECUTE_VCS_METHOD(method)
Definition: vcspluginhelper.cpp:238
QFileInfo
vcsevent.h
QAction
KDevelop
Definition: dvcsevent.h:33
KDevelop::VcsRevision::createSpecialRevision
static VcsRevision createSpecialRevision(KDevelop::VcsRevision::RevisionSpecialType type)
Helper function to create a vcs revision for one of the special types.
Definition: vcsrevision.cpp:49
KDevelop::VcsJob::JobSucceeded
The job succeeded.
Definition: vcsjob.h:88
KDevelop::VcsPluginHelper::commit
void commit()
Definition: vcspluginhelper.cpp:533
KDevelop::VcsPluginHelper::diffJobFinished
void diffJobFinished(KJob *job)
Definition: vcspluginhelper.cpp:299
QDialog
vcsannotationmodel.h
QMenu::addAction
void addAction(QAction *action)
QTimer::setInterval
void setInterval(int msec)
vcseventwidget.h
KDevelop::VcsPluginHelper::setupFromContext
void setupFromContext(KDevelop::Context *)
Definition: vcspluginhelper.cpp:208
KDevelop::VcsPluginHelper::VcsPluginHelper
VcsPluginHelper(IPlugin *parent, IBasicVersionControl *vcs)
Definition: vcspluginhelper.cpp:173
KDevelop::VcsPluginHelper::diffForRev
void diffForRev()
Definition: vcspluginhelper.cpp:330
QDialogButtonBox
QObject::parent
QObject * parent() const
vcsrevision.h
KDevelop::VcsLocation
Denotes a local or repository location for a Vcs system.
Definition: vcslocation.h:42
KDevelop::VcsPluginHelper::update
void update()
Definition: vcspluginhelper.cpp:519
KDevelop::VcsPluginHelper::annotation
void annotation()
Definition: vcspluginhelper.cpp:396
QVariant::toString
QString toString() const
QObject::property
QVariant property(const char *name) const
QMenu::setIcon
void setIcon(const QIcon &icon)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Apr 18 2021 23:31:38 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/vcs

Skip menu "kdevplatform/vcs"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal