summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-29 00:51:23 (UTC)
committer llornkcor <llornkcor>2002-06-29 00:51:23 (UTC)
commita9e336965e1cccb41d3e9f5c31168c85cf4e7d36 (patch) (side-by-side diff)
treebf902af67089de044833da378d1f491574ac4965
parent9cc6f3de75b884f338f708ff03900b197f281802 (diff)
downloadopie-a9e336965e1cccb41d3e9f5c31168c85cf4e7d36.zip
opie-a9e336965e1cccb41d3e9f5c31168c85cf4e7d36.tar.gz
opie-a9e336965e1cccb41d3e9f5c31168c85cf4e7d36.tar.bz2
on your way out, save dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp49
1 files changed, 29 insertions, 20 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index ea27e1b..40ea501 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -497,33 +497,33 @@ void TextEdit::fileNew()
// 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);
- if(!str.isEmpty() )
- openFile( str );
+ 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);
+ if(!str.isEmpty() )
+ openFile( str );
}
void TextEdit::doSearchBar()
{
Config cfg("TextEdit");
cfg.setGroup("View");
if(cfg.readEntry("SearchBar","Closed") != "Opened")
searchBar->hide();
}
#if 0
@@ -783,35 +783,44 @@ bool TextEdit::saveAs()
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;
}
}
-
-// 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 ) {
+/*
+ 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);
+ if(!str.isEmpty() ) {
+ QString fileNm=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);
@@ -828,25 +837,25 @@ bool TextEdit::saveAs()
filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm);
filePerm->exec();
if( filePerm)
delete filePerm;
}
}
}
editor->setEdited(TRUE);
edited1=FALSE;
edited=TRUE;
if(caption().left(1)=="*")
- setCaption(caption().right(caption().length()-1));
+ setCaption(caption().right(caption().length()-1));
if(fileSaveDlg)
delete fileSaveDlg;
return true;
} //end saveAs
void TextEdit::clear()
{
delete doc;
doc = 0;
editor->clear();
}