summaryrefslogtreecommitdiffstats
path: root/opensuse/core/tdelibs/ktip-icon-hack.diff
blob: 4812646d15e6e137d269423f9a22e273997210c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Index: kdeui/ktip.cpp
===================================================================
--- kdeui/ktip.cpp.orig
+++ kdeui/ktip.cpp
@@ -367,24 +367,47 @@ void KTipDialog::showMultiTip(QWidget *p
       mInstance->raise();
   }
 
+static QString fixTip(QString tip)
+{
+    QRegExp iconRegExp("<img src=\"(.*)\">");
+    iconRegExp.setMinimal(true);
+    if (iconRegExp.search(tip)>-1) {
+      QString iconName = iconRegExp.cap(1);
+      if (!iconName.isEmpty())
+         if (KGlobal::dirs()->findResource("icon", iconName).isEmpty())
+           tip.replace("crystalsvg","hicolor");
+    }
+
+    return tip;
+}
+
   void KTipDialog::prevTip()
   {
       mDatabase->prevTip();
-      mTipText->setText(QString::fromLatin1(
+      QString currentTip = QString::fromLatin1(
      "<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
      .arg(mTextColor.name())
      .arg(mBaseColor.name())
-     .arg(i18n(mDatabase->tip().utf8())));
+     .arg(i18n(mDatabase->tip().utf8()));
+
+
+      currentTip = fixTip(currentTip);
+      mTipText->setText(currentTip);
       mTipText->setContentsPos(0, 0);
   }
 
   void KTipDialog::nextTip()
   {
       mDatabase->nextTip();
-      mTipText->setText(QString::fromLatin1("<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
+      QString currentTip = QString::fromLatin1(
+        "<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
         .arg(mTextColor.name())
         .arg(mBaseColor.name())
-        .arg(i18n(mDatabase->tip().utf8())));
+        .arg(i18n(mDatabase->tip().utf8()));
+
+
+      currentTip = fixTip(currentTip);
+      mTipText->setText(currentTip);
       mTipText->setContentsPos(0, 0);
   }