summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-19 01:26:49 (UTC)
committer llornkcor <llornkcor>2002-10-19 01:26:49 (UTC)
commit7871e87fbd796c57374b23ec91890962b2ef1fe9 (patch) (unidiff)
treebc6cb8493540674ce18bfc017637108d10906cbf
parenta0ea0e7ff2fad769a92136edc1a7381692e7739f (diff)
downloadopie-7871e87fbd796c57374b23ec91890962b2ef1fe9.zip
opie-7871e87fbd796c57374b23ec91890962b2ef1fe9.tar.gz
opie-7871e87fbd796c57374b23ec91890962b2ef1fe9.tar.bz2
default fileopen to docs dir
Diffstat (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 35f9d3c..209c5de 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -510,65 +510,65 @@ void TextEdit::setBold(bool y) {
510 510
511void TextEdit::setItalic(bool y) { 511void TextEdit::setItalic(bool y) {
512 QFont f = editor->font(); 512 QFont f = editor->font();
513 f.setItalic(y); 513 f.setItalic(y);
514 editor->setFont(f); 514 editor->setFont(f);
515} 515}
516 516
517void TextEdit::setWordWrap(bool y) { 517void TextEdit::setWordWrap(bool y) {
518 bool state = editor->edited(); 518 bool state = editor->edited();
519 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); 519 editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap );
520 editor->setEdited( state ); 520 editor->setEdited( state );
521} 521}
522 522
523void TextEdit::fileNew() { 523void TextEdit::fileNew() {
524// if( !bFromDocView ) { 524// if( !bFromDocView ) {
525// saveAs(); 525// saveAs();
526// } 526// }
527 newFile(DocLnk()); 527 newFile(DocLnk());
528} 528}
529 529
530void TextEdit::fileOpen() { 530void TextEdit::fileOpen() {
531 Config cfg("TextEdit"); 531 Config cfg("TextEdit");
532 cfg.setGroup("View"); 532 cfg.setGroup("View");
533 // bool b=FALSE; 533 // bool b=FALSE;
534 534
535 QMap<QString, QStringList> map; 535 QMap<QString, QStringList> map;
536 map.insert(tr("All"), QStringList() ); 536 map.insert(tr("All"), QStringList() );
537 QStringList text; 537 QStringList text;
538 text << "text/*"; 538 text << "text/*";
539 map.insert(tr("Text"), text ); 539 map.insert(tr("Text"), text );
540 text << "*"; 540 text << "*";
541 map.insert(tr("All"), text ); 541 map.insert(tr("All"), text );
542 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); 542 QString str = OFileDialog::getOpenFileName( 2, QPEApplication::documentDir(), QString::null, map);
543 if(!str.isEmpty() ) 543 if(!str.isEmpty() )
544 openFile( str ); 544 openFile( str );
545 545
546} 546}
547 547
548void TextEdit::doSearchBar() { 548void TextEdit::doSearchBar() {
549 Config cfg("TextEdit"); 549 Config cfg("TextEdit");
550 cfg.setGroup("View"); 550 cfg.setGroup("View");
551 if(cfg.readEntry("SearchBar","Closed") != "Opened") 551 if(cfg.readEntry("SearchBar","Closed") != "Opened")
552 searchBar->hide(); 552 searchBar->hide();
553} 553}
554 554
555#if 0 555#if 0
556void TextEdit::slotFind() { 556void TextEdit::slotFind() {
557 FindDialog frmFind( tr("Text Editor"), this ); 557 FindDialog frmFind( tr("Text Editor"), this );
558 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 558 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
559 editor, SLOT(slotDoFind( const QString&,bool,bool))); 559 editor, SLOT(slotDoFind( const QString&,bool,bool)));
560 560
561 //case sensitive, backwards, [category] 561 //case sensitive, backwards, [category]
562 562
563 connect( editor, SIGNAL(notFound()), 563 connect( editor, SIGNAL(notFound()),
564 &frmFind, SLOT(slotNotFound()) ); 564 &frmFind, SLOT(slotNotFound()) );
565 connect( editor, SIGNAL(searchWrapped()), 565 connect( editor, SIGNAL(searchWrapped()),
566 &frmFind, SLOT(slotWrapAround()) ); 566 &frmFind, SLOT(slotWrapAround()) );
567 567
568 frmFind.exec(); 568 frmFind.exec();
569 569
570 570
571} 571}
572#endif 572#endif
573 573
574void TextEdit::fileRevert() { 574void TextEdit::fileRevert() {
@@ -785,65 +785,65 @@ bool TextEdit::saveAs() {
785 qDebug(currentFileName); 785 qDebug(currentFileName);
786 786
787 if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { 787 if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) {
788// qDebug("do silly TT filename thing"); 788// qDebug("do silly TT filename thing");
789 if ( doc->name().isEmpty() ) { 789 if ( doc->name().isEmpty() ) {
790 QString pt = rt.simplifyWhiteSpace(); 790 QString pt = rt.simplifyWhiteSpace();
791 int i = pt.find( ' ' ); 791 int i = pt.find( ' ' );
792 QString docname = pt; 792 QString docname = pt;
793 if ( i > 0 ) 793 if ( i > 0 )
794 docname = pt.left( i ); 794 docname = pt.left( i );
795 // remove "." at the beginning 795 // remove "." at the beginning
796 while( docname.startsWith( "." ) ) 796 while( docname.startsWith( "." ) )
797 docname = docname.mid( 1 ); 797 docname = docname.mid( 1 );
798 docname.replace( QRegExp("/"), "_" ); 798 docname.replace( QRegExp("/"), "_" );
799 // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. 799 // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long.
800 if ( docname.length() > 40 ) 800 if ( docname.length() > 40 )
801 docname = docname.left(40); 801 docname = docname.left(40);
802 if ( docname.isEmpty() ) 802 if ( docname.isEmpty() )
803 docname = tr("Unnamed"); 803 docname = tr("Unnamed");
804 doc->setName(docname); 804 doc->setName(docname);
805 currentFileName=docname; 805 currentFileName=docname;
806 } 806 }
807 } 807 }
808 808
809 QMap<QString, QStringList> map; 809 QMap<QString, QStringList> map;
810 map.insert(tr("All"), QStringList() ); 810 map.insert(tr("All"), QStringList() );
811 QStringList text; 811 QStringList text;
812 text << "text/*"; 812 text << "text/*";
813 map.insert(tr("Text"), text ); 813 map.insert(tr("Text"), text );
814 text << "*"; 814 text << "*";
815 map.insert(tr("All"), text ); 815 map.insert(tr("All"), text );
816 816
817 QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map); 817 QString str = OFileDialog::getSaveFileName( 2,QPEApplication::documentDir(), QString::null, map);
818 818
819 if(!str.isEmpty() ) { 819 if(!str.isEmpty() ) {
820 QString fileNm=str; 820 QString fileNm=str;
821 821
822 qDebug("saving filename "+fileNm); 822 qDebug("saving filename "+fileNm);
823 QFileInfo fi(fileNm); 823 QFileInfo fi(fileNm);
824 currentFileName=fi.fileName(); 824 currentFileName=fi.fileName();
825 if(doc) { 825 if(doc) {
826// QString file = doc->file(); 826// QString file = doc->file();
827// doc->removeFiles(); 827// doc->removeFiles();
828 delete doc; 828 delete doc;
829 DocLnk nf; 829 DocLnk nf;
830 nf.setType("text/plain"); 830 nf.setType("text/plain");
831 nf.setFile( fileNm); 831 nf.setFile( fileNm);
832 doc = new DocLnk(nf); 832 doc = new DocLnk(nf);
833// editor->setText(rt); 833// editor->setText(rt);
834// qDebug("openFile doclnk "+currentFileName); 834// qDebug("openFile doclnk "+currentFileName);
835 doc->setName( currentFileName); 835 doc->setName( currentFileName);
836 updateCaption( currentFileName); 836 updateCaption( currentFileName);
837 837
838 FileManager fm; 838 FileManager fm;
839 if ( !fm.saveFile( *doc, rt ) ) { 839 if ( !fm.saveFile( *doc, rt ) ) {
840 return false; 840 return false;
841 } 841 }
842 842
843 if( filePerms ) { 843 if( filePerms ) {
844 filePermissions *filePerm; 844 filePermissions *filePerm;
845 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); 845 filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
846 filePerm->showMaximized(); 846 filePerm->showMaximized();
847 filePerm->exec(); 847 filePerm->exec();
848 848
849 if( filePerm) 849 if( filePerm)