author | llornkcor <llornkcor> | 2002-12-26 03:48:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-26 03:48:32 (UTC) |
commit | f736bf0ae774159a80a97b9492d7624e7caf07a3 (patch) (unidiff) | |
tree | 6e66396c264e2d878920ba273487c81abe7a474e | |
parent | 451d6a8692cf65d970b0c582e96e8a59072df191 (diff) | |
download | opie-f736bf0ae774159a80a97b9492d7624e7caf07a3.zip opie-f736bf0ae774159a80a97b9492d7624e7caf07a3.tar.gz opie-f736bf0ae774159a80a97b9492d7624e7caf07a3.tar.bz2 |
added setDocFile function to change the filename needs more work
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.h | 11 |
2 files changed, 15 insertions, 6 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 | |||
@@ -323,16 +323,17 @@ void KateDocument::openURL(const QString &filename) | |||
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 |
@@ -1920,17 +1921,18 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor | |||
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 | ||
@@ -3025,16 +3027,22 @@ void KateDocument::guiActivateEvent( KParts::GUIActivateEvent *ev ) | |||
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 | ||
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.h b/noncore/apps/tinykate/libkate/document/katedocument.h index 220d188..356541f 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.h +++ b/noncore/apps/tinykate/libkate/document/katedocument.h | |||
@@ -449,16 +449,17 @@ class KateDocument: public Kate::Document | |||
449 | If forceReload is true, the document is reloaded without asking the user, | 449 | If forceReload is true, the document is reloaded without asking the user, |
450 | otherwise [default] the user is asked what to do. */ | 450 | otherwise [default] the user is asked what to do. */ |
451 | void isModOnHD(bool forceReload=false); | 451 | void isModOnHD(bool forceReload=false); |
452 | 452 | ||
453 | uint docID () {return myDocID;}; | 453 | uint docID () {return myDocID;}; |
454 | QString docName () {return myDocName;}; | 454 | QString docName () {return myDocName;}; |
455 | 455 | ||
456 | void setDocName (QString docName); | 456 | void setDocName (QString docName); |
457 | void setDocFile (QString docFile); | ||
457 | 458 | ||
458 | public slots: | 459 | public slots: |
459 | /** Reloads the current document from disk if possible */ | 460 | /** Reloads the current document from disk if possible */ |
460 | void reloadFile(); | 461 | void reloadFile(); |
461 | 462 | ||
462 | private slots: | 463 | private slots: |
463 | void slotModChanged (); | 464 | void slotModChanged (); |
464 | 465 | ||
@@ -523,21 +524,21 @@ class KateDocument: public Kate::Document | |||
523 | // wrap the text of the document at the column col | 524 | // wrap the text of the document at the column col |
524 | void wrapText (uint col); | 525 | void wrapText (uint col); |
525 | 526 | ||
526 | public slots: | 527 | public slots: |
527 | void applyWordWrap (); | 528 | void applyWordWrap (); |
528 | 529 | ||
529 | private: | 530 | private: |
530 | 531 | ||
531 | class KateDocPrivate | 532 | class KateDocPrivate |
532 | { | 533 | { |
533 | public: | 534 | public: |
534 | bool hlSetByUser; | 535 | bool hlSetByUser; |
535 | }; | 536 | }; |
536 | 537 | ||
537 | 538 | ||
538 | // BCI: Add a real d-pointer in the next BIC release | 539 | // BCI: Add a real d-pointer in the next BIC release |
539 | static QPtrDict<KateDocPrivate>* d_ptr; | 540 | static QPtrDict<KateDocPrivate>* d_ptr; |
540 | static void cleanup_d_ptr() | 541 | static void cleanup_d_ptr() |
541 | { | 542 | { |
542 | delete d_ptr; | 543 | delete d_ptr; |
543 | } | 544 | } |