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

List:       kfm-devel
Subject:    Re: [PATCH] auto-completing URLs on Ctrl-Enter
From:       David Faure <faure () kde ! org>
Date:       2006-02-02 8:08:41
Message-ID: 200602020908.41984.faure () kde ! org
[Download RAW message or body]

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@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


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

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