summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
Unidiff
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 6f96574..1c95a97 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -566,26 +566,24 @@ void TextEdit::fileNew() {
566 newFile(DocLnk()); 566 newFile(DocLnk());
567} 567}
568 568
569void TextEdit::fileOpen() { 569void TextEdit::fileOpen() {
570 Config cfg("TextEdit"); 570 Config cfg("TextEdit");
571 cfg. setGroup ( "View" ); 571 cfg. setGroup ( "View" );
572 QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir());
573 QMap<QString, QStringList> map; 572 QMap<QString, QStringList> map;
574 map.insert(tr("All"), QStringList() ); 573 map.insert(tr("All"), QStringList() );
575 QStringList text; 574 QStringList text;
576 text << "text/*"; 575 text << "text/*";
577 map.insert(tr("Text"), text ); 576 map.insert(tr("Text"), text );
578 text << "*"; 577 text << "*";
579 map.insert(tr("All"), text ); 578 map.insert(tr("All"), text );
580 QString str = OFileDialog::getOpenFileName( 2, 579 QString str = OFileDialog::getOpenFileName( 2,
581 dir , 580 QString::null ,
582 QString::null, map); 581 QString::null, map);
583 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) 582 if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() )
584 { 583 {
585 cfg.writeEntry("LastOpenDirectory", QFileInfo(str).dirPath(false));
586 openFile( str ); 584 openFile( str );
587 } 585 }
588 else 586 else
589 updateCaption(); 587 updateCaption();
590} 588}
591 589
@@ -973,13 +971,13 @@ void TextEdit::updateCaption( const QString &name ) {
973 if ( s.isEmpty() ) { 971 if ( s.isEmpty() ) {
974 s = tr( "Unnamed" ); 972 s = tr( "Unnamed" );
975 currentFileName=s; 973 currentFileName=s;
976 } 974 }
977// if(s.left(1) == "/") 975// if(s.left(1) == "/")
978// s = s.right(s.length()-1); 976// s = s.right(s.length()-1);
979 setCaption( s + " - " + tr("Text Editor") ); 977 setCaption( tr("%1 - Text Editor").arg( s ) );
980 } 978 }
981} 979}
982 980
983void TextEdit::setDocument(const QString& fileref) { 981void TextEdit::setDocument(const QString& fileref) {
984 if(fileref != "Unnamed") { 982 if(fileref != "Unnamed") {
985 currentFileName=fileref; 983 currentFileName=fileref;
@@ -1019,13 +1017,13 @@ void TextEdit::changeFont() {
1019} 1017}
1020 1018
1021void TextEdit::editDelete() { 1019void TextEdit::editDelete() {
1022 switch ( QMessageBox::warning(this,tr("Text Editor"), 1020 switch ( QMessageBox::warning(this,tr("Text Editor"),
1023 tr("Do you really want<BR>to <B>delete</B> " 1021 tr("Do you really want<BR>to <B>delete</B> "
1024 "the current file\nfrom the disk?<BR>This is " 1022 "the current file\nfrom the disk?<BR>This is "
1025 "<B>irreversable!!</B>"), 1023 "<B>irreversable!</B>"),
1026 tr("Yes"),tr("No"),0,0,1) ) { 1024 tr("Yes"),tr("No"),0,0,1) ) {
1027 case 0: 1025 case 0:
1028 if(doc) { 1026 if(doc) {
1029 doc->removeFiles(); 1027 doc->removeFiles();
1030 clear(); 1028 clear();
1031 setCaption( tr("Text Editor") ); 1029 setCaption( tr("Text Editor") );