summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
authorllornkcor <llornkcor>2002-03-24 14:17:21 (UTC)
committer llornkcor <llornkcor>2002-03-24 14:17:21 (UTC)
commit927d5f33cc4c36541d7fb7dde036bdd22f5d7253 (patch) (unidiff)
treecd846d8b462131c8c06c2ddf5787171449b8521e /core/apps/textedit/textedit.cpp
parent807ea39f3ccfbc26e769fc16a79d459327e13437 (diff)
downloadopie-927d5f33cc4c36541d7fb7dde036bdd22f5d7253.zip
opie-927d5f33cc4c36541d7fb7dde036bdd22f5d7253.tar.gz
opie-927d5f33cc4c36541d7fb7dde036bdd22f5d7253.tar.bz2
changed things in filebrowser
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 1a1b186..da74893 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -404,194 +404,194 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
404 } else { 404 } else {
405 fileOpen(); 405 fileOpen();
406 } 406 }
407 viewSelection = cfg.readNumEntry( "FileView", 0 ); 407 viewSelection = cfg.readNumEntry( "FileView", 0 );
408} 408}
409 409
410void TextEdit::cleanUp() 410void TextEdit::cleanUp()
411{ 411{
412// save(); 412// save();
413 Config cfg("TextEdit"); 413 Config cfg("TextEdit");
414 cfg.setGroup("View"); 414 cfg.setGroup("View");
415 QFont f = editor->font(); 415 QFont f = editor->font();
416 cfg.writeEntry("FontSize",f.pointSize()); 416 cfg.writeEntry("FontSize",f.pointSize());
417 cfg.writeEntry("Bold",f.bold()); 417 cfg.writeEntry("Bold",f.bold());
418 cfg.writeEntry("Italic",f.italic()); 418 cfg.writeEntry("Italic",f.italic());
419 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); 419 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth);
420 cfg.writeEntry( "FileView", viewSelection ); 420 cfg.writeEntry( "FileView", viewSelection );
421 421
422} 422}
423 423
424TextEdit::~TextEdit() 424TextEdit::~TextEdit()
425{ 425{
426} 426}
427 427
428void TextEdit::zoomIn() 428void TextEdit::zoomIn()
429{ 429{
430 setFontSize(editor->font().pointSize()+1,FALSE); 430 setFontSize(editor->font().pointSize()+1,FALSE);
431} 431}
432 432
433void TextEdit::zoomOut() 433void TextEdit::zoomOut()
434{ 434{
435 setFontSize(editor->font().pointSize()-1,TRUE); 435 setFontSize(editor->font().pointSize()-1,TRUE);
436} 436}
437 437
438 438
439void TextEdit::setFontSize(int sz, bool round_down_not_up) 439void TextEdit::setFontSize(int sz, bool round_down_not_up)
440{ 440{
441 int s=10; 441 int s=10;
442 for (int i=0; i<nfontsizes; i++) { 442 for (int i=0; i<nfontsizes; i++) {
443 if ( fontsize[i] == sz ) { 443 if ( fontsize[i] == sz ) {
444 s = sz; 444 s = sz;
445 break; 445 break;
446 } else if ( round_down_not_up ) { 446 } else if ( round_down_not_up ) {
447 if ( fontsize[i] < sz ) 447 if ( fontsize[i] < sz )
448 s = fontsize[i]; 448 s = fontsize[i];
449 } else { 449 } else {
450 if ( fontsize[i] > sz ) { 450 if ( fontsize[i] > sz ) {
451 s = fontsize[i]; 451 s = fontsize[i];
452 break; 452 break;
453 } 453 }
454 } 454 }
455 } 455 }
456 456
457 QFont f = editor->font(); 457 QFont f = editor->font();
458 f.setPointSize(s); 458 f.setPointSize(s);
459 editor->setFont(f); 459 editor->setFont(f);
460 460
461 zin->setEnabled(s != fontsize[nfontsizes-1]); 461 zin->setEnabled(s != fontsize[nfontsizes-1]);
462 zout->setEnabled(s != fontsize[0]); 462 zout->setEnabled(s != fontsize[0]);
463} 463}
464 464
465void TextEdit::setBold(bool y) 465void TextEdit::setBold(bool y)
466{ 466{
467 QFont f = editor->font(); 467 QFont f = editor->font();
468 f.setBold(y); 468 f.setBold(y);
469 editor->setFont(f); 469 editor->setFont(f);
470} 470}
471 471
472void TextEdit::setItalic(bool y) 472void TextEdit::setItalic(bool y)
473{ 473{
474 QFont f = editor->font(); 474 QFont f = editor->font();
475 f.setItalic(y); 475 f.setItalic(y);
476 editor->setFont(f); 476 editor->setFont(f);
477} 477}
478 478
479void TextEdit::setWordWrap(bool y) 479void TextEdit::setWordWrap(bool y)
480{ 480{
481 bool state = editor->edited(); 481 bool state = editor->edited();
482 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 482 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
483 editor->setEdited( state ); 483 editor->setEdited( state );
484} 484}
485 485
486void TextEdit::fileNew() 486void TextEdit::fileNew()
487{ 487{
488 if( !bFromDocView ) { 488 if( !bFromDocView ) {
489 saveAs(); 489 saveAs();
490 } 490 }
491 newFile(DocLnk()); 491 newFile(DocLnk());
492} 492}
493 493
494void TextEdit::fileOpen() 494void TextEdit::fileOpen()
495{ 495{
496 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); 496 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*");
497 browseForFiles->setFileView( viewSelection ); 497 browseForFiles->setFileView( viewSelection );
498 browseForFiles->showMaximized(); 498 browseForFiles->showMaximized();
499 if( browseForFiles->exec() != -1 ) { 499 if( browseForFiles->exec() != -1 ) {
500 QString selFile= browseForFiles->selectedFileName; 500 QString selFile = browseForFiles->selectedFileName;
501 QStringList fileList=browseForFiles->fileList; 501 QStringList fileList = browseForFiles->fileList;
502 qDebug(selFile); 502 qDebug(selFile);
503 QStringList::ConstIterator f; 503 QStringList::ConstIterator f;
504 QString fileTemp; 504 QString fileTemp;
505 for ( f = fileList.begin(); f != fileList.end(); f++ ) { 505 for ( f = fileList.begin(); f != fileList.end(); f++ ) {
506 fileTemp = *f; 506 fileTemp = *f;
507 fileTemp.right( fileTemp.length()-5); 507 fileTemp.right( fileTemp.length()-5);
508 QString fileName = fileTemp; 508 QString fileName = fileTemp;
509 if( fileName != "Unnamed" || fileName != "Empty Text" ) { 509 if( fileName != "Unnamed" || fileName != "Empty Text" ) {
510 currentFileName = fileName; 510 currentFileName = fileName;
511 qDebug("please open "+currentFileName); 511 qDebug("please open "+currentFileName);
512 openFile(fileName ); 512 openFile(fileName );
513 } 513 }
514 } 514 }
515 viewSelection = browseForFiles->SelectionCombo->currentItem(); 515 viewSelection = browseForFiles->SelectionCombo->currentItem();
516 } 516 }
517 delete browseForFiles; 517 delete browseForFiles;
518 editor->setEdited( FALSE); 518 editor->setEdited( FALSE);
519 edited1=FALSE; 519 edited1=FALSE;
520 edited=FALSE; 520 edited=FALSE;
521 if(caption().left(1)=="*") 521 if(caption().left(1)=="*")
522 setCaption(caption().right(caption().length()-1)); 522 setCaption(caption().right(caption().length()-1));
523 doSearchBar(); 523 doSearchBar();
524} 524}
525 525
526void TextEdit::doSearchBar() 526void TextEdit::doSearchBar()
527{ 527{
528 Config cfg("TextEdit"); 528 Config cfg("TextEdit");
529 cfg.setGroup("View"); 529 cfg.setGroup("View");
530 if(cfg.readEntry("SearchBar","Closed") != "Opened") 530 if(cfg.readEntry("SearchBar","Closed") != "Opened")
531 searchBar->hide(); 531 searchBar->hide();
532} 532}
533 533
534#if 0 534#if 0
535void TextEdit::slotFind() 535void TextEdit::slotFind()
536{ 536{
537 FindDialog frmFind( "Text Editor", this ); 537 FindDialog frmFind( "Text Editor", this );
538 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 538 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
539 editor, SLOT(slotDoFind( const QString&,bool,bool))); 539 editor, SLOT(slotDoFind( const QString&,bool,bool)));
540 540
541 //case sensitive, backwards, [category] 541 //case sensitive, backwards, [category]
542 542
543 connect( editor, SIGNAL(notFound()), 543 connect( editor, SIGNAL(notFound()),
544 &frmFind, SLOT(slotNotFound()) ); 544 &frmFind, SLOT(slotNotFound()) );
545 connect( editor, SIGNAL(searchWrapped()), 545 connect( editor, SIGNAL(searchWrapped()),
546 &frmFind, SLOT(slotWrapAround()) ); 546 &frmFind, SLOT(slotWrapAround()) );
547 547
548 frmFind.exec(); 548 frmFind.exec();
549 549
550 550
551} 551}
552#endif 552#endif
553 553
554void TextEdit::fileRevert() 554void TextEdit::fileRevert()
555{ 555{
556 clear(); 556 clear();
557 fileOpen(); 557 fileOpen();
558} 558}
559 559
560void TextEdit::editCut() 560void TextEdit::editCut()
561{ 561{
562#ifndef QT_NO_CLIPBOARD 562#ifndef QT_NO_CLIPBOARD
563 editor->cut(); 563 editor->cut();
564#endif 564#endif
565} 565}
566 566
567void TextEdit::editCopy() 567void TextEdit::editCopy()
568{ 568{
569#ifndef QT_NO_CLIPBOARD 569#ifndef QT_NO_CLIPBOARD
570 editor->copy(); 570 editor->copy();
571#endif 571#endif
572} 572}
573 573
574void TextEdit::editPaste() 574void TextEdit::editPaste()
575{ 575{
576#ifndef QT_NO_CLIPBOARD 576#ifndef QT_NO_CLIPBOARD
577 editor->paste(); 577 editor->paste();
578#endif 578#endif
579} 579}
580 580
581void TextEdit::editFind() 581void TextEdit::editFind()
582{ 582{
583 searchBar->show(); 583 searchBar->show();
584 searchVisible = TRUE; 584 searchVisible = TRUE;
585 searchEdit->setFocus(); 585 searchEdit->setFocus();
586 Config cfg("TextEdit"); 586 Config cfg("TextEdit");
587 cfg.setGroup("View"); 587 cfg.setGroup("View");
588 cfg.writeEntry("SearchBar","Opened"); 588 cfg.writeEntry("SearchBar","Opened");
589 589
590} 590}
591 591
592void TextEdit::findNext() 592void TextEdit::findNext()
593{ 593{
594 editor->find( searchEdit->text(), FALSE, FALSE ); 594 editor->find( searchEdit->text(), FALSE, FALSE );
595 595
596} 596}
597 597