KTextEditor

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

KDE's Doxygen guidelines are available online.