-rw-r--r-- | core/apps/textedit/textedit.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 35f9d3c..209c5de 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -494,97 +494,97 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up) { } } QFont f = editor->font(); f.setPointSize(s); editor->setFont(f); zin->setEnabled(s != fontsize[nfontsizes-1]); zout->setEnabled(s != fontsize[0]); } 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(); editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); editor->setEdited( state ); } void TextEdit::fileNew() { // if( !bFromDocView ) { // saveAs(); // } newFile(DocLnk()); } void TextEdit::fileOpen() { Config cfg("TextEdit"); cfg.setGroup("View"); // bool b=FALSE; 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,"/", QString::null, map); + QString str = OFileDialog::getOpenFileName( 2, QPEApplication::documentDir(), QString::null, map); if(!str.isEmpty() ) openFile( str ); } void TextEdit::doSearchBar() { Config cfg("TextEdit"); cfg.setGroup("View"); if(cfg.readEntry("SearchBar","Closed") != "Opened") searchBar->hide(); } #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 } @@ -769,97 +769,97 @@ bool TextEdit::save() { prompted save */ bool TextEdit::saveAs() { qDebug("saveAsFile "+currentFileName); // case of nothing to save... if ( !doc ) { //|| !bFromDocView) qDebug("no doc"); return true; } if ( !editor->edited() ) { delete doc; doc = 0; return true; } QString rt = editor->text(); qDebug(currentFileName); if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { // qDebug("do silly TT filename thing"); if ( doc->name().isEmpty() ) { QString pt = rt.simplifyWhiteSpace(); int i = pt.find( ' ' ); QString docname = pt; if ( i > 0 ) docname = pt.left( i ); // remove "." at the beginning while( docname.startsWith( "." ) ) docname = docname.mid( 1 ); docname.replace( QRegExp("/"), "_" ); // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. if ( docname.length() > 40 ) docname = docname.left(40); if ( docname.isEmpty() ) docname = tr("Unnamed"); doc->setName(docname); currentFileName=docname; } } 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::getSaveFileName( 2,"/", QString::null, map); + QString str = OFileDialog::getSaveFileName( 2,QPEApplication::documentDir(), QString::null, map); if(!str.isEmpty() ) { QString fileNm=str; qDebug("saving filename "+fileNm); QFileInfo fi(fileNm); currentFileName=fi.fileName(); if(doc) { // QString file = doc->file(); // doc->removeFiles(); delete doc; DocLnk nf; nf.setType("text/plain"); nf.setFile( fileNm); doc = new DocLnk(nf); // editor->setText(rt); // qDebug("openFile doclnk "+currentFileName); doc->setName( currentFileName); updateCaption( currentFileName); FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { return false; } if( filePerms ) { filePermissions *filePerm; filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); filePerm->showMaximized(); filePerm->exec(); if( filePerm) delete filePerm; } } editor->setEdited( false); edited1 = false; edited = false; if(caption().left(1)=="*") setCaption(caption().right(caption().length()-1)); return true; } qDebug("returning false"); return false; } //end saveAs void TextEdit::clear() { |