File indexing completed on 2024-04-28 09:36:13

0001 /*
0002     SPDX-FileCopyrightText: 2019-2020 Nikolai Krasheninnikov <nkrasheninnikov@yandex.ru>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SVNCOMMITDIALOG_H
0008 #define SVNCOMMITDIALOG_H
0009 
0010 #include <QDialog>
0011 #include <QHash>
0012 
0013 #include <Dolphin/KVersionControlPlugin>
0014 
0015 class QPlainTextEdit;
0016 class QTableWidget;
0017 
0018 /**
0019  * \brief SVN Commit dialog class.
0020  */
0021 class SvnCommitDialog : public QDialog {
0022     Q_OBJECT
0023 public:
0024     /**
0025      * Constructor.
0026      *
0027      * \param versionInfo Pointer to a current full list of SVN plugin changed files. This pointer
0028      *        is saved internaly and used for changes list updates.
0029      * \param context List of dirs and files for which this dialog is shown. Every directory entry
0030      *        means "every file in this directory", file stands for a file. This context is used
0031      *        like a filter for \p versionInfo to make changes list.
0032      * \param parent Parent widget.
0033      */
0034     SvnCommitDialog(const QHash<QString, KVersionControlPlugin::ItemVersion> *versionInfo, const QStringList& context, QWidget *parent = nullptr);
0035 
0036     virtual ~SvnCommitDialog() override;
0037 
0038 Q_SIGNALS:
0039     /**
0040      * Is emitted for SVN commit.
0041      *
0042      * \param context List of files and dirs for which this commit is applied. This not necessarily
0043      *        the same list which passed to the class contructor because some files might be, for
0044      *        example, reverted.
0045      * \param msg Commit message.
0046      */
0047     void commit(const QStringList& context, const QString& msg);
0048 
0049     void revertFiles(const QStringList& filesPath);
0050     void diffFile(const QString& filePath);
0051     void addFiles(const QStringList& filesPath);
0052 
0053 public Q_SLOTS:
0054     void refreshChangesList();
0055     void show();
0056 
0057 private Q_SLOTS:
0058     void contextMenu(const QPoint& pos);
0059 
0060 private:
0061     const QHash<QString, KVersionControlPlugin::ItemVersion> *m_versionInfoHash;
0062     const QStringList m_context;
0063     QPlainTextEdit *m_editor;
0064     QTableWidget *m_changes;
0065     QAction *m_actRevertFile;
0066     QAction *m_actDiffFile;
0067     QAction *m_actAddFile;
0068 };
0069 
0070 #endif  // SVNCOMMITDIALOG_H