summaryrefslogtreecommitdiff
authorpaule <paule>2007-01-13 07:24:51 (UTC)
committer paule <paule>2007-01-13 07:24:51 (UTC)
commit4892c61a3e76c031d7b882854dcb0dfbd575f045 (patch) (unidiff)
tree5c5de924caf9683ad844fd1ef6d27aff433a560b
parent80d1934bbbfaea40ee08cf6be738c6517de9477c (diff)
downloadopie-4892c61a3e76c031d7b882854dcb0dfbd575f045.zip
opie-4892c61a3e76c031d7b882854dcb0dfbd575f045.tar.gz
opie-4892c61a3e76c031d7b882854dcb0dfbd575f045.tar.bz2
Clear document modified flag on save
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp
index a70f3aa..b82a86a 100644
--- a/noncore/apps/tinykate/libkate/document/katedocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp
@@ -336,65 +336,70 @@ bool KateDocument::saveFile()
336 QTextStream stream(&f); 336 QTextStream stream(&f);
337 337
338 stream.setEncoding(QTextStream::RawUnicode); // disable Unicode headers 338 stream.setEncoding(QTextStream::RawUnicode); // disable Unicode headers
339#warning fixme 339#warning fixme
340// stream.setCodec(KGlobal::charsets()->codecForName(myEncoding)); 340// stream.setCodec(KGlobal::charsets()->codecForName(myEncoding));
341 stream.setCodec(QTextCodec::codecForLocale()); // this line sets the mapper to the correct codec 341 stream.setCodec(QTextCodec::codecForLocale()); // this line sets the mapper to the correct codec
342 342
343 int maxLine = numLines(); 343 int maxLine = numLines();
344 int line = 0; 344 int line = 0;
345 while(true) 345 while(true)
346 { 346 {
347 stream << getTextLine(line)->getString(); 347 stream << getTextLine(line)->getString();
348 line++; 348 line++;
349 if (line >= maxLine) break; 349 if (line >= maxLine) break;
350 350
351 if (eolMode == KateDocument::eolUnix) stream << "\n"; 351 if (eolMode == KateDocument::eolUnix) stream << "\n";
352 else if (eolMode == KateDocument::eolDos) stream << "\r\n"; 352 else if (eolMode == KateDocument::eolDos) stream << "\r\n";
353 else if (eolMode == KateDocument::eolMacintosh) stream << '\r'; 353 else if (eolMode == KateDocument::eolMacintosh) stream << '\r';
354 }; 354 };
355 f.close(); 355 f.close();
356 356
357 fileInfo->setFile (m_file); 357 fileInfo->setFile (m_file);
358 setMTime(); 358 setMTime();
359 359
360 if (!(d(this)->hlSetByUser)) 360 if (!(d(this)->hlSetByUser))
361 { 361 {
362 int hl = hlManager->wildcardFind( m_file ); 362 int hl = hlManager->wildcardFind( m_file );
363 363
364 setHighlight(hl); 364 setHighlight(hl);
365 } 365 }
366 emit fileNameChanged (); 366 emit fileNameChanged ();
367 367
368 return (f.status() == IO_Ok); 368 if(f.status() == IO_Ok) {
369 setModified(false);
370 return true;
371 }
372 else
373 return false;
369} 374}
370 375
371KTextEditor::View *KateDocument::createView( QWidget *parent, const char *name ) 376KTextEditor::View *KateDocument::createView( QWidget *parent, const char *name )
372{ 377{
373 return new KateView( this, parent, name); 378 return new KateView( this, parent, name);
374} 379}
375 380
376QString KateDocument::textLine( int line ) const 381QString KateDocument::textLine( int line ) const
377{ 382{
378 TextLine::Ptr l = getTextLine( line ); 383 TextLine::Ptr l = getTextLine( line );
379 if ( !l ) 384 if ( !l )
380 return QString(); 385 return QString();
381 386
382 return l->getString(); 387 return l->getString();
383} 388}
384 389
385void KateDocument::replaceLine(const QString& s,int line) 390void KateDocument::replaceLine(const QString& s,int line)
386{ 391{
387 remove_Line(line,false); 392 remove_Line(line,false);
388 insert_Line(s,line,true); 393 insert_Line(s,line,true);
389} 394}
390 395
391void KateDocument::insertLine( const QString &str, int l ) { 396void KateDocument::insertLine( const QString &str, int l ) {
392 insert_Line(str,l,true); 397 insert_Line(str,l,true);
393} 398}
394 399
395void KateDocument::insert_Line(const QString& s,int line, bool update) 400void KateDocument::insert_Line(const QString& s,int line, bool update)
396{ 401{
397 kdDebug(13020)<<"KateDocument::insertLine "<<s<<QString(" %1").arg(line)<<endl; 402 kdDebug(13020)<<"KateDocument::insertLine "<<s<<QString(" %1").arg(line)<<endl;
398 TextLine::Ptr TL=new TextLine(); 403 TextLine::Ptr TL=new TextLine();
399 TL->append(s.unicode(),s.length()); 404 TL->append(s.unicode(),s.length());
400 buffer->insertLine(line,TL); 405 buffer->insertLine(line,TL);