File indexing completed on 2024-05-12 04:38:53

0001 /*
0002     SPDX-FileCopyrightText: 2013 Sven Brauch <svenbrauch@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_ICONTENTAWAREVERSIONCONTROL_H
0008 #define KDEVPLATFORM_ICONTENTAWAREVERSIONCONTROL_H
0009 
0010 #include <KJob>
0011 
0012 #include <vcs/vcsexport.h>
0013 
0014 namespace KTextEditor {
0015     class Document;
0016 }
0017 
0018 namespace KDevelop {
0019 class CheckInRepositoryJobPrivate;
0020 
0021 class KDEVPLATFORMVCS_EXPORT CheckInRepositoryJob : public KJob
0022 {
0023 Q_OBJECT
0024 public:
0025     explicit CheckInRepositoryJob(KTextEditor::Document* document);
0026     ~CheckInRepositoryJob() override;
0027 
0028     KTextEditor::Document* document() const;
0029 
0030 public Q_SLOTS:
0031     /// Abort this request.
0032     void abort();
0033 
0034 Q_SIGNALS:
0035     void finished(bool canRecreate);
0036 
0037 private:
0038     const QScopedPointer<class CheckInRepositoryJobPrivate> d_ptr;
0039     Q_DECLARE_PRIVATE(CheckInRepositoryJob)
0040 };
0041 
0042 /**
0043  * This interface is used by version control systems which can tell whether a given
0044  * blob of data is stored in the repository or not, such as git.
0045  * This information is used to reload files automatically if that involves no data loss.
0046  */
0047 class IContentAwareVersionControl
0048 {
0049 public:
0050     virtual ~IContentAwareVersionControl() {};
0051 
0052     /**
0053      * @brief Determines whether the given data is stored in the VCS' repository.
0054      *
0055      * @param document Document to search for in the repository
0056      * @returns CheckInRepositoryJob request object to track get notified when this finishes.
0057      * The request object deletes itself after finished() was emitted.
0058      */
0059     virtual CheckInRepositoryJob* isInRepository(KTextEditor::Document* document) = 0;
0060 };
0061 
0062 }
0063 
0064 Q_DECLARE_INTERFACE( KDevelop::IContentAwareVersionControl, "org.kdevelop.IContentAwareVersionControl" )
0065 
0066 #endif
0067