From f6095d86a621538298e764b710344c3e50ecc9e8 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 17 Jan 2013 14:59:23 -0600 Subject: Fix krandrtray profile list when no XRandR extension is available --- kcontrol/randr/krandrtray.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'kcontrol') diff --git a/kcontrol/randr/krandrtray.cpp b/kcontrol/randr/krandrtray.cpp index 8e6a19256..89315f75c 100644 --- a/kcontrol/randr/krandrtray.cpp +++ b/kcontrol/randr/krandrtray.cpp @@ -232,11 +232,14 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu) menu->clear(); menu->setCheckable(true); - if (!isValid()) { + bool valid = isValid(); + + if (!valid) { lastIndex = menu->insertItem(i18n("Required X Extension Not Available")); menu->setItemEnabled(lastIndex, false); - } else { + } + else { m_screenPopups.clear(); for (int s = 0; s < numScreens() /*&& numScreens() > 1 */; s++) { setCurrentScreen(s); @@ -273,17 +276,19 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu) menu->connectItem(lastIndex, this, TQT_SLOT(slotColorProfileChanged(int))); } - // Find any display profiles - TQStringList displayProfiles; - displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true)); - if (displayProfiles.isEmpty() == false) { - menu->insertTitle(SmallIcon("background"), i18n("Display Profiles")); - } - lastIndex = menu->insertItem(SmallIcon("bookmark"), ""); - menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int))); - for (TQStringList::Iterator t(displayProfiles.begin()); t != displayProfiles.end(); ++t) { - lastIndex = menu->insertItem(SmallIcon("bookmark"), *t); + if (valid) { + // Find any display profiles + TQStringList displayProfiles; + displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true)); + if (displayProfiles.isEmpty() == false) { + menu->insertTitle(SmallIcon("background"), i18n("Display Profiles")); + } + lastIndex = menu->insertItem(SmallIcon("bookmark"), ""); menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int))); + for (TQStringList::Iterator t(displayProfiles.begin()); t != displayProfiles.end(); ++t) { + lastIndex = menu->insertItem(SmallIcon("bookmark"), *t); + menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int))); + } } menu->insertTitle(SmallIcon("randr"), i18n("Global Configuation")); -- cgit v1.2.1