[PATCH] auto-completing URLs on Ctrl-Enter
David Faure
faure at kde.org
Thu Feb 2 08:08:41 GMT 2006
On Thursday 02 February 2006 03:31, Tony Sideris wrote:
> +QStringList getExtraURLSuffixes()
> +bool autoWrapURL(QLineEdit *edit)
Should both be marked as "static"
> + if (filename != QString::null)
if (!filename.isEmpty())
> + QStringList suffixes (QStringList::split("|", ".com|.org|.net"));
QStringList suffixes; suffixes << ".com" << ".org" << ".net";
to avoid the string parsing.
> suffixes[index]
is linear-time for a QStringList. Will be O(1) in Qt4 though, so I don't care much given that the list is very small.
> + if (txt.right(suffixlen) == suffixes[index])
if (txt.endsWith( suffixes[index] ) )
would be faster though (and allows calling suffixes[index] only once in the loop)
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.
A Makefile.am change for installing the .desktop file will be needed.
Probably just adding it to the konqdata_DATA line.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kfm-devel
mailing list