KTextEditor

katedialogs.h
1 /*
2  SPDX-FileCopyrightText: 2002, 2003 Anders Lund <[email protected]>
3  SPDX-FileCopyrightText: 2003 Christoph Cullmann <[email protected]>
4  SPDX-FileCopyrightText: 2001 Joseph Wenninger <[email protected]>
5  SPDX-FileCopyrightText: 2006-2016 Dominik Haumann <[email protected]>
6  SPDX-FileCopyrightText: 2007 Mirko Stocker <[email protected]>
7  SPDX-FileCopyrightText: 2009 Michel Ludwig <[email protected]>
8  SPDX-FileCopyrightText: 1999 Jochen Wilhelmy <[email protected]>
9 
10  SPDX-License-Identifier: LGPL-2.0-or-later
11 */
12 
13 #ifndef KATE_DIALOGS_H
14 #define KATE_DIALOGS_H
15 
16 #include "kateconfigpage.h"
17 #include "katehighlight.h"
18 #include "kateviewhelpers.h"
19 
20 #include <ktexteditor/attribute.h>
21 #include <ktexteditor/document.h>
22 #include <ktexteditor/modificationinterface.h>
23 
24 #include <sonnet/configwidget.h>
25 #include <sonnet/dictionarycombobox.h>
26 
27 #include <QColor>
28 #include <QDialog>
29 #include <QTabWidget>
30 #include <QTreeWidget>
31 
32 class ModeConfigPage;
33 namespace KTextEditor
34 {
35 class DocumentPrivate;
36 }
37 namespace KTextEditor
38 {
39 class ViewPrivate;
40 }
41 namespace KTextEditor
42 {
43 class Message;
44 }
45 
46 namespace KIO
47 {
48 class Job;
49 class TransferJob;
50 }
51 
52 class KShortcutsEditor;
53 class QSpinBox;
54 class KProcess;
55 
56 class QCheckBox;
57 class QLabel;
58 class QCheckBox;
59 class QKeyEvent;
60 class QTemporaryFile;
61 class QTableWidget;
62 
63 namespace Ui
64 {
65 class TextareaAppearanceConfigWidget;
66 class BordersAppearanceConfigWidget;
67 class NavigationConfigWidget;
68 class EditConfigWidget;
69 class IndentationConfigWidget;
70 class OpenSaveConfigWidget;
71 class OpenSaveConfigAdvWidget;
72 class CompletionConfigTab;
73 class SpellCheckConfigWidget;
74 }
75 
76 class KateGotoBar : public KateViewBarWidget
77 {
78  Q_OBJECT
79 
80 public:
81  explicit KateGotoBar(KTextEditor::View *view, QWidget *parent = nullptr);
82 
83  void closed() override;
84 
85 public Q_SLOTS:
86  void updateData();
87 
88 protected Q_SLOTS:
89  void gotoLine();
90  void gotoClipboard();
91 
92 protected:
93  void keyPressEvent(QKeyEvent *event) override;
94  bool eventFilter(QObject *, QEvent *) override;
95  void showEvent(QShowEvent *event) override;
96 
97 private:
98  KTextEditor::View *const m_view;
99  QSpinBox *m_gotoRange = nullptr;
100  QToolButton *m_modifiedUp = nullptr;
101  QToolButton *m_modifiedDown = nullptr;
102  int m_wheelDelta = 0; // To accumulate "wheel-deltas" to become e.g. a touch-pad usable
103 };
104 
105 class KateDictionaryBar : public KateViewBarWidget
106 {
107  Q_OBJECT
108 
109 public:
110  explicit KateDictionaryBar(KTextEditor::ViewPrivate *view, QWidget *parent = nullptr);
111  virtual ~KateDictionaryBar();
112 
113 public Q_SLOTS:
114  void updateData();
115 
116 protected Q_SLOTS:
117  void dictionaryChanged(const QString &dictionary);
118 
119 private:
120  KTextEditor::ViewPrivate *m_view;
121  Sonnet::DictionaryComboBox *m_dictionaryComboBox;
122 };
123 
124 class KateIndentConfigTab : public KateConfigPage
125 {
126  Q_OBJECT
127 
128 public:
129  explicit KateIndentConfigTab(QWidget *parent);
130  ~KateIndentConfigTab() override;
131  QString name() const override;
132 
133 protected:
134  Ui::IndentationConfigWidget *ui;
135 
136 public Q_SLOTS:
137  void apply() override;
138  void reload() override;
139  void reset() override
140  {
141  }
142  void defaults() override
143  {
144  }
145 
146 private Q_SLOTS:
147  void slotChanged();
148  void showWhatsThis(const QString &text);
149 };
150 
151 class KateCompletionConfigTab : public KateConfigPage
152 {
153  Q_OBJECT
154 
155 public:
156  explicit KateCompletionConfigTab(QWidget *parent);
157  ~KateCompletionConfigTab() override;
158  QString name() const override;
159 
160 protected:
161  Ui::CompletionConfigTab *ui;
162 
163 public Q_SLOTS:
164  void apply() override;
165  void reload() override;
166  void reset() override
167  {
168  }
169  void defaults() override
170  {
171  }
172 
173 private Q_SLOTS:
174  void showWhatsThis(const QString &text);
175 };
176 
177 class KateEditGeneralConfigTab : public KateConfigPage
178 {
179  Q_OBJECT
180 
181 public:
182  explicit KateEditGeneralConfigTab(QWidget *parent);
183  ~KateEditGeneralConfigTab() override;
184  QString name() const override;
185 
186 private:
187  Ui::EditConfigWidget *ui;
188 
189  enum SetOfCharsToEncloseSelection {
190  None,
191  MarkDown,
192  NonLetters,
193  MirrorChar,
194  UserData // Ensure to keep it at bottom of this list
195  };
196 
197 public Q_SLOTS:
198  void apply() override;
199  void reload() override;
200  void reset() override
201  {
202  }
203  void defaults() override
204  {
205  }
206 };
207 
208 class KateNavigationConfigTab : public KateConfigPage
209 {
210  Q_OBJECT
211 
212 public:
213  explicit KateNavigationConfigTab(QWidget *parent);
214  ~KateNavigationConfigTab() override;
215  QString name() const override;
216 
217 private:
218  Ui::NavigationConfigWidget *ui;
219 
220 public Q_SLOTS:
221  void apply() override;
222  void reload() override;
223  void reset() override
224  {
225  }
226  void defaults() override
227  {
228  }
229 };
230 
231 class KateSpellCheckConfigTab : public KateConfigPage
232 {
233  Q_OBJECT
234 
235 public:
236  explicit KateSpellCheckConfigTab(QWidget *parent);
237  ~KateSpellCheckConfigTab() override;
238  QString name() const override;
239 
240 protected:
241  Ui::SpellCheckConfigWidget *ui;
242  Sonnet::ConfigWidget *m_sonnetConfigWidget;
243 
244 public Q_SLOTS:
245  void apply() override;
246  void reload() override;
247  void reset() override
248  {
249  }
250  void defaults() override
251  {
252  }
253 
254 private Q_SLOTS:
255  void showWhatsThis(const QString &text);
256 };
257 
258 class KateEditConfigTab : public KateConfigPage
259 {
260  Q_OBJECT
261 
262 public:
263  explicit KateEditConfigTab(QWidget *parent);
264  ~KateEditConfigTab() override;
265  QString name() const override;
266  QString fullName() const override;
267  QIcon icon() const override;
268 
269 public Q_SLOTS:
270  void apply() override;
271  void reload() override;
272  void reset() override;
273  void defaults() override;
274 
275 private:
276  KateEditGeneralConfigTab *editConfigTab;
277  KateNavigationConfigTab *navigationConfigTab;
278  KateIndentConfigTab *indentConfigTab;
279  KateCompletionConfigTab *completionConfigTab;
280  KateSpellCheckConfigTab *spellCheckConfigTab;
281  QList<KateConfigPage *> m_inputModeConfigTabs;
282 };
283 
284 class KateViewDefaultsConfig : public KateConfigPage
285 {
286  Q_OBJECT
287 
288 public:
289  explicit KateViewDefaultsConfig(QWidget *parent);
290  ~KateViewDefaultsConfig() override;
291  QString name() const override;
292  QString fullName() const override;
293  QIcon icon() const override;
294 
295 public Q_SLOTS:
296  void apply() override;
297  void reload() override;
298  void reset() override;
299  void defaults() override;
300 
301 private:
302  Ui::TextareaAppearanceConfigWidget *const textareaUi;
303  Ui::BordersAppearanceConfigWidget *const bordersUi;
304  class KFontChooser *m_fontchooser;
305 };
306 
307 class KateSaveConfigTab : public KateConfigPage
308 {
309  Q_OBJECT
310 
311 public:
312  explicit KateSaveConfigTab(QWidget *parent);
313  ~KateSaveConfigTab() override;
314  QString name() const override;
315  QString fullName() const override;
316  QIcon icon() const override;
317 
318 public Q_SLOTS:
319  void apply() override;
320  void reload() override;
321  void reset() override;
322  void defaults() override;
323  void swapFileModeChanged(int);
324 
325 protected:
326  // why?
327  // KComboBox *m_encoding, *m_encodingDetection, *m_eol;
328  QCheckBox *cbLocalFiles, *cbRemoteFiles;
329  QCheckBox *replaceTabs, *removeSpaces, *allowEolDetection;
330  class QSpinBox *blockCount;
331  class QLabel *blockCountLabel;
332 
333 private:
334  Ui::OpenSaveConfigWidget *ui;
335  Ui::OpenSaveConfigAdvWidget *uiadv;
336  ModeConfigPage *modeConfigPage;
337 };
338 
346 {
347  Q_OBJECT
348 public:
349  enum Status {
350  Reload = 1, // 0 is QDialog::Rejected
351  Save,
352  Overwrite,
353  Ignore,
354  Close
355  };
356  KateModOnHdPrompt(KTextEditor::DocumentPrivate *doc, KTextEditor::ModificationInterface::ModifiedOnDiskReason modtype, const QString &reason);
358 
359 Q_SIGNALS:
360  void saveAsTriggered();
361  void ignoreTriggered();
362  void reloadTriggered();
363  void autoReloadTriggered();
364  void closeTriggered();
365 
366 private Q_SLOTS:
370  void slotDiff();
371 
372 private Q_SLOTS:
373  void slotDataAvailable();
374  void slotPDone();
375 
376 private:
377  KTextEditor::DocumentPrivate *m_doc;
380  KProcess *m_proc;
381  QTemporaryFile *m_diffFile;
382  QAction *m_diffAction;
383 };
384 
385 #endif
KGuiItem defaults()
QString name(const QVariant &location)
const QList< QKeySequence > & reload()
QString fullName(const PartType &type)
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition: katetextblock.h:21
ModifiedOnDiskReason
Reasons why a document is modified on disk.
This dialog will prompt the user for what do with a file that is modified on disk.
Definition: katedialogs.h:345
KGuiItem reset()
KGuiItem apply()
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:146
const QList< QKeySequence > & gotoLine()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 22:56:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.