void KTreemapView::readConfig() { KConfig * config = kapp->config(); config->setGroup( "Treemaps" ); _ambientLight = config->readNumEntry( "AmbientLight" , DefaultAmbientLight ); _heightScaleFactor = config->readDoubleNumEntry( "HeightScaleFactor" , DefaultHeightScaleFactor ); _autoResize = config->readBoolEntry( "AutoResize" , true ); _squarify = config->readBoolEntry( "Squarify" , true ); _doCushionShading = config->readBoolEntry( "CushionShading" , true ); _ensureContrast = config->readBoolEntry( "EnsureContrast" , true ); _forceCushionGrid = config->readBoolEntry( "ForceCushionGrid" , false ); _minTileSize = config->readNumEntry ( "MinTileSize" , DefaultMinTileSize ); _highlightColor = readColorEntry( config, "HighlightColor" , red ); _cushionGridColor = readColorEntry( config, "CushionGridColor" , QColor( 0x80, 0x80, 0x80 ) ); _outlineColor = readColorEntry( config, "OutlineColor" , black ); _fileFillColor = readColorEntry( config, "FileFillColor" , QColor( 0xde, 0x8d, 0x53 ) ); _dirFillColor = readColorEntry( config, "DirFillColor" , QColor( 0x10, 0x7d, 0xb4 ) ); if ( _autoResize ) { setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOff ); } else { setHScrollBarMode( QScrollView::Auto ); setVScrollBarMode( QScrollView::Auto ); } }
void KTreemapPage::setup() { KConfig * config = kapp->config(); config->setGroup( "Treemaps" ); _squarify->setChecked ( config->readBoolEntry( "Squarify" , true ) ); _doCushionShading->setChecked ( config->readBoolEntry( "CushionShading" , true ) ); _ambientLight->setValue ( config->readNumEntry( "AmbientLight" , DefaultAmbientLight ) ); _heightScalePercent->setValue( (int) ( 100 * config->readDoubleNumEntry ( "HeightScaleFactor", DefaultHeightScaleFactor ) ) ); _ensureContrast->setChecked ( config->readBoolEntry( "EnsureContrast" , true ) ); _forceCushionGrid->setChecked ( config->readBoolEntry( "ForceCushionGrid" , false ) ); _minTileSize->setValue ( config->readNumEntry ( "MinTileSize" , DefaultMinTileSize ) ); _autoResize->setChecked ( config->readBoolEntry( "AutoResize" , true ) ); _cushionGridColor->setColor ( readColorEntry( config, "CushionGridColor" , QColor( 0x80, 0x80, 0x80 ) ) ); _outlineColor->setColor ( readColorEntry( config, "OutlineColor" , black ) ); _fileFillColor->setColor ( readColorEntry( config, "FileFillColor" , QColor( 0xde, 0x8d, 0x53 ) ) ); _dirFillColor->setColor ( readColorEntry( config, "DirFillColor" , QColor( 0x10, 0x7d, 0xb4 ) ) ); _highlightColor->setColor ( readColorEntry( config, "HighlightColor" , red ) ); _ambientLightSB->setValue( _ambientLight->value() ); _heightScalePercentSB->setValue( _heightScalePercent->value() ); checkEnabledState(); }
ColorSchema::ColorSchema(KConfig& c) :m_fileRead(false) ,fRelPath(QString::null) ,lastRead(0L) { clearSchema(); c.setGroup("SchemaGeneral"); m_title = c.readEntry("Title",i18n("[no title]")); m_imagePath = c.readEntry("ImagePath"); m_alignment = c.readNumEntry("ImageAlignment",1); m_useTransparency = c.readBoolEntry("UseTransparency",false); m_tr_r = c.readNumEntry("TransparentR",0); m_tr_g = c.readNumEntry("TransparentG",0); m_tr_b = c.readNumEntry("TransparentB",0); m_tr_x = c.readDoubleNumEntry("TransparentX",0.0); for (int i=0; i < TABLE_COLORS; i++) { readConfigColor(c,colorName(i),m_table[i]); } m_numb = serial++; }
void KeyboardConfig::init_keyboard() { KConfig *config = new KConfig("kcminputrc", true); // Read-only, no globals config->setGroup("Keyboard"); XKeyboardState kbd; XKeyboardControl kbdc; XGetKeyboardControl(kapp->getDisplay(), &kbd); bool key = config->readBoolEntry("KeyboardRepeating", true); kbdc.key_click_percent = config->readNumEntry("ClickVolume", kbd.key_click_percent); kbdc.auto_repeat_mode = (key ? AutoRepeatModeOn : AutoRepeatModeOff); XChangeKeyboardControl(kapp->getDisplay(), KBKeyClickPercent | KBAutoRepeatMode, &kbdc); if( key ) { int delay_ = config->readNumEntry("RepeatDelay", 250); double rate_ = config->readDoubleNumEntry("RepeatRate", 30); set_repeatrate(delay_, rate_); } int numlockState = config->readNumEntry( "NumLock", 2 ); if( numlockState != 2 ) numlockx_change_numlock_state( numlockState == 0 ); delete config; }
void KuickData::load() { KConfig *kc = KGlobal::config(); KuickData def; kc->setGroup( "GeneralConfiguration" ); fileFilter = kc->readEntry( "FileFilter", def.fileFilter ); slideDelay = kc->readNumEntry( "SlideShowDelay", def.slideDelay ); slideshowCycles = kc->readUnsignedNumEntry( "SlideshowCycles", 1 ); slideshowFullscreen = kc->readBoolEntry( "SlideshowFullscreen", true ); slideshowStartAtFirst = kc->readBoolEntry("SlideshowStartAtFirst", true ); preloadImage = kc->readBoolEntry( "PreloadNextImage", def.preloadImage ); fullScreen = kc->readBoolEntry( "Fullscreen", def.fullScreen); autoRotation = kc->readBoolEntry( "AutoRotation", def.autoRotation); downScale = kc->readBoolEntry( "ShrinkToScreenSize", def.downScale ); upScale = kc->readBoolEntry( "ZoomToScreenSize", def.upScale ); flipVertically = kc->readBoolEntry( "FlipVertically", def.flipVertically ); flipHorizontally = kc->readBoolEntry( "FlipHorizontally", def.flipHorizontally ); maxUpScale = kc->readNumEntry( "MaxUpscale Factor", def.maxUpScale ); rotation = (Rotation) kc->readNumEntry( "Rotation", def.rotation ); isModsEnabled = kc->readBoolEntry( "ApplyDefaultModifications", def.isModsEnabled ); brightnessSteps = kc->readNumEntry("BrightnessStepSize",def.brightnessSteps); contrastSteps = kc->readNumEntry("ContrastStepSize", def.contrastSteps); gammaSteps = kc->readNumEntry("GammaStepSize", def.gammaSteps); scrollSteps = kc->readNumEntry("ScrollingStepSize", def.scrollSteps); zoomSteps = kc->readDoubleNumEntry("ZoomStepSize", def.zoomSteps); maxZoomFactor = kc->readDoubleNumEntry( "MaximumZoomFactorByDesktop", def.maxZoomFactor ); maxCachedImages = kc->readUnsignedNumEntry( "MaxCachedImages", def.maxCachedImages ); backgroundColor = kc->readColorEntry( "BackgroundColor", &Qt::black ); startInLastDir = kc->readBoolEntry( "StartInLastDir", true); idata->load( kc ); // compatibility with KuickShow <= 0.8.3 switch ( rotation ) { case 90: rotation = ROT_90; break; case 180: rotation = ROT_180; break; case 270: rotation = ROT_270; break; default: if ( (rotation < ROT_0) || (rotation > ROT_270) ) rotation = ROT_0; break; } }
void HTMLWidget::readSettings( ) { KConfig* config = kapp->config( ); config->setGroup( "General" ); m_zoomFactor = config->readDoubleNumEntry( "zoomFactor", 100.0 ); m_stylesheetURL.setPath( config->readPathEntry( "stylesheetURL" )); }
/****************************************************************************** * Read preference values from the config file. */ void Preferences::read() { initialise(); KConfig *config = KGlobal::config(); config->setGroup(GENERAL_SECTION); QStringList cols = config->readListEntry(MESSAGE_COLOURS); if(!cols.count()) mMessageColours = default_messageColours; else { mMessageColours.clear(); for(QStringList::Iterator it = cols.begin(); it != cols.end(); ++it) { QColor c((*it)); if(c.isValid()) mMessageColours.insert(c); } } mDefaultBgColour = config->readColorEntry(MESSAGE_BG_COLOUR, &default_defaultBgColour); mMessageFont = config->readFontEntry(MESSAGE_FONT, &mDefault_messageFont); mRunInSystemTray = config->readBoolEntry(RUN_IN_SYSTEM_TRAY, default_runInSystemTray); mDisableAlarmsIfStopped = config->readBoolEntry(DISABLE_IF_STOPPED, default_disableAlarmsIfStopped); mAutostartTrayIcon = config->readBoolEntry(AUTOSTART_TRAY, default_autostartTrayIcon); mModalMessages = config->readBoolEntry(MODAL_MESSAGES, default_modalMessages); mMessageButtonDelay = config->readNumEntry(MESSAGE_BUTTON_DELAY, default_messageButtonDelay); if(mMessageButtonDelay > 10) mMessageButtonDelay = 10; // prevent windows being unusable for a long time if(mMessageButtonDelay < -1) mMessageButtonDelay = -1; mTooltipAlarmCount = static_cast<int>(config->readUnsignedNumEntry(TOOLTIP_ALARM_COUNT, default_tooltipAlarmCount)); if(mTooltipAlarmCount < 1) mTooltipAlarmCount = 1; mShowTooltipAlarmTime = config->readBoolEntry(TOOLTIP_ALARM_TIME, default_showTooltipAlarmTime); mShowTooltipTimeToAlarm = config->readBoolEntry(TOOLTIP_TIME_TO_ALARM, default_showTooltipTimeToAlarm); mTooltipTimeToPrefix = config->readEntry(TOOLTIP_TIME_TO_PREFIX, default_tooltipTimeToPrefix); mDaemonTrayCheckInterval = static_cast<int>(config->readUnsignedNumEntry(DAEMON_TRAY_INTERVAL, default_daemonTrayCheckInterval)); if(mDaemonTrayCheckInterval < 1) mDaemonTrayCheckInterval = 1; QCString client = config->readEntry(EMAIL_CLIENT, defaultEmailClient).local8Bit(); // don't use readPathEntry() here (values are hard-coded) mEmailClient = (client == "sendmail" ? SENDMAIL : KMAIL); mEmailCopyToKMail = config->readBoolEntry(EMAIL_COPY_TO_KMAIL, default_emailCopyToKMail); QString from = config->readEntry(EMAIL_FROM, emailFrom(default_emailFrom(), false, false)); mEmailFrom = emailFrom(from); QString bccFrom = config->readEntry(EMAIL_BCC_ADDRESS, emailFrom(default_emailBccFrom, false, true)); mEmailBccFrom = emailFrom(bccFrom); if(mEmailFrom == MAIL_FROM_CONTROL_CENTRE || mEmailBccFrom == MAIL_FROM_CONTROL_CENTRE) mEmailAddress = mEmailBccAddress = KAMail::controlCentreAddress(); if(mEmailFrom == MAIL_FROM_ADDR) mEmailAddress = from; if(mEmailBccFrom == MAIL_FROM_ADDR) mEmailBccAddress = bccFrom; mCmdXTermCommand = translateXTermPath(config, config->readEntry(CMD_XTERM_COMMAND), false); QDateTime defStartOfDay(QDate(1900, 1, 1), default_startOfDay); mStartOfDay = config->readDateTimeEntry(START_OF_DAY, &defStartOfDay).time(); mOldStartOfDay.setHMS(0, 0, 0); int sod = config->readNumEntry(START_OF_DAY_CHECK, 0); if(sod) mOldStartOfDay = mOldStartOfDay.addMSecs(sod ^ SODxor); mDisabledColour = config->readColorEntry(DISABLED_COLOUR, &default_disabledColour); mExpiredColour = config->readColorEntry(EXPIRED_COLOUR, &default_expiredColour); mExpiredKeepDays = config->readNumEntry(EXPIRED_KEEP_DAYS, default_expiredKeepDays); config->setGroup(DEFAULTS_SECTION); mDefaultLateCancel = static_cast<int>(config->readUnsignedNumEntry(DEF_LATE_CANCEL, default_defaultLateCancel)); mDefaultAutoClose = config->readBoolEntry(DEF_AUTO_CLOSE, default_defaultAutoClose); mDefaultConfirmAck = config->readBoolEntry(DEF_CONFIRM_ACK, default_defaultConfirmAck); mDefaultCopyToKOrganizer = config->readBoolEntry(DEF_COPY_TO_KORG, default_defaultCopyToKOrganizer); int soundType = config->readNumEntry(DEF_SOUND_TYPE, default_defaultSoundType); mDefaultSoundType = (soundType < 0 || soundType > SoundPicker::SPEAK) ? default_defaultSoundType : (SoundPicker::Type)soundType; mDefaultSoundVolume = static_cast<float>(config->readDoubleNumEntry(DEF_SOUND_VOLUME, default_defaultSoundVolume)); #ifdef WITHOUT_ARTS mDefaultSoundRepeat = false; #else mDefaultSoundRepeat = config->readBoolEntry(DEF_SOUND_REPEAT, default_defaultSoundRepeat); #endif mDefaultSoundFile = config->readPathEntry(DEF_SOUND_FILE); mDefaultCmdScript = config->readBoolEntry(DEF_CMD_SCRIPT, default_defaultCmdScript); int logType = config->readNumEntry(DEF_CMD_LOG_TYPE, default_defaultCmdLogType); mDefaultCmdLogType = (logType < EditAlarmDlg::DISCARD_OUTPUT || logType > EditAlarmDlg::EXEC_IN_TERMINAL) ? default_defaultCmdLogType : (EditAlarmDlg::CmdLogType)logType; mDefaultCmdLogFile = config->readPathEntry(DEF_LOG_FILE); mDefaultEmailBcc = config->readBoolEntry(DEF_EMAIL_BCC, default_defaultEmailBcc); int recurPeriod = config->readNumEntry(DEF_RECUR_PERIOD, default_defaultRecurPeriod); mDefaultRecurPeriod = (recurPeriod < RecurrenceEdit::SUBDAILY || recurPeriod > RecurrenceEdit::ANNUAL) ? default_defaultRecurPeriod : (RecurrenceEdit::RepeatType)recurPeriod; QCString feb29 = config->readEntry(FEB29_RECUR_TYPE, defaultFeb29RecurType).local8Bit(); mDefaultFeb29Type = (feb29 == "Mar1") ? KARecurrence::FEB29_MAR1 : (feb29 == "Feb28") ? KARecurrence::FEB29_FEB28 : KARecurrence::FEB29_FEB29; QString remindUnits = config->readEntry(DEF_REMIND_UNITS); mDefaultReminderUnits = (remindUnits == QString::fromLatin1("Minutes")) ? TimePeriod::MINUTES : (remindUnits == QString::fromLatin1("HoursMinutes")) ? TimePeriod::HOURS_MINUTES : (remindUnits == QString::fromLatin1("Days")) ? TimePeriod::DAYS : (remindUnits == QString::fromLatin1("Weeks")) ? TimePeriod::WEEKS : default_defaultReminderUnits; mDefaultPreAction = config->readEntry(DEF_PRE_ACTION, default_defaultPreAction); mDefaultPostAction = config->readEntry(DEF_POST_ACTION, default_defaultPostAction); mInstance->emitPreferencesChanged(); mStartOfDayChanged = (mStartOfDay != mOldStartOfDay); if(mStartOfDayChanged) { mInstance->emitStartOfDayChanged(); mOldStartOfDay = mStartOfDay; } }