Fix krandrtray profile list when no XRandR extension is available

pull/2/head
Timothy Pearson 12 years ago
parent 2d728f781b
commit f6095d86a6

@ -232,11 +232,14 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
menu->clear(); menu->clear();
menu->setCheckable(true); menu->setCheckable(true);
if (!isValid()) { bool valid = isValid();
if (!valid) {
lastIndex = menu->insertItem(i18n("Required X Extension Not Available")); lastIndex = menu->insertItem(i18n("Required X Extension Not Available"));
menu->setItemEnabled(lastIndex, false); menu->setItemEnabled(lastIndex, false);
} else { }
else {
m_screenPopups.clear(); m_screenPopups.clear();
for (int s = 0; s < numScreens() /*&& numScreens() > 1 */; s++) { for (int s = 0; s < numScreens() /*&& numScreens() > 1 */; s++) {
setCurrentScreen(s); setCurrentScreen(s);
@ -273,17 +276,19 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
menu->connectItem(lastIndex, this, TQT_SLOT(slotColorProfileChanged(int))); menu->connectItem(lastIndex, this, TQT_SLOT(slotColorProfileChanged(int)));
} }
// Find any display profiles if (valid) {
TQStringList displayProfiles; // Find any display profiles
displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true)); TQStringList displayProfiles;
if (displayProfiles.isEmpty() == false) { displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true));
menu->insertTitle(SmallIcon("background"), i18n("Display Profiles")); if (displayProfiles.isEmpty() == false) {
} menu->insertTitle(SmallIcon("background"), i18n("Display Profiles"));
lastIndex = menu->insertItem(SmallIcon("bookmark"), "<default>"); }
menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int))); lastIndex = menu->insertItem(SmallIcon("bookmark"), "<default>");
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->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")); menu->insertTitle(SmallIcon("randr"), i18n("Global Configuation"));

Loading…
Cancel
Save