author | llornkcor <llornkcor> | 2002-06-01 23:30:12 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-01 23:30:12 (UTC) |
commit | 7b145de0bf5dfe015e3c53fb4058315857e725a3 (patch) (side-by-side diff) | |
tree | 6000c8844b749537bdf69c0b4cf124dda4eddb6b /core/apps/textedit | |
parent | 4a8e6f982a1033b7f2b0406a238503f9acb9a7c5 (diff) | |
download | opie-7b145de0bf5dfe015e3c53fb4058315857e725a3.zip opie-7b145de0bf5dfe015e3c53fb4058315857e725a3.tar.gz opie-7b145de0bf5dfe015e3c53fb4058315857e725a3.tar.bz2 |
buf gix
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 3 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 16 |
2 files changed, 13 insertions, 6 deletions
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index b1ddc0b..209a258 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp @@ -171,24 +171,25 @@ void fileSaver::populateList() void fileSaver::upDir() { // qDebug(currentDir.canonicalPath()); } void fileSaver::listDoubleClicked(QListViewItem *selectedItem) { } void fileSaver::listClicked(QListViewItem *selectedItem) { + if(selectedItem != NULL) { QString strItem=selectedItem->text(0); QString strSize=selectedItem->text(1); // qDebug("strItem is "+strItem); strSize.stripWhiteSpace(); // qDebug(strSize); if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); // qDebug("strItem symlink is "+strItem2); if(QDir(strItem2).exists() ) { currentDir.cd(strItem2, TRUE); populateList(); @@ -207,25 +208,25 @@ void fileSaver::listClicked(QListViewItem *selectedItem) if(QDir(strItem).exists()){ currentDir.cd(strItem, TRUE); populateList(); } } // else // if( QFile::exists(strItem ) ) { // qDebug("We found our files!!"); // OnOK(); } //end not symlink chdir(strItem.latin1()); - + } } void fileSaver::closeEvent( QCloseEvent *e ) { if(e->isAccepted()) { e->accept(); } else { qDebug("not accepted"); done(-1); } } diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index f89ed6d..f99f259 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -501,25 +501,25 @@ void TextEdit::fileNew() // } newFile(DocLnk()); } void TextEdit::fileOpen() { Config cfg("TextEdit"); cfg.setGroup("View"); bool b=FALSE; // if(cfg.readEntry("useOldFileDialog") == "TRUE") // b=TRUE; // if(!b) { - QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); + QString str = OFileDialog::getOpenFileName( 2,"/");//,"", "*", this ); if(!str.isEmpty() ) openFile( str ); // } else { // QString str; // browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); // // browseForFiles->setFileView( viewSelection ); // browseForFiles->showMaximized(); // // if( result != -1 ) // if( browseForFiles->exec() != -1 ) { // QString selFile = browseForFiles->selectedFileName; // QStringList fileList = browseForFiles->fileList; @@ -739,24 +739,25 @@ bool TextEdit::save() QString rt = editor->text(); if( !rt.isEmpty() ) { if(name.isEmpty()) { saveAs(); } else { currentFileName= name ; qDebug("saveFile "+currentFileName); struct stat buf; mode_t mode; stat(file.latin1(), &buf); mode = buf.st_mode; + if(!fileIs) { doc->setName( name); FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { return false; } } else { qDebug("regular save file"); QFile f(file); if( f.open(IO_WriteOnly)) { f.writeBlock(rt,rt.length()); } else { @@ -813,29 +814,34 @@ bool TextEdit::saveAs() 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; } } - fileSaveDlg=new fileSaver(this,tr("Save File As?"),TRUE, 0, currentFileName); - qDebug("wanna save filename "+currentFileName); - fileSaveDlg->exec(); - if( fileSaveDlg->result() == 1 ) { +// QString str = OFileDialog::getSaveFileName( 2,"/");//,"", "*", this ); +// if(!str.isEmpty() ) { +// openFile( str ); + + fileSaveDlg=new fileSaver(this,tr("Save File As?"),TRUE, 0, currentFileName); + qDebug("wanna save filename "+currentFileName); + fileSaveDlg->exec(); + if( fileSaveDlg->result() == 1 ) { QString fileNm=fileSaveDlg->selectedFileName; +// QString fileNm=srt; 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); |