Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 8 |
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 | |||
@@ -564,30 +564,28 @@ void TextEdit::fileNew() { | |||
564 | // saveAs(); | 564 | // saveAs(); |
565 | // } | 565 | // } |
566 | newFile(DocLnk()); | 566 | newFile(DocLnk()); |
567 | } | 567 | } |
568 | 568 | ||
569 | void TextEdit::fileOpen() { | 569 | void 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 | ||
592 | void TextEdit::doSearchBar() { | 590 | void TextEdit::doSearchBar() { |
593 | if(!useSearchBar) | 591 | if(!useSearchBar) |
@@ -971,17 +969,17 @@ void TextEdit::updateCaption( const QString &name ) { | |||
971 | if ( s.isNull() ) | 969 | if ( s.isNull() ) |
972 | s = doc->name(); | 970 | s = doc->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 | ||
983 | void TextEdit::setDocument(const QString& fileref) { | 981 | void TextEdit::setDocument(const QString& fileref) { |
984 | if(fileref != "Unnamed") { | 982 | if(fileref != "Unnamed") { |
985 | currentFileName=fileref; | 983 | currentFileName=fileref; |
986 | qDebug("setDocument"); | 984 | qDebug("setDocument"); |
987 | QFileInfo fi(currentFileName); | 985 | QFileInfo fi(currentFileName); |
@@ -1017,17 +1015,17 @@ void TextEdit::changeFont() { | |||
1017 | delete d; | 1015 | delete d; |
1018 | 1016 | ||
1019 | } | 1017 | } |
1020 | 1018 | ||
1021 | void TextEdit::editDelete() { | 1019 | void 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") ); |
1032 | } | 1030 | } |
1033 | break; | 1031 | break; |