summaryrefslogtreecommitdiffstats
path: root/kcontrol/randr
diff options
context:
space:
mode:
Diffstat (limited to 'kcontrol/randr')
-rw-r--r--kcontrol/randr/krandrtray.cpp49
-rw-r--r--kcontrol/randr/krandrtray.h5
2 files changed, 54 insertions, 0 deletions
diff --git a/kcontrol/randr/krandrtray.cpp b/kcontrol/randr/krandrtray.cpp
index 18d14bdc6..292d51380 100644
--- a/kcontrol/randr/krandrtray.cpp
+++ b/kcontrol/randr/krandrtray.cpp
@@ -78,6 +78,14 @@ KRandRSystemTray::KRandRSystemTray(QWidget* parent, const char *name)
last_known_x = currentScreen()->currentPixelWidth();
last_known_y = currentScreen()->currentPixelHeight();
}
+
+ t_config = new KSimpleConfig("kiccconfigrc");
+
+ QString cur_profile;
+ cur_profile = getCurrentProfile();
+ if (cur_profile != "") {
+ applyIccConfiguration(cur_profile, NULL);
+ }
}
void KRandRSystemTray::mousePressEvent(QMouseEvent* e)
@@ -179,8 +187,26 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
addOutputMenu(menu);
+ // Find any user ICC profiles
+ menu->insertTitle(SmallIcon("kcoloredit"), i18n("Color Profile"));
+ QStringList cfgProfiles;
+ cfgProfiles = t_config->groupList();
+ for (QStringList::Iterator t(cfgProfiles.begin()); t != cfgProfiles.end(); ++t) {
+ lastIndex = menu->insertItem(*t);
+ if (t_config->readEntry("CurrentProfile") == (*t)) {
+ menu->setItemChecked(lastIndex, true);
+ }
+ menu->setItemEnabled(lastIndex, t_config->readBoolEntry("EnableICC", false));
+ menu->connectItem(lastIndex, this, SLOT(slotColorProfileChanged(int)));
+ }
+
menu->insertTitle(SmallIcon("randr"), i18n("Global Configuation"));
+ KAction *actColors = new KAction( i18n( "Configure Color Profiles..." ),
+ SmallIconSet( "configure" ), KShortcut(), this, SLOT( slotColorConfig() ),
+ actionCollection() );
+ actColors->plug( menu );
+
// KAction *actPrefs = new KAction( i18n( "Configure Display..." ),
// SmallIconSet( "configure" ), KShortcut(), this, SLOT( slotPrefs() ),
// actionCollection() );
@@ -194,6 +220,8 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
menu->insertItem(SmallIcon("help"),KStdGuiItem::help().text(), m_help->menu());
KAction *quitAction = actionCollection()->action(KStdAction::name(KStdAction::Quit));
quitAction->plug(menu);
+
+ m_menu = menu;
}
void KRandRSystemTray::slotScreenActivated()
@@ -225,6 +253,12 @@ void KRandRSystemTray::configChanged()
}
first = false;
+
+ QString cur_profile;
+ cur_profile = getCurrentProfile();
+ if (cur_profile != "") {
+ applyIccConfiguration(cur_profile, NULL);
+ }
}
int KRandRSystemTray::GetDefaultResolutionParameter()
@@ -401,6 +435,15 @@ void KRandRSystemTray::slotPrefs()
kcm->exec();
}
+void KRandRSystemTray::slotColorConfig()
+{
+ KCMultiDialog *kcm = new KCMultiDialog( KDialogBase::Plain, i18n( "Configure" ), this );
+
+ kcm->addModule( "iccconfig" );
+ kcm->setPlainCaption( i18n( "Configure Display Color Profiles" ) );
+ kcm->exec();
+}
+
void KRandRSystemTray::slotSettingsChanged(int category)
{
if ( category == (int) KApplication::SETTINGS_SHORTCUTS ) {
@@ -693,6 +736,12 @@ void KRandRSystemTray::addOutputMenu(KPopupMenu* menu)
}
}
+void KRandRSystemTray::slotColorProfileChanged(int parameter)
+{
+ t_config->writeEntry("CurrentProfile", m_menu->text(parameter));
+ applyIccConfiguration(m_menu->text(parameter), NULL);
+}
+
void KRandRSystemTray::slotOutputChanged(int parameter)
{
XRROutputInfo *output_info;
diff --git a/kcontrol/randr/krandrtray.h b/kcontrol/randr/krandrtray.h
index fac91e358..d34c85071 100644
--- a/kcontrol/randr/krandrtray.h
+++ b/kcontrol/randr/krandrtray.h
@@ -50,10 +50,12 @@ protected slots:
void slotOrientationChanged(int parameter);
void slotRefreshRateChanged(int parameter);
void slotPrefs();
+ void slotColorConfig();
void slotSKeys();
void slotSettingsChanged(int category);
void slotCycleDisplays();
void slotOutputChanged(int parameter);
+ void slotColorProfileChanged(int parameter);
protected:
void mousePressEvent( QMouseEvent *e );
@@ -75,6 +77,9 @@ private:
int last_known_x;
int last_known_y;
+
+ KPopupMenu* m_menu;
+ KSimpleConfig *t_config;
};
#endif