author | llornkcor <llornkcor> | 2003-02-28 17:44:25 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-28 17:44:25 (UTC) |
commit | 92c322fc6500de8c33409e0cecb25bf655bee8bc (patch) (side-by-side diff) | |
tree | 1c032dcc5ed8d61fb77e7e006adfa7414414c7e4 | |
parent | 592904b2664c6fa3dbb4590b80a8552475995366 (diff) | |
download | opie-92c322fc6500de8c33409e0cecb25bf655bee8bc.zip opie-92c322fc6500de8c33409e0cecb25bf655bee8bc.tar.gz opie-92c322fc6500de8c33409e0cecb25bf655bee8bc.tar.bz2 |
allow open file to remember last directory
-rw-r--r-- | core/apps/textedit/textedit.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index ce868d6..2f62789 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -550,60 +550,66 @@ void TextEdit::setWordWrap(bool y) { setCaption(captionStr); } void TextEdit::setSearchBar(bool b) { useSearchBar=b; Config cfg("TextEdit"); cfg.setGroup("View"); cfg.writeEntry ( "SearchBar", b ); searchBarAction->setOn(b); if(b) searchBar->show(); else searchBar->hide(); editor->setFocus(); } void TextEdit::fileNew() { // if( !bFromDocView ) { // saveAs(); // } newFile(DocLnk()); } void TextEdit::fileOpen() { + Config cfg("TextEdit"); + cfg. setGroup ( "View" ); + QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir()); QMap<QString, QStringList> map; map.insert(tr("All"), QStringList() ); QStringList text; text << "text/*"; map.insert(tr("Text"), text ); text << "*"; map.insert(tr("All"), text ); QString str = OFileDialog::getOpenFileName( 2, - QPEApplication::documentDir(), + dir , QString::null, map); if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) + { + cfg.writeEntry("LastOpenDirectory", QFileInfo(str).dirPath(false)); openFile( str ); + } else updateCaption(); } void TextEdit::doSearchBar() { if(!useSearchBar) searchBar->hide(); else searchBar->show(); } #if 0 void TextEdit::slotFind() { FindDialog frmFind( tr("Text Editor"), this ); connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), editor, SLOT(slotDoFind( const QString&,bool,bool))); //case sensitive, backwards, [category] connect( editor, SIGNAL(notFound()), &frmFind, SLOT(slotNotFound()) ); connect( editor, SIGNAL(searchWrapped()), &frmFind, SLOT(slotWrapAround()) ); |