From 78feb5c8dc099b79e855db97ac96d7a2c33644c6 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 22 Sep 2010 07:16:55 +0000 Subject: Repair various KMenu side pixmap problems git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1178045 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/kicker/menutab_impl.cpp | 7 +++++++ kicker/kicker/ui/k_mnu.cpp | 21 ++++++++++++++++++++- kicker/kicker/ui/k_mnu.h | 4 ++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/kcontrol/kicker/menutab_impl.cpp b/kcontrol/kicker/menutab_impl.cpp index fa1b123e1..970aa10a1 100644 --- a/kcontrol/kicker/menutab_impl.cpp +++ b/kcontrol/kicker/menutab_impl.cpp @@ -233,6 +233,13 @@ void MenuTab::save() if (kmenusetting != oldkmenusetting) DCOPRef ("kicker", "default").call("restart()"); + c->setGroup("KMenu"); + bool sidepixmapsetting = kcfg_UseSidePixmap->isChecked(); + bool oldsidepixmapsetting = c->readBoolEntry("UseSidePixmap", true); + + if (sidepixmapsetting != oldsidepixmapsetting) + DCOPRef ("kicker", "default").call("restart()"); + // Save KMenu settings c->setGroup("KMenu"); c->writeEntry("CustomIcon", m_kmenu_icon); diff --git a/kicker/kicker/ui/k_mnu.cpp b/kicker/kicker/ui/k_mnu.cpp index b8084f489..9328a8586 100644 --- a/kicker/kicker/ui/k_mnu.cpp +++ b/kicker/kicker/ui/k_mnu.cpp @@ -74,6 +74,7 @@ PanelKMenu::PanelKMenu() : PanelServiceMenu(TQString::null, TQString::null, 0, "KMenu") , bookmarkMenu(0) , bookmarkOwner(0) + , displayRepaired(FALSE) { static const TQCString dcopObjId("KMenu"); DCOPObject::setObjId(dcopObjId); @@ -91,6 +92,8 @@ PanelKMenu::PanelKMenu() dcopObjId, "slotServiceStartedByStorageId(TQString,TQString)", false); + displayRepairTimer = new TQTimer( this ); + connect( displayRepairTimer, SIGNAL(timeout()), this, SLOT(repairDisplay()) ); } PanelKMenu::~PanelKMenu() @@ -365,9 +368,26 @@ void PanelKMenu::initialize() insertTearOffHandle(); #endif + if (displayRepaired == FALSE) { + displayRepairTimer->start(0, FALSE); + displayRepaired = TRUE; + } + setInitialized(true); } +void PanelKMenu::repairDisplay(void) { + if (isShown() == true) { + displayRepairTimer->stop(); + + // Now do a nasty hack to prevent search bar merging into the side image + // This forces a layout/repaint of the qpopupmenu + repaint(); // This ensures that the side bar image was applied + styleChange(style()); // This forces a call to the private function updateSize(TRUE) inside the qpopupmenu. + update(); // This repaints the entire popup menu to apply the widget size/alignment changes made above + } +} + int PanelKMenu::insertClientMenu(KickerClientMenu *p) { int id = client_id; @@ -520,7 +540,6 @@ void PanelKMenu::showMenu() else { show(); - repaint(); // If the menu is not repainted on initial display the search bar merges into the side image } } diff --git a/kicker/kicker/ui/k_mnu.h b/kicker/kicker/ui/k_mnu.h index 91904e0d0..6dedec4c9 100644 --- a/kicker/kicker/ui/k_mnu.h +++ b/kicker/kicker/ui/k_mnu.h @@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include "service_mnu.h" @@ -84,6 +85,7 @@ protected slots: void paletteChanged(); virtual void configChanged(); void updateRecent(); + void repairDisplay(); protected: TQRect sideImageRect(); @@ -113,6 +115,8 @@ private: PopupMenuList dynamicSubMenus; KPIM::ClickLineEdit *searchEdit; static const int searchLineID; + TQTimer *displayRepairTimer; + bool displayRepaired; }; #endif -- cgit v1.2.3