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

List:       kfm-devel
Subject:    Re: A more flexible solution for internet keywords
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2001-06-11 10:50:14
[Download RAW message or body]

On Sunday 10 June 2001 12:14, Andreas Hochsteger wrote:
> Hi!

Hi Andreas,

> Sorry for this rather long mail, I hope you read it nevertheless ;-)
> I've implemented a more flexible solution for the internet keywords which
> solves some problems with more advanced queries and provides a more
> flexible usage.

I read your original post but forgot to respond, too many things going on :(
Anyways, though I like this expaned feature I have some concerns that
these changes might completely break the curent behavior.  See below...

>
> What was my intend to change the current scheme?
> ------------------------------------------------
> Last week I wanted to create a simplified query for telephone numbers with
> konqeror's internet keywords.
> But I had troubles to get this working the way it should, because the url
> to be generated looks like this:
> http://my.telephone.book/query?name=MyName&city=MyCity
> As you can see there are there are two different substitutions necessary,
> which can't be done by the current substitution scheme.
> It only replaces \1 by the whole (encoded) string of the user query.
>
> I submitted a bug report (whishlist) therefore which can be read here:
> http://lists.kde.org/?l=kde-bugs-dist&m=99189305712959&w=2
>
>
> Overview to my implementation:
> ------------------------------
> Since I never really programmed anything with KDE/Qt beyond some simple
> "Hello World" programms, I wanted to try it myself.
> It's now finished and working well.
> I'm writing to this list, because I've got some remaining questions.
> Perhaps someone can take a look at it, if I've done everything allright.
>
> All changes were done in the method "formatResult".
> Nothing else had to be modified which speaks a lot for the great design of
> kde!
> The parameters query and url of that method have been replaced to reflect
> the real semantics of that parameters.
> I've attached a diff for the file kuriikwsfiltereng.cpp and the whole,
> plain method filterResult (for a quick look).
>
>
> The algorithm works like this:
> ------------------------------
> The user query gets split at the spaces into a QStringList.
                                              ^^^^
Here lies what I think could be the problem.  Does typing for example
gg:The K Desktop Environment work correctly ?  If it does then the 
changes below are probably okay, but ofcourse we need to test and
my concerns go away.  Anyways,  I am being lazy since I can apply
the patch and test :)

>
> Testing:
> --------
> After applying the patch create an internet keyword 'ikw' with the
> following (test-)URL:
> http://www.ikwtest.com/1=\1&2=\2&3=\3&4=\4&5=\5&6=\6&7=\7&8=\8&9=\9&10=\10&
>11=\11&12=\12&name=\name&test=\test
>
> Enter the following query into konqueror:
> ikw:1 2 3 4 5 6 7 name=myname 9 test=mytest 11 12
>
> This query gets replaced with the following url:
> http://www.ikwtest.com/1=1&2=2&3=3&4=4&5=5&6=6&7=7&8=name%3Dmyname&9=9&10=t
>est%3Dmytest&11=11&12=12&name=myname&test=mytest

Please add these and any other tests in the test unit code found under
kdelibs/kio/tests/kurifiltertest.cpp and use it to test if the other scenarios
work as well after making this change.  The main framework (the plugin loader)
that deals with this stuff is located under under kdelibs/kio...

> \0 is a special reference and has the same meanig like \1 has now. It
> simply expands to the whole user query.  The old internet keyword files
> needs to be changed therefore (replace \1 with \0) to work with the new
> scheme.

Hmm... this is also problematic since it breaks any .desktop file other people
have created.  It is fine for our own since we can adapot them.  It also I guess
as Yves stated messes with the charset entry.  I can look into that.

>
> Future work:
> ------------
> * Allow quoted string (name="My Name") and save spaces quotes.
> * Let the user define some global references which can be used in query
>    definitions without specifying them at the user query
>   Examples: name, e-mail address, some environment variables, ...
>   Important: Don't use sensitive information by default, which can cause
> some security weaks, but give the user the possibility to do so if he
> wants to.
>   Implementation is rather simple: Just initialize the IKW-Map with those
> values.
>
>
> Questions:
> ----------
> * I don't know, if I've done everything right with the encoding of the
> strings.
>   Can somebody with more experience take a look at it and help me with that?

I will take a look at this later today if Malte does not beat me to it :)

> * When the code works for everyone and all agree to put it into cvs:
>   Can somebody put it into CVS for me, since I don't have an account?

Yes and Yes :) 

> * What do you think about the global reference thing?

Let me see how it works first :)

Regards,
Dawit A.

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

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