author | llornkcor <llornkcor> | 2002-05-29 15:24:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-29 15:24:04 (UTC) |
commit | ceaf90ad848c69d693f0c9eedbc8f9ab1935e42f (patch) (unidiff) | |
tree | d66941f764e2c162b1707881ce44b8d396651f98 | |
parent | 949c238e785ad1060db41690bb60b1e252824708 (diff) | |
download | opie-ceaf90ad848c69d693f0c9eedbc8f9ab1935e42f.zip opie-ceaf90ad848c69d693f0c9eedbc8f9ab1935e42f.tar.gz opie-ceaf90ad848c69d693f0c9eedbc8f9ab1935e42f.tar.bz2 |
: is not the proper way to end a line in C, nor C++.. please use a ; next time
-rw-r--r-- | core/apps/textedit/textedit.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 403bd92..f89ed6d 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -385,257 +385,257 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
385 | 385 | ||
386 | editor = new QpeEditor( this ); | 386 | editor = new QpeEditor( this ); |
387 | setCentralWidget( editor ); | 387 | setCentralWidget( editor ); |
388 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 388 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
389 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); | 389 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); |
390 | 390 | ||
391 | // resize( 200, 300 ); | 391 | // resize( 200, 300 ); |
392 | 392 | ||
393 | // setFontSize(defsize,TRUE); | 393 | // setFontSize(defsize,TRUE); |
394 | FontDatabase fdb; | 394 | FontDatabase fdb; |
395 | QFont defaultFont=editor->font(); | 395 | QFont defaultFont=editor->font(); |
396 | QFontInfo fontInfo(defaultFont); | 396 | QFontInfo fontInfo(defaultFont); |
397 | 397 | ||
398 | cfg.setGroup("Font"); | 398 | cfg.setGroup("Font"); |
399 | QString family = cfg.readEntry("Family", fontInfo.family()); | 399 | QString family = cfg.readEntry("Family", fontInfo.family()); |
400 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); | 400 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); |
401 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); | 401 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); |
402 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); | 402 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); |
403 | 403 | ||
404 | defaultFont = fdb.font(family,style,i_size,charSet); | 404 | defaultFont = fdb.font(family,style,i_size,charSet); |
405 | editor->setFont( defaultFont); | 405 | editor->setFont( defaultFont); |
406 | 406 | ||
407 | wa->setOn(wrap); | 407 | wa->setOn(wrap); |
408 | updateCaption(); | 408 | updateCaption(); |
409 | 409 | ||
410 | cfg.setGroup("View"); | 410 | cfg.setGroup("View"); |
411 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { | 411 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { |
412 | nStart->setOn(TRUE); | 412 | nStart->setOn(TRUE); |
413 | fileNew(); | 413 | fileNew(); |
414 | } else { | 414 | } else { |
415 | fileOpen(); | 415 | fileOpen(); |
416 | } | 416 | } |
417 | 417 | ||
418 | viewSelection = cfg.readNumEntry( "FileView", 0 ); | 418 | viewSelection = cfg.readNumEntry( "FileView", 0 ); |
419 | } | 419 | } |
420 | 420 | ||
421 | void TextEdit::cleanUp() | 421 | void TextEdit::cleanUp() |
422 | { | 422 | { |
423 | // save(); | 423 | // save(); |
424 | Config cfg("TextEdit"); | 424 | Config cfg("TextEdit"); |
425 | cfg.setGroup("View"); | 425 | cfg.setGroup("View"); |
426 | QFont f = editor->font(); | 426 | QFont f = editor->font(); |
427 | cfg.writeEntry("FontSize",f.pointSize()); | 427 | cfg.writeEntry("FontSize",f.pointSize()); |
428 | cfg.writeEntry("Bold",f.bold()); | 428 | cfg.writeEntry("Bold",f.bold()); |
429 | cfg.writeEntry("Italic",f.italic()); | 429 | cfg.writeEntry("Italic",f.italic()); |
430 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); | 430 | cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); |
431 | cfg.writeEntry( "FileView", viewSelection ); | 431 | cfg.writeEntry( "FileView", viewSelection ); |
432 | 432 | ||
433 | } | 433 | } |
434 | 434 | ||
435 | TextEdit::~TextEdit() | 435 | TextEdit::~TextEdit() |
436 | { | 436 | { |
437 | } | 437 | } |
438 | 438 | ||
439 | void TextEdit::zoomIn() | 439 | void TextEdit::zoomIn() |
440 | { | 440 | { |
441 | setFontSize(editor->font().pointSize()+1,FALSE); | 441 | setFontSize(editor->font().pointSize()+1,FALSE); |
442 | } | 442 | } |
443 | 443 | ||
444 | void TextEdit::zoomOut() | 444 | void TextEdit::zoomOut() |
445 | { | 445 | { |
446 | setFontSize(editor->font().pointSize()-1,TRUE); | 446 | setFontSize(editor->font().pointSize()-1,TRUE); |
447 | } | 447 | } |
448 | 448 | ||
449 | 449 | ||
450 | void TextEdit::setFontSize(int sz, bool round_down_not_up) | 450 | void TextEdit::setFontSize(int sz, bool round_down_not_up) |
451 | { | 451 | { |
452 | int s=10; | 452 | int s=10; |
453 | for (int i=0; i<nfontsizes; i++) { | 453 | for (int i=0; i<nfontsizes; i++) { |
454 | if ( fontsize[i] == sz ) { | 454 | if ( fontsize[i] == sz ) { |
455 | s = sz; | 455 | s = sz; |
456 | break; | 456 | break; |
457 | } else if ( round_down_not_up ) { | 457 | } else if ( round_down_not_up ) { |
458 | if ( fontsize[i] < sz ) | 458 | if ( fontsize[i] < sz ) |
459 | s = fontsize[i]; | 459 | s = fontsize[i]; |
460 | } else { | 460 | } else { |
461 | if ( fontsize[i] > sz ) { | 461 | if ( fontsize[i] > sz ) { |
462 | s = fontsize[i]; | 462 | s = fontsize[i]; |
463 | break; | 463 | break; |
464 | } | 464 | } |
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
468 | QFont f = editor->font(); | 468 | QFont f = editor->font(); |
469 | f.setPointSize(s); | 469 | f.setPointSize(s); |
470 | editor->setFont(f); | 470 | editor->setFont(f); |
471 | 471 | ||
472 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 472 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
473 | zout->setEnabled(s != fontsize[0]); | 473 | zout->setEnabled(s != fontsize[0]); |
474 | } | 474 | } |
475 | 475 | ||
476 | void TextEdit::setBold(bool y) | 476 | void TextEdit::setBold(bool y) |
477 | { | 477 | { |
478 | QFont f = editor->font(); | 478 | QFont f = editor->font(); |
479 | f.setBold(y); | 479 | f.setBold(y); |
480 | editor->setFont(f); | 480 | editor->setFont(f); |
481 | } | 481 | } |
482 | 482 | ||
483 | void TextEdit::setItalic(bool y) | 483 | void TextEdit::setItalic(bool y) |
484 | { | 484 | { |
485 | QFont f = editor->font(); | 485 | QFont f = editor->font(); |
486 | f.setItalic(y); | 486 | f.setItalic(y); |
487 | editor->setFont(f); | 487 | editor->setFont(f); |
488 | } | 488 | } |
489 | 489 | ||
490 | void TextEdit::setWordWrap(bool y) | 490 | void TextEdit::setWordWrap(bool y) |
491 | { | 491 | { |
492 | bool state = editor->edited(); | 492 | bool state = editor->edited(); |
493 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 493 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
494 | editor->setEdited( state ); | 494 | editor->setEdited( state ); |
495 | } | 495 | } |
496 | 496 | ||
497 | void TextEdit::fileNew() | 497 | void TextEdit::fileNew() |
498 | { | 498 | { |
499 | // if( !bFromDocView ) { | 499 | // if( !bFromDocView ) { |
500 | // saveAs(); | 500 | // saveAs(); |
501 | // } | 501 | // } |
502 | newFile(DocLnk()); | 502 | newFile(DocLnk()); |
503 | } | 503 | } |
504 | 504 | ||
505 | void TextEdit::fileOpen() | 505 | void TextEdit::fileOpen() |
506 | { | 506 | { |
507 | Config cfg("TextEdit"); | 507 | Config cfg("TextEdit"); |
508 | cfg.setGroup("View"); | 508 | cfg.setGroup("View"); |
509 | bool b=FALSE; | 509 | bool b=FALSE; |
510 | // if(cfg.readEntry("useOldFileDialog") == "TRUE") | 510 | // if(cfg.readEntry("useOldFileDialog") == "TRUE") |
511 | // b=TRUE; | 511 | // b=TRUE; |
512 | // if(!b) { | 512 | // if(!b) { |
513 | QString str = OFileDialog::getOpenFileName( 1,"/")://,"", "*", this ); | 513 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
514 | if(!str.isEmpty() ) | 514 | if(!str.isEmpty() ) |
515 | openFile( str ); | 515 | openFile( str ); |
516 | // } else { | 516 | // } else { |
517 | // QString str; | 517 | // QString str; |
518 | // browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); // | 518 | // browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); // |
519 | // browseForFiles->setFileView( viewSelection ); | 519 | // browseForFiles->setFileView( viewSelection ); |
520 | // browseForFiles->showMaximized(); | 520 | // browseForFiles->showMaximized(); |
521 | // // if( result != -1 ) | 521 | // // if( result != -1 ) |
522 | 522 | ||
523 | // if( browseForFiles->exec() != -1 ) { | 523 | // if( browseForFiles->exec() != -1 ) { |
524 | // QString selFile = browseForFiles->selectedFileName; | 524 | // QString selFile = browseForFiles->selectedFileName; |
525 | // QStringList fileList = browseForFiles->fileList; | 525 | // QStringList fileList = browseForFiles->fileList; |
526 | // qDebug(selFile); | 526 | // qDebug(selFile); |
527 | // QStringList::ConstIterator f; | 527 | // QStringList::ConstIterator f; |
528 | // QString fileTemp; | 528 | // QString fileTemp; |
529 | // for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 529 | // for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
530 | // fileTemp = *f; | 530 | // fileTemp = *f; |
531 | // fileTemp.right( fileTemp.length()-5); | 531 | // fileTemp.right( fileTemp.length()-5); |
532 | // QString fileName = fileTemp; | 532 | // QString fileName = fileTemp; |
533 | // if( fileName != "Unnamed" || fileName != "Empty Text" ) { | 533 | // if( fileName != "Unnamed" || fileName != "Empty Text" ) { |
534 | // currentFileName = fileName; | 534 | // currentFileName = fileName; |
535 | // qDebug("please open "+currentFileName); | 535 | // qDebug("please open "+currentFileName); |
536 | // openFile(currentFileName ); | 536 | // openFile(currentFileName ); |
537 | // } | 537 | // } |
538 | // } | 538 | // } |
539 | // viewSelection = browseForFiles->SelectionCombo->currentItem(); | 539 | // viewSelection = browseForFiles->SelectionCombo->currentItem(); |
540 | // } | 540 | // } |
541 | // delete browseForFiles; | 541 | // delete browseForFiles; |
542 | // editor->setEdited( FALSE); | 542 | // editor->setEdited( FALSE); |
543 | // edited1=FALSE; | 543 | // edited1=FALSE; |
544 | // edited=FALSE; | 544 | // edited=FALSE; |
545 | // if(caption().left(1)=="*") | 545 | // if(caption().left(1)=="*") |
546 | // setCaption(caption().right(caption().length()-1)); | 546 | // setCaption(caption().right(caption().length()-1)); |
547 | // doSearchBar(); | 547 | // doSearchBar(); |
548 | // } | 548 | // } |
549 | 549 | ||
550 | } | 550 | } |
551 | 551 | ||
552 | void TextEdit::doSearchBar() | 552 | void TextEdit::doSearchBar() |
553 | { | 553 | { |
554 | Config cfg("TextEdit"); | 554 | Config cfg("TextEdit"); |
555 | cfg.setGroup("View"); | 555 | cfg.setGroup("View"); |
556 | if(cfg.readEntry("SearchBar","Closed") != "Opened") | 556 | if(cfg.readEntry("SearchBar","Closed") != "Opened") |
557 | searchBar->hide(); | 557 | searchBar->hide(); |
558 | } | 558 | } |
559 | 559 | ||
560 | #if 0 | 560 | #if 0 |
561 | void TextEdit::slotFind() | 561 | void TextEdit::slotFind() |
562 | { | 562 | { |
563 | FindDialog frmFind( tr("Text Editor"), this ); | 563 | FindDialog frmFind( tr("Text Editor"), this ); |
564 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 564 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
565 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 565 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
566 | 566 | ||
567 | //case sensitive, backwards, [category] | 567 | //case sensitive, backwards, [category] |
568 | 568 | ||
569 | connect( editor, SIGNAL(notFound()), | 569 | connect( editor, SIGNAL(notFound()), |
570 | &frmFind, SLOT(slotNotFound()) ); | 570 | &frmFind, SLOT(slotNotFound()) ); |
571 | connect( editor, SIGNAL(searchWrapped()), | 571 | connect( editor, SIGNAL(searchWrapped()), |
572 | &frmFind, SLOT(slotWrapAround()) ); | 572 | &frmFind, SLOT(slotWrapAround()) ); |
573 | 573 | ||
574 | frmFind.exec(); | 574 | frmFind.exec(); |
575 | 575 | ||
576 | 576 | ||
577 | } | 577 | } |
578 | #endif | 578 | #endif |
579 | 579 | ||
580 | void TextEdit::fileRevert() | 580 | void TextEdit::fileRevert() |
581 | { | 581 | { |
582 | clear(); | 582 | clear(); |
583 | fileOpen(); | 583 | fileOpen(); |
584 | } | 584 | } |
585 | 585 | ||
586 | void TextEdit::editCut() | 586 | void TextEdit::editCut() |
587 | { | 587 | { |
588 | #ifndef QT_NO_CLIPBOARD | 588 | #ifndef QT_NO_CLIPBOARD |
589 | editor->cut(); | 589 | editor->cut(); |
590 | #endif | 590 | #endif |
591 | } | 591 | } |
592 | 592 | ||
593 | void TextEdit::editCopy() | 593 | void TextEdit::editCopy() |
594 | { | 594 | { |
595 | #ifndef QT_NO_CLIPBOARD | 595 | #ifndef QT_NO_CLIPBOARD |
596 | editor->copy(); | 596 | editor->copy(); |
597 | #endif | 597 | #endif |
598 | } | 598 | } |
599 | 599 | ||
600 | void TextEdit::editPaste() | 600 | void TextEdit::editPaste() |
601 | { | 601 | { |
602 | #ifndef QT_NO_CLIPBOARD | 602 | #ifndef QT_NO_CLIPBOARD |
603 | editor->paste(); | 603 | editor->paste(); |
604 | #endif | 604 | #endif |
605 | } | 605 | } |
606 | 606 | ||
607 | void TextEdit::editFind() | 607 | void TextEdit::editFind() |
608 | { | 608 | { |
609 | searchBar->show(); | 609 | searchBar->show(); |
610 | searchVisible = TRUE; | 610 | searchVisible = TRUE; |
611 | searchEdit->setFocus(); | 611 | searchEdit->setFocus(); |
612 | Config cfg("TextEdit"); | 612 | Config cfg("TextEdit"); |
613 | cfg.setGroup("View"); | 613 | cfg.setGroup("View"); |
614 | cfg.writeEntry("SearchBar","Opened"); | 614 | cfg.writeEntry("SearchBar","Opened"); |
615 | 615 | ||
616 | } | 616 | } |
617 | 617 | ||
618 | void TextEdit::findNext() | 618 | void TextEdit::findNext() |
619 | { | 619 | { |
620 | editor->find( searchEdit->text(), FALSE, FALSE ); | 620 | editor->find( searchEdit->text(), FALSE, FALSE ); |
621 | 621 | ||
622 | } | 622 | } |
623 | 623 | ||
624 | void TextEdit::findClose() | 624 | void TextEdit::findClose() |
625 | { | 625 | { |
626 | searchVisible = FALSE; | 626 | searchVisible = FALSE; |
627 | searchBar->hide(); | 627 | searchBar->hide(); |
628 | Config cfg("TextEdit"); | 628 | Config cfg("TextEdit"); |
629 | cfg.setGroup("View"); | 629 | cfg.setGroup("View"); |
630 | cfg.writeEntry("SearchBar","Closed"); | 630 | cfg.writeEntry("SearchBar","Closed"); |
631 | cfg.write(); | 631 | cfg.write(); |
632 | } | 632 | } |
633 | 633 | ||
634 | void TextEdit::search() | 634 | void TextEdit::search() |
635 | { | 635 | { |
636 | editor->find( searchEdit->text(), FALSE, FALSE ); | 636 | editor->find( searchEdit->text(), FALSE, FALSE ); |
637 | } | 637 | } |
638 | 638 | ||
639 | void TextEdit::newFile( const DocLnk &f ) | 639 | void TextEdit::newFile( const DocLnk &f ) |
640 | { | 640 | { |
641 | DocLnk nf = f; | 641 | DocLnk nf = f; |