Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > d452cce76a211840150b563e9f20ef84 > files > 16

kdebase-3.5.7-38.4mdv2008.0.src.rpm

--- kdebase-3.5.6/kicker/libkicker/kickerSettings.kcfg.kicker_side_top	2007-03-13 19:13:48.000000000 +0100
+++ kdebase-3.5.6/kicker/libkicker/kickerSettings.kcfg	2007-03-13 19:13:48.000000000 +0100
@@ -255,6 +255,22 @@
       <default>true</default>
    </entry>
 
+<entry name="UseTopSide" type="Bool" >
+      <label>Use side image on top of Kmenu</label>
+      <default>true</default>
+   </entry>
+
+<entry name="SideTopPixmapName" key="SideTopName" type="String" >
+      <label>The name of the file to use as the side image in the K Menu</label>
+      <default>kside_top.png</default>
+   </entry>
+
+<entry name="SideTopTileName" key="SideTopTileName" type="String" >
+      <label>The name of the file used as a tile to fill the height of K Menu that SidePixmapName does not cover</label>
+      <default>kside_top_tile.png</default>
+   </entry>
+
+
 <entry name="SidePixmapName" key="SideName" type="String" >
       <label>The name of the file to use as the side image in the K Menu</label>
       <default>kside.png</default>
--- kdebase-3.5.6/kicker/kicker/ui/popupmenutop.cpp.kicker_side_top	2007-03-13 19:13:48.000000000 +0100
+++ kdebase-3.5.6/kicker/kicker/ui/popupmenutop.cpp	2007-03-13 19:13:48.000000000 +0100
@@ -0,0 +1,85 @@
+/*****************************************************************
+
+Copyright (c) 2007 Montel Laurent <lmontel@mandriva.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************/
+
+#include "popupmenutop.h"
+#include "kickerSettings.h"
+#include <kstandarddirs.h>
+#include <qimage.h>
+#include <kdebug.h>
+
+PopupMenuTop::PopupMenuTop() : 
+        QCustomMenuItem()
+{
+  init();
+}
+
+void PopupMenuTop::init()
+{
+  QString sideName = KickerSettings::sideTopPixmapName();
+  QString sideTileName = KickerSettings::sideTopTileName();
+  //kdDebug()<<" sideName :"<<sideName<<endl;
+  //kdDebug()<<" sideTileName : "<<sideTileName<<endl;
+  QImage image;
+  image.load(locate("data", "kicker/pics/" + sideName));
+
+  sidePixmap.convertFromImage(image);
+  image.load(locate("data", "kicker/pics/" + sideTileName));
+  
+  if (image.isNull())
+    {
+      kdDebug(1210) << "Can't find a side tile pixmap" << endl;
+      return;
+    }
+  sideTilePixmap.convertFromImage(image);
+  
+  if (sidePixmap.height() != sideTilePixmap.height())
+    {
+      kdDebug(1210) << "Pixmaps have to be the same size" << endl;
+      return;
+    }
+  if (sideTilePixmap.width() < 100)
+    {
+      int tiles = (int)(100 / sideTilePixmap.width()) + 1;
+      QPixmap preTiledPixmap(sideTilePixmap.width()*tiles, sideTilePixmap.height());
+      QPainter p2(&preTiledPixmap);
+      p2.drawTiledPixmap(preTiledPixmap.rect(), sideTilePixmap);
+      sideTilePixmap = preTiledPixmap;
+    }
+}
+
+void PopupMenuTop::paint(QPainter* p, const QColorGroup& cg, 
+	   bool /* act */, bool /*enabled*/, 
+	   int x, int y, int w, int h)
+{
+  //kdDebug()<<" PopupMenuTop::paint\n";
+  p->save();
+  p->drawPixmap( x,y, sidePixmap );
+  p->drawTiledPixmap(QRect(x+sidePixmap.width(),y,w,h),sideTilePixmap);
+  p->restore();
+}
+
+QSize PopupMenuTop::sizeHint()
+{
+  QSize size = QSize(50,sideTilePixmap.height());
+  return size;
+}
--- kdebase-3.5.6/kicker/kicker/ui/popupmenutop.h.kicker_side_top	2007-03-13 19:13:48.000000000 +0100
+++ kdebase-3.5.6/kicker/kicker/ui/popupmenutop.h	2007-03-13 19:13:48.000000000 +0100
@@ -0,0 +1,53 @@
+/*****************************************************************
+
+Copyright (c) 2007 Montel Laurent <lmontel@mandriva.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************/
+
+#ifndef POPUPMENUTOP_H
+#define POPUPMENUTOP_H
+
+#include <qfont.h>
+#include <qstring.h>
+#include <qstyle.h>
+#include <qpainter.h>
+#include <qmenudata.h>
+
+#include <kapplication.h>
+
+class PopupMenuTop : public QCustomMenuItem
+{
+public:
+    PopupMenuTop();
+
+    bool fullSpan () const { return true; }
+
+    QSize sizeHint();
+
+    void paint(QPainter* p, const QColorGroup& cg, 
+	   bool /* act */, bool /*enabled*/, 
+	       int x, int y, int w, int h);
+ private:
+    void init();
+     QPixmap sidePixmap;
+     QPixmap sideTilePixmap;
+};
+
+#endif
--- kdebase-3.5.6/kicker/kicker/ui/Makefile.am.kicker_side_top	2005-09-10 10:25:31.000000000 +0200
+++ kdebase-3.5.6/kicker/kicker/ui/Makefile.am	2007-03-13 19:13:48.000000000 +0100
@@ -12,7 +12,7 @@
         addextension_mnu.cpp extensionop_mnu.cpp \
         recentapps.cpp browser_dlg.cpp \
         removeapplet_mnu.cpp removeextension_mnu.cpp removecontainer_mnu.cpp \
-        removebutton_mnu.cpp popupmenutitle.cpp hidebutton.cpp \
+        removebutton_mnu.cpp popupmenutitle.cpp popupmenutop.cpp hidebutton.cpp \
         addappletvisualfeedback.cpp
 
 libkicker_ui_la_LIBADD = $(top_builddir)/libkonq/libkonq.la $(top_builddir)/kdmlib/libdmctl.la
--- kdebase-3.5.6/kicker/kicker/ui/k_mnu.cpp.kicker_side_top	2006-10-01 19:31:52.000000000 +0200
+++ kdebase-3.5.6/kicker/kicker/ui/k_mnu.cpp	2007-03-13 19:23:42.000000000 +0100
@@ -44,6 +44,7 @@
 #include <kmessagebox.h>
 #include <kstandarddirs.h>
 #include <kwin.h>
+#include <popupmenutop.h>
 
 #include "client_mnu.h"
 #include "container_base.h"
@@ -106,7 +107,7 @@
 
 bool PanelKMenu::loadSidePixmap()
 {
-    if (!KickerSettings::useSidePixmap())
+    if (!KickerSettings::useSidePixmap() || KickerSettings::useTopSide())
     {
         return false;
     }
@@ -602,9 +603,11 @@
     if (RecentApps.count() > 0)
     {
         bool bSeparator = KickerSettings::showMenuTitles();
+	bool bTitleTop = KickerSettings::useTopSide();
         int nId = serviceMenuEndId() + 1;
         int nIndex = KickerSettings::showMenuTitles() ? 1 : 0;
-
+	if( bTitleTop )
+		nIndex = KickerSettings::showMenuTitles() ? 2 : 0;
         for (QValueList<QString>::ConstIterator it =
              RecentApps.fromLast(); /*nop*/; --it)
         {
@@ -623,6 +626,11 @@
                             RecentlyLaunchedApps::the().caption(), font()),
                         serviceMenuEndId(), 0);
                     setItemEnabled( id, false );
+		    if( bTitleTop)
+		    {
+		    id = insertItem(new PopupMenuTop(),serviceMenuEndId(),0);
+		    setItemEnabled( id, false );
+		    }
                 }
                 insertMenuItem(s, nId++, nIndex);
                 RecentlyLaunchedApps::the().m_nNumMenuItems++;
@@ -639,6 +647,11 @@
             insertSeparator(RecentlyLaunchedApps::the().m_nNumMenuItems);
         }
     }
+    else if(KickerSettings::useTopSide())
+    {
+            int id = insertItem(new PopupMenuTop(),serviceMenuEndId(),0);
+            setItemEnabled( id, false );
+    }
 }
 
 void PanelKMenu::clearSubmenus()
@@ -670,6 +683,8 @@
 
     RecentlyLaunchedApps::the().m_bNeedToUpdate = false;
 
+    bool bTitleTop = KickerSettings::useTopSide();
+
     int nId = serviceMenuEndId() + 1;
 
     // remove previous items
@@ -677,6 +692,8 @@
     {
         // -1 --> menu title
         int i = KickerSettings::showMenuTitles() ? -1 : 0;
+	if(bTitleTop)
+		i = KickerSettings::showMenuTitles() ? -2 : 0;
         for (; i < RecentlyLaunchedApps::the().m_nNumMenuItems; i++)
         {
             removeItem(nId + i);
@@ -689,6 +706,8 @@
             removeItemAt(0);
         }
     }
+    if(bTitleTop)
+    	removeItemAt(0);
 
     // insert new items
     QStringList RecentApps;
@@ -714,9 +733,15 @@
                         RecentlyLaunchedApps::the().caption(),
                             font()), nId - 1, 0);
                     setItemEnabled( id, false );
+		    if(bTitleTop)
+		    {
+                    id = insertItem(new PopupMenuTop(),nId - 1,0);
+                    setItemEnabled( id, false );
+		    }
+
                 }
                 insertMenuItem(s, nId++, KickerSettings::showMenuTitles() ?
-                    1 : 0);
+                    2 : 0);
                 RecentlyLaunchedApps::the().m_nNumMenuItems++;
             }
 
@@ -729,6 +754,12 @@
             insertSeparator(RecentlyLaunchedApps::the().m_nNumMenuItems);
         }
     }
+    else if(bTitleTop)
+    {
+            int id = insertItem(new PopupMenuTop(),serviceMenuEndId(),0);
+            setItemEnabled( id, false );
+    }
+
 }
 
 void PanelKMenu::clearRecentMenuItems()