[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    [Kwrite-devel] GRRRRRR kmail - here are all those patches, though...
From:       Anders Lund <anders () alweb ! dk>
Date:       2002-01-31 3:36:24
[Download RAW message or body]

I was going to send 1 mail from the que, and opened it and pushed the send 
button, and VUPTI kmail sent all my prepared messages without the 
attatchments :(( I'd call that a bug.

Anyway:

Here are all my changes, in fewer files, with comments. Please refer to 
earlier mails.

file kate.cvs.diff:
kdebase/kate$ cvs diff > kate.cvs.diff
contents:
  - using the new dircompletion for the fileselecter urlcombo :)
  - removing the unwanted show full path in title thing.

file part.cvs.diff:
kdelibs/kate$ cvs diff part > part.cvs.diff
contents:
  In KateDocument:
  - making the buffer for mimefind contain the data
  - fixes for comment/uncomment
    a) preferring single line where resonable
    b) fixing removeStartStopCommentFromSelection: skipping whitespace before     
    removing text, checking that both markers are present before proceeding.
- in katehighlight.cpp: making nameFind() as well as mimefind work, and 
  removind deprecated call to kmimemagic::result()
- in kateviewdialog: hiding unimplemented select options

file css.cvs.diff:
kdelibs/kate$ cvs diff data/css.xml > css.cvs.diff
enhanced as described in earlier post.

My immediate TODO list:

Further improvements on comment/uncomment are possible, opinions on adding 
data to the hl defs of those? in eg perl and shell scripts it is legal to 
place a comment marker in the middle of the line, while not in some other 
languages. Nesting should be checked for in cpp/c/css/java etc (/**/) and i 
guess also in xml style comments.

Make the tab completion work as described earlier.

Make the "word wrap" work (renaming that one could be the little thing we 
could get to do with i18n?)

And thank you for the patience, i'm a bit embarrassed about that flood.

-anders 
-- 
Using konqueror for serious reading? try the rellinks plugin - available from 
http://www.alweb.dk/rellinks.html

["kate.cvs.diff" (text/x-diff)]

? kate.cvs.diff
Index: app/kateconfigdialog.cpp
===================================================================
RCS file: /home/kde/kdebase/kate/app/kateconfigdialog.cpp,v
retrieving revision 1.17
diff -r1.17 kateconfigdialog.cpp
144a145,148
> 
> // show full path in title
> cb_fullPath = new QCheckBox( i18n("Show Full &Path in Title"), frGeneral);
> cb_fullPath->setChecked( config->readBoolEntry("Show Full Path in Title", false ) \
> );
330a335,336
> viewManager->setShowFullPath( cb_fullPath->isChecked() ); // hm, stored 2 places :(
> config->writeEntry( "Show Full Path in Title", cb_fullPath->isChecked() );
Index: app/kateconfigdialog.h
===================================================================
RCS file: /home/kde/kdebase/kate/app/kateconfigdialog.h,v
retrieving revision 1.8
diff -r1.8 kateconfigdialog.h
67a68
> class QCheckBox *cb_fullPath;
Index: app/katefileselector.cpp
===================================================================
RCS file: /home/kde/kdebase/kate/app/katefileselector.cpp,v
retrieving revision 1.3
diff -r1.3 katefileselector.cpp
77c77
<   KURLCompletion* cmpl = new KURLCompletion();
---
> KURLCompletion* cmpl = new KURLCompletion(KURLCompletion::DirCompletion);
82c82
<   dir->setView(KFile::Simple);
---
> dir->setView(KFile::/*Simple*/Detail);
Index: app/katemainwindow.cpp
===================================================================
RCS file: /home/kde/kdebase/kate/app/katemainwindow.cpp,v
retrieving revision 1.36
diff -r1.36 katemainwindow.cpp
283,284c283,284
<   // allow full path in title -anders
<   settingsShowFullPath = new KToggleAction(i18n("Show Full &Path in Title"), 0, \
this, SLOT(slotSettingsShowFullPath()), actionCollection(), \
                "settings_show_full_path");
---
> // (now moved to config dialog) show full path in title -anders
> // settingsShowFullPath = new KToggleAction(i18n("Show Full &Path in Title"), 0, \
> this, SLOT(slotSettingsShowFullPath()), actionCollection(), \
> "settings_show_full_path");
366c366
<   settingsShowFullPath->setChecked(viewManager->getShowFullPath());
---
> //settingsShowFullPath->setChecked(viewManager->getShowFullPath());
630a631
> /* FIXME anders: remove later
635c636
< 
---
> */
Index: app/katemainwindow.h
===================================================================
RCS file: /home/kde/kdebase/kate/app/katemainwindow.h,v
retrieving revision 1.15
diff -r1.15 katemainwindow.h
115c115
<     KToggleAction* settingsShowFullPath;
---
> //KToggleAction* settingsShowFullPath;
120c120
<     
---
> 
165c165
<     void slotSettingsShowFullPath();
---
> //void slotSettingsShowFullPath();
Index: data/kateui.rc
===================================================================
RCS file: /home/kde/kdebase/kate/data/kateui.rc,v
retrieving revision 1.29
diff -r1.29 kateui.rc
98c98
<     <Action name="settings_show_full_path" />
---
> <!--    <Action name="settings_show_full_path" />
100c100
<     <Separator />
---
> <Separator />//-->


["part.cvs.diff" (text/x-diff)]

Index: part/katedocument.cpp
===================================================================
RCS file: /home/kde/kdelibs/kate/part/katedocument.cpp,v
retrieving revision 1.126
diff -r1.126 katedocument.cpp
1932a1933
> // anders: I fixed this to work :^)
1939c1940,1941
<       len = textLine->length();
---
> len = textLine->length() + 1; // space for a newline - seemingly not required by \
> kmimemagic, but nicer for debugging. //kdDebug(13020)<<"openFile(): collecting a \
> buffer for hlManager->mimeFind(): found "<<len<<" bytes in line "<<i<<endl;
1941c1943,1944
<       memcpy(&buf[bufpos], textLine->getText(), len);
---
> //kdDebug(13020)<<"copying "<<len<<"bytes."<<endl;
> memcpy(&buf[bufpos], /*textLine->getText()*/(textLine->getString()+"\n").latin1(), \
> len);
1945c1948
< 
---
> //kdDebug(13020)<<"openFile(): calling hlManager->mimeFind() with \
> data:"<<endl<<buf.data()<<endl<<"--"<<endl;
2615a2619
> // FIXME anders: Make this work...
2760c2764
<       removeText(line, col-1, line, col);
---
> removeText(line, col-l, line, col);
3114,3115c3118,3119
<   int sl = selectStart.line;
<   int el = selectEnd.line;
---
> uint sl = selectStart.line;
> uint el = selectEnd.line;
3122c3126,3141
<   if (ec-endCommentLen < 0)
---
> // had this been perl or sed: s/^\s*$startComment(.+?)$endComment\s*/$1/
> // check if both ends matches, allowing whitespace on outer side; return if eithre \
> fails TextLine::Ptr l;
> l = getTextLine(sl);
> // skip spaces/lines starting at selectStart
> while ( sl <= el && sc < ec && l->getChar(sc).isSpace() ) {
> if ( sc == l->length() ) {
> sl++;
> sc = 0;
> l = getTextLine( sl );
> if (!l) return false; // hopefully _VERY_ unlikely
> }
> sc++;
> }
> if ( l->getString().mid( sc, startCommentLen ) != startComment ) {
> kdDebug(13020)<<"removeBlaBla(): '"<<startComment<<"' not found after skipping \
> space ("<<sl<<", "<<sc<<") - giving up :("<<endl;
3124c3143,3161
< 
---
> }
> // repat kinda reversed for end.....
> l = getTextLine( el );
> ec--;
> while ( el >= sl /*&& ec > sc*/ && l->getChar(ec).isSpace() ) {
> if ( ec < 0 ) {
> kdDebug(13020)<<"removeBlaBla(): up a line = "<<el-1<<endl;
> el--;
> l = getTextLine( el );
> if (!l) return false; // hopefully _VERY_ unlikely
> ec = l->length();
> }
> ec--;
> }
> ec++; // we went one char too far to find a nonspace
> if ( ec - endCommentLen < 0 || l->getString().mid(ec-endCommentLen,endCommentLen) \
> != endComment ) { kdDebug(13020)<<"removeBlaBla(): '"<<endComment<<"' not found \
> after skipping space ("<<el<<", "<<ec-endCommentLen<<") - giving up :("<<endl; \
> return false; }
3127c3164,3165
< 
---
> // TODO anders: redefine selection
> kdDebug(13020)<<"removeBlaBla(): I DID IT!! I'm DANCING AROUND"<<endl;
3180c3218,3228
<       if ( hasStartStopCommentMark )
---
> // anders: prefer single line comment to avoid nesting probs
> // If the selection starts after first char in the first line
> // or ends before the last char of the last line, we may use
> // multiline comment markers.
> // TODO We should try to detect nesting.
> //    - if selection ends at col 0, most likely she wanted that line ignored
> if ( hasStartStopCommentMark &&
> ( !hasStartLineCommentMark || (
> ( selectStart.col > getTextLine( selectStart.line )->firstChar() ) ||
> ( selectEnd.col < getTextLine( selectEnd.line )->length() )
> ) ) )
3197,3200c3245,3249
<       removed = ( hasStartStopCommentMark
<                   && removeStartStopCommentFromSelection() )
<         || ( hasStartLineCommentMark
<              && removeStartLineCommentFromSelection() );
---
> // anders: this seems like it will work with above changes :)
> removed = ( hasStartLineCommentMark
> && removeStartLineCommentFromSelection() )
> > > ( hasStartStopCommentMark
> && removeStartStopCommentFromSelection() );
4050a4100
> bool modified = false;
4067a4118
> {
4068a4120,4121
> modified  = true;
> }
4077a4131,4133
> // anders: this may have modified the document
> if ( modified )
> setModified( true );
Index: part/katehighlight.cpp
===================================================================
RCS file: /home/kde/kdelibs/kate/part/katehighlight.cpp,v
retrieving revision 1.33
diff -r1.33 katehighlight.cpp
29c29,30
< #include <kmimemagic.h>
---
> //#include <kmimemagic.h>
> #include <kmimetype.h>
1490,1491c1491,1492
<   int p1, p2;
<   QString w;
---
> QStringList l;
> QRegExp sep("\\s*;\\s*");
1493,1502c1494,1502
<     p1 = 0;
<     w = highlight->getWildcards();
<     while (p1 < (int) w.length()) {
<       p2 = w.find(';',p1);
<       if (p2 == -1) p2 = w.length();
<       if (p1 < p2) {
<         QRegExp regExp(w.mid(p1,p2 - p1),true,true);
<         if (regExp.search(fileName) == 0) return hlList.at();
<       }
<       p1 = p2 + 1;
---
> // anders: this is more likely to catch the right one ;)
> QStringList l = QStringList::split( sep, highlight->getWildcards() );
> for( QStringList::Iterator it = l.begin(); it != l.end(); ++it )
> {
> // anders: we need to be sure to match the end of string, as eg a css file
> // would otherwise end up with the c hl
> QRegExp re(*it, false, true);
> if ( ( re.search( fileName ) > -1 ) && ( re.matchedLength() == \
> (int)fileName.length() ) ) return hlList.at();
1509a1510,1512
> //  kdDebug(13010)<<"hlManager::mimeFind( [contents], "<<fname<<")"<<endl;
> //  kdDebug(13010)<<"file contents: "<<endl<<contents.data()<<endl<<"- - - - - - \
> END CONTENTS - - - - -"<<endl; 
1511,1512c1514,1518
<   KMimeMagicResult *result;
<   result = KMimeMagic::self()->findBufferFileType(contents, fname);
---
> KMimeType::Ptr mt;
> int accuracy; // just for debugging
> mt = KMimeType::findByContent( contents, &accuracy );
> QString mtname = mt->name();
> //  kdDebug(13010)<<"KMimeType::findByContent() returned '"<<mtname<<"', accuracy: \
> "<<accuracy<<endl;
1515,1517d1520
<   int p1, p2;
<   QString w;
< 
1520,1530c1523,1530
<     w = highlight->getMimetypes();
< 
<     p1 = 0;
<     while (p1 < (int) w.length()) {
<       p2 = w.find(';',p1);
<       if (p2 == -1) p2 = w.length();
<       if (p1 < p2) {
<         QRegExp regExp(w.mid(p1,p2 - p1),true,true);
<         if (regExp.search(result->mimeType()) == 0) return hlList.at();
<       }
<       p1 = p2 + 1;
---
> //    kdDebug(13010)<<"KMimeType::findByContent(): considering hl \
> "<<highlight->name()<<endl; QRegExp sep("\\s*;\\s*");
> QStringList l = QStringList::split( sep, highlight->getMimetypes() );
> for( QStringList::Iterator it = l.begin(); it != l.end(); ++it )
> {
> //      kdDebug(13010)<<"..trying "<<*it<<endl;
> if ( *it == mtname ) // faster than a regexp i guess?
> return hlList.at();
1554c1554
< 	  doc->myAttribs = (Attribute *) realloc (doc->myAttribs, sizeof(Attribute) * \
                nAttribs);	
---
> 	  doc->myAttribs = (Attribute *) realloc (doc->myAttribs, sizeof(Attribute) * \
> nAttribs);
Index: part/kateview.cpp
===================================================================
RCS file: /home/kde/kdelibs/kate/part/kateview.cpp,v
retrieving revision 1.80
diff -r1.80 kateview.cpp
257,258c257,260
<       else myDoc->backspace(c.cursor.line, c.cursor.col);
<       if ((uint)c.cursor.line >= myDoc->lastLine()) leftBorder->update();
---
> else
> myDoc->backspace(c.cursor.line, c.cursor.col);
> if ( (uint)c.cursor.line >= myDoc->lastLine() )
> leftBorder->update();
754c756
< //kdDebug()<<"windest line to draw is "<<maxLen<<" px"<<endl;
---
> //kdDebug()<<"widest line to draw is "<<maxLen<<" px"<<endl;
1665c1667
<             break;
---
> break; // never reached ;)
Index: part/kateviewdialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/kate/part/kateviewdialog.cpp,v
retrieving revision 1.23
diff -r1.23 kateviewdialog.cpp
392a393,394
> // anders I hide this for now
> opt[3]->hide();
397c399,400
< 
---
> // anders: this one 2
> opt[4]->hide();
404,405c407,408
<   QWhatsThis::add(opt[3], i18n("Not implemented yet."));
<   QWhatsThis::add(opt[4], i18n("Not yet implemented."));
---
> //QWhatsThis::add(opt[3], i18n("Not implemented yet."));
> //QWhatsThis::add(opt[4], i18n("Not yet implemented."));


["css.cvs.diff" (text/x-diff)]

Index: data/css.xml
===================================================================
RCS file: /home/kde/kdelibs/kate/data/css.xml,v
retrieving revision 1.10
diff -r1.10 css.xml
306c306,312
<       <context attribute="0" lineEndContext="#stay">
---
>       <context attribute="0" lineEndContext="#stay" name="Normal">
>         <Detect2Chars attribute="5" context="2" char="/" char1="*" />
>         <DetectChar attribute="0" context="1" char="{" />
>       </context>
>       <context attribute="0" lineEndContext="#stay" name="Rules">
>         <DetectChar attribute="0" context="#pop" char="}" />
>         <Detect2Chars attribute="5" context="2" char="/" char1="*" />
309a316,319
>       <context attribute="5" lineEndContext="#stay" name="Comment">
>         <Detect2Chars attribute="5" context="#pop" char="*" char1="/" />
>         <RegExpr attribute="6" context= "#stay" string="(FIXME|TODO|NOTE)" />
>       </context>
316a327,328
>       <itemData name="Comment" defStyleNum="dsComment" />
>       <itemData name="Notice" defStyleNum="dsString" />
320a333,335
>     <comments>
>       <comment name="multiLine" start="/*" end="*/" />
>     </comments>

_______________________________________________
kwrite-devel mailing list
kwrite-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kwrite-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic