author | llornkcor <llornkcor> | 2003-02-18 19:29:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-18 19:29:56 (UTC) |
commit | 9f5098a6da637e81f6525482456394a68524dc61 (patch) (side-by-side diff) | |
tree | 85bfd8e545a10d0faa321c174354d0a2302e0591 | |
parent | 4dd3080c36c96c58564a29f1b3d2cf21bfb1eae2 (diff) | |
download | opie-9f5098a6da637e81f6525482456394a68524dc61.zip opie-9f5098a6da637e81f6525482456394a68524dc61.tar.gz opie-9f5098a6da637e81f6525482456394a68524dc61.tar.bz2 |
5 minutes, not 30 seconds
-rw-r--r-- | core/apps/textedit/textedit.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 1e8ce7f..f571511 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -960,66 +960,66 @@ 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"); if(doc) doc->setName(docname); currentFileName=docname; // } // else // qDebug("hmmmmmm"); } QMap<QString, QStringList> map; map.insert(tr("All"), QStringList() ); QStringList text; text << "text/*"; map.insert(tr("Text"), text ); text << "*"; map.insert(tr("All"), text ); QFileInfo cuFi( currentFileName); QString filee = cuFi.fileName(); QString dire = cuFi.dirPath(); if(dire==".") dire = QPEApplication::documentDir(); QString str; if( !featureAutoSave) { str = OFileDialog::getSaveFileName( 2, - dire, - filee, map); + dire, + filee, map); } else str=currentFileName; 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("Saving file as "+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); @@ -1189,77 +1189,74 @@ void TextEdit::editPasteTimeDate() { int TextEdit::savePrompt() { switch( QMessageBox::information( 0, (tr("Textedit")), (tr("Textedit detected\n" "you have unsaved changes\n" "Go ahead and save?\n")), (tr("Save")), (tr("Don't Save")), (tr("&Cancel")), 2, 2 ) ) { case 0: { return 1; } break; case 1: { return 2; } break; case 2: { return -1; } break; }; return 0; } void TextEdit::timerCrank() { - if(featureAutoSave) + if(featureAutoSave && edited1) { - if( edited1 ) + if(currentFileName.isEmpty()) { - if(currentFileName.isEmpty()) - { - currentFileName = QDir::homeDirPath()+"/textedit.tmp"; - saveAs(); - } - else - { - qDebug("autosave"); - save(); - } - setTimer(); + currentFileName = QDir::homeDirPath()+"/textedit.tmp"; + saveAs(); } + else + { +// qDebug("autosave"); + save(); + } + setTimer(); } } void TextEdit::doTimer(bool b) { Config cfg("TextEdit"); cfg.setGroup ( "View" ); cfg.writeEntry ( "autosave", b); featureAutoSave = b; nAutoSave->setOn(b); if(b) { - qDebug("doTimer true"); +// qDebug("doTimer true"); setTimer(); } - else - qDebug("doTimer false"); +// else +// qDebug("doTimer false"); } void TextEdit::setTimer() { if(featureAutoSave) { - qDebug("setting autosave"); +// qDebug("setting autosave"); QTimer *timer = new QTimer(this ); connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); - timer->start( 30000/*0*/, true); //5 minutes + timer->start( 300000, true); //5 minutes } } |