Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katedocument.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index 10bc976..df1de8d 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp | |||
@@ -319,24 +319,25 @@ void KateDocument::openURL(const QString &filename) | |||
319 | setHighlight(hl); | 319 | setHighlight(hl); |
320 | 320 | ||
321 | updateLines(); | 321 | updateLines(); |
322 | updateViews(); | 322 | updateViews(); |
323 | 323 | ||
324 | emit fileNameChanged(); | 324 | emit fileNameChanged(); |
325 | 325 | ||
326 | return ; | 326 | return ; |
327 | } | 327 | } |
328 | 328 | ||
329 | bool KateDocument::saveFile() | 329 | bool KateDocument::saveFile() |
330 | { | 330 | { |
331 | |||
331 | QFile f( m_file ); | 332 | QFile f( m_file ); |
332 | if ( !f.open( IO_WriteOnly ) ) | 333 | if ( !f.open( IO_WriteOnly ) ) |
333 | return false; // Error | 334 | return false; // Error |
334 | 335 | ||
335 | QTextStream stream(&f); | 336 | QTextStream stream(&f); |
336 | 337 | ||
337 | stream.setEncoding(QTextStream::RawUnicode); // disable Unicode headers | 338 | stream.setEncoding(QTextStream::RawUnicode); // disable Unicode headers |
338 | #warning fixme | 339 | #warning fixme |
339 | // stream.setCodec(KGlobal::charsets()->codecForName(myEncoding)); | 340 | // stream.setCodec(KGlobal::charsets()->codecForName(myEncoding)); |
340 | 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 |
341 | 342 | ||
342 | int maxLine = numLines(); | 343 | int maxLine = numLines(); |
@@ -1916,25 +1917,26 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor | |||
1916 | line = startLine; | 1917 | line = startLine; |
1917 | ctxNum = 0; | 1918 | ctxNum = 0; |
1918 | if (line > 0) ctxNum = getTextLine(line - 1)->getContext(); | 1919 | if (line > 0) ctxNum = getTextLine(line - 1)->getContext(); |
1919 | do { | 1920 | do { |
1920 | // kdDebug(13020)<<QString("**************Working on line: %1").arg(line)<<endl; | 1921 | // kdDebug(13020)<<QString("**************Working on line: %1").arg(line)<<endl; |
1921 | textLine = getTextLine(line); | 1922 | textLine = getTextLine(line); |
1922 | if (textLine==0) kdDebug(13020)<<"****updateLines()>> error textLine==0"<<endl; | 1923 | if (textLine==0) kdDebug(13020)<<"****updateLines()>> error textLine==0"<<endl; |
1923 | if (line <= endLine && line != cursorY) { | 1924 | if (line <= endLine && line != cursorY) { |
1924 | if (flags & KateView::cfRemoveSpaces) textLine->removeSpaces(); | 1925 | if (flags & KateView::cfRemoveSpaces) textLine->removeSpaces(); |
1925 | updateMaxLength(textLine); | 1926 | updateMaxLength(textLine); |
1926 | } | 1927 | } |
1927 | endCtx = textLine->getContext(); | 1928 | endCtx = textLine->getContext(); |
1928 | qDebug("DOHIGHLIGHT"); | 1929 | // qDebug("DOHIGHLIGHT"); |
1930 | |||
1929 | ctxNum = m_highlight->doHighlight(ctxNum,textLine); | 1931 | ctxNum = m_highlight->doHighlight(ctxNum,textLine); |
1930 | textLine->setContext(ctxNum); | 1932 | textLine->setContext(ctxNum); |
1931 | line++; | 1933 | line++; |
1932 | } while ((buffer->line(line)!=0) && (line <= endLine || endCtx != ctxNum)); | 1934 | } while ((buffer->line(line)!=0) && (line <= endLine || endCtx != ctxNum)); |
1933 | // kdDebug(13020)<<"updateLines :: while loop left"<<endl; | 1935 | // kdDebug(13020)<<"updateLines :: while loop left"<<endl; |
1934 | tagLines(startLine, line - 1); | 1936 | tagLines(startLine, line - 1); |
1935 | } | 1937 | } |
1936 | 1938 | ||
1937 | 1939 | ||
1938 | void KateDocument::updateMaxLength(TextLine::Ptr &textLine) { | 1940 | void KateDocument::updateMaxLength(TextLine::Ptr &textLine) { |
1939 | int len; | 1941 | int len; |
1940 | 1942 | ||
@@ -3021,24 +3023,30 @@ void KateDocument::guiActivateEvent( KParts::GUIActivateEvent *ev ) | |||
3021 | KParts::ReadWritePart::guiActivateEvent( ev ); | 3023 | KParts::ReadWritePart::guiActivateEvent( ev ); |
3022 | if ( ev->activated() ) | 3024 | if ( ev->activated() ) |
3023 | emit selectionChanged(); | 3025 | emit selectionChanged(); |
3024 | } | 3026 | } |
3025 | #endif | 3027 | #endif |
3026 | 3028 | ||
3027 | void KateDocument::setDocName (QString docName) | 3029 | void KateDocument::setDocName (QString docName) |
3028 | { | 3030 | { |
3029 | myDocName = docName; | 3031 | myDocName = docName; |
3030 | emit nameChanged (this); | 3032 | emit nameChanged (this); |
3031 | } | 3033 | } |
3032 | 3034 | ||
3035 | void KateDocument::setDocFile (QString docFile) | ||
3036 | { | ||
3037 | m_file = docFile; | ||
3038 | emit fileNameChanged (); | ||
3039 | } | ||
3040 | |||
3033 | void KateDocument::setMTime() | 3041 | void KateDocument::setMTime() |
3034 | { | 3042 | { |
3035 | if (fileInfo && !fileInfo->fileName().isEmpty()) { | 3043 | if (fileInfo && !fileInfo->fileName().isEmpty()) { |
3036 | fileInfo->refresh(); | 3044 | fileInfo->refresh(); |
3037 | mTime = fileInfo->lastModified(); | 3045 | mTime = fileInfo->lastModified(); |
3038 | } | 3046 | } |
3039 | } | 3047 | } |
3040 | 3048 | ||
3041 | void KateDocument::isModOnHD(bool forceReload) | 3049 | void KateDocument::isModOnHD(bool forceReload) |
3042 | { | 3050 | { |
3043 | if (fileInfo && !fileInfo->fileName().isEmpty()) { | 3051 | if (fileInfo && !fileInfo->fileName().isEmpty()) { |
3044 | fileInfo->refresh(); | 3052 | fileInfo->refresh(); |