From f0817bac39d72b7d42c2ca867fdff59ad5333d7a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 16 May 2010 23:04:24 +0200 Subject: Removed pointers use in UrlResolver class --- src/urlbar/urlresolver.cpp | 16 +++++++++++----- src/urlbar/urlresolver.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 1376ca2c..5f4f86a3 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -46,7 +46,8 @@ #define MAX_ELEMENTS 9 -// NOTE default kurifilter plugin list (at least in my box) +// NOTE +// default kurifilter plugin list (at least in my box): // 1. "kshorturifilter" // 2. "kurisearchfilter" // 3. "localdomainurifilter" @@ -60,14 +61,19 @@ bool UrlSearchItem::operator==(const UrlSearchItem &i) const } -QRegExp* UrlResolver::_browseRegexp = NULL; +// ------------------------------------------------------------------------ + + +QRegExp UrlResolver::_browseRegexp; UrlResolver::UrlResolver(const QString &typedUrl) : _typedString(typedUrl.trimmed()) { - if (_browseRegexp==NULL) + if ( _browseRegexp.isEmpty() ) { + kDebug() << "browse regexp empty. Setting value.."; + QString protocol = "^(http://|https://|file://|ftp://)"; QString ipv4 = "^0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])"\ @@ -83,7 +89,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\ "pro)"; - _browseRegexp = new QRegExp("(" + protocol + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")"); + _browseRegexp = QRegExp("(" + protocol + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")"); } } @@ -99,7 +105,7 @@ UrlSearchList UrlResolver::orderedSearchItems() UrlSearchList list; - if(_browseRegexp->indexIn(_typedString) != -1) + if(_browseRegexp.indexIn(_typedString) != -1) { list << qurlFromUserInputResolution(); list << webSearchesResolution(); diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index 7d3db967..0c7df8c8 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -84,7 +84,7 @@ private: UrlSearchList bookmarksResolution(); UrlSearchList placeTypedDomaineNameOnTop(UrlSearchList list); - static QRegExp *_browseRegexp; + static QRegExp _browseRegexp; }; #endif // URL_RESOLVER_H -- cgit v1.2.1