summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
Unidiff
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 55725cc..b54da34 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1,779 +1,779 @@
1/********************************************************************** 1/**********************************************************************
2// textedit.cpp 2// textedit.cpp
3** Copyright (C) 2000 Trolltech AS. All rights reserved. 3** Copyright (C) 2000 Trolltech AS. All rights reserved.
4** 4**
5** This file is part of Opie Environment. 5** This file is part of Opie Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12**********************************************************************/ 12**********************************************************************/
13// changes added by L. J. Potter Sun 02-17-2002 21:31:31 13// changes added by L. J. Potter Sun 02-17-2002 21:31:31
14#include "textedit.h" 14#include "textedit.h"
15#include "filePermissions.h" 15#include "filePermissions.h"
16 16
17 17
18#include <opie2/ofileselector.h> 18#include <opie2/ofileselector.h>
19#include <opie2/ofiledialog.h> 19#include <opie2/ofiledialog.h>
20#include <opie2/ofontselector.h> 20#include <opie2/ofontselector.h>
21 21
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qtoolbar.h> 26#include <qtoolbar.h>
27 27
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qclipboard.h> 29#include <qclipboard.h>
30#include <qaction.h> 30#include <qaction.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qtimer.h> 34#include <qtimer.h>
35#include <qdir.h> 35#include <qdir.h>
36#include <unistd.h> 36#include <unistd.h>
37#include <sys/stat.h> 37#include <sys/stat.h>
38#include <stdlib.h> //getenv 38#include <stdlib.h> //getenv
39 39
40using Opie::OFileDialog; 40using Opie::OFileDialog;
41using Opie::OFileSelector; 41using Opie::OFileSelector;
42using Opie::OFontSelector; 42using Opie::OFontSelector;
43 43
44#if QT_VERSION < 300 44#if QT_VERSION < 300
45 45
46class QpeEditor : public QMultiLineEdit 46class QpeEditor : public QMultiLineEdit
47{ 47{
48 48
49public: 49public:
50 QpeEditor( QWidget *parent, const char * name = 0 ) 50 QpeEditor( QWidget *parent, const char * name = 0 )
51 : QMultiLineEdit( parent, name ) { 51 : QMultiLineEdit( parent, name ) {
52 clearTableFlags(); 52 clearTableFlags();
53 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); 53 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar );
54} 54}
55 55
56 void find( const QString &txt, bool caseSensitive, 56 void find( const QString &txt, bool caseSensitive,
57 bool backwards ); 57 bool backwards );
58protected: 58protected:
59 bool markIt; 59 bool markIt;
60 int line1, line2, col1, col2; 60 int line1, line2, col1, col2;
61 void mousePressEvent( QMouseEvent * ); 61 void mousePressEvent( QMouseEvent * );
62 void mouseReleaseEvent( QMouseEvent * ); 62 void mouseReleaseEvent( QMouseEvent * );
63 63
64//public slots: 64//public slots:
65 /* 65 /*
66signals: 66signals:
67 void notFound(); 67 void notFound();
68 void searchWrapped(); 68 void searchWrapped();
69 */ 69 */
70 70
71private: 71private:
72 72
73}; 73};
74 74
75void QpeEditor::mousePressEvent( QMouseEvent *e ) { 75void QpeEditor::mousePressEvent( QMouseEvent *e ) {
76 switch(e->button()) { 76 switch(e->button()) {
77 case RightButton: 77 case RightButton:
78 { //rediculous workaround for qt popup menu 78 { //rediculous workaround for qt popup menu
79 //and the hold right click mechanism 79 //and the hold right click mechanism
80 this->setSelection( line1, col1, line2, col2); 80 this->setSelection( line1, col1, line2, col2);
81 QMultiLineEdit::mousePressEvent( e ); 81 QMultiLineEdit::mousePressEvent( e );
82 markIt = false; 82 markIt = false;
83 } 83 }
84 break; 84 break;
85 default: 85 default:
86 { 86 {
87 if(!markIt) { 87 if(!markIt) {
88 int line, col; 88 int line, col;
89 this->getCursorPosition(&line, &col); 89 this->getCursorPosition(&line, &col);
90 line1=line2=line; 90 line1=line2=line;
91 col1=col2=col; 91 col1=col2=col;
92 } 92 }
93 QMultiLineEdit::mousePressEvent( e ); 93 QMultiLineEdit::mousePressEvent( e );
94 } 94 }
95 break; 95 break;
96 }; 96 };
97} 97}
98 98
99void QpeEditor::mouseReleaseEvent( QMouseEvent * ) { 99void QpeEditor::mouseReleaseEvent( QMouseEvent * ) {
100 if(this->hasMarkedText()) { 100 if(this->hasMarkedText()) {
101 markIt = true; 101 markIt = true;
102 this->getMarkedRegion( &line1, &col1, &line2, & col2 ); 102 this->getMarkedRegion( &line1, &col1, &line2, & col2 );
103 } else { 103 } else {
104 markIt = false; 104 markIt = false;
105 } 105 }
106} 106}
107 107
108void QpeEditor::find ( const QString &txt, bool caseSensitive, 108void QpeEditor::find ( const QString &txt, bool caseSensitive,
109 bool backwards ) 109 bool backwards )
110{ 110{
111 static bool wrap = false; 111 static bool wrap = false;
112 int line, col; 112 int line, col;
113 if ( wrap ) { 113 if ( wrap ) {
114 if ( !backwards ) 114 if ( !backwards )
115 line = col = 0; 115 line = col = 0;
116 wrap = false; 116 wrap = false;
117 // emit searchWrapped(); 117 // emit searchWrapped();
118 } else { 118 } else {
119 getCursorPosition( &line, &col ); 119 getCursorPosition( &line, &col );
120 } 120 }
121 //ignore backwards for now.... 121 //ignore backwards for now....
122 if ( !backwards ) { 122 if ( !backwards ) {
123 for ( ; ; ) { 123 for ( ; ; ) {
124 if ( line >= numLines() ) { 124 if ( line >= numLines() ) {
125 wrap = true; 125 wrap = true;
126 //emit notFound(); 126 //emit notFound();
127 break; 127 break;
128 } 128 }
129 int findCol = getString( line )->find( txt, col, caseSensitive ); 129 int findCol = getString( line )->find( txt, col, caseSensitive );
130 if ( findCol >= 0 ) { 130 if ( findCol >= 0 ) {
131 setCursorPosition( line, findCol, false ); 131 setCursorPosition( line, findCol, false );
132 col = findCol + txt.length(); 132 col = findCol + txt.length();
133 setCursorPosition( line, col, true ); 133 setCursorPosition( line, col, true );
134 134
135 //found = true; 135 //found = true;
136 break; 136 break;
137 } 137 }
138 line++; 138 line++;
139 col = 0; 139 col = 0;
140 } 140 }
141 } 141 }
142} 142}
143 143
144 144
145#else 145#else
146 146
147#error "Must make a QpeEditor that inherits QTextEdit" 147#error "Must make a QpeEditor that inherits QTextEdit"
148 148
149#endif 149#endif
150 150
151 151
152static const int nfontsizes = 6; 152static const int nfontsizes = 6;
153static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 153static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
154 154
155TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 155TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
156 : QMainWindow( parent, name, f ), bFromDocView( false ) 156 : QMainWindow( parent, name, f ), bFromDocView( false )
157{ 157{
158 doc = 0; 158 doc = 0;
159 edited=false; 159 edited=false;
160 fromSetDocument=false; 160 fromSetDocument=false;
161 161
162 setToolBarsMovable( false ); 162 setToolBarsMovable( false );
163 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 163 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
164 164
165 channel = new QCopChannel( "QPE/Application/textedit", this ); 165 channel = new QCopChannel( "QPE/Application/textedit", this );
166 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 166 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
167 this, SLOT(receive(const QCString&, const QByteArray&)) ); 167 this, SLOT(receive(const QCString&,const QByteArray&)) );
168 168
169 setIcon( Resource::loadPixmap( "TextEditor" ) ); 169 setIcon( Resource::loadPixmap( "TextEditor" ) );
170 170
171 QToolBar *bar = new QToolBar( this ); 171 QToolBar *bar = new QToolBar( this );
172 bar->setHorizontalStretchable( true ); 172 bar->setHorizontalStretchable( true );
173 menu = bar; 173 menu = bar;
174 174
175 QMenuBar *mb = new QMenuBar( bar ); 175 QMenuBar *mb = new QMenuBar( bar );
176 QPopupMenu *file = new QPopupMenu( this ); 176 QPopupMenu *file = new QPopupMenu( this );
177 QPopupMenu *edit = new QPopupMenu( this ); 177 QPopupMenu *edit = new QPopupMenu( this );
178 QPopupMenu *advancedMenu = new QPopupMenu(this); 178 QPopupMenu *advancedMenu = new QPopupMenu(this);
179 179
180 font = new QPopupMenu( this ); 180 font = new QPopupMenu( this );
181 181
182 bar = new QToolBar( this ); 182 bar = new QToolBar( this );
183 editBar = bar; 183 editBar = bar;
184 184
185 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 185 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
186 QString::null, 0, this, 0 ); 186 QString::null, 0, this, 0 );
187 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 187 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
188// a->addTo( bar ); 188// a->addTo( bar );
189 a->addTo( file ); 189 a->addTo( file );
190 190
191 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), 191 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ),
192 QString::null, 0, this, 0 ); 192 QString::null, 0, this, 0 );
193 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 193 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
194 a->addTo( bar ); 194 a->addTo( bar );
195 a->addTo( file ); 195 a->addTo( file );
196 196
197 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") , 197 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") ,
198 QString::null, 0, this, 0 ); 198 QString::null, 0, this, 0 );
199 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 199 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
200 file->insertSeparator(); 200 file->insertSeparator();
201 a->addTo( bar ); 201 a->addTo( bar );
202 a->addTo( file ); 202 a->addTo( file );
203 203
204 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") , 204 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") ,
205 QString::null, 0, this, 0 ); 205 QString::null, 0, this, 0 );
206 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); 206 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
207 a->addTo( file ); 207 a->addTo( file );
208 208
209 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), 209 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ),
210 QString::null, 0, this, 0 ); 210 QString::null, 0, this, 0 );
211 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 211 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
212 a->addTo( editBar ); 212 a->addTo( editBar );
213 a->addTo( edit ); 213 a->addTo( edit );
214 214
215 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), 215 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ),
216 QString::null, 0, this, 0 ); 216 QString::null, 0, this, 0 );
217 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 217 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
218 a->addTo( editBar ); 218 a->addTo( editBar );
219 a->addTo( edit ); 219 a->addTo( edit );
220 220
221 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), 221 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ),
222 QString::null, 0, this, 0 ); 222 QString::null, 0, this, 0 );
223 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 223 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
224 a->addTo( editBar ); 224 a->addTo( editBar );
225 a->addTo( edit ); 225 a->addTo( edit );
226 226
227 227
228#ifndef QT_NO_CLIPBOARD 228#ifndef QT_NO_CLIPBOARD
229 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), 229 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ),
230 QString::null, 0, this, 0 ); 230 QString::null, 0, this, 0 );
231 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); 231 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) );
232 a->addTo( edit ); 232 a->addTo( edit );
233#endif 233#endif
234 234
235 a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ), 235 a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ),
236 QString::null, 0, this, 0 ); 236 QString::null, 0, this, 0 );
237 connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) ); 237 connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) );
238 edit->insertSeparator(); 238 edit->insertSeparator();
239 a->addTo( edit ); 239 a->addTo( edit );
240 240
241 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), 241 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ),
242 QString::null, 0, this, 0 ); 242 QString::null, 0, this, 0 );
243 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); 243 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
244 a->addTo( bar ); 244 a->addTo( bar );
245 a->addTo( edit ); 245 a->addTo( edit );
246 246
247 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); 247 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
248 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); 248 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
249 zin->addTo( font ); 249 zin->addTo( font );
250 250
251 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); 251 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
252 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); 252 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) );
253 zout->addTo( font ); 253 zout->addTo( font );
254 254
255 font->insertSeparator(); 255 font->insertSeparator();
256 256
257 font->insertItem(tr("Font"), this, SLOT(changeFont()) ); 257 font->insertItem(tr("Font"), this, SLOT(changeFont()) );
258 258
259 font->insertSeparator(); 259 font->insertSeparator();
260 font->insertItem(tr("Advanced Features"), advancedMenu); 260 font->insertItem(tr("Advanced Features"), advancedMenu);
261 261
262 QAction *wa = new QAction( tr("Wrap lines"), 262 QAction *wa = new QAction( tr("Wrap lines"),
263 QString::null, 0, this, 0 ); 263 QString::null, 0, this, 0 );
264 connect( wa, SIGNAL( toggled(bool) ), 264 connect( wa, SIGNAL( toggled(bool) ),
265 this, SLOT( setWordWrap(bool) ) ); 265 this, SLOT( setWordWrap(bool) ) );
266 wa->setToggleAction(true); 266 wa->setToggleAction(true);
267 wa->addTo( advancedMenu); 267 wa->addTo( advancedMenu);
268 268
269 nStart = new QAction( tr("Start with new file"), 269 nStart = new QAction( tr("Start with new file"),
270 QString::null, 0, this, 0 ); 270 QString::null, 0, this, 0 );
271 connect( nStart, SIGNAL( toggled(bool) ), 271 connect( nStart, SIGNAL( toggled(bool) ),
272 this, SLOT( changeStartConfig(bool) ) ); 272 this, SLOT( changeStartConfig(bool) ) );
273 nStart->setToggleAction(true); 273 nStart->setToggleAction(true);
274 nStart->addTo( advancedMenu ); 274 nStart->addTo( advancedMenu );
275 nStart->setEnabled(false); 275 nStart->setEnabled(false);
276 276
277 nAdvanced = new QAction( tr("Prompt on Exit"), 277 nAdvanced = new QAction( tr("Prompt on Exit"),
278 QString::null, 0, this, 0 ); 278 QString::null, 0, this, 0 );
279 connect( nAdvanced, SIGNAL( toggled(bool) ), 279 connect( nAdvanced, SIGNAL( toggled(bool) ),
280 this, SLOT( doPrompt(bool) ) ); 280 this, SLOT( doPrompt(bool) ) );
281 nAdvanced->setToggleAction(true); 281 nAdvanced->setToggleAction(true);
282 nAdvanced->addTo( advancedMenu ); 282 nAdvanced->addTo( advancedMenu );
283 283
284 desktopAction = new QAction( tr("Always open linked file"), 284 desktopAction = new QAction( tr("Always open linked file"),
285 QString::null, 0, this, 0 ); 285 QString::null, 0, this, 0 );
286 connect( desktopAction, SIGNAL( toggled(bool) ), 286 connect( desktopAction, SIGNAL( toggled(bool) ),
287 this, SLOT( doDesktop(bool) ) ); 287 this, SLOT( doDesktop(bool) ) );
288 desktopAction->setToggleAction(true); 288 desktopAction->setToggleAction(true);
289 desktopAction->addTo( advancedMenu); 289 desktopAction->addTo( advancedMenu);
290 290
291 filePermAction = new QAction( tr("File Permissions"), 291 filePermAction = new QAction( tr("File Permissions"),
292 QString::null, 0, this, 0 ); 292 QString::null, 0, this, 0 );
293 connect( filePermAction, SIGNAL( toggled(bool) ), 293 connect( filePermAction, SIGNAL( toggled(bool) ),
294 this, SLOT( doFilePerms(bool) ) ); 294 this, SLOT( doFilePerms(bool) ) );
295 filePermAction->setToggleAction(true); 295 filePermAction->setToggleAction(true);
296 filePermAction->addTo( advancedMenu); 296 filePermAction->addTo( advancedMenu);
297 297
298 searchBarAction = new QAction( tr("Search Bar Open"), 298 searchBarAction = new QAction( tr("Search Bar Open"),
299 QString::null, 0, this, 0 ); 299 QString::null, 0, this, 0 );
300 connect( searchBarAction, SIGNAL( toggled(bool) ), 300 connect( searchBarAction, SIGNAL( toggled(bool) ),
301 this, SLOT( setSearchBar(bool) ) ); 301 this, SLOT( setSearchBar(bool) ) );
302 searchBarAction->setToggleAction(true); 302 searchBarAction->setToggleAction(true);
303 searchBarAction->addTo( advancedMenu); 303 searchBarAction->addTo( advancedMenu);
304 304
305 nAutoSave = new QAction( tr("Auto Save 5 min."), 305 nAutoSave = new QAction( tr("Auto Save 5 min."),
306 QString::null, 0, this, 0 ); 306 QString::null, 0, this, 0 );
307 connect( nAutoSave, SIGNAL( toggled(bool) ), 307 connect( nAutoSave, SIGNAL( toggled(bool) ),
308 this, SLOT( doTimer(bool) ) ); 308 this, SLOT( doTimer(bool) ) );
309 nAutoSave->setToggleAction(true); 309 nAutoSave->setToggleAction(true);
310 nAutoSave->addTo( advancedMenu); 310 nAutoSave->addTo( advancedMenu);
311 311
312 312
313 //font->insertSeparator(); 313 //font->insertSeparator();
314 314
315 //font->insertItem(tr("About"), this, SLOT( doAbout()) ); 315 //font->insertItem(tr("About"), this, SLOT( doAbout()) );
316 316
317 mb->insertItem( tr( "File" ), file ); 317 mb->insertItem( tr( "File" ), file );
318 mb->insertItem( tr( "Edit" ), edit ); 318 mb->insertItem( tr( "Edit" ), edit );
319 mb->insertItem( tr( "View" ), font ); 319 mb->insertItem( tr( "View" ), font );
320 320
321 searchBar = new QToolBar(this); 321 searchBar = new QToolBar(this);
322 addToolBar( searchBar, "Search", QMainWindow::Top, true ); 322 addToolBar( searchBar, "Search", QMainWindow::Top, true );
323 323
324 searchBar->setHorizontalStretchable( true ); 324 searchBar->setHorizontalStretchable( true );
325 325
326 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 326 searchEdit = new QLineEdit( searchBar, "searchEdit" );
327 searchBar->setStretchableWidget( searchEdit ); 327 searchBar->setStretchableWidget( searchEdit );
328 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 328 connect( searchEdit, SIGNAL( textChanged(const QString&) ),
329 this, SLOT( search() ) ); 329 this, SLOT( search() ) );
330 330
331 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), 331 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ),
332 QString::null, 0, this, 0 ); 332 QString::null, 0, this, 0 );
333 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 333 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
334 a->addTo( searchBar ); 334 a->addTo( searchBar );
335 a->addTo( edit ); 335 a->addTo( edit );
336 336
337 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), 337 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ),
338 QString::null, 0, this, 0 ); 338 QString::null, 0, this, 0 );
339 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 339 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
340 a->addTo( searchBar ); 340 a->addTo( searchBar );
341 341
342 edit->insertSeparator(); 342 edit->insertSeparator();
343 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), 343 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ),
344 QString::null, 0, this, 0 ); 344 QString::null, 0, this, 0 );
345 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); 345 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
346 a->addTo( edit ); 346 a->addTo( edit );
347 347
348 searchBar->hide(); 348 searchBar->hide();
349 349
350 editor = new QpeEditor( this ); 350 editor = new QpeEditor( this );
351 setCentralWidget( editor ); 351 setCentralWidget( editor );
352 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 352 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
353 connect( editor, SIGNAL( textChanged() ), 353 connect( editor, SIGNAL( textChanged() ),
354 this, SLOT( editorChanged() ) ); 354 this, SLOT( editorChanged() ) );
355 355
356 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); 356 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold);
357 357
358 Config cfg("TextEdit"); 358 Config cfg("TextEdit");
359 cfg. setGroup ( "Font" ); 359 cfg. setGroup ( "Font" );
360 360
361 QFont defaultFont = editor-> font ( ); 361 QFont defaultFont = editor-> font ( );
362 362
363 QString family = cfg. readEntry ( "Family", defaultFont. family ( )); 363 QString family = cfg. readEntry ( "Family", defaultFont. family ( ));
364 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); 364 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( ));
365 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); 365 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( ));
366 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); 366 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( ));
367 367
368 defaultFont = QFont ( family, size, weight, italic ); 368 defaultFont = QFont ( family, size, weight, italic );
369 editor-> setFont ( defaultFont ); 369 editor-> setFont ( defaultFont );
370// updateCaption(); 370// updateCaption();
371 371
372 cfg.setGroup ( "View" ); 372 cfg.setGroup ( "View" );
373 373
374 promptExit = cfg.readBoolEntry ( "PromptExit", false ); 374 promptExit = cfg.readBoolEntry ( "PromptExit", false );
375 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true ); 375 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true );
376 filePerms = cfg.readBoolEntry ( "FilePermissions", false ); 376 filePerms = cfg.readBoolEntry ( "FilePermissions", false );
377 useSearchBar = cfg.readBoolEntry ( "SearchBar", false ); 377 useSearchBar = cfg.readBoolEntry ( "SearchBar", false );
378 startWithNew = cfg.readBoolEntry ( "startNew", true); 378 startWithNew = cfg.readBoolEntry ( "startNew", true);
379 featureAutoSave = cfg.readBoolEntry( "autosave", false); 379 featureAutoSave = cfg.readBoolEntry( "autosave", false);
380 380
381 if(useSearchBar) searchBarAction->setOn(true); 381 if(useSearchBar) searchBarAction->setOn(true);
382 if(promptExit) nAdvanced->setOn( true ); 382 if(promptExit) nAdvanced->setOn( true );
383 if(openDesktop) desktopAction->setOn( true ); 383 if(openDesktop) desktopAction->setOn( true );
384 if(filePerms) filePermAction->setOn( true ); 384 if(filePerms) filePermAction->setOn( true );
385 if(startWithNew) nStart->setOn( true ); 385 if(startWithNew) nStart->setOn( true );
386 if(featureAutoSave) nAutoSave->setOn(true); 386 if(featureAutoSave) nAutoSave->setOn(true);
387 387
388// { 388// {
389// doTimer(true); 389// doTimer(true);
390// } 390// }
391 391
392 bool wrap = cfg. readBoolEntry ( "Wrap", true ); 392 bool wrap = cfg. readBoolEntry ( "Wrap", true );
393 wa-> setOn ( wrap ); 393 wa-> setOn ( wrap );
394 setWordWrap ( wrap ); 394 setWordWrap ( wrap );
395 395
396///////////////// 396/////////////////
397 if( qApp->argc() > 1) { 397 if( qApp->argc() > 1) {
398 currentFileName=qApp->argv()[1]; 398 currentFileName=qApp->argv()[1];
399 399
400 QFileInfo fi(currentFileName); 400 QFileInfo fi(currentFileName);
401 401
402 if(fi.baseName().left(1) == "") { 402 if(fi.baseName().left(1) == "") {
403 openDotFile(currentFileName); 403 openDotFile(currentFileName);
404 } else { 404 } else {
405 openFile(currentFileName); 405 openFile(currentFileName);
406 } 406 }
407 } else { 407 } else {
408 edited1=false; 408 edited1=false;
409 openDotFile(""); 409 openDotFile("");
410 } 410 }
411 411
412 viewSelection = cfg.readNumEntry( "FileView", 0 ); 412 viewSelection = cfg.readNumEntry( "FileView", 0 );
413} 413}
414 414
415TextEdit::~TextEdit() { 415TextEdit::~TextEdit() {
416 qWarning("textedit d'tor"); 416 qWarning("textedit d'tor");
417 delete editor; 417 delete editor;
418} 418}
419 419
420void TextEdit::closeEvent(QCloseEvent *) { 420void TextEdit::closeEvent(QCloseEvent *) {
421 if( edited1 && promptExit) 421 if( edited1 && promptExit)
422 { 422 {
423 switch( savePrompt() ) 423 switch( savePrompt() )
424 { 424 {
425 case 1: 425 case 1:
426 { 426 {
427 saveAs(); 427 saveAs();
428 qApp->quit(); 428 qApp->quit();
429 } 429 }
430 break; 430 break;
431 431
432 case 2: 432 case 2:
433 { 433 {
434 qApp->quit(); 434 qApp->quit();
435 } 435 }
436 break; 436 break;
437 437
438 case -1: 438 case -1:
439 break; 439 break;
440 }; 440 };
441 } 441 }
442 else 442 else
443 qApp->quit(); 443 qApp->quit();
444 444
445} 445}
446 446
447void TextEdit::cleanUp() { 447void TextEdit::cleanUp() {
448 448
449 Config cfg ( "TextEdit" ); 449 Config cfg ( "TextEdit" );
450 cfg. setGroup ( "Font" ); 450 cfg. setGroup ( "Font" );
451 QFont f = editor->font(); 451 QFont f = editor->font();
452 cfg.writeEntry ( "Family", f. family ( )); 452 cfg.writeEntry ( "Family", f. family ( ));
453 cfg.writeEntry ( "Size", f. pointSize ( )); 453 cfg.writeEntry ( "Size", f. pointSize ( ));
454 cfg.writeEntry ( "Weight", f. weight ( )); 454 cfg.writeEntry ( "Weight", f. weight ( ));
455 cfg.writeEntry ( "Italic", f. italic ( )); 455 cfg.writeEntry ( "Italic", f. italic ( ));
456 456
457 cfg.setGroup ( "View" ); 457 cfg.setGroup ( "View" );
458 cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth ); 458 cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth );
459 cfg.writeEntry ( "FileView", viewSelection ); 459 cfg.writeEntry ( "FileView", viewSelection );
460 460
461 cfg.writeEntry ( "PromptExit", promptExit ); 461 cfg.writeEntry ( "PromptExit", promptExit );
462 cfg.writeEntry ( "OpenDesktop", openDesktop ); 462 cfg.writeEntry ( "OpenDesktop", openDesktop );
463 cfg.writeEntry ( "FilePermissions", filePerms ); 463 cfg.writeEntry ( "FilePermissions", filePerms );
464 cfg.writeEntry ( "SearchBar", useSearchBar ); 464 cfg.writeEntry ( "SearchBar", useSearchBar );
465 cfg.writeEntry ( "startNew", startWithNew ); 465 cfg.writeEntry ( "startNew", startWithNew );
466 466
467} 467}
468 468
469 469
470void TextEdit::accept() { 470void TextEdit::accept() {
471 if( edited1) 471 if( edited1)
472 saveAs(); 472 saveAs();
473 qApp->quit(); 473 qApp->quit();
474} 474}
475 475
476void TextEdit::zoomIn() { 476void TextEdit::zoomIn() {
477 setFontSize(editor->font().pointSize()+1,false); 477 setFontSize(editor->font().pointSize()+1,false);
478} 478}
479 479
480void TextEdit::zoomOut() { 480void TextEdit::zoomOut() {
481 setFontSize(editor->font().pointSize()-1,true); 481 setFontSize(editor->font().pointSize()-1,true);
482} 482}
483 483
484 484
485void TextEdit::setFontSize(int sz, bool round_down_not_up) { 485void TextEdit::setFontSize(int sz, bool round_down_not_up) {
486 int s=10; 486 int s=10;
487 for (int i=0; i<nfontsizes; i++) { 487 for (int i=0; i<nfontsizes; i++) {
488 if ( fontsize[i] == sz ) { 488 if ( fontsize[i] == sz ) {
489 s = sz; 489 s = sz;
490 break; 490 break;
491 } else if ( round_down_not_up ) { 491 } else if ( round_down_not_up ) {
492 if ( fontsize[i] < sz ) 492 if ( fontsize[i] < sz )
493 s = fontsize[i]; 493 s = fontsize[i];
494 } else { 494 } else {
495 if ( fontsize[i] > sz ) { 495 if ( fontsize[i] > sz ) {
496 s = fontsize[i]; 496 s = fontsize[i];
497 break; 497 break;
498 } 498 }
499 } 499 }
500 } 500 }
501 501
502 QFont f = editor->font(); 502 QFont f = editor->font();
503 f.setPointSize(s); 503 f.setPointSize(s);
504 editor->setFont(f); 504 editor->setFont(f);
505 505
506 zin->setEnabled(s != fontsize[nfontsizes-1]); 506 zin->setEnabled(s != fontsize[nfontsizes-1]);
507 zout->setEnabled(s != fontsize[0]); 507 zout->setEnabled(s != fontsize[0]);
508} 508}
509 509
510void TextEdit::setBold(bool y) { 510void TextEdit::setBold(bool y) {
511 QFont f = editor->font(); 511 QFont f = editor->font();
512 f.setBold(y); 512 f.setBold(y);
513 editor->setFont(f); 513 editor->setFont(f);
514} 514}
515 515
516void TextEdit::setItalic(bool y) { 516void TextEdit::setItalic(bool y) {
517 QFont f = editor->font(); 517 QFont f = editor->font();
518 f.setItalic(y); 518 f.setItalic(y);
519 editor->setFont(f); 519 editor->setFont(f);
520} 520}
521 521
522void TextEdit::setWordWrap(bool y) { 522void TextEdit::setWordWrap(bool y) {
523 bool state = editor->edited(); 523 bool state = editor->edited();
524 QString captionStr = caption(); 524 QString captionStr = caption();
525 bool b1 = edited1; 525 bool b1 = edited1;
526 bool b2 = edited; 526 bool b2 = edited;
527 527
528 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 528 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
529 editor->setEdited( state ); 529 editor->setEdited( state );
530 edited1=b1; 530 edited1=b1;
531 edited=b2; 531 edited=b2;
532 setCaption(captionStr); 532 setCaption(captionStr);
533} 533}
534 534
535void TextEdit::setSearchBar(bool b) { 535void TextEdit::setSearchBar(bool b) {
536 useSearchBar=b; 536 useSearchBar=b;
537 Config cfg("TextEdit"); 537 Config cfg("TextEdit");
538 cfg.setGroup("View"); 538 cfg.setGroup("View");
539 cfg.writeEntry ( "SearchBar", b ); 539 cfg.writeEntry ( "SearchBar", b );
540 searchBarAction->setOn(b); 540 searchBarAction->setOn(b);
541 if(b) 541 if(b)
542 searchBar->show(); 542 searchBar->show();
543 else 543 else
544 searchBar->hide(); 544 searchBar->hide();
545 editor->setFocus(); 545 editor->setFocus();
546} 546}
547 547
548void TextEdit::fileNew() { 548void TextEdit::fileNew() {
549// if( !bFromDocView ) { 549// if( !bFromDocView ) {
550// saveAs(); 550// saveAs();
551// } 551// }
552 newFile(DocLnk()); 552 newFile(DocLnk());
553} 553}
554 554
555void TextEdit::fileOpen() { 555void TextEdit::fileOpen() {
556 Config cfg("TextEdit"); 556 Config cfg("TextEdit");
557 cfg. setGroup ( "View" ); 557 cfg. setGroup ( "View" );
558 QMap<QString, QStringList> map; 558 QMap<QString, QStringList> map;
559 map.insert(tr("All"), QStringList() ); 559 map.insert(tr("All"), QStringList() );
560 QStringList text; 560 QStringList text;
561 text << "text/*"; 561 text << "text/*";
562 map.insert(tr("Text"), text ); 562 map.insert(tr("Text"), text );
563 text << "*"; 563 text << "*";
564 map.insert(tr("All"), text ); 564 map.insert(tr("All"), text );
565 QString str = OFileDialog::getOpenFileName( 2, 565 QString str = OFileDialog::getOpenFileName( 2,
566 QString::null , 566 QString::null ,
567 QString::null, map); 567 QString::null, map);
568 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) 568 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() )
569 { 569 {
570 openFile( str ); 570 openFile( str );
571 } 571 }
572 else 572 else
573 updateCaption(); 573 updateCaption();
574} 574}
575 575
576void TextEdit::doSearchBar() { 576void TextEdit::doSearchBar() {
577 if(!useSearchBar) 577 if(!useSearchBar)
578 searchBar->hide(); 578 searchBar->hide();
579 else 579 else
580 searchBar->show(); 580 searchBar->show();
581} 581}
582 582
583#if 0 583#if 0
584void TextEdit::slotFind() { 584void TextEdit::slotFind() {
585 FindDialog frmFind( tr("Text Editor"), this ); 585 FindDialog frmFind( tr("Text Editor"), this );
586 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 586 connect( &frmFind, SIGNAL(signalFindClicked(const QString&,bool,bool,int)),
587 editor, SLOT(slotDoFind( const QString&,bool,bool))); 587 editor, SLOT(slotDoFind(const QString&,bool,bool)));
588 588
589 //case sensitive, backwards, [category] 589 //case sensitive, backwards, [category]
590 590
591 connect( editor, SIGNAL(notFound()), 591 connect( editor, SIGNAL(notFound()),
592 &frmFind, SLOT(slotNotFound()) ); 592 &frmFind, SLOT(slotNotFound()) );
593 connect( editor, SIGNAL(searchWrapped()), 593 connect( editor, SIGNAL(searchWrapped()),
594 &frmFind, SLOT(slotWrapAround()) ); 594 &frmFind, SLOT(slotWrapAround()) );
595 595
596 frmFind.exec(); 596 frmFind.exec();
597 597
598 598
599} 599}
600#endif 600#endif
601 601
602void TextEdit::fileRevert() { 602void TextEdit::fileRevert() {
603 clear(); 603 clear();
604 fileOpen(); 604 fileOpen();
605} 605}
606 606
607void TextEdit::editCut() { 607void TextEdit::editCut() {
608#ifndef QT_NO_CLIPBOARD 608#ifndef QT_NO_CLIPBOARD
609 editor->cut(); 609 editor->cut();
610#endif 610#endif
611} 611}
612 612
613void TextEdit::editCopy() { 613void TextEdit::editCopy() {
614#ifndef QT_NO_CLIPBOARD 614#ifndef QT_NO_CLIPBOARD
615 editor->copy(); 615 editor->copy();
616#endif 616#endif
617} 617}
618 618
619void TextEdit::editPaste() { 619void TextEdit::editPaste() {
620#ifndef QT_NO_CLIPBOARD 620#ifndef QT_NO_CLIPBOARD
621 editor->paste(); 621 editor->paste();
622#endif 622#endif
623} 623}
624 624
625void TextEdit::editFind() { 625void TextEdit::editFind() {
626 searchBar->show(); 626 searchBar->show();
627 searchEdit->setFocus(); 627 searchEdit->setFocus();
628} 628}
629 629
630void TextEdit::findNext() { 630void TextEdit::findNext() {
631 editor->find( searchEdit->text(), false, false ); 631 editor->find( searchEdit->text(), false, false );
632 632
633} 633}
634 634
635void TextEdit::findClose() { 635void TextEdit::findClose() {
636 searchBar->hide(); 636 searchBar->hide();
637} 637}
638 638
639void TextEdit::search() { 639void TextEdit::search() {
640 editor->find( searchEdit->text(), false, false ); 640 editor->find( searchEdit->text(), false, false );
641} 641}
642 642
643void TextEdit::newFile( const DocLnk &f ) { 643void TextEdit::newFile( const DocLnk &f ) {
644 DocLnk nf = f; 644 DocLnk nf = f;
645 nf.setType("text/plain"); 645 nf.setType("text/plain");
646 clear(); 646 clear();
647 setWState (WState_Reserved1 ); 647 setWState (WState_Reserved1 );
648 editor->setFocus(); 648 editor->setFocus();
649 doc = new DocLnk(nf); 649 doc = new DocLnk(nf);
650 currentFileName = "Unnamed"; 650 currentFileName = "Unnamed";
651 qDebug("newFile "+currentFileName); 651 qDebug("newFile "+currentFileName);
652 updateCaption( currentFileName); 652 updateCaption( currentFileName);
653// editor->setEdited( false); 653// editor->setEdited( false);
654} 654}
655 655
656void TextEdit::openDotFile( const QString &f ) { 656void TextEdit::openDotFile( const QString &f ) {
657 if(!currentFileName.isEmpty()) { 657 if(!currentFileName.isEmpty()) {
658 currentFileName=f; 658 currentFileName=f;
659 659
660 qDebug("openFile dotfile " + currentFileName); 660 qDebug("openFile dotfile " + currentFileName);
661 QString txt; 661 QString txt;
662 QFile file(f); 662 QFile file(f);
663 file.open(IO_ReadWrite); 663 file.open(IO_ReadWrite);
664 QTextStream t(&file); 664 QTextStream t(&file);
665 while ( !t.atEnd()) { 665 while ( !t.atEnd()) {
666 txt+=t.readLine()+"\n"; 666 txt+=t.readLine()+"\n";
667 } 667 }
668 editor->setText(txt); 668 editor->setText(txt);
669 editor->setEdited( false); 669 editor->setEdited( false);
670 edited1=false; 670 edited1=false;
671 edited=false; 671 edited=false;
672 672
673 673
674 } 674 }
675 updateCaption( currentFileName); 675 updateCaption( currentFileName);
676} 676}
677 677
678void TextEdit::openFile( const QString &f ) { 678void TextEdit::openFile( const QString &f ) {
679 qDebug("filename is "+ f); 679 qDebug("filename is "+ f);
680 QString filer; 680 QString filer;
681 QFileInfo fi( f); 681 QFileInfo fi( f);
682// bFromDocView = true; 682// bFromDocView = true;
683 if(f.find(".desktop",0,true) != -1 && !openDesktop ) 683 if(f.find(".desktop",0,true) != -1 && !openDesktop )
684 { 684 {
685 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) ) 685 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Text Editor has detected<BR>you selected a <B>.desktop</B>file.<BR>Open<B>.desktop</B> file or <B>linked</B> file?"),tr(".desktop File"),tr("Linked Document"),0,1,1) )
686 { 686 {
687 case 0: //desktop 687 case 0: //desktop
688 filer = f; 688 filer = f;
689 break; 689 break;
690 case 1: //linked 690 case 1: //linked
691 DocLnk sf(f); 691 DocLnk sf(f);
692 filer = sf.file(); 692 filer = sf.file();
693 break; 693 break;
694 }; 694 };
695 } 695 }
696 else if(fi.baseName().left(1) == "") 696 else if(fi.baseName().left(1) == "")
697 { 697 {
698 qDebug("opening dotfile"); 698 qDebug("opening dotfile");
699 currentFileName=f; 699 currentFileName=f;
700 openDotFile(currentFileName); 700 openDotFile(currentFileName);
701 return; 701 return;
702 } 702 }
703 /* 703 /*
704 * The problem is a file where Config(f).isValid() and it does not 704 * The problem is a file where Config(f).isValid() and it does not
705 * end with .desktop will be treated as desktop file 705 * end with .desktop will be treated as desktop file
706 */ 706 */
707 else if (f.find(".desktop",0,true) != -1 ) 707 else if (f.find(".desktop",0,true) != -1 )
708 { 708 {
709 DocLnk sf(f); 709 DocLnk sf(f);
710 filer = sf.file(); 710 filer = sf.file();
711 if(filer.right(1) == "/") 711 if(filer.right(1) == "/")
712 filer = f; 712 filer = f;
713 713
714 } 714 }
715 else 715 else
716 filer = f; 716 filer = f;
717 717
718 DocLnk nf; 718 DocLnk nf;
719 nf.setType("text/plain"); 719 nf.setType("text/plain");
720 nf.setFile(filer); 720 nf.setFile(filer);
721 currentFileName=filer; 721 currentFileName=filer;
722 722
723 nf.setName(fi.baseName()); 723 nf.setName(fi.baseName());
724 openFile(nf); 724 openFile(nf);
725 725
726 qDebug("openFile string "+currentFileName); 726 qDebug("openFile string "+currentFileName);
727 727
728 showEditTools(); 728 showEditTools();
729 // Show filename in caption 729 // Show filename in caption
730 QString name = filer; 730 QString name = filer;
731 int sep = name.findRev( '/' ); 731 int sep = name.findRev( '/' );
732 if ( sep > 0 ) 732 if ( sep > 0 )
733 name = name.mid( sep+1 ); 733 name = name.mid( sep+1 );
734 updateCaption( name ); 734 updateCaption( name );
735} 735}
736 736
737void TextEdit::openFile( const DocLnk &f ) { 737void TextEdit::openFile( const DocLnk &f ) {
738// clear(); 738// clear();
739// bFromDocView = true; 739// bFromDocView = true;
740 FileManager fm; 740 FileManager fm;
741 QString txt; 741 QString txt;
742 currentFileName=f.file(); 742 currentFileName=f.file();
743 qDebug("openFile doclnk " + currentFileName); 743 qDebug("openFile doclnk " + currentFileName);
744 if ( !fm.loadFile( f, txt ) ) { 744 if ( !fm.loadFile( f, txt ) ) {
745 // ####### could be a new file 745 // ####### could be a new file
746 qDebug( "Cannot open file" ); 746 qDebug( "Cannot open file" );
747 } 747 }
748// fileNew(); 748// fileNew();
749 if ( doc ) 749 if ( doc )
750 delete doc; 750 delete doc;
751 doc = new DocLnk(f); 751 doc = new DocLnk(f);
752 editor->setText(txt); 752 editor->setText(txt);
753 editor->setEdited( false); 753 editor->setEdited( false);
754 edited1=false; 754 edited1=false;
755 edited=false; 755 edited=false;
756 756
757 doc->setName(currentFileName); 757 doc->setName(currentFileName);
758 updateCaption(); 758 updateCaption();
759 setTimer(); 759 setTimer();
760} 760}
761 761
762void TextEdit::showEditTools() { 762void TextEdit::showEditTools() {
763 menu->show(); 763 menu->show();
764 editBar->show(); 764 editBar->show();
765 if(!useSearchBar) 765 if(!useSearchBar)
766 searchBar->hide(); 766 searchBar->hide();
767 else 767 else
768 searchBar->show(); 768 searchBar->show();
769 setWState (WState_Reserved1 ); 769 setWState (WState_Reserved1 );
770} 770}
771 771
772/*! 772/*!
773 unprompted save */ 773 unprompted save */
774bool TextEdit::save() { 774bool TextEdit::save() {
775 qDebug("saveAsFile " + currentFileName); 775 qDebug("saveAsFile " + currentFileName);
776 if(currentFileName.isEmpty()) { 776 if(currentFileName.isEmpty()) {
777 saveAs(); 777 saveAs();
778 return false; 778 return false;
779 } 779 }