Bug 85352 - changes to google searchprovider cannot be saved
Summary: changes to google searchprovider cannot be saved
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Miscellaneous
Component: kcmkurifilt (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 89497 94380 104187 104278 109782 110371 114039 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-07-16 23:31 UTC by mcamen
Modified: 2007-01-30 16:21 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
ikws.diff (914 bytes, text/x-diff)
2005-10-09 05:54 UTC, Dawit Alemayehu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mcamen 2004-07-16 23:31:52 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 3.3.3 (SuSE Linux) 
OS:                Linux

The google.desktop searchprovider file has the following entries:
Query=http://www.google.com/search? [...]
Query[de]=http://www.google.de/search? [...]

If one runs KDE with 'de' language settings, changing the gg: shortcut with the configuration dialog will generate a google.desktop file in $KDEHOME with an entry:
Query=http://foo.bar.com/search? [...]

This is wrong as for KDE_LANG=de the kcontrol module should change the 'Query[de]' key instead of the 'Query' key.
Comment 1 Stephan Kulow 2004-07-18 12:48:58 UTC
I very much disagree. If you change your query settings, it shouldn't fallback to default just because you change languages. 
Comment 2 mcamen 2004-07-18 13:16:25 UTC
Yes, I also noticed this and agree that we have to find another fix.
With the current code a 'de' user has no way to change the gg: shotcut.
Comment 3 Maksim Orlovich 2004-11-15 18:46:52 UTC
*** Bug 89497 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Orlovich 2004-11-15 18:47:33 UTC
Coolo: except isn't the [de] version inside the global file preferred?
The bug reports seem to indicate so.
Comment 5 Maksim Orlovich 2004-12-04 17:45:42 UTC
*** Bug 94380 has been marked as a duplicate of this bug. ***
Comment 6 Maksim Orlovich 2005-04-19 05:15:19 UTC
*** Bug 104187 has been marked as a duplicate of this bug. ***
Comment 7 Maksim Orlovich 2005-04-20 17:21:06 UTC
*** Bug 104278 has been marked as a duplicate of this bug. ***
Comment 8 bonne 2005-04-21 03:08:07 UTC
I found a simple answer to this problem. 
When a searchprovider is modified, it should have the locale saved as well...
For example if google is currently google.co.uk (the default for en_GB) and you want to change it to google.com.au, then simply make the change using Konquerors settings window then modify one line of the file ~/.kde/share/services/searchproviders/google.desktop to read

Query[en_GB]=http://www.google.com.au/search?q=\\{@}&ie=UTF-8&oe=UTF-8 

instead of 

Query=http://www.google.com.au/search?q=\\{@}&ie=UTF-8&oe=UTF-8

Now Konqueror will use your modified settings as default. 
Comment 9 bonne 2005-04-21 03:09:31 UTC
I found a simple answer to this problem. 
 When a searchprovider is modified, it should have the locale saved as well... 
 For example if google is currently google.co.uk (the default for en_GB) and you want to change it to google.com.au, then simply make the change using Konquerors settings window then modify one line of the file ~/.kde/share/services/searchproviders/google.desktop to read 
 
 Query[en_GB]=http://www.google.com.au/search?q=\\{@}&ie=UTF-8&oe=UTF-8 
 
 instead of 
 
 Query=http://www.google.com.au/search?q=\\{@}&ie=UTF-8&oe=UTF-8 
 
 Now Konqueror will use your modified settings as default. 
Comment 10 Maksim Orlovich 2005-07-29 17:37:07 UTC
*** Bug 109782 has been marked as a duplicate of this bug. ***
Comment 11 Al Muckart 2005-09-07 09:37:47 UTC
This bug still exists in KDE 3.4.2/FreeBSD 5.4 ports.

Since British English is used as the default language in more countries than just the UK (Australia and New Zealand at least, and probably other Commonwealth countries, too.) would it not make more sense to select regional settings, such as which google to use, on the configured country rather than the configured language? There is, after all, a setting in the control centre where you specify your country.
Comment 12 Maksim Orlovich 2005-10-07 22:39:20 UTC
*** Bug 114039 has been marked as a duplicate of this bug. ***
Comment 13 Dawit Alemayehu 2005-10-09 05:54:28 UTC
Can someone please try the following patch and let me know if it works fine 
for them ? I cannot test this myself since I have no language other than the 
default installed. Thanks...


Created an attachment (id=12921)
ikws.diff
Comment 14 Dawit Alemayehu 2005-10-09 10:59:03 UTC
*** Bug 110371 has been marked as a duplicate of this bug. ***
Comment 15 Volker Hemmann 2005-10-09 17:20:13 UTC
Hi,
I had to remove my ~/.kde* stuff (survived from 3.2 up to 3.4.2 but had to go after my switch from x86 to x86_64 because of kwin crashes), and since then, setting wpe to en.wikipedia works ...
I don't know, why, but it works

Sorry for the noise.
Comment 16 mcamen 2005-10-09 18:15:45 UTC
The patch requires that we use our current *.ini like configuration backend (because of the hardcoded [ ]). IMHO that doesn't matter.

But it also breaks Kiosk mode, e.g.
 Query[$i]=foobar
becomes
 Query[de]=foobar
instead of
 Query[de][$i]=foobar

Or am I missing something?
Comment 17 Dawit Alemayehu 2005-10-10 16:06:49 UTC
On Sunday 09 October 2005 12:15, mcamen@mcamen.de wrote:
> The patch requires that we use our current *.ini like configuration backend
> (because of the hardcoded [ ]). IMHO that doesn't matter.


Since there is no other way to do this thought KConfig itself, there is no 
choice so it does not matter...

> But it also breaks Kiosk mode, e.g.
>  Query[$i]=foobar
> becomes
>  Query[de]=foobar
> instead of
>  Query[de][$i]=foobar
>
> Or am I missing something?


Yes, you are. Unless you have write permission to kde install directory, the 
newly generated desktop files are saved in your $KDEHOME directory. They then 
simply mask the global .desktop file with the same name. Basically it uses 
KConfig merge feature against itself. Anyways, AFAIK kiosk mode applies to 
the global files and forces KConfig to ignore local settings if things are 
set immutable. Hence, the local changes will simply be ignored...
Comment 18 Dawit Alemayehu 2005-10-10 17:09:13 UTC
SVN commit 469260 by adawit:

- David is right. Make internet keywords case-insensitive. Fixes bug# 106559
- Changes to internet keywords cannot be saved if language is not the default. Fix for bug # 85352

BUG: 106559
CCBUG: 85352



 M  +7 -2      ikwsopts.cpp  
 M  +6 -3      kuriikwsfiltereng.cpp  


--- branches/KDE/3.5/kdebase/kcontrol/ebrowsing/plugins/ikws/ikwsopts.cpp #469259:469260
@@ -28,7 +28,7 @@
 #include <qwhatsthis.h>
 
 #include <kdebug.h>
-
+#include <kglobal.h>
 #include <dcopref.h>
 #include <kapplication.h>
 #include <kcombobox.h>
@@ -262,7 +262,12 @@
       service.writeEntry("Type", "Service");
       service.writeEntry("ServiceTypes", "SearchProvider");
       service.writeEntry("Name", provider->name());
-      service.writeEntry("Query", provider->query());
+
+      QString queryText = QString::fromLatin1("Query");
+      if (KGlobal::locale()->language() != KGlobal::locale()->defaultLanguage())
+          queryText += "[" + KGlobal::locale()->language() + "]";
+
+      service.writeEntry(queryText, provider->query());
       service.writeEntry("Keys", provider->keys());
       service.writeEntry("Charset", provider->charset());
 
--- branches/KDE/3.5/kdebase/kcontrol/ebrowsing/plugins/ikws/kuriikwsfiltereng.cpp #469259:469260
@@ -67,14 +67,16 @@
     int pos = search.find(m_cKeywordDelimiter);
 
     QString key;
-    if ( pos > -1 )
+    if (pos > -1)
       key = search.left(pos);
-    else if ( m_cKeywordDelimiter == ' ' && !search.isEmpty() )
+    else if (m_cKeywordDelimiter == ' ' && !search.isEmpty())
       key = search;
 
     if (!key.isEmpty() && !KProtocolInfo::isKnownProtocol( key ))
     {
-      SearchProvider *provider = SearchProvider::findByKey(key);
+      // Make web shortcut keywords case-insensitive, i.e.
+      // kde == KDE == Kde == kDe == kdE
+      SearchProvider *provider = SearchProvider::findByKey(key.lower());
 
       if (provider)
       {
@@ -445,6 +447,7 @@
   // Migrate from the old format, this block should remain until
   // we can assume "every" user has upgraded to a KDE version that
   // contains the sycoca based search provider configuration (malte).
+  // TODO: Remove in KDE 4 !!! This has been here a sufficient amount of time...
   {
     KSimpleConfig oldConfig(kapp->dirs()->saveLocation("config") + QString(name()) + "rc");
     oldConfig.setGroup("General");
Comment 19 Dawit Alemayehu 2005-10-10 18:22:42 UTC
SVN commit 469299 by adawit:

- Fix bug# 85352 the right way! Thanks David.

BUG: 85352


 M  +1 -6      ikwsopts.cpp  


--- branches/KDE/3.5/kdebase/kcontrol/ebrowsing/plugins/ikws/ikwsopts.cpp #469298:469299
@@ -262,12 +262,7 @@
       service.writeEntry("Type", "Service");
       service.writeEntry("ServiceTypes", "SearchProvider");
       service.writeEntry("Name", provider->name());
-
-      QString queryText = QString::fromLatin1("Query");
-      if (KGlobal::locale()->language() != KGlobal::locale()->defaultLanguage())
-          queryText += "[" + KGlobal::locale()->language() + "]";
-
-      service.writeEntry(queryText, provider->query());
+      service.writeEntry("Query", provider->query(), true, false, true);
       service.writeEntry("Keys", provider->keys());
       service.writeEntry("Charset", provider->charset());