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 | 10 |
1 files changed, 8 insertions, 2 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 @@ -526,108 +526,114 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up) { } void TextEdit::setBold(bool y) { QFont f = editor->font(); f.setBold(y); editor->setFont(f); } void TextEdit::setItalic(bool y) { QFont f = editor->font(); f.setItalic(y); editor->setFont(f); } void TextEdit::setWordWrap(bool y) { bool state = editor->edited(); QString captionStr = caption(); bool b1 = edited1; bool b2 = edited; editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); editor->setEdited( state ); edited1=b1; edited=b2; 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() ) - openFile( str ); + { + 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()) ); frmFind.exec(); } #endif void TextEdit::fileRevert() { clear(); fileOpen(); } void TextEdit::editCut() { #ifndef QT_NO_CLIPBOARD editor->cut(); #endif } void TextEdit::editCopy() { #ifndef QT_NO_CLIPBOARD editor->copy(); #endif } void TextEdit::editPaste() { |