summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-29 00:54:12 (UTC)
committer llornkcor <llornkcor>2002-11-29 00:54:12 (UTC)
commit70c8fe38d9d65b75912c8b473c3940d2160cdde6 (patch) (unidiff)
tree8e307e814fa5960007f21afc27ad5da4a9493454
parent54b1bd8e8eaf5764b465f169d4ee1b9261659a11 (diff)
downloadopie-70c8fe38d9d65b75912c8b473c3940d2160cdde6.zip
opie-70c8fe38d9d65b75912c8b473c3940d2160cdde6.tar.gz
opie-70c8fe38d9d65b75912c8b473c3940d2160cdde6.tar.bz2
removed open with fileselector, cause I hate it. Fixes opening through docs tab, and other annoyances
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp67
-rw-r--r--core/apps/textedit/textedit.h1
2 files changed, 42 insertions, 26 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index e978fa4..b199c81 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -198,192 +198,195 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
198 int line, col; 198 int line, col;
199 if ( wrap ) { 199 if ( wrap ) {
200 if ( !backwards ) 200 if ( !backwards )
201 line = col = 0; 201 line = col = 0;
202 wrap = false; 202 wrap = false;
203 // emit searchWrapped(); 203 // emit searchWrapped();
204 } else { 204 } else {
205 getCursorPosition( &line, &col ); 205 getCursorPosition( &line, &col );
206 } 206 }
207 //ignore backwards for now.... 207 //ignore backwards for now....
208 if ( !backwards ) { 208 if ( !backwards ) {
209 for ( ; ; ) { 209 for ( ; ; ) {
210 if ( line >= numLines() ) { 210 if ( line >= numLines() ) {
211 wrap = true; 211 wrap = true;
212 //emit notFound(); 212 //emit notFound();
213 break; 213 break;
214 } 214 }
215 int findCol = getString( line )->find( txt, col, caseSensitive ); 215 int findCol = getString( line )->find( txt, col, caseSensitive );
216 if ( findCol >= 0 ) { 216 if ( findCol >= 0 ) {
217 setCursorPosition( line, findCol, false ); 217 setCursorPosition( line, findCol, false );
218 col = findCol + txt.length(); 218 col = findCol + txt.length();
219 setCursorPosition( line, col, true ); 219 setCursorPosition( line, col, true );
220 220
221 //found = true; 221 //found = true;
222 break; 222 break;
223 } 223 }
224 line++; 224 line++;
225 col = 0; 225 col = 0;
226 } 226 }
227 } 227 }
228} 228}
229 229
230 230
231#else 231#else
232 232
233#error "Must make a QpeEditor that inherits QTextEdit" 233#error "Must make a QpeEditor that inherits QTextEdit"
234 234
235#endif 235#endif
236 236
237 237
238static const int nfontsizes = 6; 238static const int nfontsizes = 6;
239static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 239static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
240 240
241TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 241TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
242 : QMainWindow( parent, name, f ), bFromDocView( false ) 242 : QMainWindow( parent, name, f ), bFromDocView( false )
243{ 243{
244 doc = 0; 244 doc = 0;
245 edited=false; 245 edited=false;
246 edited1=false; 246 fromSetDocument=false;
247
247 setToolBarsMovable( false ); 248 setToolBarsMovable( false );
248 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 249 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
249 250
250 channel = new QCopChannel( "QPE/Application/textedit", this ); 251 channel = new QCopChannel( "QPE/Application/textedit", this );
251 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 252 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
252 this, SLOT(receive(const QCString&, const QByteArray&)) ); 253 this, SLOT(receive(const QCString&, const QByteArray&)) );
253 254
254 setIcon( Resource::loadPixmap( "TextEditor" ) ); 255 setIcon( Resource::loadPixmap( "TextEditor" ) );
255 256
256 QPEToolBar *bar = new QPEToolBar( this ); 257 QPEToolBar *bar = new QPEToolBar( this );
257 bar->setHorizontalStretchable( true ); 258 bar->setHorizontalStretchable( true );
258 menu = bar; 259 menu = bar;
259 260
260 QPEMenuBar *mb = new QPEMenuBar( bar ); 261 QPEMenuBar *mb = new QPEMenuBar( bar );
261 QPopupMenu *file = new QPopupMenu( this ); 262 QPopupMenu *file = new QPopupMenu( this );
262 QPopupMenu *edit = new QPopupMenu( this ); 263 QPopupMenu *edit = new QPopupMenu( this );
263 QPopupMenu *advancedMenu = new QPopupMenu(this); 264 QPopupMenu *advancedMenu = new QPopupMenu(this);
264 265
265 font = new QPopupMenu( this ); 266 font = new QPopupMenu( this );
266 267
267 bar = new QPEToolBar( this ); 268 bar = new QPEToolBar( this );
268 editBar = bar; 269 editBar = bar;
269 270
270 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 271 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
271 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 272 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
272 a->addTo( bar ); 273// a->addTo( bar );
273 a->addTo( file ); 274 a->addTo( file );
274 275
275 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 276 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
276 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 277 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
277 a->addTo( bar ); 278 a->addTo( bar );
278 a->addTo( file ); 279 a->addTo( file );
279 280
280 a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); 281 a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 );
281 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 282 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
282 file->insertSeparator(); 283 file->insertSeparator();
284 a->addTo( bar );
283 a->addTo( file ); 285 a->addTo( file );
284 286
285 a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); 287 a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 );
286 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); 288 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
287 a->addTo( file ); 289 a->addTo( file );
288 290
289 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); 291 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 );
290 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 292 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
291 a->addTo( editBar ); 293 a->addTo( editBar );
292 a->addTo( edit ); 294 a->addTo( edit );
293 295
294 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); 296 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 );
295 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 297 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
296 a->addTo( editBar ); 298 a->addTo( editBar );
297 a->addTo( edit ); 299 a->addTo( edit );
298 300
299 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 301 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
300 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 302 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
301 a->addTo( editBar ); 303 a->addTo( editBar );
302 a->addTo( edit ); 304 a->addTo( edit );
303 305
304 306
305#ifndef QT_NO_CLIPBOARD 307#ifndef QT_NO_CLIPBOARD
306 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 308 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
307 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); 309 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) );
308 a->addTo( edit ); 310 a->addTo( edit );
309#endif 311#endif
310 312
311 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 313 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
312 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); 314 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
313 edit->insertSeparator(); 315 edit->insertSeparator();
314 a->addTo( bar ); 316 a->addTo( bar );
315 a->addTo( edit ); 317 a->addTo( edit );
316 318
317 319
318 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); 320 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
319 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); 321 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
320 zin->addTo( font ); 322 zin->addTo( font );
321 323
322 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); 324 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
323 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); 325 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) );
324 zout->addTo( font ); 326 zout->addTo( font );
325 327
326 font->insertSeparator(); 328 font->insertSeparator();
327// font->insertSeparator(); 329// font->insertSeparator();
328 font->insertItem(tr("Font"), this, SLOT(changeFont()) ); 330 font->insertItem(tr("Font"), this, SLOT(changeFont()) );
329 331
330 font->insertSeparator(); 332 font->insertSeparator();
331 font->insertItem(tr("Advanced Features"), advancedMenu); 333 font->insertItem(tr("Advanced Features"), advancedMenu);
332 334
333 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); 335 QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 );
334 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); 336 connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) );
335 wa->setToggleAction(true); 337 wa->setToggleAction(true);
336 wa->addTo( advancedMenu); 338 wa->addTo( advancedMenu);
337 339
338 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); 340 nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 );
339 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); 341 connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) );
340 nStart->setToggleAction(true); 342 nStart->setToggleAction(true);
341 nStart->addTo( advancedMenu ); 343 nStart->addTo( advancedMenu );
344 nStart->setEnabled(false);
342 345
343 nAdvanced = new QAction( tr("Prompt on Exit"), QString::null, 0, this, 0 ); 346 nAdvanced = new QAction( tr("Prompt on Exit"), QString::null, 0, this, 0 );
344 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doPrompt(bool) ) ); 347 connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doPrompt(bool) ) );
345 nAdvanced->setToggleAction(true); 348 nAdvanced->setToggleAction(true);
346 nAdvanced->addTo( advancedMenu ); 349 nAdvanced->addTo( advancedMenu );
347 350
348 desktopAction = new QAction( tr("Always open linked file"), QString::null, 0, this, 0 ); 351 desktopAction = new QAction( tr("Always open linked file"), QString::null, 0, this, 0 );
349 connect( desktopAction, SIGNAL( toggled(bool) ), this, SLOT( doDesktop(bool) ) ); 352 connect( desktopAction, SIGNAL( toggled(bool) ), this, SLOT( doDesktop(bool) ) );
350 desktopAction->setToggleAction(true); 353 desktopAction->setToggleAction(true);
351 desktopAction->addTo( advancedMenu); 354 desktopAction->addTo( advancedMenu);
352 355
353 filePermAction = new QAction( tr("File Permissions"), QString::null, 0, this, 0 ); 356 filePermAction = new QAction( tr("File Permissions"), QString::null, 0, this, 0 );
354 connect( filePermAction, SIGNAL( toggled(bool) ), this, SLOT( doFilePerms(bool) ) ); 357 connect( filePermAction, SIGNAL( toggled(bool) ), this, SLOT( doFilePerms(bool) ) );
355 filePermAction->setToggleAction(true); 358 filePermAction->setToggleAction(true);
356 filePermAction->addTo( advancedMenu); 359 filePermAction->addTo( advancedMenu);
357 360
358 searchBarAction = new QAction( tr("Search Bar Open"), QString::null, 0, this, 0 ); 361 searchBarAction = new QAction( tr("Search Bar Open"), QString::null, 0, this, 0 );
359 connect( searchBarAction, SIGNAL( toggled(bool) ), this, SLOT( setSearchBar(bool) ) ); 362 connect( searchBarAction, SIGNAL( toggled(bool) ), this, SLOT( setSearchBar(bool) ) );
360 searchBarAction->setToggleAction(true); 363 searchBarAction->setToggleAction(true);
361 searchBarAction->addTo( advancedMenu); 364 searchBarAction->addTo( advancedMenu);
362 365
363 366
364 font->insertSeparator(); 367 font->insertSeparator();
365 368
366 font->insertItem(tr("About"), this, SLOT( doAbout()) ); 369 font->insertItem(tr("About"), this, SLOT( doAbout()) );
367 370
368 mb->insertItem( tr( "File" ), file ); 371 mb->insertItem( tr( "File" ), file );
369 mb->insertItem( tr( "Edit" ), edit ); 372 mb->insertItem( tr( "Edit" ), edit );
370 mb->insertItem( tr( "View" ), font ); 373 mb->insertItem( tr( "View" ), font );
371 374
372 searchBar = new QPEToolBar(this); 375 searchBar = new QPEToolBar(this);
373 addToolBar( searchBar, "Search", QMainWindow::Top, true ); 376 addToolBar( searchBar, "Search", QMainWindow::Top, true );
374 377
375 searchBar->setHorizontalStretchable( true ); 378 searchBar->setHorizontalStretchable( true );
376 379
377 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 380 searchEdit = new QLineEdit( searchBar, "searchEdit" );
378 searchBar->setStretchableWidget( searchEdit ); 381 searchBar->setStretchableWidget( searchEdit );
379 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 382 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
380 this, SLOT( search() ) ); 383 this, SLOT( search() ) );
381 384
382 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); 385 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
383 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 386 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
384 a->addTo( searchBar ); 387 a->addTo( searchBar );
385 a->addTo( edit ); 388 a->addTo( edit );
386 389
387 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 390 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
388 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 391 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
389 a->addTo( searchBar ); 392 a->addTo( searchBar );
@@ -391,115 +394,118 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
391 edit->insertSeparator(); 394 edit->insertSeparator();
392 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 395 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
393 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); 396 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
394 a->addTo( edit ); 397 a->addTo( edit );
395 398
396 searchBar->hide(); 399 searchBar->hide();
397 400
398 editor = new QpeEditor( this ); 401 editor = new QpeEditor( this );
399 setCentralWidget( editor ); 402 setCentralWidget( editor );
400 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 403 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
401 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); 404 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
402 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); 405 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold);
403 406
404 Config cfg("TextEdit"); 407 Config cfg("TextEdit");
405 cfg. setGroup ( "Font" ); 408 cfg. setGroup ( "Font" );
406 409
407 QFont defaultFont = editor-> font ( ); 410 QFont defaultFont = editor-> font ( );
408 411
409 QString family = cfg. readEntry ( "Family", defaultFont. family ( )); 412 QString family = cfg. readEntry ( "Family", defaultFont. family ( ));
410 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); 413 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( ));
411 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); 414 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( ));
412 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); 415 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( ));
413 416
414 defaultFont = QFont ( family, size, weight, italic ); 417 defaultFont = QFont ( family, size, weight, italic );
415 editor-> setFont ( defaultFont ); 418 editor-> setFont ( defaultFont );
416 419
417// updateCaption(); 420// updateCaption();
418 421
419 cfg.setGroup ( "View" ); 422 cfg.setGroup ( "View" );
420 423
421 promptExit = cfg.readBoolEntry ( "PromptExit", false ); 424 promptExit = cfg.readBoolEntry ( "PromptExit", false );
422 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true ); 425 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true );
423 filePerms = cfg.readBoolEntry ( "FilePermissions", false ); 426 filePerms = cfg.readBoolEntry ( "FilePermissions", false );
424 useSearchBar = cfg.readBoolEntry ( "SearchBar", false ); 427 useSearchBar = cfg.readBoolEntry ( "SearchBar", false );
425 startWithNew = cfg.readBoolEntry ( "startNew", true); 428 startWithNew = cfg.readBoolEntry ( "startNew", true);
426 429
427 if(useSearchBar) searchBarAction->setOn(true); 430 if(useSearchBar) searchBarAction->setOn(true);
428 if(promptExit ) nAdvanced->setOn( true ); 431 if(promptExit ) nAdvanced->setOn( true );
429 if(openDesktop) desktopAction->setOn( true ); 432 if(openDesktop) desktopAction->setOn( true );
430 if(filePerms) filePermAction->setOn( true ); 433 if(filePerms) filePermAction->setOn( true );
431 if(startWithNew) nStart->setOn( true ); 434 if(startWithNew) nStart->setOn( true );
432 435
433 bool wrap = cfg. readBoolEntry ( "Wrap", true ); 436 bool wrap = cfg. readBoolEntry ( "Wrap", true );
434 wa-> setOn ( wrap ); 437 wa-> setOn ( wrap );
435 setWordWrap ( wrap ); 438 setWordWrap ( wrap );
436 439
437 if( qApp->argc() > 1) { 440 if( qApp->argc() > 1) {
438 currentFileName=qApp->argv()[1]; 441 currentFileName=qApp->argv()[1];
439// qDebug("<<<<<<<<<<<<<<<<<<<<<<<< "+currentFileName+" %d",qApp->argc()); 442
440 QFileInfo fi(currentFileName); 443 QFileInfo fi(currentFileName);
441 444
442 if(fi.baseName().left(1) == "") { 445 if(fi.baseName().left(1) == "") {
443 openDotFile(currentFileName); 446 openDotFile(currentFileName);
444 } else { 447 } else {
445 openFile(currentFileName); 448 openFile(currentFileName);
446 } 449 }
447 } else { 450 } else {
448// qDebug("Do other thing"); 451 edited1=false;
449 if(startWithNew) { 452
453// if(startWithNew ) {
450 openDotFile(""); 454 openDotFile("");
451// fileNew(); 455// fileNew();
452 } else { 456// }
453 fileOpen(); 457// else {
454 } 458// fileOpen();
459// }
455 } 460 }
456 461
457 viewSelection = cfg.readNumEntry( "FileView", 0 ); 462 viewSelection = cfg.readNumEntry( "FileView", 0 );
463// setCaption(tr("Text Editor"));
458} 464}
459 465
460TextEdit::~TextEdit() { 466TextEdit::~TextEdit() {
461// qDebug("destr"); 467// qDebug("destr");
462} 468}
463 469
464void TextEdit::closeEvent(QCloseEvent *) { 470void TextEdit::closeEvent(QCloseEvent *) {
465// qDebug("closing here"); 471// qDebug("closing here");
466 if( edited1 && promptExit) 472 if( edited1 && promptExit)
467 saveAs(); 473 saveAs();
468 qApp->quit(); 474 qApp->quit();
469} 475}
470 476
471void TextEdit::cleanUp() { 477void TextEdit::cleanUp() {
472// qDebug("cleanUp");// save(); 478// qDebug("cleanUp");// save();
473 479
474 Config cfg ( "TextEdit" ); 480 Config cfg ( "TextEdit" );
475 cfg. setGroup ( "Font" ); 481 cfg. setGroup ( "Font" );
476 QFont f = editor->font(); 482 QFont f = editor->font();
477 cfg.writeEntry ( "Family", f. family ( )); 483 cfg.writeEntry ( "Family", f. family ( ));
478 cfg.writeEntry ( "Size", f. pointSize ( )); 484 cfg.writeEntry ( "Size", f. pointSize ( ));
479 cfg.writeEntry ( "Weight", f. weight ( )); 485 cfg.writeEntry ( "Weight", f. weight ( ));
480 cfg.writeEntry ( "Italic", f. italic ( )); 486 cfg.writeEntry ( "Italic", f. italic ( ));
481 487
482 cfg.setGroup ( "View" ); 488 cfg.setGroup ( "View" );
483 cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth ); 489 cfg.writeEntry ( "Wrap", editor->wordWrap() == QMultiLineEdit::WidgetWidth );
484 cfg.writeEntry ( "FileView", viewSelection ); 490 cfg.writeEntry ( "FileView", viewSelection );
485 491
486 cfg.writeEntry ( "PromptExit", promptExit ); 492 cfg.writeEntry ( "PromptExit", promptExit );
487 cfg.writeEntry ( "OpenDesktop", openDesktop ); 493 cfg.writeEntry ( "OpenDesktop", openDesktop );
488 cfg.writeEntry ( "FilePermissions", filePerms ); 494 cfg.writeEntry ( "FilePermissions", filePerms );
489 cfg.writeEntry ( "SearchBar", useSearchBar ); 495 cfg.writeEntry ( "SearchBar", useSearchBar );
490 cfg.writeEntry ( "startNew", startWithNew ); 496 cfg.writeEntry ( "startNew", startWithNew );
491 497
492} 498}
493 499
494 500
495void TextEdit::accept() { 501void TextEdit::accept() {
496// qDebug("accept"); 502// qDebug("accept");
497 if( edited1) 503 if( edited1)
498 saveAs(); 504 saveAs();
499 qApp->quit(); 505 qApp->quit();
500} 506}
501 507
502void TextEdit::zoomIn() { 508void TextEdit::zoomIn() {
503 setFontSize(editor->font().pointSize()+1,false); 509 setFontSize(editor->font().pointSize()+1,false);
504} 510}
505 511
@@ -650,97 +656,97 @@ void TextEdit::findNext() {
650void TextEdit::findClose() { 656void TextEdit::findClose() {
651 searchBar->hide(); 657 searchBar->hide();
652} 658}
653 659
654void TextEdit::search() { 660void TextEdit::search() {
655 editor->find( searchEdit->text(), false, false ); 661 editor->find( searchEdit->text(), false, false );
656} 662}
657 663
658void TextEdit::newFile( const DocLnk &f ) { 664void TextEdit::newFile( const DocLnk &f ) {
659 DocLnk nf = f; 665 DocLnk nf = f;
660 nf.setType("text/plain"); 666 nf.setType("text/plain");
661 clear(); 667 clear();
662 setWState (WState_Reserved1 ); 668 setWState (WState_Reserved1 );
663 editor->setFocus(); 669 editor->setFocus();
664 doc = new DocLnk(nf); 670 doc = new DocLnk(nf);
665 currentFileName = "Unnamed"; 671 currentFileName = "Unnamed";
666 qDebug("newFile "+currentFileName); 672 qDebug("newFile "+currentFileName);
667 updateCaption( currentFileName); 673 updateCaption( currentFileName);
668// editor->setEdited( false); 674// editor->setEdited( false);
669} 675}
670 676
671void TextEdit::openDotFile( const QString &f ) { 677void TextEdit::openDotFile( const QString &f ) {
672 if(!currentFileName.isEmpty()) { 678 if(!currentFileName.isEmpty()) {
673 currentFileName=f; 679 currentFileName=f;
674 680
675 qDebug("openFile dotfile " + currentFileName); 681 qDebug("openFile dotfile " + currentFileName);
676 QString txt; 682 QString txt;
677 QFile file(f); 683 QFile file(f);
678 file.open(IO_ReadWrite); 684 file.open(IO_ReadWrite);
679 QTextStream t(&file); 685 QTextStream t(&file);
680 while ( !t.atEnd()) { 686 while ( !t.atEnd()) {
681 txt+=t.readLine(); 687 txt+=t.readLine();
682 } 688 }
683 editor->setText(txt); 689 editor->setText(txt);
684 editor->setEdited( false); 690 editor->setEdited( false);
685 edited1=false; 691 edited1=false;
686 edited=false; 692 edited=false;
687 693
688 694
689 } 695 }
690 updateCaption( currentFileName); 696 updateCaption( currentFileName);
691} 697}
692 698
693void TextEdit::openFile( const QString &f ) { 699void TextEdit::openFile( const QString &f ) {
694 qDebug("filename is "+ f); 700 qDebug("filename is "+ f);
695 QString filer; 701 QString filer;
696 QFileInfo fi( f); 702 QFileInfo fi( f);
697// bFromDocView = true; 703// bFromDocView = true;
698 if(f.find(".desktop",0,true) != -1 && !openDesktop) { 704 if(f.find(".desktop",0,true) != -1 && !openDesktop ) {
699 switch ( QMessageBox::warning(this,tr("Text Editor"), 705 switch ( QMessageBox::warning(this,tr("Text Editor"),
700 tr("Text Editor has detected<BR>you selected a <B>.desktop</B> 706 tr("Text Editor has detected<BR>you selected a <B>.desktop</B>
701file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), 707file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"),
702 tr(".desktop File"),tr("Linked Document"),0,1,1) ) { 708 tr(".desktop File"),tr("Linked Document"),0,1,1) ) {
703 case 0: 709 case 0:
704 filer = f; 710 filer = f;
705 break; 711 break;
706 case 1: 712 case 1:
707 DocLnk sf(f); 713 DocLnk sf(f);
708 filer = sf.file(); 714 filer = sf.file();
709 break; 715 break;
710 } 716 }
711 } else if(fi.baseName().left(1) == "") { 717 } else if(fi.baseName().left(1) == "") {
712 currentFileName=f; 718 currentFileName=f;
713 openDotFile(currentFileName); 719 openDotFile(currentFileName);
714 } else { 720 } else {
715 DocLnk sf(f); 721 DocLnk sf(f);
716 filer = sf.file(); 722 filer = sf.file();
717 if(filer.right(1) == "/") 723 if(filer.right(1) == "/")
718 filer = f; 724 filer = f;
719 } 725 }
720 726
721 DocLnk nf; 727 DocLnk nf;
722 nf.setType("text/plain"); 728 nf.setType("text/plain");
723 nf.setFile(filer); 729 nf.setFile(filer);
724 currentFileName=filer; 730 currentFileName=filer;
725 731
726 nf.setName(fi.baseName()); 732 nf.setName(fi.baseName());
727 openFile(nf); 733 openFile(nf);
728 734
729 qDebug("openFile string "+currentFileName); 735 qDebug("openFile string "+currentFileName);
730 736
731 showEditTools(); 737 showEditTools();
732 // Show filename in caption 738 // Show filename in caption
733 QString name = filer; 739 QString name = filer;
734 int sep = name.findRev( '/' ); 740 int sep = name.findRev( '/' );
735 if ( sep > 0 ) 741 if ( sep > 0 )
736 name = name.mid( sep+1 ); 742 name = name.mid( sep+1 );
737 updateCaption( name ); 743 updateCaption( name );
738} 744}
739 745
740void TextEdit::openFile( const DocLnk &f ) { 746void TextEdit::openFile( const DocLnk &f ) {
741// clear(); 747// clear();
742// bFromDocView = true; 748// bFromDocView = true;
743 FileManager fm; 749 FileManager fm;
744 QString txt; 750 QString txt;
745 currentFileName=f.file(); 751 currentFileName=f.file();
746 qDebug("openFile doclnk " + currentFileName); 752 qDebug("openFile doclnk " + currentFileName);
@@ -781,96 +787,98 @@ bool TextEdit::save() {
781 QString rt = editor->text(); 787 QString rt = editor->text();
782 if( !rt.isEmpty() ) { 788 if( !rt.isEmpty() ) {
783 if(name.isEmpty()) { 789 if(name.isEmpty()) {
784 saveAs(); 790 saveAs();
785 } else { 791 } else {
786 currentFileName= name ; 792 currentFileName= name ;
787 qDebug("saveFile "+currentFileName); 793 qDebug("saveFile "+currentFileName);
788 794
789 struct stat buf; 795 struct stat buf;
790 mode_t mode; 796 mode_t mode;
791 stat(file.latin1(), &buf); 797 stat(file.latin1(), &buf);
792 mode = buf.st_mode; 798 mode = buf.st_mode;
793 799
794 if(!fileIs) { 800 if(!fileIs) {
795 doc->setName( name); 801 doc->setName( name);
796 FileManager fm; 802 FileManager fm;
797 if ( !fm.saveFile( *doc, rt ) ) { 803 if ( !fm.saveFile( *doc, rt ) ) {
798 return false; 804 return false;
799 } 805 }
800 } else { 806 } else {
801 qDebug("regular save file"); 807 qDebug("regular save file");
802 QFile f(file); 808 QFile f(file);
803 if( f.open(IO_WriteOnly)) { 809 if( f.open(IO_WriteOnly)) {
804 QCString crt = rt.utf8(); 810 QCString crt = rt.utf8();
805 f.writeBlock(crt,crt.length()); 811 f.writeBlock(crt,crt.length());
806 } else { 812 } else {
807 QMessageBox::message(tr("Text Edit"),tr("Write Failed")); 813 QMessageBox::message(tr("Text Edit"),tr("Write Failed"));
808 return false; 814 return false;
809 } 815 }
810 816
811 } 817 }
812 editor->setEdited( false); 818 editor->setEdited( false);
813 edited1=false; 819 edited1=false;
814 edited=false; 820 edited=false;
815 if(caption().left(1)=="*") 821 if(caption().left(1)=="*")
816 setCaption(caption().right(caption().length()-1)); 822 setCaption(caption().right(caption().length()-1));
817 823
818 824
819 chmod( file.latin1(), mode); 825 chmod( file.latin1(), mode);
820 } 826 }
821 return true; 827 return true;
822 } 828 }
823 return false; 829 return false;
824} 830}
825 831
826/*! 832/*!
827 prompted save */ 833 prompted save */
828bool TextEdit::saveAs() { 834bool TextEdit::saveAs() {
835 if(caption() == tr("Text Editor"))
836 return false;
829 qDebug("saveAsFile " + currentFileName); 837 qDebug("saveAsFile " + currentFileName);
830 // case of nothing to save... 838 // case of nothing to save...
831// if ( !doc && !currentFileName.isEmpty()) { 839// if ( !doc && !currentFileName.isEmpty()) {
832// //|| !bFromDocView) 840// //|| !bFromDocView)
833// qDebug("no doc"); 841// qDebug("no doc");
834// return true; 842// return true;
835// } 843// }
836// if ( !editor->edited() ) { 844// if ( !editor->edited() ) {
837// delete doc; 845// delete doc;
838// doc = 0; 846// doc = 0;
839// return true; 847// return true;
840// } 848// }
841 849
842 QString rt = editor->text(); 850 QString rt = editor->text();
843 qDebug(currentFileName); 851 qDebug(currentFileName);
844 852
845 if( currentFileName.isEmpty() 853 if( currentFileName.isEmpty()
846 || currentFileName == tr("Unnamed") 854 || currentFileName == tr("Unnamed")
847 || currentFileName == tr("Text Editor")) { 855 || currentFileName == tr("Text Editor")) {
848 qDebug("do silly TT filename thing"); 856 qDebug("do silly TT filename thing");
849// if ( doc && doc->name().isEmpty() ) { 857// if ( doc && doc->name().isEmpty() ) {
850 QString pt = rt.simplifyWhiteSpace(); 858 QString pt = rt.simplifyWhiteSpace();
851 int i = pt.find( ' ' ); 859 int i = pt.find( ' ' );
852 QString docname = pt; 860 QString docname = pt;
853 if ( i > 0 ) 861 if ( i > 0 )
854 docname = pt.left( i ); 862 docname = pt.left( i );
855 // remove "." at the beginning 863 // remove "." at the beginning
856 while( docname.startsWith( "." ) ) 864 while( docname.startsWith( "." ) )
857 docname = docname.mid( 1 ); 865 docname = docname.mid( 1 );
858 docname.replace( QRegExp("/"), "_" ); 866 docname.replace( QRegExp("/"), "_" );
859 // cut the length. filenames longer than that 867 // cut the length. filenames longer than that
860 //don't make sense and something goes wrong when they get too long. 868 //don't make sense and something goes wrong when they get too long.
861 if ( docname.length() > 40 ) 869 if ( docname.length() > 40 )
862 docname = docname.left(40); 870 docname = docname.left(40);
863 if ( docname.isEmpty() ) 871 if ( docname.isEmpty() )
864 docname = tr("Unnamed"); 872 docname = tr("Unnamed");
865 if(doc) doc->setName(docname); 873 if(doc) doc->setName(docname);
866 currentFileName=docname; 874 currentFileName=docname;
867// } 875// }
868// else 876// else
869// qDebug("hmmmmmm"); 877// qDebug("hmmmmmm");
870 } 878 }
871 879
872 880
873 QMap<QString, QStringList> map; 881 QMap<QString, QStringList> map;
874 map.insert(tr("All"), QStringList() ); 882 map.insert(tr("All"), QStringList() );
875 QStringList text; 883 QStringList text;
876 text << "text/*"; 884 text << "text/*";
@@ -918,156 +926,163 @@ bool TextEdit::saveAs() {
918 0,(const QString &)fileNm); 926 0,(const QString &)fileNm);
919 filePerm->showMaximized(); 927 filePerm->showMaximized();
920 filePerm->exec(); 928 filePerm->exec();
921 929
922 if( filePerm) 930 if( filePerm)
923 delete filePerm; 931 delete filePerm;
924 } 932 }
925// } 933// }
926 editor->setEdited( false); 934 editor->setEdited( false);
927 edited1 = false; 935 edited1 = false;
928 edited = false; 936 edited = false;
929 if(caption().left(1)=="*") 937 if(caption().left(1)=="*")
930 setCaption(caption().right(caption().length()-1)); 938 setCaption(caption().right(caption().length()-1));
931 939
932 return true; 940 return true;
933 } 941 }
934 qDebug("returning false"); 942 qDebug("returning false");
935 return false; 943 return false;
936} //end saveAs 944} //end saveAs
937 945
938void TextEdit::clear() { 946void TextEdit::clear() {
939 delete doc; 947 delete doc;
940 doc = 0; 948 doc = 0;
941 editor->clear(); 949 editor->clear();
942} 950}
943 951
944void TextEdit::updateCaption( const QString &name ) { 952void TextEdit::updateCaption( const QString &name ) {
945 953
946 if ( name.isEmpty() ) 954 if ( name.isEmpty() )
947 setCaption( tr("Text Editor") ); 955 setCaption( tr("Text Editor") );
948 else { 956 else {
949 QString s = name; 957 QString s = name;
950 if ( s.isNull() ) 958 if ( s.isNull() )
951 s = doc->name(); 959 s = doc->name();
952 if ( s.isEmpty() ) { 960 if ( s.isEmpty() ) {
953 s = tr( "Unnamed" ); 961 s = tr( "Unnamed" );
954 currentFileName=s; 962 currentFileName=s;
955 } 963 }
956// if(s.left(1) == "/") 964// if(s.left(1) == "/")
957// s = s.right(s.length()-1); 965// s = s.right(s.length()-1);
958 setCaption( s + " - " + tr("Text Editor") ); 966 setCaption( s + " - " + tr("Text Editor") );
959 } 967 }
960} 968}
961 969
962void TextEdit::setDocument(const QString& fileref) { 970void TextEdit::setDocument(const QString& fileref) {
963 if(fileref != "Unnamed") { 971 if(fileref != "Unnamed") {
964 currentFileName=fileref; 972 currentFileName=fileref;
965 qDebug("setDocument"); 973 qDebug("setDocument");
966 QFileInfo fi(currentFileName); 974 QFileInfo fi(currentFileName);
967 qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName); 975 qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName);
968 if(fi.baseName().left(1) == "") { 976 if(fi.baseName().left(1) == "") {
969// openDotFile(currentFileName); 977 // openDotFile(currentFileName);
970 } else { 978 } else {
971 qDebug("setDoc open"); 979 qDebug("setDoc open");
972 bFromDocView = true; 980 bFromDocView = true;
973 openFile(fileref); 981 openFile(fileref);
974 editor->setEdited(true); 982 editor->setEdited(true);
975 edited1=false; 983 edited1=false;
976 edited=true; 984 edited=true;
977 985 // fromSetDocument=false;
978// doSearchBar(); 986 // doSearchBar();
979 } 987 }
980 } 988 }
981 updateCaption( currentFileName); 989 updateCaption( currentFileName);
982} 990}
983 991
984void TextEdit::changeFont() { 992void TextEdit::changeFont() {
985 QDialog *d = new QDialog ( this, "FontDialog", true ); 993 QDialog *d = new QDialog ( this, "FontDialog", true );
986 d-> setCaption ( tr( "Choose font" )); 994 d-> setCaption ( tr( "Choose font" ));
987 QBoxLayout *lay = new QVBoxLayout ( d ); 995 QBoxLayout *lay = new QVBoxLayout ( d );
988 OFontSelector *ofs = new OFontSelector ( true, d ); 996 OFontSelector *ofs = new OFontSelector ( true, d );
989 lay-> addWidget ( ofs ); 997 lay-> addWidget ( ofs );
990 ofs-> setSelectedFont ( editor-> font ( )); 998 ofs-> setSelectedFont ( editor-> font ( ));
991 999
992 d-> showMaximized ( ); 1000 d-> showMaximized ( );
993 if ( d-> exec ( ) == QDialog::Accepted ) 1001 if ( d-> exec ( ) == QDialog::Accepted )
994 editor-> setFont ( ofs-> selectedFont ( )); 1002 editor-> setFont ( ofs-> selectedFont ( ));
995 delete d; 1003 delete d;
996 1004
997} 1005}
998 1006
999void TextEdit::editDelete() { 1007void TextEdit::editDelete() {
1000 switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) { 1008 switch ( QMessageBox::warning(this,tr("Text Editor"),
1009 tr("Do you really want<BR>to <B>delete</B> "
1010 "the current file\nfrom the disk?<BR>This is "
1011 "<B>irreversable!!</B>"),
1012 tr("Yes"),tr("No"),0,0,1) ) {
1001 case 0: 1013 case 0:
1002 if(doc) { 1014 if(doc) {
1003 doc->removeFiles(); 1015 doc->removeFiles();
1004 clear(); 1016 clear();
1005 setCaption( tr("Text Editor") ); 1017 setCaption( tr("Text Editor") );
1006 } 1018 }
1007 break; 1019 break;
1008 case 1: 1020 case 1:
1009 // exit 1021 // exit
1010 break; 1022 break;
1011 }; 1023 };
1012} 1024}
1013 1025
1014void TextEdit::changeStartConfig( bool b ) { 1026void TextEdit::changeStartConfig( bool b ) {
1015 startWithNew=b; 1027 startWithNew=b;
1016 Config cfg("TextEdit"); 1028 Config cfg("TextEdit");
1017 cfg.setGroup("View"); 1029 cfg.setGroup("View");
1018 cfg.writeEntry("startNew",b); 1030 cfg.writeEntry("startNew",b);
1019 update(); 1031 update();
1020} 1032}
1021 1033
1022void TextEdit::editorChanged() { 1034void TextEdit::editorChanged() {
1023 if(editor->edited() && edited && !edited1) { 1035// qDebug("editor changed");
1036 if( /*editor->edited() &&*/ /*edited && */!edited1) {
1024 setCaption( "*"+caption()); 1037 setCaption( "*"+caption());
1025 edited1=true; 1038 edited1=true;
1026 } 1039 }
1027 edited=true; 1040 edited=true;
1028} 1041}
1029 1042
1030void TextEdit::receive(const QCString&msg, const QByteArray&) { 1043void TextEdit::receive(const QCString&msg, const QByteArray &data) {
1031 qDebug("QCop "+msg); 1044 qDebug("QCop "+msg);
1032 if ( msg == "setDocument(QString)" ) { 1045 if ( msg == "setDocument(QString)" ) {
1033 qDebug("bugger all"); 1046 qDebug("bugger all");
1047
1034 } 1048 }
1035 1049
1036} 1050}
1051
1037void TextEdit::doAbout() { 1052void TextEdit::doAbout() {
1038 QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" 1053 QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>"
1039 "2000 Trolltech AS, and<BR>" 1054 "2000 Trolltech AS, and<BR>"
1040 "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" 1055 "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>"
1041 "and is licensed under the GPL")); 1056 "and is licensed under the GPL"));
1042} 1057}
1043 1058
1044void TextEdit::doPrompt(bool b) { 1059void TextEdit::doPrompt(bool b) {
1045 promptExit=b; 1060 promptExit=b;
1046 Config cfg("TextEdit"); 1061 Config cfg("TextEdit");
1047 cfg.setGroup ( "View" ); 1062 cfg.setGroup ( "View" );
1048 cfg.writeEntry ( "PromptExit", b); 1063 cfg.writeEntry ( "PromptExit", b);
1049} 1064}
1050 1065
1051void TextEdit::doDesktop(bool b) { 1066void TextEdit::doDesktop(bool b) {
1052 openDesktop=b; 1067 openDesktop=b;
1053 Config cfg("TextEdit"); 1068 Config cfg("TextEdit");
1054 cfg.setGroup ( "View" ); 1069 cfg.setGroup ( "View" );
1055 cfg.writeEntry ( "OpenDesktop", b); 1070 cfg.writeEntry ( "OpenDesktop", b);
1056} 1071}
1057 1072
1058void TextEdit::doFilePerms(bool b) { 1073void TextEdit::doFilePerms(bool b) {
1059 filePerms=b; 1074 filePerms=b;
1060 Config cfg("TextEdit"); 1075 Config cfg("TextEdit");
1061 cfg.setGroup ( "View" ); 1076 cfg.setGroup ( "View" );
1062 cfg.writeEntry ( "FilePermissions", b); 1077 cfg.writeEntry ( "FilePermissions", b);
1063} 1078}
1064 1079
1065void TextEdit::editPasteTimeDate() { 1080void TextEdit::editPasteTimeDate() {
1066#ifndef QT_NO_CLIPBOARD 1081#ifndef QT_NO_CLIPBOARD
1067 QClipboard *cb = QApplication::clipboard(); 1082 QClipboard *cb = QApplication::clipboard();
1068 QDateTime dt = QDateTime::currentDateTime(); 1083 QDateTime dt = QDateTime::currentDateTime();
1069 cb->setText( dt.toString()); 1084 cb->setText( dt.toString());
1070 editor->paste(); 1085 editor->paste();
1071#endif 1086#endif
1072} 1087}
1073 1088
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index bb7d693..9f16ebf 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -71,61 +71,62 @@ private slots:
71 void editPasteTimeDate(); 71 void editPasteTimeDate();
72 void doPrompt(bool); 72 void doPrompt(bool);
73 void doDesktop(bool); 73 void doDesktop(bool);
74 void doFilePerms(bool); 74 void doFilePerms(bool);
75 void doAbout(); 75 void doAbout();
76 void setDocument(const QString&); 76 void setDocument(const QString&);
77 void changeFont(); 77 void changeFont();
78 void fileNew(); 78 void fileNew();
79 void fileRevert(); 79 void fileRevert();
80 void fileOpen(); 80 void fileOpen();
81 void changeStartConfig(bool); 81 void changeStartConfig(bool);
82 bool save(); 82 bool save();
83 bool saveAs(); 83 bool saveAs();
84 void cleanUp(); 84 void cleanUp();
85 85
86 86
87 void editCut(); 87 void editCut();
88 void editCopy(); 88 void editCopy();
89 void editPaste(); 89 void editPaste();
90 void editFind(); 90 void editFind();
91 void editDelete(); 91 void editDelete();
92 92
93 void findNext(); 93 void findNext();
94 void findClose(); 94 void findClose();
95 95
96 void search(); 96 void search();
97 void accept(); 97 void accept();
98 98
99 void newFile( const DocLnk & ); 99 void newFile( const DocLnk & );
100 void openFile( const DocLnk & ); 100 void openFile( const DocLnk & );
101 void showEditTools(); 101 void showEditTools();
102 102
103 void zoomIn(); 103 void zoomIn();
104 void zoomOut(); 104 void zoomOut();
105 void setBold(bool y); 105 void setBold(bool y);
106 void setItalic(bool y); 106 void setItalic(bool y);
107 void setWordWrap(bool y); 107 void setWordWrap(bool y);
108 void setSearchBar(bool); 108 void setSearchBar(bool);
109 109
110private: 110private:
111 void openDotFile(const QString &); 111 void openDotFile(const QString &);
112 void colorChanged( const QColor &c ); 112 void colorChanged( const QColor &c );
113 void clear(); 113 void clear();
114 void updateCaption( const QString &name=QString::null ); 114 void updateCaption( const QString &name=QString::null );
115 void setFontSize(int sz, bool round_down_not_up); 115 void setFontSize(int sz, bool round_down_not_up);
116private: 116private:
117// fileSaver *fileSaveDlg; 117// fileSaver *fileSaveDlg;
118// fileBrowser *browseForFiles; 118// fileBrowser *browseForFiles;
119 bool fromSetDocument;
119 QpeEditor* editor; 120 QpeEditor* editor;
120 QToolBar *menu, *editBar, *searchBar; 121 QToolBar *menu, *editBar, *searchBar;
121 QPopupMenu *advancedMenu; 122 QPopupMenu *advancedMenu;
122 QLineEdit *searchEdit; 123 QLineEdit *searchEdit;
123 DocLnk *doc; 124 DocLnk *doc;
124 bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar, startWithNew; 125 bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar, startWithNew;
125 bool bFromDocView; 126 bool bFromDocView;
126 int viewSelection; 127 int viewSelection;
127 QAction *zin, *zout; 128 QAction *zin, *zout;
128 QString currentFileName; 129 QString currentFileName;
129}; 130};
130 131
131#endif 132#endif