From 10e41144596fc9ced40fc349d9ecd099b1c2ea19 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 11 Dec 2009 20:21:27 +0000 Subject: Initial import of Trinity 3.5.11 to kdebase Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes Will need to check for commit warnings and repair as encountered Also needs full compile test git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/iccconfig/Makefile.am | 17 ++++ kcontrol/iccconfig/configure.in.in | 7 ++ kcontrol/iccconfig/iccconfig.cpp | 166 +++++++++++++++++++++++++++++++++++ kcontrol/iccconfig/iccconfig.desktop | 21 +++++ kcontrol/iccconfig/iccconfig.h | 71 +++++++++++++++ kcontrol/iccconfig/iccconfigbase.ui | 102 +++++++++++++++++++++ kcontrol/iccconfig/iccconfigbase2.ui | 104 ++++++++++++++++++++++ 7 files changed, 488 insertions(+) create mode 100644 kcontrol/iccconfig/Makefile.am create mode 100644 kcontrol/iccconfig/configure.in.in create mode 100644 kcontrol/iccconfig/iccconfig.cpp create mode 100644 kcontrol/iccconfig/iccconfig.desktop create mode 100644 kcontrol/iccconfig/iccconfig.h create mode 100644 kcontrol/iccconfig/iccconfigbase.ui create mode 100644 kcontrol/iccconfig/iccconfigbase2.ui (limited to 'kcontrol/iccconfig') diff --git a/kcontrol/iccconfig/Makefile.am b/kcontrol/iccconfig/Makefile.am new file mode 100644 index 000000000..8ebd2b289 --- /dev/null +++ b/kcontrol/iccconfig/Makefile.am @@ -0,0 +1,17 @@ +AM_CPPFLAGS = $(all_includes) +kde_module_LTLIBRARIES = kcm_iccconfig.la + +kcm_iccconfig_la_SOURCES = iccconfig.cpp iccconfigbase.ui iccconfig.skel + +kcm_iccconfig_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined + +kcm_iccconfig_la_LIBADD = -lkdeui $(LIB_KIO) + +METASOURCES = AUTO + +noinst_HEADERS = iccconfig.h + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmiccconfig.pot + +xdg_apps_DATA = iccconfig.desktop diff --git a/kcontrol/iccconfig/configure.in.in b/kcontrol/iccconfig/configure.in.in new file mode 100644 index 000000000..a98dfc1b2 --- /dev/null +++ b/kcontrol/iccconfig/configure.in.in @@ -0,0 +1,7 @@ +case "$host" in + *-*-linux*) + FOUND_LINUX=yes + ;; +esac + +AM_CONDITIONAL(include_kcontrol_iccconfig, test "$FOUND_LINUX" = "yes") \ No newline at end of file diff --git a/kcontrol/iccconfig/iccconfig.cpp b/kcontrol/iccconfig/iccconfig.cpp new file mode 100644 index 000000000..36eb20593 --- /dev/null +++ b/kcontrol/iccconfig/iccconfig.cpp @@ -0,0 +1,166 @@ +/** + * smartcard.cpp + * + * Copyright (c) 2001 George Staikos + * Copyright (c) 2001 Fernando Llobregat + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "iccconfig.h" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using namespace std; + +/**** DLL Interface ****/ +typedef KGenericFactory KICCCFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_iccconfig, KICCCFactory("kcmiccconfig") ) + +KSimpleConfig *config; + +/**** KICCConfig ****/ + +KICCConfig::KICCConfig(QWidget *parent, const char *name, const QStringList &) + : KCModule(KICCCFactory::instance(), parent, name) +{ + + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + config = new KSimpleConfig( QString::fromLatin1( KDE_CONFDIR "/kicc/kiccconfigrc" )); + + KAboutData *about = + new KAboutData(I18N_NOOP("kcmiccconfig"), I18N_NOOP("KDE ICC Profile Control Module"), + 0, 0, KAboutData::License_GPL, + I18N_NOOP("(c) 2009 Timothy Pearson")); + + about->addAuthor("Timothy Pearson", 0, "kb9vqf@pearsoncomputing.net"); + setAboutData( about ); + + base = new ICCConfigBase(this); + layout->add(base); + + setRootOnlyMsg(i18n("The ICC color profile is a system wide setting, and requires administrator access
To alter the system's ICC profile, click on the \"Administrator Mode\" button below.")); + setUseRootOnlyMsg(true); + + connect(base->enableSupport, SIGNAL(clicked()), SLOT(changed())); + connect(base->enableSupport, SIGNAL(toggled(bool)), base->iccFile, SLOT(setEnabled(bool))); + + connect(base->iccFile, SIGNAL(textChanged(const QString&)), SLOT(changed())); + + load(); + + if (getuid() != 0 || !config->checkConfigFilesWritable( true )) { + base->enableSupport->setEnabled(false); + base->iccFile->setEnabled(false); + } +} + +KICCConfig::~KICCConfig() +{ + delete config; +} + +void KICCConfig::load() +{ + load( false ); +} + +void KICCConfig::load(bool useDefaults ) +{ + //Update the toggle buttons with the current configuration + + config->setReadDefaults( useDefaults ); + + base->enableSupport->setChecked(config->readBoolEntry("EnableICC", false)); + base->iccFile->setEnabled(config->readBoolEntry("EnableICC", false)); + base->iccFile->setURL(config->readEntry("ICCFile")); + + emit changed(useDefaults); +} + +void KICCConfig::save() +{ + config->writeEntry("EnableICC", base->enableSupport->isChecked()); + config->writeEntry("ICCFile", base->iccFile->url()); + + if (base->enableSupport->isChecked()) { + // Apply ICC settings with XCalib + string icc_command="/usr/bin/xcalib "; + FILE *pipe_xcalib; + char xcalib_result[2048]; + int i; + xcalib_result[0]=0; + + icc_command.append(base->iccFile->url().ascii()); + if ((pipe_xcalib = popen(icc_command.c_str(), "r")) == NULL) + { + printf("Xcalib pipe error\n\r"); + } + else { + fgets(xcalib_result, 2048, pipe_xcalib); + pclose(pipe_xcalib); + for (i=1;i<2048;i++) { + if (xcalib_result[i] == 0) { + xcalib_result[i-1]=0; + i=2048; + } + } + if (strlen(xcalib_result) > 2) { + KMessageBox::error(this, QString("Unable to apply ICC configuration:\n\r%1").arg(xcalib_result)); + } + } + } + + emit changed(false); +} + +void KICCConfig::defaults() +{ + load( true ); +} + +QString KICCConfig::quickHelp() const +{ + return i18n("

ICC Profile Configuration

This module allows you to configure KDE support" + " for ICC profiles. This allows you to easily color correct your monitor" + " for a more lifelike and vibrant image."); +} + +#include "iccconfig.moc" \ No newline at end of file diff --git a/kcontrol/iccconfig/iccconfig.desktop b/kcontrol/iccconfig/iccconfig.desktop new file mode 100644 index 000000000..97f1b5a9d --- /dev/null +++ b/kcontrol/iccconfig/iccconfig.desktop @@ -0,0 +1,21 @@ +[Desktop Entry] +Exec=kcmshell iccconfig +Icon=kcoloredit +Type=Application +DocPath=kcontrol/iccconfig/index.html + +X-KDE-Library=iccconfig +X-KDE-ParentApp=kcontrol +X-KDE-RootOnly=true +X-KDE-SubstituteUID=true + +Categories=Qt;KDE;X-KDE-settings-peripherals; +Comment=Configure display ICC profile +Comment[en_US]=Configure display ICC profile +DocPath=kcontrol/iccconfig.html +GenericName= +GenericName[en_US]= +Keywords=ICC,display,color,profile +MimeType= +Name=ICC Color Profile +Name[en_US]=ICC Color Profile \ No newline at end of file diff --git a/kcontrol/iccconfig/iccconfig.h b/kcontrol/iccconfig/iccconfig.h new file mode 100644 index 000000000..0736968b4 --- /dev/null +++ b/kcontrol/iccconfig/iccconfig.h @@ -0,0 +1,71 @@ +/** + * iccconfig.h + * + * Copyright (c) 2009 Timothy Pearson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _KCM_ICCCONFIG_H +#define _KCM_ICCCONFIG_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include + +#include "iccconfigbase.h" + +class KConfig; +class KPopupMenu; +class KListViewItem; + +class KICCConfig : public KCModule, public DCOPObject +{ + K_DCOP + Q_OBJECT + + +public: + //KICCConfig(QWidget *parent = 0L, const char *name = 0L); + KICCConfig(QWidget *parent, const char *name, const QStringList &); + virtual ~KICCConfig(); + + ICCConfigBase *base; + + void load(); + void load( bool useDefaults); + void save(); + void defaults(); + + int buttons(); + QString quickHelp() const; + + k_dcop: + +private: + + KConfig *config; + bool _ok; + KPopupMenu * _popUpKardChooser; + + +}; + +#endif + diff --git a/kcontrol/iccconfig/iccconfigbase.ui b/kcontrol/iccconfig/iccconfigbase.ui new file mode 100644 index 000000000..0d6689fd7 --- /dev/null +++ b/kcontrol/iccconfig/iccconfigbase.ui @@ -0,0 +1,102 @@ + +ICCConfigBase + + + ICCConfigBase + + + + 0 + 0 + 519 + 356 + + + + + unnamed + + + + TabWidget2 + + + true + + + + tab + + + ICC Color Profile Configuration + + + + unnamed + + + + enableSupport + + + &Enable global ICC color profile support + + + + + iccFile + + + *.icc + + + + + textLabel2_2 + + + ICC File + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + enableSupport + toggled(bool) + ICCConfigBase + enableSupport_toggled(bool) + + + + ICCConfigBase.ui.h + + + enableSupport_toggled(bool) + + + kdialog.h + + + + diff --git a/kcontrol/iccconfig/iccconfigbase2.ui b/kcontrol/iccconfig/iccconfigbase2.ui new file mode 100644 index 000000000..cad130b47 --- /dev/null +++ b/kcontrol/iccconfig/iccconfigbase2.ui @@ -0,0 +1,104 @@ + +ICCConfigBase + + + ICCConfigBase + + + + 0 + 0 + 519 + 356 + + + + ICCConfigBase + + + + unnamed + + + + TabWidget2 + + + true + + + + tab + + + ICC Color Profile Configuration + + + + unnamed + + + + enableSupport + + + &Enable ICC color profile support + + + + + editPCF + + + .icc + + + + + textLabel2_2 + + + ICC File + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + + enableSupport + toggled(bool) + ICCConfigBase + enableSupport_toggled(bool) + + + + enableSupport_toggled(bool) + + + + + kurlrequester.h + klineedit.h + kpushbutton.h + + -- cgit v1.2.1