Commit 49728b0c authored by Sven Brauch's avatar Sven Brauch
Browse files

Revert showing diffs on left-clicking the annotation bar; use menu instead

There's already a context menu to show the diff, that it was not shown
when the action was invoked via the shortcut was a bug which is now fixed.
parent 6a0519cf
......@@ -147,7 +147,7 @@ QString revisionInterval(const KDevelop::VcsRevision& rev, const KDevelop::VcsRe
rev.revisionValue().value<VcsRevision::RevisionSpecialType>()==VcsRevision::Start) //if we want it to the beginning just put the revisionInterval
ret = toRevisionName(limit, QString());
else {
QString dst = toRevisionName(limit, toRevisionName(rev));
QString dst = toRevisionName(limit);
if(dst.isEmpty())
ret = dst;
else {
......
......@@ -1220,9 +1220,13 @@ void DocumentController::vcsAnnotateCurrentDocument()
if(project && project->versionControlPlugin()) {
IBasicVersionControl* iface = 0;
iface = project->versionControlPlugin()->extension<IBasicVersionControl>();
VcsPluginHelper helper(project->versionControlPlugin(), iface);
helper.addContextDocument(url);
helper.annotation();
auto helper = new VcsPluginHelper(project->versionControlPlugin(), iface);
connect(doc->textDocument(), SIGNAL(aboutToClose(KTextEditor::Document*)),
helper, SLOT(disposeEventually(bool)));
connect(doc->textDocument(), SIGNAL(annotationBorderVisibilityChanged(KTextEditor::View*, bool)),
helper, SLOT(disposeEventually(bool)));
helper->addContextDocument(url);
helper->annotation();
}
else {
KMessageBox::error(0, i18n("Could not annotate the document because it is not "
......
......@@ -34,18 +34,9 @@
#include <klocale.h>
#include <kglobal.h>
#include <kdebug.h>
#include <KTextEditor/View>
#include <KTextEditor/Document>
#include <widgets/vcsdiffwidget.h>
#include <interfaces/ibasicversioncontrol.h>
#include <interfaces/icore.h>
#include <interfaces/iruncontroller.h>
#include <interfaces/idocumentcontroller.h>
#include <interfaces/iproject.h>
#include <interfaces/iplugin.h>
#include <interfaces/iprojectcontroller.h>
namespace KDevelop
{
......@@ -84,21 +75,6 @@ public:
}
}
}
void itemActivated(KTextEditor::View* view, int index) {
IProject* project = KDevelop::ICore::self()->projectController()->findProjectForUrl(view->document()->url());
if( !project )
return;
auto vcs = qobject_cast<IBasicVersionControl*>(project->versionControlPlugin());
if( !vcs )
return;
KDevelop::VcsAnnotationLine aline = m_annotation.line(index);
auto start = aline.revision();
auto end = start.createSpecialRevision(VcsRevision::Previous);
auto job = vcs->diff(project->folder(), start, end,
VcsDiff::DiffDontCare, IBasicVersionControl::Recursive);
auto widget = new VcsDiffWidget(job);
}
};
VcsAnnotationModel::VcsAnnotationModel(VcsJob *job, const KUrl& url, QObject* parent,
......
......@@ -52,7 +52,6 @@ public:
private:
Q_PRIVATE_SLOT( d, void addLines( KDevelop::VcsJob*) )
Q_PRIVATE_SLOT( d, void itemActivated(KTextEditor::View*, int) )
class VcsAnnotationModelPrivate* const d;
friend class VcsAnnotationModelPrivate;
......
......@@ -189,6 +189,13 @@ void VcsPluginHelper::addContextDocument(const KUrl &url)
d->ctxUrls.append(url);
}
void VcsPluginHelper::disposeEventually(bool dont)
{
if ( ! dont ) {
deleteLater();
}
}
void VcsPluginHelper::setupFromContext(Context* context)
{
d->ctxUrls.clear();
......
......@@ -66,6 +66,7 @@ public Q_SLOTS:
void diffJobFinished(KJob* job);
void revertDone(KJob* job);
void disposeEventually(bool);
private Q_SLOTS:
void delayedModificationWarningOn();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment