-rw-r--r-- | core/apps/textedit/textedit.cpp | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index ea27e1b..40ea501 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -1,970 +1,979 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // changes added by L. J. Potter Sun 02-17-2002 21:31:31 | 20 | // changes added by L. J. Potter Sun 02-17-2002 21:31:31 |
21 | 21 | ||
22 | #include "textedit.h" | 22 | #include "textedit.h" |
23 | #include "fileSaver.h" | 23 | #include "fileSaver.h" |
24 | #include "filePermissions.h" | 24 | #include "filePermissions.h" |
25 | #include "fontDialog.h" | 25 | #include "fontDialog.h" |
26 | 26 | ||
27 | #include <opie/ofileselector.h> | 27 | #include <opie/ofileselector.h> |
28 | #include <opie/ofiledialog.h> | 28 | #include <opie/ofiledialog.h> |
29 | 29 | ||
30 | #include <qpe/fontdatabase.h> | 30 | #include <qpe/fontdatabase.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/fileselector.h> | 32 | #include <qpe/fileselector.h> |
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/qpemenubar.h> | 37 | #include <qpe/qpemenubar.h> |
38 | #include <qpe/qpetoolbar.h> | 38 | #include <qpe/qpetoolbar.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | 40 | ||
41 | #include <qstringlist.h> | 41 | #include <qstringlist.h> |
42 | #include <qaction.h> | 42 | #include <qaction.h> |
43 | #include <qcolordialog.h> | 43 | #include <qcolordialog.h> |
44 | #include <qfileinfo.h> | 44 | #include <qfileinfo.h> |
45 | #include <qlineedit.h> | 45 | #include <qlineedit.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | #include <qobjectlist.h> | 47 | #include <qobjectlist.h> |
48 | #include <qpopupmenu.h> | 48 | #include <qpopupmenu.h> |
49 | #include <qspinbox.h> | 49 | #include <qspinbox.h> |
50 | #include <qtoolbutton.h> | 50 | #include <qtoolbutton.h> |
51 | #include <qwidgetstack.h> | 51 | #include <qwidgetstack.h> |
52 | #include <qcheckbox.h> | 52 | #include <qcheckbox.h> |
53 | #include <qcombo.h> | 53 | #include <qcombo.h> |
54 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #include <sys/stat.h> | 55 | #include <sys/stat.h> |
56 | 56 | ||
57 | #include <stdlib.h> //getenv | 57 | #include <stdlib.h> //getenv |
58 | /* XPM */ | 58 | /* XPM */ |
59 | static char * filesave_xpm[] = { | 59 | static char * filesave_xpm[] = { |
60 | "16 16 78 1", | 60 | "16 16 78 1", |
61 | " c None", | 61 | " c None", |
62 | ". c #343434", | 62 | ". c #343434", |
63 | "+ c #A0A0A0", | 63 | "+ c #A0A0A0", |
64 | "@ c #565656", | 64 | "@ c #565656", |
65 | "# c #9E9E9E", | 65 | "# c #9E9E9E", |
66 | "$ c #525252", | 66 | "$ c #525252", |
67 | "% c #929292", | 67 | "% c #929292", |
68 | "& c #676767", | 68 | "& c #676767", |
69 | "* c #848484", | 69 | "* c #848484", |
70 | "= c #666666", | 70 | "= c #666666", |
71 | "- c #D8D8D8", | 71 | "- c #D8D8D8", |
72 | "; c #FFFFFF", | 72 | "; c #FFFFFF", |
73 | "> c #DBDBDB", | 73 | "> c #DBDBDB", |
74 | ", c #636363", | 74 | ", c #636363", |
75 | "' c #989898", | 75 | "' c #989898", |
76 | ") c #2D2D2D", | 76 | ") c #2D2D2D", |
77 | "! c #909090", | 77 | "! c #909090", |
78 | "~ c #AEAEAE", | 78 | "~ c #AEAEAE", |
79 | "{ c #EAEAEA", | 79 | "{ c #EAEAEA", |
80 | "] c #575757", | 80 | "] c #575757", |
81 | "^ c #585858", | 81 | "^ c #585858", |
82 | "/ c #8A8A8A", | 82 | "/ c #8A8A8A", |
83 | "( c #828282", | 83 | "( c #828282", |
84 | "_ c #6F6F6F", | 84 | "_ c #6F6F6F", |
85 | ": c #C9C9C9", | 85 | ": c #C9C9C9", |
86 | "< c #050505", | 86 | "< c #050505", |
87 | "[ c #292929", | 87 | "[ c #292929", |
88 | "} c #777777", | 88 | "} c #777777", |
89 | "| c #616161", | 89 | "| c #616161", |
90 | "1 c #3A3A3A", | 90 | "1 c #3A3A3A", |
91 | "2 c #BEBEBE", | 91 | "2 c #BEBEBE", |
92 | "3 c #2C2C2C", | 92 | "3 c #2C2C2C", |
93 | "4 c #7C7C7C", | 93 | "4 c #7C7C7C", |
94 | "5 c #F6F6F6", | 94 | "5 c #F6F6F6", |
95 | "6 c #FCFCFC", | 95 | "6 c #FCFCFC", |
96 | "7 c #6B6B6B", | 96 | "7 c #6B6B6B", |
97 | "8 c #959595", | 97 | "8 c #959595", |
98 | "9 c #4F4F4F", | 98 | "9 c #4F4F4F", |
99 | "0 c #808080", | 99 | "0 c #808080", |
100 | "a c #767676", | 100 | "a c #767676", |
101 | "b c #818181", | 101 | "b c #818181", |
102 | "c c #B8B8B8", | 102 | "c c #B8B8B8", |
103 | "d c #FBFBFB", | 103 | "d c #FBFBFB", |
104 | "e c #F9F9F9", | 104 | "e c #F9F9F9", |
105 | "f c #CCCCCC", | 105 | "f c #CCCCCC", |
106 | "g c #030303", | 106 | "g c #030303", |
107 | "h c #737373", | 107 | "h c #737373", |
108 | "i c #7A7A7A", | 108 | "i c #7A7A7A", |
109 | "j c #7E7E7E", | 109 | "j c #7E7E7E", |
110 | "k c #6A6A6A", | 110 | "k c #6A6A6A", |
111 | "l c #FAFAFA", | 111 | "l c #FAFAFA", |
112 | "m c #505050", | 112 | "m c #505050", |
113 | "n c #9D9D9D", | 113 | "n c #9D9D9D", |
114 | "o c #333333", | 114 | "o c #333333", |
115 | "p c #7B7B7B", | 115 | "p c #7B7B7B", |
116 | "q c #787878", | 116 | "q c #787878", |
117 | "r c #696969", | 117 | "r c #696969", |
118 | "s c #494949", | 118 | "s c #494949", |
119 | "t c #555555", | 119 | "t c #555555", |
120 | "u c #949494", | 120 | "u c #949494", |
121 | "v c #E6E6E6", | 121 | "v c #E6E6E6", |
122 | "w c #424242", | 122 | "w c #424242", |
123 | "x c #515151", | 123 | "x c #515151", |
124 | "y c #535353", | 124 | "y c #535353", |
125 | "z c #3E3E3E", | 125 | "z c #3E3E3E", |
126 | "A c #D4D4D4", | 126 | "A c #D4D4D4", |
127 | "B c #0C0C0C", | 127 | "B c #0C0C0C", |
128 | "C c #353535", | 128 | "C c #353535", |
129 | "D c #474747", | 129 | "D c #474747", |
130 | "E c #ECECEC", | 130 | "E c #ECECEC", |
131 | "F c #919191", | 131 | "F c #919191", |
132 | "G c #7D7D7D", | 132 | "G c #7D7D7D", |
133 | "H c #000000", | 133 | "H c #000000", |
134 | "I c #404040", | 134 | "I c #404040", |
135 | "J c #858585", | 135 | "J c #858585", |
136 | "K c #323232", | 136 | "K c #323232", |
137 | "L c #D0D0D0", | 137 | "L c #D0D0D0", |
138 | "M c #1C1C1C", | 138 | "M c #1C1C1C", |
139 | " ...+ ", | 139 | " ...+ ", |
140 | " @#$%&..+ ", | 140 | " @#$%&..+ ", |
141 | " .*=-;;>,..+ ", | 141 | " .*=-;;>,..+ ", |
142 | " ')!~;;;;;;{]..", | 142 | " ')!~;;;;;;{]..", |
143 | " ^/(-;;;;;;;_:<", | 143 | " ^/(-;;;;;;;_:<", |
144 | " [}|;;;;;;;{12$", | 144 | " [}|;;;;;;;{12$", |
145 | " #34-55;;;;678$+", | 145 | " #34-55;;;;678$+", |
146 | " 90ab=c;dd;e1fg ", | 146 | " 90ab=c;dd;e1fg ", |
147 | " [ahij((kbl0mn$ ", | 147 | " [ahij((kbl0mn$ ", |
148 | " op^q^^7r&]s/$+ ", | 148 | " op^q^^7r&]s/$+ ", |
149 | "@btu;vbwxy]zAB ", | 149 | "@btu;vbwxy]zAB ", |
150 | "CzDEvEv;;DssF$ ", | 150 | "CzDEvEv;;DssF$ ", |
151 | "G.H{E{E{IxsJ$+ ", | 151 | "G.H{E{E{IxsJ$+ ", |
152 | " +...vEKxzLM ", | 152 | " +...vEKxzLM ", |
153 | " +...z]n$ ", | 153 | " +...z]n$ ", |
154 | " +... "}; | 154 | " +... "}; |
155 | 155 | ||
156 | 156 | ||
157 | #if QT_VERSION < 300 | 157 | #if QT_VERSION < 300 |
158 | 158 | ||
159 | class QpeEditor : public QMultiLineEdit | 159 | class QpeEditor : public QMultiLineEdit |
160 | { | 160 | { |
161 | // Q_OBJECT | 161 | // Q_OBJECT |
162 | public: | 162 | public: |
163 | QpeEditor( QWidget *parent, const char * name = 0 ) | 163 | QpeEditor( QWidget *parent, const char * name = 0 ) |
164 | : QMultiLineEdit( parent, name ) | 164 | : QMultiLineEdit( parent, name ) |
165 | { | 165 | { |
166 | clearTableFlags(); | 166 | clearTableFlags(); |
167 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); | 167 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); |
168 | } | 168 | } |
169 | 169 | ||
170 | void find( const QString &txt, bool caseSensitive, | 170 | void find( const QString &txt, bool caseSensitive, |
171 | bool backwards ); | 171 | bool backwards ); |
172 | //public slots: | 172 | //public slots: |
173 | /* | 173 | /* |
174 | signals: | 174 | signals: |
175 | void notFound(); | 175 | void notFound(); |
176 | void searchWrapped(); | 176 | void searchWrapped(); |
177 | */ | 177 | */ |
178 | 178 | ||
179 | private: | 179 | private: |
180 | 180 | ||
181 | }; | 181 | }; |
182 | 182 | ||
183 | 183 | ||
184 | void QpeEditor::find ( const QString &txt, bool caseSensitive, | 184 | void QpeEditor::find ( const QString &txt, bool caseSensitive, |
185 | bool backwards ) | 185 | bool backwards ) |
186 | { | 186 | { |
187 | static bool wrap = FALSE; | 187 | static bool wrap = FALSE; |
188 | int line, col; | 188 | int line, col; |
189 | if ( wrap ) { | 189 | if ( wrap ) { |
190 | if ( !backwards ) | 190 | if ( !backwards ) |
191 | line = col = 0; | 191 | line = col = 0; |
192 | wrap = FALSE; | 192 | wrap = FALSE; |
193 | // emit searchWrapped(); | 193 | // emit searchWrapped(); |
194 | } else { | 194 | } else { |
195 | getCursorPosition( &line, &col ); | 195 | getCursorPosition( &line, &col ); |
196 | } | 196 | } |
197 | //ignore backwards for now.... | 197 | //ignore backwards for now.... |
198 | if ( !backwards ) { | 198 | if ( !backwards ) { |
199 | for ( ; ; ) { | 199 | for ( ; ; ) { |
200 | if ( line >= numLines() ) { | 200 | if ( line >= numLines() ) { |
201 | wrap = TRUE; | 201 | wrap = TRUE; |
202 | //emit notFound(); | 202 | //emit notFound(); |
203 | break; | 203 | break; |
204 | } | 204 | } |
205 | int findCol = getString( line )->find( txt, col, caseSensitive ); | 205 | int findCol = getString( line )->find( txt, col, caseSensitive ); |
206 | if ( findCol >= 0 ) { | 206 | if ( findCol >= 0 ) { |
207 | setCursorPosition( line, findCol, FALSE ); | 207 | setCursorPosition( line, findCol, FALSE ); |
208 | col = findCol + txt.length(); | 208 | col = findCol + txt.length(); |
209 | setCursorPosition( line, col, TRUE ); | 209 | setCursorPosition( line, col, TRUE ); |
210 | 210 | ||
211 | //found = TRUE; | 211 | //found = TRUE; |
212 | break; | 212 | break; |
213 | } | 213 | } |
214 | line++; | 214 | line++; |
215 | col = 0; | 215 | col = 0; |
216 | } | 216 | } |
217 | 217 | ||
218 | } | 218 | } |
219 | 219 | ||
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | #else | 223 | #else |
224 | 224 | ||
225 | #error "Must make a QpeEditor that inherits QTextEdit" | 225 | #error "Must make a QpeEditor that inherits QTextEdit" |
226 | 226 | ||
227 | #endif | 227 | #endif |
228 | 228 | ||
229 | 229 | ||
230 | static const int nfontsizes = 6; | 230 | static const int nfontsizes = 6; |
231 | static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; | 231 | static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; |
232 | 232 | ||
233 | TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | 233 | TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) |
234 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ) | 234 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ) |
235 | { | 235 | { |
236 | doc = 0; | 236 | doc = 0; |
237 | edited=FALSE; | 237 | edited=FALSE; |
238 | edited1=FALSE; | 238 | edited1=FALSE; |
239 | setToolBarsMovable( FALSE ); | 239 | setToolBarsMovable( FALSE ); |
240 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 240 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
241 | 241 | ||
242 | channel = new QCopChannel( "QPE/Application/textedit", this ); | 242 | channel = new QCopChannel( "QPE/Application/textedit", this ); |
243 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 243 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
244 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 244 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
245 | 245 | ||
246 | setIcon( Resource::loadPixmap( "TextEditor" ) ); | 246 | setIcon( Resource::loadPixmap( "TextEditor" ) ); |
247 | 247 | ||
248 | QPEToolBar *bar = new QPEToolBar( this ); | 248 | QPEToolBar *bar = new QPEToolBar( this ); |
249 | bar->setHorizontalStretchable( TRUE ); | 249 | bar->setHorizontalStretchable( TRUE ); |
250 | menu = bar; | 250 | menu = bar; |
251 | 251 | ||
252 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 252 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
253 | QPopupMenu *file = new QPopupMenu( this ); | 253 | QPopupMenu *file = new QPopupMenu( this ); |
254 | QPopupMenu *edit = new QPopupMenu( this ); | 254 | QPopupMenu *edit = new QPopupMenu( this ); |
255 | font = new QPopupMenu( this ); | 255 | font = new QPopupMenu( this ); |
256 | 256 | ||
257 | bar = new QPEToolBar( this ); | 257 | bar = new QPEToolBar( this ); |
258 | editBar = bar; | 258 | editBar = bar; |
259 | 259 | ||
260 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 260 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
261 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 261 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
262 | a->addTo( bar ); | 262 | a->addTo( bar ); |
263 | a->addTo( file ); | 263 | a->addTo( file ); |
264 | 264 | ||
265 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 265 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); |
266 | connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); | 266 | connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); |
267 | a->addTo( bar ); | 267 | a->addTo( bar ); |
268 | a->addTo( file ); | 268 | a->addTo( file ); |
269 | 269 | ||
270 | a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); | 270 | a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); |
271 | connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); | 271 | connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); |
272 | file->insertSeparator(); | 272 | file->insertSeparator(); |
273 | a->addTo( file ); | 273 | a->addTo( file ); |
274 | 274 | ||
275 | a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); | 275 | a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); |
276 | connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); | 276 | connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); |
277 | a->addTo( file ); | 277 | a->addTo( file ); |
278 | 278 | ||
279 | a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); | 279 | a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); |
280 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); | 280 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); |
281 | a->addTo( editBar ); | 281 | a->addTo( editBar ); |
282 | a->addTo( edit ); | 282 | a->addTo( edit ); |
283 | 283 | ||
284 | a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); | 284 | a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); |
285 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 285 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); |
286 | a->addTo( editBar ); | 286 | a->addTo( editBar ); |
287 | a->addTo( edit ); | 287 | a->addTo( edit ); |
288 | 288 | ||
289 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 289 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
290 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); | 290 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); |
291 | a->addTo( editBar ); | 291 | a->addTo( editBar ); |
292 | a->addTo( edit ); | 292 | a->addTo( edit ); |
293 | 293 | ||
294 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 294 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
295 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 295 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
296 | edit->insertSeparator(); | 296 | edit->insertSeparator(); |
297 | a->addTo( bar ); | 297 | a->addTo( bar ); |
298 | a->addTo( edit ); | 298 | a->addTo( edit ); |
299 | 299 | ||
300 | int defsize; | 300 | int defsize; |
301 | bool defb, defi, wrap; | 301 | bool defb, defi, wrap; |
302 | 302 | ||
303 | Config cfg("TextEdit"); | 303 | Config cfg("TextEdit"); |
304 | cfg.setGroup("View"); | 304 | cfg.setGroup("View"); |
305 | defsize = cfg.readNumEntry("FontSize",10); | 305 | defsize = cfg.readNumEntry("FontSize",10); |
306 | defb = cfg.readBoolEntry("Bold",FALSE); | 306 | defb = cfg.readBoolEntry("Bold",FALSE); |
307 | defi = cfg.readBoolEntry("Italic",FALSE); | 307 | defi = cfg.readBoolEntry("Italic",FALSE); |
308 | wrap = cfg.readBoolEntry("Wrap",TRUE); | 308 | wrap = cfg.readBoolEntry("Wrap",TRUE); |
309 | 309 | ||
310 | zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); | 310 | zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); |
311 | connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); | 311 | connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); |
312 | zin->addTo( font ); | 312 | zin->addTo( font ); |
313 | 313 | ||
314 | zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); | 314 | zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); |
315 | connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); | 315 | connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); |
316 | zout->addTo( font ); | 316 | zout->addTo( font ); |
317 | 317 | ||
318 | font->insertSeparator(); | 318 | font->insertSeparator(); |
319 | 319 | ||
320 | #if 0 | 320 | #if 0 |
321 | QAction *ba = new QAction( tr("Bold"), QString::null, 0, this, 0 ); | 321 | QAction *ba = new QAction( tr("Bold"), QString::null, 0, this, 0 ); |
322 | connect( ba, SIGNAL( toggled(bool) ), this, SLOT( setBold(bool) ) ); | 322 | connect( ba, SIGNAL( toggled(bool) ), this, SLOT( setBold(bool) ) ); |
323 | ba->setToggleAction(TRUE); | 323 | ba->setToggleAction(TRUE); |
324 | ba->addTo( font ); | 324 | ba->addTo( font ); |
325 | 325 | ||
326 | QAction *ia = new QAction( tr("Italic"), QString::null, 0, this, 0 ); | 326 | QAction *ia = new QAction( tr("Italic"), QString::null, 0, this, 0 ); |
327 | connect( ia, SIGNAL( toggled(bool) ), this, SLOT( setItalic(bool) ) ); | 327 | connect( ia, SIGNAL( toggled(bool) ), this, SLOT( setItalic(bool) ) ); |
328 | ia->setToggleAction(TRUE); | 328 | ia->setToggleAction(TRUE); |
329 | ia->addTo( font ); | 329 | ia->addTo( font ); |
330 | 330 | ||
331 | ba->setOn(defb); | 331 | ba->setOn(defb); |
332 | ia->setOn(defi); | 332 | ia->setOn(defi); |
333 | 333 | ||
334 | font->insertSeparator(); | 334 | font->insertSeparator(); |
335 | #endif | 335 | #endif |
336 | 336 | ||
337 | QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); | 337 | QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); |
338 | connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); | 338 | connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); |
339 | wa->setToggleAction(TRUE); | 339 | wa->setToggleAction(TRUE); |
340 | wa->addTo( font ); | 340 | wa->addTo( font ); |
341 | 341 | ||
342 | font->insertSeparator(); | 342 | font->insertSeparator(); |
343 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); | 343 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); |
344 | 344 | ||
345 | font->insertSeparator(); | 345 | font->insertSeparator(); |
346 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); | 346 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); |
347 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); | 347 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); |
348 | nStart->setToggleAction(TRUE); | 348 | nStart->setToggleAction(TRUE); |
349 | nStart->addTo( font ); | 349 | nStart->addTo( font ); |
350 | font->insertSeparator(); | 350 | font->insertSeparator(); |
351 | font->insertItem(tr("About"), this, SLOT( doAbout()) ); | 351 | font->insertItem(tr("About"), this, SLOT( doAbout()) ); |
352 | 352 | ||
353 | mb->insertItem( tr( "File" ), file ); | 353 | mb->insertItem( tr( "File" ), file ); |
354 | mb->insertItem( tr( "Edit" ), edit ); | 354 | mb->insertItem( tr( "Edit" ), edit ); |
355 | mb->insertItem( tr( "View" ), font ); | 355 | mb->insertItem( tr( "View" ), font ); |
356 | 356 | ||
357 | searchBar = new QPEToolBar(this); | 357 | searchBar = new QPEToolBar(this); |
358 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 358 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
359 | 359 | ||
360 | searchBar->setHorizontalStretchable( TRUE ); | 360 | searchBar->setHorizontalStretchable( TRUE ); |
361 | 361 | ||
362 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 362 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
363 | searchBar->setStretchableWidget( searchEdit ); | 363 | searchBar->setStretchableWidget( searchEdit ); |
364 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 364 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
365 | this, SLOT( search() ) ); | 365 | this, SLOT( search() ) ); |
366 | 366 | ||
367 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 367 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); |
368 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 368 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
369 | a->addTo( searchBar ); | 369 | a->addTo( searchBar ); |
370 | a->addTo( edit ); | 370 | a->addTo( edit ); |
371 | 371 | ||
372 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 372 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
373 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 373 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
374 | a->addTo( searchBar ); | 374 | a->addTo( searchBar ); |
375 | 375 | ||
376 | edit->insertSeparator(); | 376 | edit->insertSeparator(); |
377 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 377 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
378 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); | 378 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); |
379 | a->addTo( edit ); | 379 | a->addTo( edit ); |
380 | 380 | ||
381 | searchBar->hide(); | 381 | searchBar->hide(); |
382 | 382 | ||
383 | editor = new QpeEditor( this ); | 383 | editor = new QpeEditor( this ); |
384 | setCentralWidget( editor ); | 384 | setCentralWidget( editor ); |
385 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 385 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
386 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); | 386 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); |
387 | 387 | ||
388 | // resize( 200, 300 ); | 388 | // resize( 200, 300 ); |
389 | 389 | ||
390 | // setFontSize(defsize,TRUE); | 390 | // setFontSize(defsize,TRUE); |
391 | FontDatabase fdb; | 391 | FontDatabase fdb; |
392 | QFont defaultFont=editor->font(); | 392 | QFont defaultFont=editor->font(); |
393 | QFontInfo fontInfo(defaultFont); | 393 | QFontInfo fontInfo(defaultFont); |
394 | 394 | ||
395 | cfg.setGroup("Font"); | 395 | cfg.setGroup("Font"); |
396 | QString family = cfg.readEntry("Family", fontInfo.family()); | 396 | QString family = cfg.readEntry("Family", fontInfo.family()); |
397 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); | 397 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); |
398 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); | 398 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); |
399 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); | 399 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); |
400 | 400 | ||
401 | defaultFont = fdb.font(family,style,i_size,charSet); | 401 | defaultFont = fdb.font(family,style,i_size,charSet); |
402 | editor->setFont( defaultFont); | 402 | editor->setFont( defaultFont); |
403 | 403 | ||
404 | wa->setOn(wrap); | 404 | wa->setOn(wrap); |
405 | updateCaption(); | 405 | updateCaption(); |
406 | 406 | ||
407 | cfg.setGroup("View"); | 407 | cfg.setGroup("View"); |
408 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { | 408 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { |
409 | nStart->setOn(TRUE); | 409 | nStart->setOn(TRUE); |
410 | fileNew(); | 410 | fileNew(); |
411 | } else { | 411 | } else { |
412 | fileOpen(); | 412 | fileOpen(); |
413 | } | 413 | } |
414 | 414 | ||
415 | viewSelection = cfg.readNumEntry( "FileView", 0 ); | 415 | viewSelection = cfg.readNumEntry( "FileView", 0 ); |
416 | } | 416 | } |
417 | 417 | ||
418 | void TextEdit::cleanUp() | 418 | void TextEdit::cleanUp() |
419 | { | 419 | { |
420 | // save(); | 420 | // save(); |
421 | Config cfg("TextEdit"); | 421 | Config cfg("TextEdit"); |
422 | cfg.setGroup("View"); | 422 | cfg.setGroup("View"); |
423 | QFont f = editor->font(); | 423 | QFont f = editor->font(); |
424 | cfg.writeEntry("FontSize",f.pointSize()); | 424 | cfg.writeEntry("FontSize",f.pointSize()); |
425 | cfg.writeEntry("Bold",f.bold()); | 425 | cfg.writeEntry("Bold",f.bold()); |
426 | cfg.writeEntry("Italic",f.italic()); | 426 | cfg.writeEntry("Italic",f.italic()); |
427 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); | 427 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); |
428 | cfg.writeEntry( "FileView", viewSelection ); | 428 | cfg.writeEntry( "FileView", viewSelection ); |
429 | 429 | ||
430 | } | 430 | } |
431 | 431 | ||
432 | TextEdit::~TextEdit() | 432 | TextEdit::~TextEdit() |
433 | { | 433 | { |
434 | } | 434 | } |
435 | 435 | ||
436 | void TextEdit::zoomIn() | 436 | void TextEdit::zoomIn() |
437 | { | 437 | { |
438 | setFontSize(editor->font().pointSize()+1,FALSE); | 438 | setFontSize(editor->font().pointSize()+1,FALSE); |
439 | } | 439 | } |
440 | 440 | ||
441 | void TextEdit::zoomOut() | 441 | void TextEdit::zoomOut() |
442 | { | 442 | { |
443 | setFontSize(editor->font().pointSize()-1,TRUE); | 443 | setFontSize(editor->font().pointSize()-1,TRUE); |
444 | } | 444 | } |
445 | 445 | ||
446 | 446 | ||
447 | void TextEdit::setFontSize(int sz, bool round_down_not_up) | 447 | void TextEdit::setFontSize(int sz, bool round_down_not_up) |
448 | { | 448 | { |
449 | int s=10; | 449 | int s=10; |
450 | for (int i=0; i<nfontsizes; i++) { | 450 | for (int i=0; i<nfontsizes; i++) { |
451 | if ( fontsize[i] == sz ) { | 451 | if ( fontsize[i] == sz ) { |
452 | s = sz; | 452 | s = sz; |
453 | break; | 453 | break; |
454 | } else if ( round_down_not_up ) { | 454 | } else if ( round_down_not_up ) { |
455 | if ( fontsize[i] < sz ) | 455 | if ( fontsize[i] < sz ) |
456 | s = fontsize[i]; | 456 | s = fontsize[i]; |
457 | } else { | 457 | } else { |
458 | if ( fontsize[i] > sz ) { | 458 | if ( fontsize[i] > sz ) { |
459 | s = fontsize[i]; | 459 | s = fontsize[i]; |
460 | break; | 460 | break; |
461 | } | 461 | } |
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | QFont f = editor->font(); | 465 | QFont f = editor->font(); |
466 | f.setPointSize(s); | 466 | f.setPointSize(s); |
467 | editor->setFont(f); | 467 | editor->setFont(f); |
468 | 468 | ||
469 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 469 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
470 | zout->setEnabled(s != fontsize[0]); | 470 | zout->setEnabled(s != fontsize[0]); |
471 | } | 471 | } |
472 | 472 | ||
473 | void TextEdit::setBold(bool y) | 473 | void TextEdit::setBold(bool y) |
474 | { | 474 | { |
475 | QFont f = editor->font(); | 475 | QFont f = editor->font(); |
476 | f.setBold(y); | 476 | f.setBold(y); |
477 | editor->setFont(f); | 477 | editor->setFont(f); |
478 | } | 478 | } |
479 | 479 | ||
480 | void TextEdit::setItalic(bool y) | 480 | void TextEdit::setItalic(bool y) |
481 | { | 481 | { |
482 | QFont f = editor->font(); | 482 | QFont f = editor->font(); |
483 | f.setItalic(y); | 483 | f.setItalic(y); |
484 | editor->setFont(f); | 484 | editor->setFont(f); |
485 | } | 485 | } |
486 | 486 | ||
487 | void TextEdit::setWordWrap(bool y) | 487 | void TextEdit::setWordWrap(bool y) |
488 | { | 488 | { |
489 | bool state = editor->edited(); | 489 | bool state = editor->edited(); |
490 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 490 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
491 | editor->setEdited( state ); | 491 | editor->setEdited( state ); |
492 | } | 492 | } |
493 | 493 | ||
494 | void TextEdit::fileNew() | 494 | void TextEdit::fileNew() |
495 | { | 495 | { |
496 | // if( !bFromDocView ) { | 496 | // if( !bFromDocView ) { |
497 | // saveAs(); | 497 | // saveAs(); |
498 | // } | 498 | // } |
499 | newFile(DocLnk()); | 499 | newFile(DocLnk()); |
500 | } | 500 | } |
501 | 501 | ||
502 | void TextEdit::fileOpen() | 502 | void TextEdit::fileOpen() |
503 | { | 503 | { |
504 | Config cfg("TextEdit"); | 504 | Config cfg("TextEdit"); |
505 | cfg.setGroup("View"); | 505 | cfg.setGroup("View"); |
506 | bool b=FALSE; | 506 | bool b=FALSE; |
507 | 507 | ||
508 | QMap<QString, QStringList> map; | 508 | QMap<QString, QStringList> map; |
509 | map.insert(tr("All"), QStringList() ); | 509 | map.insert(tr("All"), QStringList() ); |
510 | QStringList text; | 510 | QStringList text; |
511 | text << "text/*"; | 511 | text << "text/*"; |
512 | map.insert(tr("Text"), text ); | 512 | map.insert(tr("Text"), text ); |
513 | text << "*"; | 513 | text << "*"; |
514 | map.insert(tr("All"), text ); | 514 | map.insert(tr("All"), text ); |
515 | QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); | 515 | QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); |
516 | if(!str.isEmpty() ) | 516 | if(!str.isEmpty() ) |
517 | openFile( str ); | 517 | openFile( str ); |
518 | 518 | ||
519 | } | 519 | } |
520 | 520 | ||
521 | void TextEdit::doSearchBar() | 521 | void TextEdit::doSearchBar() |
522 | { | 522 | { |
523 | Config cfg("TextEdit"); | 523 | Config cfg("TextEdit"); |
524 | cfg.setGroup("View"); | 524 | cfg.setGroup("View"); |
525 | if(cfg.readEntry("SearchBar","Closed") != "Opened") | 525 | if(cfg.readEntry("SearchBar","Closed") != "Opened") |
526 | searchBar->hide(); | 526 | searchBar->hide(); |
527 | } | 527 | } |
528 | 528 | ||
529 | #if 0 | 529 | #if 0 |
530 | void TextEdit::slotFind() | 530 | void TextEdit::slotFind() |
531 | { | 531 | { |
532 | FindDialog frmFind( tr("Text Editor"), this ); | 532 | FindDialog frmFind( tr("Text Editor"), this ); |
533 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 533 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
534 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 534 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
535 | 535 | ||
536 | //case sensitive, backwards, [category] | 536 | //case sensitive, backwards, [category] |
537 | 537 | ||
538 | connect( editor, SIGNAL(notFound()), | 538 | connect( editor, SIGNAL(notFound()), |
539 | &frmFind, SLOT(slotNotFound()) ); | 539 | &frmFind, SLOT(slotNotFound()) ); |
540 | connect( editor, SIGNAL(searchWrapped()), | 540 | connect( editor, SIGNAL(searchWrapped()), |
541 | &frmFind, SLOT(slotWrapAround()) ); | 541 | &frmFind, SLOT(slotWrapAround()) ); |
542 | 542 | ||
543 | frmFind.exec(); | 543 | frmFind.exec(); |
544 | 544 | ||
545 | 545 | ||
546 | } | 546 | } |
547 | #endif | 547 | #endif |
548 | 548 | ||
549 | void TextEdit::fileRevert() | 549 | void TextEdit::fileRevert() |
550 | { | 550 | { |
551 | clear(); | 551 | clear(); |
552 | fileOpen(); | 552 | fileOpen(); |
553 | } | 553 | } |
554 | 554 | ||
555 | void TextEdit::editCut() | 555 | void TextEdit::editCut() |
556 | { | 556 | { |
557 | #ifndef QT_NO_CLIPBOARD | 557 | #ifndef QT_NO_CLIPBOARD |
558 | editor->cut(); | 558 | editor->cut(); |
559 | #endif | 559 | #endif |
560 | } | 560 | } |
561 | 561 | ||
562 | void TextEdit::editCopy() | 562 | void TextEdit::editCopy() |
563 | { | 563 | { |
564 | #ifndef QT_NO_CLIPBOARD | 564 | #ifndef QT_NO_CLIPBOARD |
565 | editor->copy(); | 565 | editor->copy(); |
566 | #endif | 566 | #endif |
567 | } | 567 | } |
568 | 568 | ||
569 | void TextEdit::editPaste() | 569 | void TextEdit::editPaste() |
570 | { | 570 | { |
571 | #ifndef QT_NO_CLIPBOARD | 571 | #ifndef QT_NO_CLIPBOARD |
572 | editor->paste(); | 572 | editor->paste(); |
573 | #endif | 573 | #endif |
574 | } | 574 | } |
575 | 575 | ||
576 | void TextEdit::editFind() | 576 | void TextEdit::editFind() |
577 | { | 577 | { |
578 | searchBar->show(); | 578 | searchBar->show(); |
579 | searchVisible = TRUE; | 579 | searchVisible = TRUE; |
580 | searchEdit->setFocus(); | 580 | searchEdit->setFocus(); |
581 | Config cfg("TextEdit"); | 581 | Config cfg("TextEdit"); |
582 | cfg.setGroup("View"); | 582 | cfg.setGroup("View"); |
583 | cfg.writeEntry("SearchBar","Opened"); | 583 | cfg.writeEntry("SearchBar","Opened"); |
584 | 584 | ||
585 | } | 585 | } |
586 | 586 | ||
587 | void TextEdit::findNext() | 587 | void TextEdit::findNext() |
588 | { | 588 | { |
589 | editor->find( searchEdit->text(), FALSE, FALSE ); | 589 | editor->find( searchEdit->text(), FALSE, FALSE ); |
590 | 590 | ||
591 | } | 591 | } |
592 | 592 | ||
593 | void TextEdit::findClose() | 593 | void TextEdit::findClose() |
594 | { | 594 | { |
595 | searchVisible = FALSE; | 595 | searchVisible = FALSE; |
596 | searchBar->hide(); | 596 | searchBar->hide(); |
597 | Config cfg("TextEdit"); | 597 | Config cfg("TextEdit"); |
598 | cfg.setGroup("View"); | 598 | cfg.setGroup("View"); |
599 | cfg.writeEntry("SearchBar","Closed"); | 599 | cfg.writeEntry("SearchBar","Closed"); |
600 | cfg.write(); | 600 | cfg.write(); |
601 | } | 601 | } |
602 | 602 | ||
603 | void TextEdit::search() | 603 | void TextEdit::search() |
604 | { | 604 | { |
605 | editor->find( searchEdit->text(), FALSE, FALSE ); | 605 | editor->find( searchEdit->text(), FALSE, FALSE ); |
606 | } | 606 | } |
607 | 607 | ||
608 | void TextEdit::newFile( const DocLnk &f ) | 608 | void TextEdit::newFile( const DocLnk &f ) |
609 | { | 609 | { |
610 | DocLnk nf = f; | 610 | DocLnk nf = f; |
611 | nf.setType("text/plain"); | 611 | nf.setType("text/plain"); |
612 | clear(); | 612 | clear(); |
613 | setWState (WState_Reserved1 ); | 613 | setWState (WState_Reserved1 ); |
614 | editor->setFocus(); | 614 | editor->setFocus(); |
615 | doc = new DocLnk(nf); | 615 | doc = new DocLnk(nf); |
616 | currentFileName = "Unnamed"; | 616 | currentFileName = "Unnamed"; |
617 | qDebug("newFile "+currentFileName); | 617 | qDebug("newFile "+currentFileName); |
618 | updateCaption( currentFileName); | 618 | updateCaption( currentFileName); |
619 | // editor->setEdited( FALSE); | 619 | // editor->setEdited( FALSE); |
620 | } | 620 | } |
621 | 621 | ||
622 | void TextEdit::openFile( const QString &f ) | 622 | void TextEdit::openFile( const QString &f ) |
623 | { | 623 | { |
624 | qDebug("filename is "+ f); | 624 | qDebug("filename is "+ f); |
625 | QString filer; | 625 | QString filer; |
626 | // bFromDocView = TRUE; | 626 | // bFromDocView = TRUE; |
627 | if(f.find(".desktop",0,TRUE) != -1) { | 627 | if(f.find(".desktop",0,TRUE) != -1) { |
628 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 628 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
629 | tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), | 629 | tr("Text Editor has detected\n you selected a .desktop file.\nOpen .desktop file or linked file?"), |
630 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { | 630 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { |
631 | case 0: | 631 | case 0: |
632 | filer = f; | 632 | filer = f; |
633 | break; | 633 | break; |
634 | case 1: | 634 | case 1: |
635 | DocLnk sf(f); | 635 | DocLnk sf(f); |
636 | filer = sf.file(); | 636 | filer = sf.file(); |
637 | break; | 637 | break; |
638 | } | 638 | } |
639 | } else { | 639 | } else { |
640 | filer = f; | 640 | filer = f; |
641 | fileIs = TRUE; | 641 | fileIs = TRUE; |
642 | } | 642 | } |
643 | 643 | ||
644 | DocLnk nf; | 644 | DocLnk nf; |
645 | nf.setType("text/plain"); | 645 | nf.setType("text/plain"); |
646 | nf.setFile(filer); | 646 | nf.setFile(filer); |
647 | currentFileName=filer; | 647 | currentFileName=filer; |
648 | QFileInfo fi( currentFileName); | 648 | QFileInfo fi( currentFileName); |
649 | nf.setName(fi.baseName()); | 649 | nf.setName(fi.baseName()); |
650 | qDebug("openFile string "+currentFileName); | 650 | qDebug("openFile string "+currentFileName); |
651 | 651 | ||
652 | openFile(nf); | 652 | openFile(nf); |
653 | showEditTools(); | 653 | showEditTools(); |
654 | // Show filename in caption | 654 | // Show filename in caption |
655 | QString name = filer; | 655 | QString name = filer; |
656 | int sep = name.findRev( '/' ); | 656 | int sep = name.findRev( '/' ); |
657 | if ( sep > 0 ) | 657 | if ( sep > 0 ) |
658 | name = name.mid( sep+1 ); | 658 | name = name.mid( sep+1 ); |
659 | updateCaption( name ); | 659 | updateCaption( name ); |
660 | } | 660 | } |
661 | 661 | ||
662 | void TextEdit::openFile( const DocLnk &f ) | 662 | void TextEdit::openFile( const DocLnk &f ) |
663 | { | 663 | { |
664 | // clear(); | 664 | // clear(); |
665 | // bFromDocView = TRUE; | 665 | // bFromDocView = TRUE; |
666 | FileManager fm; | 666 | FileManager fm; |
667 | QString txt; | 667 | QString txt; |
668 | currentFileName=f.file(); | 668 | currentFileName=f.file(); |
669 | qDebug("openFile doclnk " + currentFileName); | 669 | qDebug("openFile doclnk " + currentFileName); |
670 | if ( !fm.loadFile( f, txt ) ) { | 670 | if ( !fm.loadFile( f, txt ) ) { |
671 | // ####### could be a new file | 671 | // ####### could be a new file |
672 | qDebug( "Cannot open file" ); | 672 | qDebug( "Cannot open file" ); |
673 | } | 673 | } |
674 | // fileNew(); | 674 | // fileNew(); |
675 | if ( doc ) | 675 | if ( doc ) |
676 | delete doc; | 676 | delete doc; |
677 | doc = new DocLnk(f); | 677 | doc = new DocLnk(f); |
678 | editor->setText(txt); | 678 | editor->setText(txt); |
679 | editor->setEdited( FALSE); | 679 | editor->setEdited( FALSE); |
680 | edited1=FALSE; | 680 | edited1=FALSE; |
681 | edited=FALSE; | 681 | edited=FALSE; |
682 | 682 | ||
683 | doc->setName(currentFileName); | 683 | doc->setName(currentFileName); |
684 | updateCaption(); | 684 | updateCaption(); |
685 | } | 685 | } |
686 | 686 | ||
687 | void TextEdit::showEditTools() | 687 | void TextEdit::showEditTools() |
688 | { | 688 | { |
689 | // if ( !doc ) | 689 | // if ( !doc ) |
690 | // close(); | 690 | // close(); |
691 | // clear(); | 691 | // clear(); |
692 | menu->show(); | 692 | menu->show(); |
693 | editBar->show(); | 693 | editBar->show(); |
694 | if ( searchVisible ) | 694 | if ( searchVisible ) |
695 | searchBar->show(); | 695 | searchBar->show(); |
696 | // updateCaption(); | 696 | // updateCaption(); |
697 | setWState (WState_Reserved1 ); | 697 | setWState (WState_Reserved1 ); |
698 | } | 698 | } |
699 | 699 | ||
700 | /*! | 700 | /*! |
701 | unprompted save */ | 701 | unprompted save */ |
702 | bool TextEdit::save() | 702 | bool TextEdit::save() |
703 | { | 703 | { |
704 | QString file = doc->file(); | 704 | QString file = doc->file(); |
705 | qDebug("saver file "+file); | 705 | qDebug("saver file "+file); |
706 | QString name= doc->name(); | 706 | QString name= doc->name(); |
707 | qDebug("File named "+name); | 707 | qDebug("File named "+name); |
708 | QString rt = editor->text(); | 708 | QString rt = editor->text(); |
709 | if( !rt.isEmpty() ) { | 709 | if( !rt.isEmpty() ) { |
710 | if(name.isEmpty()) { | 710 | if(name.isEmpty()) { |
711 | saveAs(); | 711 | saveAs(); |
712 | } else { | 712 | } else { |
713 | currentFileName= name ; | 713 | currentFileName= name ; |
714 | qDebug("saveFile "+currentFileName); | 714 | qDebug("saveFile "+currentFileName); |
715 | 715 | ||
716 | struct stat buf; | 716 | struct stat buf; |
717 | mode_t mode; | 717 | mode_t mode; |
718 | stat(file.latin1(), &buf); | 718 | stat(file.latin1(), &buf); |
719 | mode = buf.st_mode; | 719 | mode = buf.st_mode; |
720 | 720 | ||
721 | if(!fileIs) { | 721 | if(!fileIs) { |
722 | doc->setName( name); | 722 | doc->setName( name); |
723 | FileManager fm; | 723 | FileManager fm; |
724 | if ( !fm.saveFile( *doc, rt ) ) { | 724 | if ( !fm.saveFile( *doc, rt ) ) { |
725 | return false; | 725 | return false; |
726 | } | 726 | } |
727 | } else { | 727 | } else { |
728 | qDebug("regular save file"); | 728 | qDebug("regular save file"); |
729 | QFile f(file); | 729 | QFile f(file); |
730 | if( f.open(IO_WriteOnly)) { | 730 | if( f.open(IO_WriteOnly)) { |
731 | QCString crt = rt.utf8(); | 731 | QCString crt = rt.utf8(); |
732 | f.writeBlock(crt,crt.length()); | 732 | f.writeBlock(crt,crt.length()); |
733 | } else { | 733 | } else { |
734 | QMessageBox::message("Text Edit","Write Failed"); | 734 | QMessageBox::message("Text Edit","Write Failed"); |
735 | return false; | 735 | return false; |
736 | } | 736 | } |
737 | 737 | ||
738 | } | 738 | } |
739 | editor->setEdited( FALSE); | 739 | editor->setEdited( FALSE); |
740 | edited1=FALSE; | 740 | edited1=FALSE; |
741 | edited=FALSE; | 741 | edited=FALSE; |
742 | if(caption().left(1)=="*") | 742 | if(caption().left(1)=="*") |
743 | setCaption(caption().right(caption().length()-1)); | 743 | setCaption(caption().right(caption().length()-1)); |
744 | 744 | ||
745 | 745 | ||
746 | chmod( file.latin1(), mode); | 746 | chmod( file.latin1(), mode); |
747 | } | 747 | } |
748 | return true; | 748 | return true; |
749 | } | 749 | } |
750 | return false; | 750 | return false; |
751 | } | 751 | } |
752 | 752 | ||
753 | /*! | 753 | /*! |
754 | prompted save */ | 754 | prompted save */ |
755 | bool TextEdit::saveAs() | 755 | bool TextEdit::saveAs() |
756 | { | 756 | { |
757 | // qDebug("saveAsFile "+currentFileName); | 757 | // qDebug("saveAsFile "+currentFileName); |
758 | // case of nothing to save... | 758 | // case of nothing to save... |
759 | if ( !doc )//|| !bFromDocView) | 759 | if ( !doc )//|| !bFromDocView) |
760 | { | 760 | { |
761 | qDebug("no doc"); | 761 | qDebug("no doc"); |
762 | return true; | 762 | return true; |
763 | } | 763 | } |
764 | if ( !editor->edited() ) { | 764 | if ( !editor->edited() ) { |
765 | delete doc; | 765 | delete doc; |
766 | doc = 0; | 766 | doc = 0; |
767 | return true; | 767 | return true; |
768 | } | 768 | } |
769 | 769 | ||
770 | QString rt = editor->text(); | 770 | QString rt = editor->text(); |
771 | qDebug(currentFileName); | 771 | qDebug(currentFileName); |
772 | 772 | ||
773 | if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { | 773 | if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { |
774 | qDebug("do silly TT filename thing"); | 774 | qDebug("do silly TT filename thing"); |
775 | if ( doc->name().isEmpty() ) { | 775 | if ( doc->name().isEmpty() ) { |
776 | QString pt = rt.simplifyWhiteSpace(); | 776 | QString pt = rt.simplifyWhiteSpace(); |
777 | int i = pt.find( ' ' ); | 777 | int i = pt.find( ' ' ); |
778 | QString docname = pt; | 778 | QString docname = pt; |
779 | if ( i > 0 ) | 779 | if ( i > 0 ) |
780 | docname = pt.left( i ); | 780 | docname = pt.left( i ); |
781 | // remove "." at the beginning | 781 | // remove "." at the beginning |
782 | while( docname.startsWith( "." ) ) | 782 | while( docname.startsWith( "." ) ) |
783 | docname = docname.mid( 1 ); | 783 | docname = docname.mid( 1 ); |
784 | docname.replace( QRegExp("/"), "_" ); | 784 | docname.replace( QRegExp("/"), "_" ); |
785 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. | 785 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. |
786 | if ( docname.length() > 40 ) | 786 | if ( docname.length() > 40 ) |
787 | docname = docname.left(40); | 787 | docname = docname.left(40); |
788 | if ( docname.isEmpty() ) | 788 | if ( docname.isEmpty() ) |
789 | docname = tr("Unnamed"); | 789 | docname = tr("Unnamed"); |
790 | doc->setName(docname); | 790 | doc->setName(docname); |
791 | currentFileName=docname; | 791 | currentFileName=docname; |
792 | } | 792 | } |
793 | } | 793 | } |
794 | 794 | ||
795 | 795 | /* | |
796 | // QString str = OFileDialog::getSaveFileName( 2,"/");//,"", "*", this ); | 796 | QMap<QString, QStringList> map; |
797 | // if(!str.isEmpty() ) { | 797 | map.insert(tr("All"), QStringList() ); |
798 | // openFile( str ); | 798 | QStringList text; |
799 | 799 | text << "text/*"; | |
800 | fileSaveDlg=new fileSaver(this,tr("Save File As?"),TRUE, 0, currentFileName); | 800 | map.insert(tr("Text"), text ); |
801 | qDebug("wanna save filename "+currentFileName); | 801 | text << "*"; |
802 | fileSaveDlg->exec(); | 802 | map.insert(tr("All"), text ); |
803 | if( fileSaveDlg->result() == 1 ) { | 803 | QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map); |
804 | if(!str.isEmpty() ) { | ||
805 | QString fileNm=str; | ||
806 | */ | ||
807 | |||
808 | fileSaveDlg=new fileSaver(this,tr("Save File As?"),TRUE, 0, currentFileName); | ||
809 | qDebug("wanna save filename "+currentFileName); | ||
810 | fileSaveDlg->exec(); | ||
811 | if( fileSaveDlg->result() == 1 ) { | ||
804 | QString fileNm=fileSaveDlg->selectedFileName; | 812 | QString fileNm=fileSaveDlg->selectedFileName; |
805 | // QString fileNm=srt; | 813 | |
814 | |||
806 | qDebug("saving filename "+fileNm); | 815 | qDebug("saving filename "+fileNm); |
807 | QFileInfo fi(fileNm); | 816 | QFileInfo fi(fileNm); |
808 | currentFileName=fi.fileName(); | 817 | currentFileName=fi.fileName(); |
809 | if(doc) { | 818 | if(doc) { |
810 | // QString file = doc->file(); | 819 | // QString file = doc->file(); |
811 | // doc->removeFiles(); | 820 | // doc->removeFiles(); |
812 | delete doc; | 821 | delete doc; |
813 | DocLnk nf; | 822 | DocLnk nf; |
814 | nf.setType("text/plain"); | 823 | nf.setType("text/plain"); |
815 | nf.setFile( fileNm); | 824 | nf.setFile( fileNm); |
816 | doc = new DocLnk(nf); | 825 | doc = new DocLnk(nf); |
817 | // editor->setText(rt); | 826 | // editor->setText(rt); |
818 | // qDebug("openFile doclnk "+currentFileName); | 827 | // qDebug("openFile doclnk "+currentFileName); |
819 | doc->setName( currentFileName); | 828 | doc->setName( currentFileName); |
820 | updateCaption( currentFileName); | 829 | updateCaption( currentFileName); |
821 | 830 | ||
822 | FileManager fm; | 831 | FileManager fm; |
823 | if ( !fm.saveFile( *doc, rt ) ) { | 832 | if ( !fm.saveFile( *doc, rt ) ) { |
824 | return false; | 833 | return false; |
825 | } | 834 | } |
826 | if( fileSaveDlg->filePermCheck->isChecked() ) { | 835 | if( fileSaveDlg->filePermCheck->isChecked() ) { |
827 | filePermissions *filePerm; | 836 | filePermissions *filePerm; |
828 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); | 837 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); |
829 | filePerm->exec(); | 838 | filePerm->exec(); |
830 | 839 | ||
831 | if( filePerm) | 840 | if( filePerm) |
832 | delete filePerm; | 841 | delete filePerm; |
833 | } | 842 | } |
834 | } | 843 | } |
835 | } | 844 | } |
836 | editor->setEdited(TRUE); | 845 | editor->setEdited(TRUE); |
837 | edited1=FALSE; | 846 | edited1=FALSE; |
838 | edited=TRUE; | 847 | edited=TRUE; |
839 | if(caption().left(1)=="*") | 848 | if(caption().left(1)=="*") |
840 | setCaption(caption().right(caption().length()-1)); | 849 | setCaption(caption().right(caption().length()-1)); |
841 | 850 | ||
842 | if(fileSaveDlg) | 851 | if(fileSaveDlg) |
843 | delete fileSaveDlg; | 852 | delete fileSaveDlg; |
844 | return true; | 853 | return true; |
845 | } //end saveAs | 854 | } //end saveAs |
846 | 855 | ||
847 | void TextEdit::clear() | 856 | void TextEdit::clear() |
848 | { | 857 | { |
849 | delete doc; | 858 | delete doc; |
850 | doc = 0; | 859 | doc = 0; |
851 | editor->clear(); | 860 | editor->clear(); |
852 | } | 861 | } |
853 | 862 | ||
854 | void TextEdit::updateCaption( const QString &name ) | 863 | void TextEdit::updateCaption( const QString &name ) |
855 | { | 864 | { |
856 | if ( !doc ) | 865 | if ( !doc ) |
857 | setCaption( tr("Text Editor") ); | 866 | setCaption( tr("Text Editor") ); |
858 | else { | 867 | else { |
859 | QString s = name; | 868 | QString s = name; |
860 | if ( s.isNull() ) | 869 | if ( s.isNull() ) |
861 | s = doc->name(); | 870 | s = doc->name(); |
862 | if ( s.isEmpty() ) { | 871 | if ( s.isEmpty() ) { |
863 | s = tr( "Unnamed" ); | 872 | s = tr( "Unnamed" ); |
864 | currentFileName=s; | 873 | currentFileName=s; |
865 | } | 874 | } |
866 | if(s.left(1) == "/") | 875 | if(s.left(1) == "/") |
867 | s = s.right(s.length()-1); | 876 | s = s.right(s.length()-1); |
868 | setCaption( s + " - " + tr("Text Editor") ); | 877 | setCaption( s + " - " + tr("Text Editor") ); |
869 | } | 878 | } |
870 | } | 879 | } |
871 | 880 | ||
872 | void TextEdit::setDocument(const QString& fileref) | 881 | void TextEdit::setDocument(const QString& fileref) |
873 | { | 882 | { |
874 | bFromDocView = TRUE; | 883 | bFromDocView = TRUE; |
875 | openFile(fileref); | 884 | openFile(fileref); |
876 | editor->setEdited(TRUE); | 885 | editor->setEdited(TRUE); |
877 | edited1=FALSE; | 886 | edited1=FALSE; |
878 | edited=TRUE; | 887 | edited=TRUE; |
879 | doSearchBar(); | 888 | doSearchBar(); |
880 | } | 889 | } |
881 | 890 | ||
882 | void TextEdit::closeEvent( QCloseEvent *e ) | 891 | void TextEdit::closeEvent( QCloseEvent *e ) |
883 | { | 892 | { |
884 | bFromDocView = FALSE; | 893 | bFromDocView = FALSE; |
885 | e->accept(); | 894 | e->accept(); |
886 | } | 895 | } |
887 | 896 | ||
888 | void TextEdit::accept() | 897 | void TextEdit::accept() |
889 | { | 898 | { |
890 | //if(caption() !="Unnamed") | 899 | //if(caption() !="Unnamed") |
891 | if(edited1) | 900 | if(edited1) |
892 | saveAs(); | 901 | saveAs(); |
893 | exit(0); | 902 | exit(0); |
894 | 903 | ||
895 | } | 904 | } |
896 | 905 | ||
897 | void TextEdit::changeFont() { | 906 | void TextEdit::changeFont() { |
898 | FontDatabase fdb; | 907 | FontDatabase fdb; |
899 | QFont defaultFont=editor->font(); | 908 | QFont defaultFont=editor->font(); |
900 | QFontInfo fontInfo(defaultFont); | 909 | QFontInfo fontInfo(defaultFont); |
901 | Config cfg("TextEdit"); | 910 | Config cfg("TextEdit"); |
902 | cfg.setGroup("Font"); | 911 | cfg.setGroup("Font"); |
903 | QString family = cfg.readEntry("Family", fontInfo.family()); | 912 | QString family = cfg.readEntry("Family", fontInfo.family()); |
904 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); | 913 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); |
905 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); | 914 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); |
906 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); | 915 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); |
907 | 916 | ||
908 | defaultFont = fdb.font(family,style,i_size,charSet); | 917 | defaultFont = fdb.font(family,style,i_size,charSet); |
909 | 918 | ||
910 | FontDialog *fontDlg; | 919 | FontDialog *fontDlg; |
911 | fontDlg=new FontDialog(this,tr("FontDialog"),TRUE); | 920 | fontDlg=new FontDialog(this,tr("FontDialog"),TRUE); |
912 | 921 | ||
913 | fontDlg->exec(); | 922 | fontDlg->exec(); |
914 | 923 | ||
915 | QFont myFont=fontDlg->selectedFont; | 924 | QFont myFont=fontDlg->selectedFont; |
916 | editor->setFont( myFont); | 925 | editor->setFont( myFont); |
917 | delete fontDlg; | 926 | delete fontDlg; |
918 | 927 | ||
919 | } | 928 | } |
920 | 929 | ||
921 | void TextEdit::editDelete() | 930 | void TextEdit::editDelete() |
922 | { | 931 | { |
923 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!"),tr("Yes"),tr("No"),0,0,1) ) { | 932 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!"),tr("Yes"),tr("No"),0,0,1) ) { |
924 | case 0: | 933 | case 0: |
925 | if(doc) { | 934 | if(doc) { |
926 | doc->removeFiles(); | 935 | doc->removeFiles(); |
927 | clear(); | 936 | clear(); |
928 | setCaption( tr("Text Editor") ); | 937 | setCaption( tr("Text Editor") ); |
929 | } | 938 | } |
930 | break; | 939 | break; |
931 | case 1: | 940 | case 1: |
932 | // exit | 941 | // exit |
933 | break; | 942 | break; |
934 | }; | 943 | }; |
935 | } | 944 | } |
936 | 945 | ||
937 | void TextEdit::changeStartConfig( bool b ) { | 946 | void TextEdit::changeStartConfig( bool b ) { |
938 | 947 | ||
939 | Config cfg("TextEdit"); | 948 | Config cfg("TextEdit"); |
940 | cfg.setGroup("View"); | 949 | cfg.setGroup("View"); |
941 | if(b) { | 950 | if(b) { |
942 | qDebug("bool"); | 951 | qDebug("bool"); |
943 | cfg.writeEntry("startNew","TRUE"); | 952 | cfg.writeEntry("startNew","TRUE"); |
944 | } else { | 953 | } else { |
945 | cfg.writeEntry("startNew","FALSE"); | 954 | cfg.writeEntry("startNew","FALSE"); |
946 | } | 955 | } |
947 | update(); | 956 | update(); |
948 | } | 957 | } |
949 | 958 | ||
950 | void TextEdit::editorChanged() { | 959 | void TextEdit::editorChanged() { |
951 | if(editor->edited() && edited && !edited1) { | 960 | if(editor->edited() && edited && !edited1) { |
952 | setCaption( "*"+caption()); | 961 | setCaption( "*"+caption()); |
953 | edited1=TRUE; | 962 | edited1=TRUE; |
954 | } | 963 | } |
955 | edited=TRUE; | 964 | edited=TRUE; |
956 | } | 965 | } |
957 | 966 | ||
958 | void TextEdit::receive(const QCString&msg, const QByteArray&) { | 967 | void TextEdit::receive(const QCString&msg, const QByteArray&) { |
959 | qDebug("QCop "+msg); | 968 | qDebug("QCop "+msg); |
960 | if ( msg == "setDocument(QString)" ) { | 969 | if ( msg == "setDocument(QString)" ) { |
961 | qDebug("bugger all"); | 970 | qDebug("bugger all"); |
962 | } | 971 | } |
963 | 972 | ||
964 | } | 973 | } |
965 | void TextEdit::doAbout() { | 974 | void TextEdit::doAbout() { |
966 | QMessageBox::about(0,"Text Edit","Text Edit is copyright\n" | 975 | QMessageBox::about(0,"Text Edit","Text Edit is copyright\n" |
967 | "2000 Trolltech AS, and\n" | 976 | "2000 Trolltech AS, and\n" |
968 | "2002 by L.J.Potter \nljp@llornkcor.com\n" | 977 | "2002 by L.J.Potter \nljp@llornkcor.com\n" |
969 | "and is licensed under the GPL"); | 978 | "and is licensed under the GPL"); |
970 | } | 979 | } |