Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index ea27e1b..40ea501 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -497,33 +497,33 @@ void TextEdit::fileNew() | |||
497 | // saveAs(); | 497 | // saveAs(); |
498 | // } | 498 | // } |
499 | newFile(DocLnk()); | 499 | newFile(DocLnk()); |
500 | } | 500 | } |
501 | 501 | ||
502 | void TextEdit::fileOpen() | 502 | void TextEdit::fileOpen() |
503 | { | 503 | { |
504 | Config cfg("TextEdit"); | 504 | Config cfg("TextEdit"); |
505 | cfg.setGroup("View"); | 505 | cfg.setGroup("View"); |
506 | bool b=FALSE; | 506 | bool b=FALSE; |
507 | 507 | ||
508 | QMap<QString, QStringList> map; | 508 | QMap<QString, QStringList> map; |
509 | map.insert(tr("All"), QStringList() ); | 509 | map.insert(tr("All"), QStringList() ); |
510 | QStringList text; | 510 | QStringList text; |
511 | text << "text/*"; | 511 | text << "text/*"; |
512 | map.insert(tr("Text"), text ); | 512 | map.insert(tr("Text"), text ); |
513 | text << "*"; | 513 | text << "*"; |
514 | map.insert(tr("All"), text ); | 514 | map.insert(tr("All"), text ); |
515 | QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); | 515 | QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); |
516 | if(!str.isEmpty() ) | 516 | if(!str.isEmpty() ) |
517 | openFile( str ); | 517 | openFile( str ); |
518 | 518 | ||
519 | } | 519 | } |
520 | 520 | ||
521 | void TextEdit::doSearchBar() | 521 | void TextEdit::doSearchBar() |
522 | { | 522 | { |
523 | Config cfg("TextEdit"); | 523 | Config cfg("TextEdit"); |
524 | cfg.setGroup("View"); | 524 | cfg.setGroup("View"); |
525 | if(cfg.readEntry("SearchBar","Closed") != "Opened") | 525 | if(cfg.readEntry("SearchBar","Closed") != "Opened") |
526 | searchBar->hide(); | 526 | searchBar->hide(); |
527 | } | 527 | } |
528 | 528 | ||
529 | #if 0 | 529 | #if 0 |
@@ -783,35 +783,44 @@ bool TextEdit::saveAs() | |||
783 | docname = docname.mid( 1 ); | 783 | docname = docname.mid( 1 ); |
784 | docname.replace( QRegExp("/"), "_" ); | 784 | docname.replace( QRegExp("/"), "_" ); |
785 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. | 785 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. |
786 | if ( docname.length() > 40 ) | 786 | if ( docname.length() > 40 ) |
787 | docname = docname.left(40); | 787 | docname = docname.left(40); |
788 | if ( docname.isEmpty() ) | 788 | if ( docname.isEmpty() ) |
789 | docname = tr("Unnamed"); | 789 | docname = tr("Unnamed"); |
790 | doc->setName(docname); | 790 | doc->setName(docname); |
791 | currentFileName=docname; | 791 | currentFileName=docname; |
792 | } | 792 | } |
793 | } | 793 | } |
794 | 794 | ||
795 | 795 | /* | |
796 | // QString str = OFileDialog::getSaveFileName( 2,"/");//,"", "*", this ); | 796 | QMap<QString, QStringList> map; |
797 | // if(!str.isEmpty() ) { | 797 | map.insert(tr("All"), QStringList() ); |
798 | // openFile( str ); | 798 | QStringList text; |
799 | 799 | text << "text/*"; | |
800 | fileSaveDlg=new fileSaver(this,tr("Save File As?"),TRUE, 0, currentFileName); | 800 | map.insert(tr("Text"), text ); |
801 | qDebug("wanna save filename "+currentFileName); | 801 | text << "*"; |
802 | fileSaveDlg->exec(); | 802 | map.insert(tr("All"), text ); |
803 | if( fileSaveDlg->result() == 1 ) { | 803 | QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map); |
804 | if(!str.isEmpty() ) { | ||
805 | QString fileNm=str; | ||
806 | */ | ||
807 | |||
808 | fileSaveDlg=new fileSaver(this,tr("Save File As?"),TRUE, 0, currentFileName); | ||
809 | qDebug("wanna save filename "+currentFileName); | ||
810 | fileSaveDlg->exec(); | ||
811 | if( fileSaveDlg->result() == 1 ) { | ||
804 | QString fileNm=fileSaveDlg->selectedFileName; | 812 | QString fileNm=fileSaveDlg->selectedFileName; |
805 | // QString fileNm=srt; | 813 | |
814 | |||
806 | qDebug("saving filename "+fileNm); | 815 | qDebug("saving filename "+fileNm); |
807 | QFileInfo fi(fileNm); | 816 | QFileInfo fi(fileNm); |
808 | currentFileName=fi.fileName(); | 817 | currentFileName=fi.fileName(); |
809 | if(doc) { | 818 | if(doc) { |
810 | // QString file = doc->file(); | 819 | // QString file = doc->file(); |
811 | // doc->removeFiles(); | 820 | // doc->removeFiles(); |
812 | delete doc; | 821 | delete doc; |
813 | DocLnk nf; | 822 | DocLnk nf; |
814 | nf.setType("text/plain"); | 823 | nf.setType("text/plain"); |
815 | nf.setFile( fileNm); | 824 | nf.setFile( fileNm); |
816 | doc = new DocLnk(nf); | 825 | doc = new DocLnk(nf); |
817 | // editor->setText(rt); | 826 | // editor->setText(rt); |
@@ -828,25 +837,25 @@ bool TextEdit::saveAs() | |||
828 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); | 837 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); |
829 | filePerm->exec(); | 838 | filePerm->exec(); |
830 | 839 | ||
831 | if( filePerm) | 840 | if( filePerm) |
832 | delete filePerm; | 841 | delete filePerm; |
833 | } | 842 | } |
834 | } | 843 | } |
835 | } | 844 | } |
836 | editor->setEdited(TRUE); | 845 | editor->setEdited(TRUE); |
837 | edited1=FALSE; | 846 | edited1=FALSE; |
838 | edited=TRUE; | 847 | edited=TRUE; |
839 | if(caption().left(1)=="*") | 848 | if(caption().left(1)=="*") |
840 | setCaption(caption().right(caption().length()-1)); | 849 | setCaption(caption().right(caption().length()-1)); |
841 | 850 | ||
842 | if(fileSaveDlg) | 851 | if(fileSaveDlg) |
843 | delete fileSaveDlg; | 852 | delete fileSaveDlg; |
844 | return true; | 853 | return true; |
845 | } //end saveAs | 854 | } //end saveAs |
846 | 855 | ||
847 | void TextEdit::clear() | 856 | void TextEdit::clear() |
848 | { | 857 | { |
849 | delete doc; | 858 | delete doc; |
850 | doc = 0; | 859 | doc = 0; |
851 | editor->clear(); | 860 | editor->clear(); |
852 | } | 861 | } |