~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to kwrite/kwritemain.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
3
 
   Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
4
 
   Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>
5
 
 
6
 
   This library is free software; you can redistribute it and/or
7
 
   modify it under the terms of the GNU Library General Public
8
 
   License version 2 as published by the Free Software Foundation.
9
 
 
10
 
   This library is distributed in the hope that it will be useful,
11
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
   Library General Public License for more details.
14
 
 
15
 
   You should have received a copy of the GNU Library General Public License
16
 
   along with this library; see the file COPYING.LIB.  If not, write to
17
 
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 
   Boston, MA 02110-1301, USA.
19
 
*/
20
 
 
21
 
#ifndef KWRITE_MAIN_H
22
 
#define KWRITE_MAIN_H
23
 
 
24
 
#include <ktexteditor/view.h>
25
 
#include <ktexteditor/document.h>
26
 
 
27
 
#include <kparts/mainwindow.h>
28
 
 
29
 
#include <kdialog.h>
30
 
 
31
 
#include <QtGui/QKeyEvent>
32
 
 
33
 
#include <config.h>
34
 
 
35
 
class QLabel;
36
 
 
37
 
namespace KTextEditor { class EditorChooser; }
38
 
 
39
 
#ifdef KActivities_FOUND
40
 
namespace KActivities { class ResourceInstance; }
41
 
#endif
42
 
 
43
 
class KToggleAction;
44
 
class KRecentFilesAction;
45
 
class KSqueezedTextLabel;
46
 
 
47
 
class KWrite : public KParts::MainWindow
48
 
{
49
 
  Q_OBJECT
50
 
 
51
 
  public:
52
 
    KWrite(KTextEditor::Document * = 0L);
53
 
    ~KWrite();
54
 
 
55
 
    void loadURL(const KUrl &url);
56
 
 
57
 
    KTextEditor::View *view() const { return m_view; }
58
 
 
59
 
    static bool noWindows () { return winList.isEmpty(); }
60
 
 
61
 
  private:
62
 
    void setupActions();
63
 
    void setupStatusBar();
64
 
 
65
 
    void addMenuBarActionToContextMenu();
66
 
    void removeMenuBarActionFromContextMenu();
67
 
 
68
 
    bool queryClose();
69
 
 
70
 
    void dragEnterEvent( QDragEnterEvent * );
71
 
    void dropEvent( QDropEvent * );
72
 
 
73
 
  public Q_SLOTS:
74
 
    void slotNew();
75
 
    void slotFlush ();
76
 
    void slotOpen();
77
 
    void slotOpen( const KUrl& url);
78
 
    void newView();
79
 
    void toggleStatusBar();
80
 
    void toggleMenuBar(bool silentMode = false);
81
 
    void editKeys();
82
 
    void editToolbars();
83
 
    void aboutEditor();
84
 
 
85
 
  private Q_SLOTS:
86
 
    void slotNewToolbarConfig();
87
 
 
88
 
  public Q_SLOTS:
89
 
    void slotDropEvent(QDropEvent *);
90
 
 
91
 
    void slotEnableActions( bool enable );
92
 
 
93
 
    /**
94
 
     * adds a changed URL to the recent files
95
 
     */
96
 
    void urlChanged();
97
 
 
98
 
  //config file functions
99
 
  public:
100
 
    void readConfig (KSharedConfigPtr);
101
 
    void writeConfig (KSharedConfigPtr);
102
 
 
103
 
    void readConfig ();
104
 
    void writeConfig ();
105
 
 
106
 
  //session management
107
 
  public:
108
 
    void restore(KConfig *,int);
109
 
    static void restore();
110
 
 
111
 
  private:
112
 
    void readProperties(KSharedConfigPtr);
113
 
    void saveProperties(KSharedConfigPtr);
114
 
    void saveGlobalProperties(KConfig *);
115
 
 
116
 
  private:
117
 
    KTextEditor::View * m_view;
118
 
 
119
 
    KRecentFilesAction * m_recentFiles;
120
 
    KToggleAction * m_paShowPath;
121
 
    KToggleAction * m_paShowStatusBar;
122
 
    KToggleAction *m_paShowMenuBar;
123
 
 
124
 
#ifdef KActivities_FOUND
125
 
    KActivities::ResourceInstance * m_activityResource;
126
 
#endif
127
 
 
128
 
    QString encoding;
129
 
 
130
 
    static QList<KTextEditor::Document*> docList;
131
 
    static QList<KWrite*> winList;
132
 
 
133
 
  /**
134
 
   * Stuff for the status bar
135
 
   */
136
 
  public Q_SLOTS:
137
 
    void updateStatus ();
138
 
 
139
 
    void viewModeChanged ( KTextEditor::View *view );
140
 
 
141
 
    void modeChanged ( KTextEditor::Document *document );
142
 
 
143
 
    void cursorPositionChanged ( KTextEditor::View *view );
144
 
 
145
 
    void selectionChanged (KTextEditor::View *view);
146
 
 
147
 
    void modifiedChanged();
148
 
 
149
 
    void documentNameChanged ();
150
 
 
151
 
    void informationMessage (KTextEditor::View *view, const QString &message);
152
 
 
153
 
   private:
154
 
      QLabel* m_lineColLabel;
155
 
      QLabel* m_modifiedLabel;
156
 
      QLabel* m_insertModeLabel;
157
 
      QLabel* m_selectModeLabel;
158
 
      QLabel* m_modeLabel;
159
 
      KSqueezedTextLabel* m_fileNameLabel;
160
 
      QPixmap m_modPm; //, m_modDiscPm, m_modmodPm;
161
 
};
162
 
 
163
 
#endif
164
 
 
165
 
// kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;