[PATCH] auto-completing URLs on Ctrl-Enter

Thiago Macieira thiago at kde.org
Thu Feb 2 09:17:16 GMT 2006


David Faure wrote:
>Config-file parsing is slow, maybe getExtraURLSuffixes() could be a real
> KonqCombo method, and could use a member variable to cache the
> QStringList? It would also need a boolean "m_extraSuffixesAlreadyRead",
> testing for the list being empty wouldn't work if the config file
> actually says empty.

Since you can't change languages in the middle of running programs, I'd 
recommend making it a static variable:

in autoWrapURL:
  static QStringList suffixes = getSuffixes();

and getSuffixes() opens the config, reads it and prepends the defaults.

The compiler will generate code to make sure getSuffixes is called only 
once, when autoWrapURL is run for the first time. Any decent compiler 
will also implement thread-safe locking on that automatically.

The consequence is, of course, that you can't change the list of suffixes 
without restarting Konqueror.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

2. Tó cennan his weorc gearu, ymbe se circolwyrde, wearð se cægbord and se 
leohtspeccabord, and þa mýs cómon lator. On þone dæg, he hine reste.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20060202/d985d920/attachment.sig>


More information about the kfm-devel mailing list