kateconfigdialog.h 2.91 KB
Newer Older
1 2 3
/* This file is part of the KDE project
   Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
   Copyright (C) 2002 Joseph Wenninger <jowenn@kde.org>
Mirko Stocker's avatar
Mirko Stocker committed
4
   Copyright (C) 2007 Mirko Stocker <me@misto.ch>
5 6 7

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
Christoph Cullmann's avatar
Christoph Cullmann committed
8 9
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef __kate_configdialog_h__
#define __kate_configdialog_h__

25
#include <KTextEditor/ConfigPage>
Christoph Cullmann's avatar
Christoph Cullmann committed
26
#include <KTextEditor/Document>
27 28
#include <KTextEditor/Editor>
#include <KTextEditor/Plugin>
Christoph Cullmann's avatar
Christoph Cullmann committed
29
#include <KTextEditor/View>
30

Michal Humpula's avatar
Michal Humpula committed
31
#include <KPageDialog>
32 33

class QCheckBox;
34
class QComboBox;
35
class QSpinBox;
36
class KateMainWindow;
37 38
class KPluralHandlingSpinBox;

39 40 41
namespace Ui
{
class SessionConfigWidget;
42
}
43

44 45
struct PluginPageListItem {
    KTextEditor::Plugin *plugin;
46
    int idInPlugin;
47 48 49
    KTextEditor::ConfigPage *pluginPage;
    QWidget *pageParent;
    KPageWidgetItem *pageWidgetItem;
50 51 52 53 54 55
};

class KateConfigDialog : public KPageDialog
{
    Q_OBJECT

56 57
public:
    KateConfigDialog(KateMainWindow *parent, KTextEditor::View *view);
Kevin Funk's avatar
Kevin Funk committed
58
    ~KateConfigDialog() override;
59

60 61 62 63 64
public: // static
    /**
     * Reads the value from the given open config. If not present in config yet then
     * the default value 10 is used.
     */
65
    static int recentFilesMaxCount();
66

67 68 69
public:
    void addPluginPage(KTextEditor::Plugin *plugin);
    void removePluginPage(KTextEditor::Plugin *plugin);
70
    void showAppPluginPage(KTextEditor::Plugin *plugin, int id);
71

72
protected Q_SLOTS:
73 74
    void slotApply();
    void slotChanged();
Christoph Cullmann's avatar
Christoph Cullmann committed
75
    void slotHelp();
76

77
    void slotCurrentPageChanged(KPageWidgetItem *current, KPageWidgetItem *before);
78

79 80
protected:
    void closeEvent(QCloseEvent *event) override;
81

82
private:
Adam Treat's avatar
Adam Treat committed
83 84
    KateMainWindow *m_mainWindow;

85
    KTextEditor::View *m_view;
86
    bool m_dataChanged = false;
Adam Treat's avatar
Adam Treat committed
87 88

    QCheckBox *m_modNotifications;
89
    QCheckBox *m_modCloseAfterLast;
Adam Treat's avatar
Adam Treat committed
90
    QCheckBox *m_saveMetaInfos;
91
    KPluralHandlingSpinBox *m_daysMetaInfos;
92 93
    QComboBox *m_cmbQuickOpenMatchMode;
    QComboBox *m_cmbQuickOpenListMode;
94

95
    // Sessions Page
96
    Ui::SessionConfigWidget *sessionConfigUi;
97

98
    QHash<KPageWidgetItem *, PluginPageListItem *> m_pluginPages;
Christoph Cullmann's avatar
Christoph Cullmann committed
99
    QList<KTextEditor::ConfigPage *> m_editorPages;
100
    KPageWidgetItem *m_applicationPage;
Christoph Cullmann's avatar
Christoph Cullmann committed
101
    KPageWidgetItem *m_editorPage;
102

Christoph Cullmann's avatar
Christoph Cullmann committed
103
    void addEditorPages();
104 105 106
};

#endif