File indexing completed on 2024-04-28 05:49:10

0001 /*
0002     SPDX-FileCopyrightText: 2021 Waqar Ahmed <waqar.17a@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "quickdialog.h"
0009 
0010 class PushPullDialog : public HUDDialog
0011 {
0012     Q_OBJECT
0013 public:
0014     PushPullDialog(KTextEditor::MainWindow *mainWindow, const QString &repo);
0015 
0016     enum Mode { Push, Pull };
0017     void openDialog(Mode m);
0018 
0019     Q_SIGNAL void runGitCommand(const QStringList &args);
0020 
0021 private:
0022     void detectGerrit();
0023     QStringList buildCmdStrings(Mode m);
0024     void loadLastExecutedCommands();
0025     void saveCommand(const QString &command);
0026 
0027     QString getLastPushPullCmd(Mode m) const;
0028 
0029     QString m_repo;
0030     QStringList m_lastExecutedCommands;
0031 
0032 protected Q_SLOTS:
0033     void slotReturnPressed(const QModelIndex &index) override;
0034 
0035 private:
0036     bool m_isGerrit = false;
0037     QString m_gerritBranch;
0038 };