From 477e956a04dfb244814f274e98a8d6f4beb84f3f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 8 Jan 2013 20:18:50 -0600 Subject: Add per-user display settings This partially resolves Bug 1264 Fix displayconfig crashes and warnings Slightly clean up iccconfig and hwmanager --- kcontrol/displayconfig/displayconfig.cpp | 91 +++++++++------- kcontrol/displayconfig/displayconfig.h | 1 - kcontrol/displayconfig/displayconfigbase.ui | 73 ++++++------- kcontrol/hwmanager/devicepropsdlgbase.ui | 8 -- kcontrol/hwmanager/hwmanager.cpp | 2 +- kcontrol/hwmanager/hwmanager.h | 3 +- kcontrol/hwmanager/hwmanagerbase.ui | 8 -- kcontrol/iccconfig/iccconfig.cpp | 160 ++++++++++++++++------------ kcontrol/iccconfig/iccconfig.h | 1 - kcontrol/iccconfig/iccconfigbase.ui | 8 -- starttde | 4 + tdeinit/CMakeLists.txt | 13 +++ tdeinit/displayconfig.cpp | 72 +++++++++++++ tdeinit/phase1.cpp | 2 + 14 files changed, 273 insertions(+), 173 deletions(-) create mode 100644 tdeinit/displayconfig.cpp diff --git a/kcontrol/displayconfig/displayconfig.cpp b/kcontrol/displayconfig/displayconfig.cpp index 7d610b6c5..faeffa1f5 100644 --- a/kcontrol/displayconfig/displayconfig.cpp +++ b/kcontrol/displayconfig/displayconfig.cpp @@ -302,11 +302,11 @@ TQPoint moveTQRectOutsideMonitorRegion(TQRect rect, MonitorRegion region) { // Next, find which rectangle is closest to the center of the TQRect int closest = 0; long distance = 16384*16384; - int fallback_mode; + int fallback_mode = 0; long test_distance; long test_center_x; long test_center_y; - for ( int i = 0; i < rectangles.size(); i++ ) { + for ( unsigned int i = 0; i < rectangles.size(); i++ ) { test_center_x = rectangles[i].x() + (rectangles[i].width()/2); test_center_y = rectangles[i].y() + (rectangles[i].height()/2); test_distance = pow(test_center_x-rect_center_x,2) + pow(test_center_y-rect_center_y,2); @@ -381,7 +381,7 @@ TQPoint compressTQRectTouchingMonitorRegion(TQRect rect, MonitorRegion region, T long test_distance; long test_center_x; long test_center_y; - for ( int i = 0; i < rectangles.size(); i++ ) { + for ( unsigned int i = 0; i < rectangles.size(); i++ ) { test_center_x = rectangles[i].x() + (rectangles[i].width()/2); test_center_y = rectangles[i].y() + (rectangles[i].height()/2); test_distance = pow(test_center_x-rect_center_x,2) + pow(test_center_y-rect_center_y,2); @@ -422,10 +422,10 @@ void KDisplayConfig::updateDraggableMonitorInformation (int monitor_id) { void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id, bool recurse) { int i; - int j; - DraggableMonitor *primary_monitor; - DraggableMonitor *moved_monitor; - SingleScreenData *screendata; + int j=0; + DraggableMonitor *primary_monitor = NULL; + DraggableMonitor *moved_monitor = NULL; + SingleScreenData *screendata = NULL; TQObjectList monitors; // Find the moved draggable monitor object @@ -442,6 +442,10 @@ void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id, } } + if (!screendata) { + return; + } + TQString rotationDesired = *screendata->rotations.at(screendata->current_rotation_index); bool isvisiblyrotated = ((rotationDesired == "Rotate 90 degrees") || (rotationDesired == "Rotate 270 degrees")); @@ -453,10 +457,12 @@ void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id, } // Handle resizing - if (isvisiblyrotated) + if (isvisiblyrotated) { moved_monitor->setFixedSize(screendata->current_y_pixel_count*base->monitorPhyArrange->resize_factor, screendata->current_x_pixel_count*base->monitorPhyArrange->resize_factor); - else + } + else { moved_monitor->setFixedSize(screendata->current_x_pixel_count*base->monitorPhyArrange->resize_factor, screendata->current_y_pixel_count*base->monitorPhyArrange->resize_factor); + } // Find the primary monitor for (i=0;imonitorDisplaySelectDD->currentItem()); @@ -716,8 +719,8 @@ int KDisplayConfig::realResolutionSliderValue() { } void KDisplayConfig::setRealResolutionSliderValue(int index) { - int i; - int j; + unsigned int i; + unsigned int j; SingleScreenData *screendata; screendata = m_screenInfoArray.at(base->monitorDisplaySelectDD->currentItem()); @@ -742,9 +745,15 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin m_randrsimple = new KRandrSimpleAPI(); - TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); - systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/kdisplay/kdisplayconfigrc" )); - systemconfig->setFileWriteMode(0644); + TQVBoxLayout *layout = new TQVBoxLayout(this, 0, KDialog::spacingHint()); + if (getuid() != 0) { + systemconfig = new KSimpleConfig( locateLocal("config", "kdisplay/", true) + "kdisplayconfigrc" ); + systemconfig->setFileWriteMode(0600); + } + else { + systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/kdisplay/kdisplayconfigrc" )); + systemconfig->setFileWriteMode(0644); + } KAboutData *about = new KAboutData(I18N_NOOP("kcmdisplayconfig"), I18N_NOOP("TDE Display Profile Control Module"), @@ -758,10 +767,14 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin connect(m_gammaApplyTimer, SIGNAL(timeout()), this, SLOT(applyGamma())); base = new DisplayConfigBase(this); - layout->add(base); + layout->addWidget(base); + + if (getuid() != 0) { + base->systemEnableSupport->setText(i18n("&Enable local display control for this session")); + } - setRootOnlyMsg(i18n("The global display configuration is a system wide setting, and requires administrator access
To alter the system's global display configuration, click on the \"Administrator Mode\" button below.")); - setUseRootOnlyMsg(true); + setRootOnlyMsg(i18n("The global display configuration is a system wide setting, and requires administrator access
To alter the system's global display configuration, click on the \"Administrator Mode\" button below.
Otherwise, you may change your session-specific display configuration below.")); +// setUseRootOnlyMsg(true); // Setting this hides the Apply button! connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(processLockoutControls())); @@ -840,32 +853,34 @@ void KDisplayConfig::rescanHardware (void) { void KDisplayConfig::reloadProfile (void) { // FIXME m_randrsimple->destroyScreenInformationObject(m_screenInfoArray); - m_screenInfoArray = m_randrsimple->loadSystemwideDisplayConfiguration("", KDE_CONFDIR); + if (getuid() != 0) { + m_screenInfoArray = m_randrsimple->loadSystemwideDisplayConfiguration("", locateLocal("config", "/", true)); + } + else { + m_screenInfoArray = m_randrsimple->loadSystemwideDisplayConfiguration("", KDE_CONFDIR); + } m_randrsimple->ensureMonitorDataConsistency(m_screenInfoArray); numberOfScreens = m_screenInfoArray.count(); refreshDisplayedInformation(); } void KDisplayConfig::identifyMonitors () { - int i; + unsigned int i; TQLabel* idWidget; TQPtrList widgetList; Display *randr_display; ScreenInfo *randr_screen_info; - XRROutputInfo *output_info; randr_display = tqt_xdisplay(); randr_screen_info = m_randrsimple->read_screen_info(randr_display); for (i = 0; i < m_screenInfoArray.count(); i++) { - output_info = randr_screen_info->outputs[i]->info; // Look for ON outputs... if (!randr_screen_info->outputs[i]->cur_crtc) { continue; } - SingleScreenData *screendata = m_screenInfoArray.at(i); idWidget = new TQLabel(TQString("Screen\n%1").arg(i+1), (TQWidget*)0, "", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM | Qt::WDestructiveClose); widgetList.append(idWidget); idWidget->resize(150, 100); @@ -923,7 +938,7 @@ void KDisplayConfig::updateArray (void) { void KDisplayConfig::updateDisplayedInformation () { // Insert data into the GUI - int i; + unsigned int i; SingleScreenData *screendata; ensureMonitorDataConsistency(); @@ -1056,8 +1071,6 @@ void KDisplayConfig::updateDragDropDisplay() { // Insert data into the GUI int i; int j; - int largest_x_pixels; - int largest_y_pixels; TQObjectList monitors; SingleScreenData *screendata; @@ -1074,8 +1087,6 @@ void KDisplayConfig::updateDragDropDisplay() { } } - int currentScreenIndex = base->monitorDisplaySelectDD->currentItem(); - ensureMonitorDataConsistency(); // Add the screens to the workspace @@ -1109,8 +1120,6 @@ void KDisplayConfig::updateDragDropDisplay() { void KDisplayConfig::layoutDragDropDisplay() { int i; - int largest_x_pixels; - int largest_y_pixels; TQObjectList monitors; SingleScreenData *screendata; @@ -1400,7 +1409,7 @@ void KDisplayConfig::processDPMSControls() { } void KDisplayConfig::processLockoutControls() { - if (getuid() != 0 || !systemconfig->checkConfigFilesWritable( true )) { + if (!systemconfig->checkConfigFilesWritable( true )) { base->globalTab->setEnabled(false); base->resolutionTab->setEnabled(false); base->gammaTab->setEnabled(false); @@ -1450,9 +1459,6 @@ KCModule* KDisplayConfig::addTab( const TQString name, const TQString label ) void KDisplayConfig::load(bool useDefaults ) { // Update the toggle buttons with the current configuration - int i; - int j; - updateArray(); systemconfig->setGroup(NULL); @@ -1477,7 +1483,12 @@ void KDisplayConfig::load(bool useDefaults ) void KDisplayConfig::save() { if (m_randrsimple->applySystemwideDisplayConfiguration(m_screenInfoArray, TRUE)) { - m_randrsimple->saveSystemwideDisplayConfiguration(base->systemEnableSupport->isChecked(), "", KDE_CONFDIR, m_screenInfoArray); + if (getuid() != 0) { + m_randrsimple->saveSystemwideDisplayConfiguration(base->systemEnableSupport->isChecked(), "", locateLocal("config", "/", true), m_screenInfoArray); + } + else { + m_randrsimple->saveSystemwideDisplayConfiguration(base->systemEnableSupport->isChecked(), "", KDE_CONFDIR, m_screenInfoArray); + } // Write system configuration systemconfig->setGroup(NULL); diff --git a/kcontrol/displayconfig/displayconfig.h b/kcontrol/displayconfig/displayconfig.h index 6c283e308..53541d8f8 100644 --- a/kcontrol/displayconfig/displayconfig.h +++ b/kcontrol/displayconfig/displayconfig.h @@ -61,7 +61,6 @@ public: void save(); void defaults(); - int buttons(); TQString quickHelp() const; k_dcop: diff --git a/kcontrol/displayconfig/displayconfigbase.ui b/kcontrol/displayconfig/displayconfigbase.ui index 05289e9b9..3ea1c57e7 100644 --- a/kcontrol/displayconfig/displayconfigbase.ui +++ b/kcontrol/displayconfig/displayconfigbase.ui @@ -4,14 +4,6 @@ DisplayConfigBase - - - 0 - 0 - 519 - 356 - - unnamed @@ -111,15 +103,21 @@ 7 - 1 + 7 1 0 + + + 150 + 150 + + 32767 - 200 + 400 @@ -193,7 +191,7 @@ - + groupColorDepth @@ -216,7 +214,7 @@ - + groupOrientation @@ -240,7 +238,7 @@ &Mirror screen horizontally - + orientationVFlip @@ -363,6 +361,9 @@ Visual Calibration Aid + + unnamed + gammaTestImage @@ -405,10 +406,10 @@ - 20 - 20 - - + 20 + 20 + + @@ -427,8 +428,8 @@ - - + + groupHardware @@ -587,25 +588,25 @@ Tip: Most computer software expects a gamma of 2.2.<br>Additionally, any ICC settings for the selected screen will override the gamma controls available on this tab. - - - Spacer4 - - - Vertical - - - Expanding - - - - 20 - 20 - - - + + + Spacer5 + + + Vertical + + + Expanding + + + + 20 + 20 + + + diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index bd3688402..5f6c2c166 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -4,14 +4,6 @@ DevicePropertiesDialogBase - - - 0 - 0 - 519 - 356 - - unnamed diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp index 96001349d..36dc89b3e 100644 --- a/kcontrol/hwmanager/hwmanager.cpp +++ b/kcontrol/hwmanager/hwmanager.cpp @@ -80,7 +80,7 @@ TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringLis base->deviceFilter->setListView(base->deviceTree); - setRootOnlyMsg(i18n("Hardware settings are system wide, and requires administrator access
To alter the system's hardware settings, click on the \"Administrator Mode\" button below.")); + setRootOnlyMsg(i18n("Hardware settings are system wide, and therefore require administrator access
To alter the system's hardware settings, click on the \"Administrator Mode\" button below.")); setUseRootOnlyMsg(true); TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); diff --git a/kcontrol/hwmanager/hwmanager.h b/kcontrol/hwmanager/hwmanager.h index 89652cd32..a7c9749a7 100644 --- a/kcontrol/hwmanager/hwmanager.h +++ b/kcontrol/hwmanager/hwmanager.h @@ -52,8 +52,7 @@ public: void load( bool useDefaults); void save(); void defaults(); - - int buttons(); + TQString quickHelp() const; k_dcop: diff --git a/kcontrol/hwmanager/hwmanagerbase.ui b/kcontrol/hwmanager/hwmanagerbase.ui index 4b14ff428..632ec2259 100644 --- a/kcontrol/hwmanager/hwmanagerbase.ui +++ b/kcontrol/hwmanager/hwmanagerbase.ui @@ -4,14 +4,6 @@ TDEHWManagerBase - - - 0 - 0 - 519 - 356 - - unnamed diff --git a/kcontrol/iccconfig/iccconfig.cpp b/kcontrol/iccconfig/iccconfig.cpp index a2285dd49..28296dd5e 100644 --- a/kcontrol/iccconfig/iccconfig.cpp +++ b/kcontrol/iccconfig/iccconfig.cpp @@ -61,11 +61,16 @@ KSimpleConfig *systemconfig; /**** KICCConfig ****/ KICCConfig::KICCConfig(TQWidget *parent, const char *name, const TQStringList &) - : KCModule(KICCCFactory::instance(), parent, name) + : KCModule(KICCCFactory::instance(), parent, name), iccFileArray(NULL) { TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); - config = new KSimpleConfig( TQString::fromLatin1( "kiccconfigrc" )); + if (getuid() != 0) { + config = new KSimpleConfig( TQString::fromLatin1( "kiccconfigrc" )); + } + else { + config = NULL; + } systemconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/kicc/kiccconfigrc" )); KAboutData *about = @@ -80,7 +85,7 @@ KICCConfig::KICCConfig(TQWidget *parent, const char *name, const TQStringList &) layout->add(base); setRootOnlyMsg(i18n("The global ICC color profile is a system wide setting, and requires administrator access
To alter the system's global ICC profile, click on the \"Administrator Mode\" button below.")); - setUseRootOnlyMsg(true); +// setUseRootOnlyMsg(true); // Setting this hides the Apply button! connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); connect(base->systemEnableSupport, TQT_SIGNAL(toggled(bool)), base->systemIccFile, TQT_SLOT(setEnabled(bool))); @@ -102,7 +107,7 @@ KICCConfig::KICCConfig(TQWidget *parent, const char *name, const TQStringList &) load(); - if (!config->checkConfigFilesWritable( true )) { + if (!config || !config->checkConfigFilesWritable( true )) { base->enableSupport->setEnabled(false); base->randrScreenList->setEnabled(false); base->iccProfileList->setEnabled(false); @@ -120,8 +125,12 @@ KICCConfig::KICCConfig(TQWidget *parent, const char *name, const TQStringList &) KICCConfig::~KICCConfig() { - delete [] iccFileArray; - delete config; + if (iccFileArray) { + delete [] iccFileArray; + } + if (config) { + delete config; + } delete systemconfig; } @@ -130,7 +139,7 @@ void KICCConfig::deleteProfile () { TQString *iccFileArrayNew; // Delete the profile - config->deleteGroup(base->iccProfileList->currentText()); + if (config) config->deleteGroup(base->iccProfileList->currentText()); base->iccProfileList->removeItem(base->iccProfileList->currentItem()); base->iccProfileList->setCurrentItem(base->iccProfileList->count()-1); @@ -171,7 +180,7 @@ void KICCConfig::renameProfile () { } // Rename the profile - config->deleteGroup(base->iccProfileList->currentText()); + if (config) config->deleteGroup(base->iccProfileList->currentText()); base->iccProfileList->changeItem(_new, base->iccProfileList->currentItem()); updateDisplayedInformation(); @@ -240,9 +249,11 @@ void KICCConfig::selectScreen (int slotNumber) { void KICCConfig::updateArray (void) { iccFileArray[((base->iccProfileList->currentItem())*(base->randrScreenList->count()))+(base->randrScreenList->currentItem())] = base->iccFile->url(); - config->setGroup(base->iccProfileList->currentText()); - if (config->readEntry(base->randrScreenList->currentText()) != iccFileArray[((base->iccProfileList->currentItem())*(base->randrScreenList->count()))+(base->randrScreenList->currentItem())]) { - emit changed(); + if (config) { + config->setGroup(base->iccProfileList->currentText()); + if (config->readEntry(base->randrScreenList->currentText()) != iccFileArray[((base->iccProfileList->currentItem())*(base->randrScreenList->count()))+(base->randrScreenList->currentItem())]) { + emit changed(); + } } } @@ -288,58 +299,69 @@ void KICCConfig::load(bool useDefaults ) XRROutputInfo *output_info; KRandrSimpleAPI *randrsimple = new KRandrSimpleAPI(); - config->setReadDefaults( useDefaults ); - - config->setGroup(NULL); - base->enableSupport->setChecked(config->readBoolEntry("EnableICC", false)); - base->randrScreenList->setEnabled(config->readBoolEntry("EnableICC", false)); - base->iccProfileList->setEnabled(config->readBoolEntry("EnableICC", false)); - base->iccFile->setEnabled(config->readBoolEntry("EnableICC", false)); - base->addProfileButton->setEnabled(config->readBoolEntry("EnableICC", false)); - base->renameProfileButton->setEnabled(config->readBoolEntry("EnableICC", false)); - base->deleteProfileButton->setEnabled(config->readBoolEntry("EnableICC", false)); - - numberOfScreens = 0; - if (randrsimple->isValid() == true) { - randr_display = XOpenDisplay(NULL); - randr_screen_info = randrsimple->read_screen_info(randr_display); - for (i = 0; i < randr_screen_info->n_output; i++) { - output_info = randr_screen_info->outputs[i]->info; - base->randrScreenList->insertItem(output_info->name, -1); + if (config) { + config->setReadDefaults( useDefaults ); + + config->setGroup(NULL); + base->enableSupport->setChecked(config->readBoolEntry("EnableICC", false)); + base->randrScreenList->setEnabled(config->readBoolEntry("EnableICC", false)); + base->iccProfileList->setEnabled(config->readBoolEntry("EnableICC", false)); + base->iccFile->setEnabled(config->readBoolEntry("EnableICC", false)); + base->addProfileButton->setEnabled(config->readBoolEntry("EnableICC", false)); + base->renameProfileButton->setEnabled(config->readBoolEntry("EnableICC", false)); + base->deleteProfileButton->setEnabled(config->readBoolEntry("EnableICC", false)); + + numberOfScreens = 0; + if (randrsimple->isValid() == true) { + randr_display = XOpenDisplay(NULL); + randr_screen_info = randrsimple->read_screen_info(randr_display); + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + base->randrScreenList->insertItem(output_info->name, -1); + numberOfScreens++; + } + } + else { + base->randrScreenList->insertItem("Default", -1); numberOfScreens++; } - } - else { - base->randrScreenList->insertItem("Default", -1); - numberOfScreens++; - } - // Find all profile names - numberOfProfiles = 0; - cfgProfiles = config->groupList(); - for (TQStringList::Iterator i(cfgProfiles.begin()); i != cfgProfiles.end(); ++i) { - base->iccProfileList->insertItem((*i), -1); - numberOfProfiles++; - } - if (numberOfProfiles == 0) { - base->iccProfileList->insertItem("", -1); - numberOfProfiles++; - } + // Find all profile names + numberOfProfiles = 0; + cfgProfiles = config->groupList(); + for (TQStringList::Iterator i(cfgProfiles.begin()); i != cfgProfiles.end(); ++i) { + base->iccProfileList->insertItem((*i), -1); + numberOfProfiles++; + } + if (numberOfProfiles == 0) { + base->iccProfileList->insertItem("", -1); + numberOfProfiles++; + } - // Load all profiles into memory - iccFileArray = new TQString[numberOfProfiles*numberOfScreens]; - for (i=0;i<(base->iccProfileList->count());i++) { - config->setGroup(base->iccProfileList->text(i)); - for (j=0;j<(base->randrScreenList->count());j++) { - iccFileArray[(i*(base->randrScreenList->count()))+j] = config->readEntry(base->randrScreenList->text(j)); + // Load all profiles into memory + iccFileArray = new TQString[numberOfProfiles*numberOfScreens]; + for (i=0;i<(base->iccProfileList->count());i++) { + config->setGroup(base->iccProfileList->text(i)); + for (j=0;j<(base->randrScreenList->count());j++) { + iccFileArray[(i*(base->randrScreenList->count()))+j] = config->readEntry(base->randrScreenList->text(j)); + } } - } - if ((findProfileIndex(base->iccProfileList->currentText()) >= 0) && (findScreenIndex(base->randrScreenList->currentText()) >= 0)) { - base->iccFile->setURL(iccFileArray[(findProfileIndex(base->iccProfileList->currentText())*base->randrScreenList->count())+findScreenIndex(base->randrScreenList->currentText())]); + if ((findProfileIndex(base->iccProfileList->currentText()) >= 0) && (findScreenIndex(base->randrScreenList->currentText()) >= 0)) { + base->iccFile->setURL(iccFileArray[(findProfileIndex(base->iccProfileList->currentText())*base->randrScreenList->count())+findScreenIndex(base->randrScreenList->currentText())]); + } + else { + base->iccFile->setURL(""); + } } else { - base->iccFile->setURL(""); + base->enableSupport->setChecked(false); + base->randrScreenList->setEnabled(false); + base->iccProfileList->setEnabled(false); + base->iccFile->setEnabled(false); + base->addProfileButton->setEnabled(false); + base->renameProfileButton->setEnabled(false); + base->deleteProfileButton->setEnabled(false); } systemconfig->setGroup(NULL); @@ -362,23 +384,25 @@ void KICCConfig::save() systemconfig->setGroup(NULL); systemconfig->writeEntry("EnableICC", base->systemEnableSupport->isChecked()); systemconfig->writeEntry("ICCFile", base->systemIccFile->url()); + systemconfig->sync(); - // Write user configuration - config->setGroup(NULL); - config->writeEntry("DefaultProfile", m_defaultProfile); - config->writeEntry("EnableICC", base->enableSupport->isChecked()); - - // Save all profiles to disk - for (i=0;i<(base->iccProfileList->count());i++) { - config->setGroup(base->iccProfileList->text(i)); - for (j=0;j<(base->randrScreenList->count());j++) { - config->writeEntry(base->randrScreenList->text(j), iccFileArray[(i*(base->randrScreenList->count()))+j]); + if (config) { + // Write user configuration + config->setGroup(NULL); + config->writeEntry("DefaultProfile", m_defaultProfile); + config->writeEntry("EnableICC", base->enableSupport->isChecked()); + + // Save all profiles to disk + for (i=0;i<(base->iccProfileList->count());i++) { + config->setGroup(base->iccProfileList->text(i)); + for (j=0;j<(base->randrScreenList->count());j++) { + config->writeEntry(base->randrScreenList->text(j), iccFileArray[(i*(base->randrScreenList->count()))+j]); + } } + + config->sync(); } - config->sync(); - systemconfig->sync(); - TQString errorstr; if (base->enableSupport->isChecked() == true) { errorstr = randrsimple->applyIccConfiguration(base->iccProfileList->currentText(), KDE_CONFDIR); diff --git a/kcontrol/iccconfig/iccconfig.h b/kcontrol/iccconfig/iccconfig.h index e3b91e34d..d113e5d84 100644 --- a/kcontrol/iccconfig/iccconfig.h +++ b/kcontrol/iccconfig/iccconfig.h @@ -53,7 +53,6 @@ public: void save(); void defaults(); - int buttons(); TQString quickHelp() const; k_dcop: diff --git a/kcontrol/iccconfig/iccconfigbase.ui b/kcontrol/iccconfig/iccconfigbase.ui index 9716563cb..0666c6e9f 100644 --- a/kcontrol/iccconfig/iccconfigbase.ui +++ b/kcontrol/iccconfig/iccconfigbase.ui @@ -4,14 +4,6 @@ ICCConfigBase - - - 0 - 0 - 519 - 356 - - unnamed diff --git a/starttde b/starttde index 080dac2ce..bf127f239 100644 --- a/starttde +++ b/starttde @@ -598,6 +598,10 @@ if test "$kpersonalizerrc_general_firstlogin" = "true"; then fi fi +# Apply any user-specific display configuration settings +$TDEDIR/bin/tdeinit_displayconfig +EXIT_CODE="$?" + # Remove moodin cache if we have a new wallpaper installed, jriddell. Distro-specific. if [ -d "$tdehome/share/apps/ksplash/cache/Moodin/kubuntu" ]; then if [ /usr/share/wallpapers/kubuntu-wallpaper.png -nt "$tdehome/share/apps/ksplash/cache/Moodin/kubuntu/" ]; then diff --git a/tdeinit/CMakeLists.txt b/tdeinit/CMakeLists.txt index 6f1f7ba96..3fd7d934e 100644 --- a/tdeinit/CMakeLists.txt +++ b/tdeinit/CMakeLists.txt @@ -12,6 +12,7 @@ include_directories( ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} ) link_directories( @@ -26,3 +27,15 @@ tde_add_executable( tdeinit_phase1 LINK tdecore-shared DESTINATION ${BIN_INSTALL_DIR} ) + + +##### tdeinit_displayconfig (executable) ####################### +if( WITH_XRANDR ) + set( TDEINIT_DISPLAYCONFIG_OPTIONAL_LINK "krandr-shared" ) +endif ( ) + +tde_add_executable( tdeinit_displayconfig + SOURCES displayconfig.cpp + LINK tdecore-shared ${TDEINIT_DISPLAYCONFIG_OPTIONAL_LINK} + DESTINATION ${BIN_INSTALL_DIR} +) \ No newline at end of file diff --git a/tdeinit/displayconfig.cpp b/tdeinit/displayconfig.cpp new file mode 100644 index 000000000..75445a98c --- /dev/null +++ b/tdeinit/displayconfig.cpp @@ -0,0 +1,72 @@ +/*************************************************************************** + * Copyright (C) 2012 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. * + ***************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef WITH_XRANDR +#include +#endif + +static const char description[] = I18N_NOOP("TDE Initialization Display Configuration"); + +static const char version[] = "0.1"; + +static KCmdLineOptions options[] = +{ + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + int return_code = -1; + + KAboutData about("tdeinit_displayconfig", I18N_NOOP("tdeinit_displayconfig"), version, description, + KAboutData::License_GPL, "(C) 2013 Timothy Pearson", 0, 0, "kb9vqf@pearsoncomputing.net"); + about.addAuthor( "Timothy Pearson", 0, "kb9vqf@pearsoncomputing.net" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + + KApplication::disableAutoDcopRegistration(); + KApplication app; + +#ifdef WITH_XRANDR + // Load up user specific display settings + KRandrSimpleAPI *randrsimple = new KRandrSimpleAPI(); + randrsimple->applySystemwideDisplayConfiguration("", locateLocal("config", "/", true)); + delete randrsimple; +#endif + + return return_code = 0; +} + diff --git a/tdeinit/phase1.cpp b/tdeinit/phase1.cpp index e667503c2..32f5249ac 100644 --- a/tdeinit/phase1.cpp +++ b/tdeinit/phase1.cpp @@ -17,6 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include + #include #include #include -- cgit v1.2.1