File indexing completed on 2024-04-28 05:49:32
0001 /* 0002 SPDX-FileCopyrightText: 2004 Anders Lund <anders@alweb.dk> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QDialog> 0010 #include <QList> 0011 0012 class KProcess; 0013 class QTemporaryFile; 0014 class QTreeWidget; 0015 class QTreeWidgetItem; 0016 0017 namespace KTextEditor 0018 { 0019 class Document; 0020 } 0021 0022 /** 0023 * A dialog for handling multiple documents modified on disk 0024 * from within KateMainWindow 0025 */ 0026 class KateMwModOnHdDialog : public QDialog 0027 { 0028 Q_OBJECT 0029 public: 0030 explicit KateMwModOnHdDialog(const QList<KTextEditor::Document *> &docs, QWidget *parent = nullptr, const char *name = nullptr); 0031 ~KateMwModOnHdDialog() override; 0032 void addDocument(KTextEditor::Document *doc); 0033 0034 void setShowOnWindowActivation(bool show) 0035 { 0036 m_showOnWindowActivation = show; 0037 } 0038 bool showOnWindowActivation() const 0039 { 0040 return m_showOnWindowActivation; 0041 } 0042 0043 Q_SIGNALS: 0044 void requestOpenDiffDocument(const QUrl &documentUrl); 0045 0046 private Q_SLOTS: 0047 void slotIgnore(); 0048 void slotOverwrite(); 0049 void slotReload(); 0050 void slotDiff(); 0051 void slotSelectionChanged(QTreeWidgetItem *current, QTreeWidgetItem *); 0052 void slotCheckedFilesChanged(QTreeWidgetItem *, int column); 0053 void slotGitDiffDone(class QProcess *p, KTextEditor::Document *doc); 0054 0055 public Q_SLOTS: 0056 void removeDocument(QObject *doc); 0057 0058 private: 0059 enum Action { Ignore, Overwrite, Reload }; 0060 void handleSelected(int action); 0061 class QTreeWidget *docsTreeWidget; 0062 class QDialogButtonBox *dlgButtons; 0063 class QPushButton *btnDiff; 0064 QStringList m_stateTexts; 0065 bool m_blockAddDocument; 0066 bool m_showOnWindowActivation = false; 0067 0068 protected: 0069 void closeEvent(QCloseEvent *e) override; 0070 void keyPressEvent(QKeyEvent *) override; 0071 };