Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1493715
 поиск   регистрация   авторизация 
 
Группа :: Графические оболочки/KDE
Пакет: kdelibs

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: kdelibs-3.2.0-ALT-icon.patch


--- kdelibs-3.2.0/kdecore/kiconloader.cpp.orig	2003-11-30 10:46:44.000000000 +0100
+++ kdelibs-3.2.0/kdecore/kiconloader.cpp	2004-02-09 22:18:46.863002564 +0100
@@ -687,8 +702,14 @@
                 // Try "User" icon too. Some apps expect this.
                 if (!name.isEmpty())
                     pix = loadIcon(name, KIcon::User, size, state, path_store, true);
-                if (!pix.isNull() || canReturnNull)
+                if (!pix.isNull() || canReturnNull) {
+		    if (pix.width() > size || pix.height() > size) {
+			QImage tmp = pix.convertToImage();
+			tmp = tmp.smoothScale(size, size);
+			pix.convertFromImage(tmp);
+		    }
                     return pix;
+		}
 
                 icon = findMatchingIcon(str_unknown, size);
                 if (!icon.isValid())
@@ -782,6 +803,10 @@
 	if ( abs(size-img->width())>iconThreshold )
 	    *img = img->smoothScale(size, size);
     }
+    if ((iconType == KIcon::Fixed) && (size != img->width()))
+    {
+        *img = img->smoothScale(size, size);
+    }
     if (group >= 0 && d->mpGroups[group].dblPixels)
     {
 	*img = d->mpEffect.doublePixels(*img);
--- kdelibs-3.2.0/kdecore/kicontheme.cpp.orig	2003-11-30 10:46:44.000000000 +0100
+++ kdelibs-3.2.0/kdecore/kicontheme.cpp	2004-02-09 22:27:25.996666882 +0100
@@ -337,7 +337,6 @@
 KIcon KIconTheme::iconPath(const QString& name, int size, KIcon::MatchType match) const
 {
     KIcon icon;
-    QString path;
     int delta = 1000, dw;
     KIconThemeDir *dir;
 
@@ -346,6 +345,8 @@
     for ( ; dirs.current(); ++dirs)
     {
         dir = dirs.current();
+        if (dir->iconPath(name).isEmpty())
+            continue;
 
         if (match == KIcon::MatchExact)
         {
@@ -359,40 +360,45 @@
                 continue;
         } else
         {
-          // dw < 0 means need to scale up to get an icon of the requested size
-          if (dir->type() == KIcon::Fixed)
-          {
-            dw = dir->size() - size;
-          } else if (dir->type() == KIcon::Scalable)
-          {
-            if (size < dir->minSize())
-              dw = dir->minSize() - size;
-            else if (size > dir->maxSize())
-              dw = dir->maxSize() - size;
-            else
-              dw = 0;
-          } else if (dir->type() == KIcon::Threshold)
-          {
-            if (size < dir->size() - dir->threshold())
-              dw = dir->size() - dir->threshold() - size;
-            else if (size > dir->size() + dir->threshold())
-              dw = dir->size() + dir->threshold() - size;
-            else
-              dw = 0;
-          }
-          /* Skip this if we've found a closer one, unless
-             it's a downscale, and we only had upscales befores.
-             This is to avoid scaling up unless we have to,
-             since that looks very ugly */
-          if ((abs(dw) >= abs(delta)) &&
-              !(delta > 0 && dw < 0))
-            continue;
+           // dw < 0 means need to scale up to get an icon of the requested size
+           int dw_ = dw;
+
+            if (dir->type() == KIcon::Fixed)
+           {
+             dw_ = dir->size() - size;
+           } else if (dir->type() == KIcon::Scalable)
+           {
+             if (size < dir->minSize())
+               dw_ = dir->minSize() - size;
+             else if (size > dir->maxSize())
+               dw_ = dir->maxSize() - size;
+             else
+               dw_ = 0;
+           } else if (dir->type() == KIcon::Threshold)
+           {
+             if (size < dir->size() - dir->threshold())
+               dw_ = dir->size() - dir->threshold() - size;
+             else if (size > dir->size() + dir->threshold())
+               dw_ = dir->size() + dir->threshold() - size;
+             else
+               dw_ = 0;
+           }
+
+           if (dw != 1000 && dw_ < dw && dw < 0)
+             continue;
+
+           /* Skip this if we've found a closer one, unless
+              it's a downscale, and we only had upscales befores.
+              This is to avoid scaling up unless we have to,
+              since that looks very ugly */
+            if (abs(dw_) >= abs(delta) && dw_<0 && delta>0)
+             continue;
+            if (abs(dw_) >= abs(dw) && dw>0)
+             continue;
+           dw = dw_;
         }
 
-        path = dir->iconPath(name);
-        if (path.isEmpty())
-            continue;
-        icon.path = path;
+        icon.path = dir->iconPath(name);
         icon.size = dir->size();
         icon.type = dir->type();
 	icon.threshold = dir->threshold();
@@ -403,8 +409,8 @@
             return icon;
 	else
         {
+	    if (dw == 0) return icon; // We won't find a better match anyway
 	    delta = dw;
-	    if (delta==0) return icon; // We won't find a better match anyway
         }
     }
     return icon;
 
design & coding: Vladimir Lettiev aka crux © 2004-2005