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>
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.
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.
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.
24 #include <ktexteditor/view.h>
25 #include <ktexteditor/document.h>
27 #include <kparts/mainwindow.h>
31 #include <QtGui/QKeyEvent>
35 namespace KTextEditor
{ class EditorChooser
; }
38 class KRecentFilesAction
;
39 class KSqueezedTextLabel
;
41 class KWrite
: public KParts::MainWindow
46 KWrite(KTextEditor::Document
* = 0L);
49 void loadURL(const KUrl
&url
);
51 KTextEditor::View
*view() const { return m_view
; }
53 static bool noWindows () { return winList
.isEmpty(); }
57 void setupStatusBar();
61 void dragEnterEvent( QDragEnterEvent
* );
62 void dropEvent( QDropEvent
* );
68 void slotOpen( const KUrl
& url
);
70 void toggleStatusBar();
76 void slotNewToolbarConfig();
79 void slotDropEvent(QDropEvent
*);
81 void slotEnableActions( bool enable
);
84 * adds a changed URL to the recent files
88 //config file functions
90 void readConfig (KSharedConfigPtr
);
91 void writeConfig (KSharedConfigPtr
);
98 void restore(KConfig
*,int);
99 static void restore();
102 void readProperties(KSharedConfigPtr
);
103 void saveProperties(KSharedConfigPtr
);
104 void saveGlobalProperties(KConfig
*);
107 KTextEditor::View
* m_view
;
109 KRecentFilesAction
* m_recentFiles
;
110 KToggleAction
* m_paShowPath
;
111 KToggleAction
* m_paShowStatusBar
;
115 static QList
<KTextEditor::Document
*> docList
;
116 static QList
<KWrite
*> winList
;
119 * Stuff for the status bar
122 void updateStatus ();
124 void viewModeChanged ( KTextEditor::View
*view
);
126 void modeChanged ( KTextEditor::Document
*document
);
128 void cursorPositionChanged ( KTextEditor::View
*view
);
130 void selectionChanged (KTextEditor::View
*view
);
132 void modifiedChanged();
134 void documentNameChanged ();
136 void informationMessage (KTextEditor::View
*view
, const QString
&message
);
139 QLabel
* m_lineColLabel
;
140 QLabel
* m_modifiedLabel
;
141 QLabel
* m_insertModeLabel
;
142 QLabel
* m_selectModeLabel
;
144 KSqueezedTextLabel
* m_fileNameLabel
;
145 QPixmap m_modPm
; //, m_modDiscPm, m_modmodPm;
148 class KWriteEditorChooser
: public KDialog
153 KWriteEditorChooser(QWidget
*parent
);
154 virtual ~KWriteEditorChooser();
157 KTextEditor::EditorChooser
*m_chooser
;
164 // kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;