From kde-commits Wed Feb 22 18:24:34 2006 From: =?utf-8?q?Pascal=20L=C3=A9tourneau?= Date: Wed, 22 Feb 2006 18:24:34 +0000 To: kde-commits Subject: KDE/kdebase/libkonq Message-Id: <1140632674.798702.23161.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=114063272115365 SVN commit 512516 by pletourn: Reduce the number of conversion KUrl <-> QString M +2 -2 konq_faviconmgr.cc M +1 -1 konq_faviconmgr.h M +6 -7 konq_pixmapprovider.cc M +2 -2 konq_pixmapprovider.h --- trunk/KDE/kdebase/libkonq/konq_faviconmgr.cc #512515:512516 @@ -34,9 +34,9 @@ "notifyChange(bool, QString, QString)", false); } -QString KonqFavIconMgr::iconForURL(const QString &url) +QString KonqFavIconMgr::iconForURL(const KUrl &url) { - return KMimeType::favIconForURL( KUrl(url) ); + return KMimeType::favIconForURL( url ); } void KonqFavIconMgr::setIconForURL(const KUrl &url, const KUrl &iconURL) --- trunk/KDE/kdebase/libkonq/konq_faviconmgr.h #512515:512516 @@ -54,7 +54,7 @@ * Looks up an icon for @p url and returns its name if found * or QString() otherwise */ - static QString iconForURL(const QString &url); + static QString iconForURL(const KUrl &url); k_dcop: /** --- trunk/KDE/kdebase/libkonq/konq_pixmapprovider.cc #512515:512516 @@ -55,9 +55,9 @@ // if not available, tries to find the pixmap for the mimetype of url // if that fails, gets the icon for the protocol // finally, inserts the url/icon pair into the cache -QString KonqPixmapProvider::iconNameFor( const QString& url ) +QString KonqPixmapProvider::iconNameFor( const KUrl& url ) { - QMap::iterator it = iconMap.find( url ); + QMap::iterator it = iconMap.find( url ); QString icon; if ( it != iconMap.end() ) { icon = it.data(); @@ -65,15 +65,14 @@ return icon; } - if ( url.isEmpty() ) { + if ( url.url().isEmpty() ) { // Use the folder icon for the empty URL icon = KMimeType::mimeType( "inode/directory" )->KServiceType::icon(); Q_ASSERT( !icon.isEmpty() ); } else { - KUrl u = KUrl::fromPathOrURL( url ); - icon = KMimeType::iconNameForURL( u ); + icon = KMimeType::iconNameForURL( url ); Q_ASSERT( !icon.isEmpty() ); } @@ -113,7 +112,7 @@ { QStringList list; QStringList::ConstIterator it = items.begin(); - QMap::const_iterator mit; + QMap::const_iterator mit; while ( it != items.end() ) { mit = iconMap.find( *it ); if ( mit != iconMap.end() ) { @@ -129,7 +128,7 @@ void KonqPixmapProvider::notifyChange( bool isHost, QString hostOrURL, QString iconName ) { - for ( QMap::iterator it = iconMap.begin(); + for ( QMap::iterator it = iconMap.begin(); it != iconMap.end(); ++it ) { --- trunk/KDE/kdebase/libkonq/konq_pixmapprovider.h #512515:512516 @@ -62,7 +62,7 @@ * Looks up an iconname for @p url. Uses a cache for the iconname of url. * @since 3.4.1 */ - QString iconNameFor( const QString& url ); + QString iconNameFor( const KUrl& url ); protected: KonqPixmapProvider( QObject *parent=0, const char *name=0 ); @@ -75,7 +75,7 @@ QPixmap loadIcon( const QString& url, const QString& icon, int size ); private: - QMap iconMap; + QMap iconMap; static KonqPixmapProvider * s_self; };