ProtocolView::ProtocolView(const QCString& appId, QWidget *parent, const char *name) : QTextEdit(parent, name) , job(0) , m_isUpdateJob(false) { setReadOnly(true); setUndoRedoEnabled(false); setTabChangesFocus(true); setTextFormat(Qt::LogText); KConfig *config = CervisiaPart::config(); config->setGroup("LookAndFeel"); setFont(config->readFontEntry("ProtocolFont")); config->setGroup("Colors"); QColor defaultColor = QColor(255, 130, 130); conflictColor=config->readColorEntry("Conflict",&defaultColor); defaultColor=QColor(130, 130, 255); localChangeColor=config->readColorEntry("LocalChange",&defaultColor); defaultColor=QColor(70, 210, 70); remoteChangeColor=config->readColorEntry("RemoteChange",&defaultColor); // create a DCOP stub for the non-concurrent cvs job job = new CvsJob_stub(appId, "NonConcurrentJob"); // establish connections to the signals of the cvs job connectDCOPSignal(job->app(), job->obj(), "jobExited(bool, int)", "slotJobExited(bool, int)", true); connectDCOPSignal(job->app(), job->obj(), "receivedStdout(QString)", "slotReceivedOutput(QString)", true); connectDCOPSignal(job->app(), job->obj(), "receivedStderr(QString)", "slotReceivedOutput(QString)", true); }
void KFinder::initColors(){ KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "KFM HTML Defaults" ); bgColor = config->readColorEntry( "BgColor", &white ); textColor = config->readColorEntry( "LinkColor", &black ); if(finderWin) finderWin->setBackgroundColor( bgColor ); }
DetailledPrintStyle::DetailledPrintStyle( PrintingWizard *parent, const char *name ) : PrintStyle( parent, name ), mPageAppearance( new AppearancePage( parent, "AppearancePage" ) ), mPainter( 0 ), mPrintProgress( 0 ) { KConfig *config; QFont font; bool kdeFonts; QFont standard = KGlobalSettings::generalFont(); QFont fixed = KGlobalSettings::fixedFont(); setPreview( "detailed-style.png" ); addPage( mPageAppearance, i18n( "Detailed Print Style - Appearance" ) ); config = kapp->config(); config->setGroup( ConfigSectionName ); kdeFonts = config->readBoolEntry( UseKDEFonts, true ); mPageAppearance->cbStandardFonts->setChecked( kdeFonts ); font = config->readFontEntry( HeaderFont, &standard ); mPageAppearance->kfcHeaderFont->setCurrentFont( font.family() ); mPageAppearance->kisbHeaderFontSize->setValue( font.pointSize() ); font = config->readFontEntry( HeadlinesFont, &standard ); mPageAppearance->kfcHeadlineFont->setCurrentFont( font.family() ); mPageAppearance->kisbHeadlineFontSize->setValue( font.pointSize() ); font = config->readFontEntry( BodyFont, &standard ); mPageAppearance->kfcBodyFont->setCurrentFont( font.family() ); mPageAppearance->kisbBodyFontSize->setValue( font.pointSize() ); font = config->readFontEntry( DetailsFont, &standard ); mPageAppearance->kfcDetailsFont->setCurrentFont( font.family() ); mPageAppearance->kisbDetailsFontSize->setValue( font.pointSize() ); font = config->readFontEntry( FixedFont, &fixed ); mPageAppearance->kfcFixedFont->setCurrentFont( font.family() ); mPageAppearance->kisbFixedFontSize->setValue( font.pointSize() ); mPageAppearance->cbBackgroundColor->setChecked( config->readBoolEntry( ColoredContactHeaders, true ) ); mPageAppearance->kcbHeaderBGColor->setColor( config->readColorEntry( ContactHeaderBGColor, &Qt::black ) ); mPageAppearance->kcbHeaderTextColor->setColor( config->readColorEntry( ContactHeaderForeColor, &Qt::white ) ); mPageAppearance->layout()->setMargin( KDialog::marginHint() ); mPageAppearance->layout()->setSpacing( KDialog::spacingHint() ); }
// read settings from config file void KBlankSetup::readSettings() { KConfig *config = KGlobal::config(); config->setGroup("Settings"); color = config->readColorEntry("Color", &black); }
void MyFracWindow::readParameters() { KConfig* config = kapp->config(); config->setGroup("Parameters"); _sliderIterations->setValue(config->readNumEntry("Iterations", 2)); _sliderQuality->setValue(config->readNumEntry("Quality", 5)); _sliderScale->setValue(config->readNumEntry("Scale", 15)); _sliderOffset->setValue(config->readNumEntry("Offset", 0)); _sliderScroll->setValue(config->readNumEntry("Scroll", 25)); _sliderHeight->setValue(config->readNumEntry("Height", 20)); _comboGrid->setCurrentItem(config->readNumEntry("Grid", 1)); setGridSize(_comboGrid->currentItem()); QColor black(0, 0, 0); _colorButton->setColor(config->readColorEntry("Background", &black)); QStringList list = config->readListEntry("Gradient"); if (list.size() == 4) { Gradient gradient(list[0] == "hsv"); gradient.getSpline(0).fromString(list[1]); gradient.getSpline(1).fromString(list[2]); gradient.getSpline(2).fromString(list[3]); setGradient(gradient); } else setGradient(_presets.getDefault()); QSize defSize(800, 600); _imageSize = config->readSizeEntry("ImageSize", &defSize); _imageMime = config->readEntry("ImageMime", "image/png"); _imagePath = config->readEntry("ImagePath"); }
void KFLConfigPage::reload() { // read in from config file KConfig *config = kapp->config(); config->setGroup( "Filelist" ); cbEnableShading->setChecked( config->readBoolEntry("Shading Enabled", &m_filelist->m_enableBgShading ) ); kcbViewShade->setColor( config->readColorEntry("View Shade", &m_filelist->m_viewShade ) ); kcbEditShade->setColor( config->readColorEntry("Edit Shade", &m_filelist->m_editShade ) ); cmbSort->setCurrentItem( m_filelist->sortType() ); m_changed = false; }
void ColorSchema::readConfigColor(KConfig& c, const QString& name, ColorEntry& e) { KConfigGroupSaver(&c,name); c.setGroup(name); e.color = c.readColorEntry("Color"); e.transparent = c.readBoolEntry("Transparent",false); e.bold = c.readBoolEntry("Bold",false); }
void QtCalculator::readSettings() { QColor tmpC(189, 255, 180); QColor blackC(0,0,0); KConfig *config = KGlobal::config(); config->setGroup("CalcPlugin"); kcalcdefaults.forecolor = config->readColorEntry("ForeColor", &blackC); kcalcdefaults.backcolor = config->readColorEntry("BackColor", &tmpC); #ifdef HAVE_LONG_DOUBLE kcalcdefaults.precision = config->readNumEntry("precision", (int)14); #else kcalcdefaults.precision = config->readNumEntry("precision", (int)10); #endif kcalcdefaults.fixedprecision = config->readNumEntry("fixedprecision", (int)2); kcalcdefaults.fixed = config->readBoolEntry("fixed", false); kcalcdefaults.style = config->readNumEntry("style", (int)0); kcalcdefaults.beep = config->readBoolEntry("beep", true); }
QColor PrettyPopupMenu::calcPixmapColor() { KConfig *config = KGlobal::config(); config->setGroup("WM"); QColor color = QApplication::palette().active().highlight(); // QColor activeTitle = QApplication::palette().active().background(); // QColor inactiveTitle = QApplication::palette().inactive().background(); QColor activeTitle = config->readColorEntry("activeBackground", &color); QColor inactiveTitle = config->readColorEntry("inactiveBackground", &color); // figure out which color is most suitable for recoloring to int h1, s1, v1, h2, s2, v2, h3, s3, v3; activeTitle.hsv(&h1, &s1, &v1); inactiveTitle.hsv(&h2, &s2, &v2); QApplication::palette().active().background().hsv(&h3, &s3, &v3); if ( (kAbs(h1-h3)+kAbs(s1-s3)+kAbs(v1-v3) < kAbs(h2-h3)+kAbs(s2-s3)+kAbs(v2-v3)) && ((kAbs(h1-h3)+kAbs(s1-s3)+kAbs(v1-v3) < 32) || (s1 < 32)) && (s2 > s1)) color = inactiveTitle; else color = activeTitle; // limit max/min brightness int r, g, b; color.rgb(&r, &g, &b); int gray = qGray(r, g, b); if (gray > 180) { r = (r - (gray - 180) < 0 ? 0 : r - (gray - 180)); g = (g - (gray - 180) < 0 ? 0 : g - (gray - 180)); b = (b - (gray - 180) < 0 ? 0 : b - (gray - 180)); } else if (gray < 76) { r = (r + (76 - gray) > 255 ? 255 : r + (76 - gray)); g = (g + (76 - gray) > 255 ? 255 : g + (76 - gray)); b = (b + (76 - gray) > 255 ? 255 : b + (76 - gray)); } color.setRgb(r, g, b); return color; }
void KopeteRichTextEditPart::readConfig() { // Don't update config untill we read whole config first m_configWriteLock = true; KConfig *config = KGlobal::config(); config->setGroup("RichTextEditor"); QColor tmpColor = KGlobalSettings::textColor(); setFgColor( config->readColorEntry("FgColor", &tmpColor ) ); tmpColor = KGlobalSettings::baseColor(); setBgColor( config->readColorEntry("BgColor", &tmpColor ) ); QFont tmpFont = KopetePrefs::prefs()->fontFace(); setFont( config->readFontEntry("Font", &tmpFont ) ); int tmp = KGlobalSettings::generalFont().pixelSize(); setFontSize( config->readNumEntry( "FontSize", tmp ) ); action_bold->setChecked( config->readBoolEntry( "FontBold" ) ); action_italic->setChecked( config->readBoolEntry( "FontItalic" ) ); action_underline->setChecked( config->readBoolEntry( "FontUnderline" ) ); switch( config->readNumEntry( "EditAlignment", AlignLeft ) ) { case AlignLeft: action_align_left->activate(); break; case AlignCenter: action_align_center->activate(); break; case AlignRight: action_align_right->activate(); break; case AlignJustify: action_align_justify->activate(); break; } m_configWriteLock = false; }
void FavoriteFolderView::readColorConfig() { FolderTreeBase::readColorConfig(); KConfig *conf = KMKernel::config(); // Custom/System color support KConfigGroupSaver saver(conf, "Reader"); QColor c = KGlobalSettings::alternateBackgroundColor(); if(!conf->readBoolEntry("defaultColors", true)) mPaintInfo.colBack = conf->readColorEntry("AltBackgroundColor", &c); else mPaintInfo.colBack = c; QPalette newPal = palette(); newPal.setColor(QColorGroup::Base, mPaintInfo.colBack); setPalette(newPal); }
void CSSConfig::load( bool useDefaults ) { KConfig *c = new KConfig("kcmcssrc", false, false); c->setReadDefaults( useDefaults ); c->setGroup("Stylesheet"); QString u = c->readEntry("Use", "default"); configDialog->useDefault->setChecked(u == "default"); configDialog->useUser->setChecked(u == "user"); configDialog->useAccess->setChecked(u == "access"); configDialog->urlRequester->setURL(c->readEntry("SheetName")); c->setGroup("Font"); customDialog->basefontsize->setEditText(QString::number(c->readNumEntry("BaseSize", 12))); customDialog->dontScale->setChecked(c->readBoolEntry("DontScale", false)); QString fname = c->readEntry("Family", "Arial"); for (int i=0; i < customDialog->fontFamily->count(); ++i) if (customDialog->fontFamily->text(i) == fname) { customDialog->fontFamily->setCurrentItem(i); break; } customDialog->sameFamily->setChecked(c->readBoolEntry("SameFamily", false)); c->setGroup("Colors"); QString m = c->readEntry("Mode", "black-on-white"); customDialog->blackOnWhite->setChecked(m == "black-on-white"); customDialog->whiteOnBlack->setChecked(m == "white-on-black"); customDialog->customColor->setChecked(m == "custom"); customDialog->backgroundColor->setColor(c->readColorEntry("BackColor", &Qt::white)); customDialog->foregroundColor->setColor(c->readColorEntry("ForeColor", &Qt::black)); customDialog->sameColor->setChecked(c->readBoolEntry("SameColor", false)); // Images c->setGroup("Images"); customDialog->hideImages->setChecked(c->readBoolEntry("Hide", false)); customDialog->hideBackground->setChecked(c->readBoolEntry("HideBackground", true)); delete c; emit changed( useDefaults ); }
void ThemeStandard::_readSettings() { if ( !mTheme ) return; KConfig *cfg = mTheme->themeConfig(); if ( !cfg ) return; //if ( !cfg->hasGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) ) ) // return; cfg->setGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) ); QString sbpos = cfg->readEntry( "Statusbar Position", "Bottom" ).upper(); mSbAtTop = ( sbpos == "TOP" ); mSbVisible = cfg->readBoolEntry( "Statusbar Visible", true); mSbPbVisible = cfg->readBoolEntry( "Progress Visible", true); mSbFontName = cfg->readEntry( "Statusbar Font", "Sans Serif" ); mSbFontSz = cfg->readNumEntry( "Statusbar Font Size", 16 ); mSbFontBold = cfg->readBoolEntry( "Statusbar Font Bold", true ); mSbFontItalic = cfg->readBoolEntry( "Statusbar Font Italic", false ); mSbFont = QFont( mSbFontName, mSbFontSz, ( mSbFontBold? QFont::Bold : QFont::Normal ) ); if( mSbFontItalic ) mSbFont.setItalic( true ); mSbFg = cfg->readColorEntry( "Statusbar Foreground", &Qt::white ); mSbBg = cfg->readColorEntry( "Statusbar Background", &Qt::black ); mSbIcon = cfg->readEntry( "Statusbar Icon", "run" ); mIconsVisible = cfg->readBoolEntry( "Icons Visible", true); mIconsJumping = cfg->readBoolEntry( "Icons Jumping", true); mIconPos = (WndIcon::Position)cfg->readNumEntry( "Icon Position", 0 ); mSplashScreen = cfg->readEntry( "Splash Screen", "(Default)"); // cfg->readBoolEntry( "Allow Configuration", true ); }
void KMixApplet::loadConfig() { kdDebug(67100) << "KMixApplet::loadConfig()" << endl; KConfig *cfg = this->config(); cfg->setGroup(0); _mixerId = cfg->readEntry( "Mixer", "undef" ); _mixerName = cfg->readEntry( "MixerName", QString::null ); _customColors = cfg->readBoolEntry( "ColorCustom", false ); _colors.high = cfg->readColorEntry("ColorHigh", &highColor); _colors.low = cfg->readColorEntry("ColorLow", &lowColor); _colors.back = cfg->readColorEntry("ColorBack", &backColor); _colors.mutedHigh = cfg->readColorEntry("ColorMutedHigh", &mutedHighColor); _colors.mutedLow = cfg->readColorEntry("ColorMutedLow", &mutedLowColor); _colors.mutedBack = cfg->readColorEntry("ColorMutedBack", &mutedBackColor); loadConfig( cfg, "Widget"); }
MainWindow::MainWindow ( const char * name ) : KMainWindow ( 0L, name ) { // QPopupMenu *filemenu; // KMenuBar *menu; setCaption("Flickr Wallpaper Grabber"); setIcon( QPixmap( QString( "%1/flickr.png" ).arg( PWD ) ) ); // filemenu = new QPopupMenu; // filemenu->insertItem( i18n( "&Quit" ), kapp, SLOT( quit() ) ); // menu = menuBar(); // menu->insertItem( i18n( "&File" ), filemenu); // global color scheme info KConfig *cfg = KGlobal::config(); cfg->setGroup( "General" ); alternateBackground = cfg->readColorEntry( "alternateBackground" ); // desktop info dwidth = KApplication::desktop()->width(); dheight = KApplication::desktop()->height(); dratio = (float)dwidth / (float)dheight; desktops = KWin::numberOfDesktops(); // layout vbox = new QVBox(this); sv = new KScrollView(vbox); central = new QWidget(sv->viewport()); grid = new QGridLayout(central, 10, 1, 0, 5); vbox->setSpacing(5); sv->addChild(central); sv->setResizePolicy(QScrollView::AutoOneFit); count = 0; page = 0; // setup photo rows PhotoRow *row; for (int i = 0; i < 10; i++) { row = new PhotoRow( central, desktops ); row->hide(); row->setSpacing(5); if (i % 2 == 1) row->setPaletteBackgroundColor( alternateBackground ); grid->addWidget(row, i, 0); rows.append(row); } // button setup QHBox *box = new QHBox( vbox ); backButton = new KPushButton( "Back", box ); goButton = new KPushButton( "Go!", box ); nextButton = new KPushButton( "Next", box ); connect(backButton, SIGNAL(clicked()), this, SLOT(back())); connect(goButton, SIGNAL(clicked()), this, SLOT(go())); connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); backButton->setEnabled(false); setCentralWidget(vbox); grabPhotos(); }
void EventWidget::updateConfig() { KConfig *config; config = kapp->getConfig(); config->setGroup("Fonts"); setFont(config->readFontEntry("Schedule Font")); config->setGroup( "Colors" ); selectedHandle = config->readColorEntry( "AptSelected" ); inactiveHandle = config->readColorEntry( "AptUnselected" ); activeHandle = config->readColorEntry( "AptActive" ); QColorGroup normalGroup( black, //kapp->windowColor, // foreground, used for the edge //kapp->windowColor, config->readColorEntry( "AptBackground" ), // background, used for non text area in textbox green, //config->readColorEntry( "AptUnselected" ),// light red, // dark red, // mid config->readColorEntry( "AptText" ), // text //kapp->windowColor config->readColorEntry( "AptBackground" ) // base used for background behind text ); // for displaying currently happening event ... QColorGroup activeGroup( selectedHandle, // for the edge config->readColorEntry( "AptBackground" ), green, // light red, // dark red, // mid config->readColorEntry( "AptText" ), // text config->readColorEntry( "AptBackground" ) ); QColorGroup disabledGroup( black, //kapp->windowColor, // foreground, used for the edge //kapp->windowColor, config->readColorEntry( "AptBackground" ).dark(120), // background, used for non text area in textbox green, //config->readColorEntry( "AptUnselected" ),// light red, // dark red, // mid config->readColorEntry( "AptText" ), // text //kapp->windowColor config->readColorEntry( "AptBackground" ).dark(120) // base used for background behind text ); QPalette myPalette; myPalette.setNormal( normalGroup ); myPalette.setActive( activeGroup ); myPalette.setDisabled(disabledGroup); setPalette(myPalette); // we don't want the hilite border for other widgets except // the main widget, so set the active color group to normalGroup. myPalette.setActive(normalGroup); textBox->setPalette( myPalette ); iconBox->setPalette( myPalette ); setSelected( widgetSelected ); // to set handle color }
/****************************************************************************** * 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; } }
bool ThumbView::readSettings() { KConfig *cfg = KGlobal::config(); cfg->setGroup( THUMB_GROUP ); bool dirty = false; QColor color; color = cfg->readColorEntry( MARGIN_COLOR1, &(colorGroup().base())); if( color != m_marginColor1 ) { dirty = true; m_marginColor1 = color; } color = cfg->readColorEntry( MARGIN_COLOR2, &(colorGroup().foreground())); if( color != m_marginColor2 ) { dirty = true; m_marginColor2 = color; } int value; bool sizeDirty = false; value = cfg->readNumEntry( THUMB_MARGIN, 5 ); if( value != m_thumbMargin ) { sizeDirty = true; m_thumbMargin = value; } value = cfg->readNumEntry( PIXMAP_WIDTH, 100 ); if( value != m_pixWidth || m_pixWidth == 0 ) { sizeDirty = true; m_pixWidth = value; } value = cfg->readNumEntry( PIXMAP_HEIGHT, 120 ); if( value != m_pixHeight || m_pixHeight == 0 ) { sizeDirty = true; m_pixHeight = value; } if( sizeDirty ) { int gX = 2*m_thumbMargin+m_pixWidth+10; int gY = 2*m_thumbMargin+m_pixHeight+10; m_iconView->setGridX(gX); m_iconView->setGridY(gY); kdDebug(28000) << "Setting Grid " << gX << " - " << gY << endl; } KStandardDirs stdDir; QString newBgImg = cfg->readEntry( BG_WALLPAPER, stdDir.findResource( "data", STD_TILE_IMG ) ); if( m_bgImg != newBgImg ) { m_bgImg = newBgImg; slSetBackGround(); } return (sizeDirty || dirty); }
/* --| main |------------------------------------------------------ */ extern "C" int KDE_EXPORT kdemain(int argc, char *argv[]) { setgid(getgid()); setuid(getuid()); // drop privileges // deal with shell/command //////////////////////////// bool histon = true; bool menubaron = true; bool tabbaron = true; bool frameon = true; bool scrollbaron = true; bool showtip = true; KAboutData aboutData("konsole", I18N_NOOP("Konsole"), KONSOLE_VERSION, description, KAboutData::License_GPL_V2, "Copyright (c) 1997-2006, Lars Doelle"); aboutData.addAuthor("Robert Knight", I18N_NOOP("Maintainer"), "*****@*****.**"); aboutData.addAuthor("Lars Doelle", I18N_NOOP("Author"), "*****@*****.**"); aboutData.addCredit("Kurt V. Hindenburg", I18N_NOOP("bug fixing and improvements"), "*****@*****.**"); aboutData.addCredit("Waldo Bastian", I18N_NOOP("bug fixing and improvements"), "*****@*****.**"); aboutData.addCredit("Stephan Binner", I18N_NOOP("bug fixing and improvements"), "*****@*****.**"); aboutData.addCredit("Chris Machemer", I18N_NOOP("bug fixing"), "*****@*****.**"); aboutData.addCredit("Stephan Kulow", I18N_NOOP("Solaris support and work on history"), "*****@*****.**"); aboutData.addCredit("Alexander Neundorf", I18N_NOOP("faster startup, bug fixing"), "*****@*****.**"); aboutData.addCredit("Peter Silva", I18N_NOOP("decent marking"), "*****@*****.**"); aboutData.addCredit("Lotzi Boloni", I18N_NOOP("partification\n" "Toolbar and session names"), "*****@*****.**"); aboutData.addCredit("David Faure", I18N_NOOP("partification\n" "overall improvements"), "*****@*****.**"); aboutData.addCredit("Antonio Larrosa", I18N_NOOP("transparency"), "*****@*****.**"); aboutData.addCredit("Matthias Ettrich", I18N_NOOP("most of main.C donated via kvt\n" "overall improvements"), "*****@*****.**"); aboutData.addCredit("Warwick Allison", I18N_NOOP("schema and selection improvements"), "*****@*****.**"); aboutData.addCredit("Dan Pilone", I18N_NOOP("SGI Port"), "*****@*****.**"); aboutData.addCredit("Kevin Street", I18N_NOOP("FreeBSD port"), "*****@*****.**"); aboutData.addCredit("Sven Fischer", I18N_NOOP("bug fixing"), "*****@*****.**"); aboutData.addCredit("Dale M. Flaven", I18N_NOOP("bug fixing"), "*****@*****.**"); aboutData.addCredit("Martin Jones", I18N_NOOP("bug fixing"), "*****@*****.**"); aboutData.addCredit("Lars Knoll", I18N_NOOP("bug fixing"), "*****@*****.**"); aboutData.addCredit("", I18N_NOOP("Thanks to many others.\n" "The above list only reflects the contributors\n" "I managed to keep track of.")); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); // Add our own options. // 1.53 sec KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KCmdLineArgs *qtargs = KCmdLineArgs::parsedArgs("qt"); has_noxft = !args->isSet("xft"); TEWidget::setAntialias(!has_noxft); TEWidget::setStandalone(true); // The following Qt options have no effect; warn users. if(qtargs->isSet("background")) kdWarning() << "The Qt option -bg, --background has no effect." << endl; if(qtargs->isSet("foreground")) kdWarning() << "The Qt option -fg, --foreground has no effect." << endl; if(qtargs->isSet("button")) kdWarning() << "The Qt option -btn, --button has no effect." << endl; if(qtargs->isSet("font")) kdWarning() << "The Qt option -fn, --font has no effect." << endl; KApplication *a = NULL; #ifdef COMPOSITE if(args->isSet("real-transparency")) { char *display = 0; if(qtargs->isSet("display")) display = qtargs->getOption("display").data(); Display *dpy = XOpenDisplay(display); if(!dpy) { kdError() << "cannot connect to X server " << display << endl; exit(1); } int screen = DefaultScreen(dpy); Colormap colormap = 0; Visual *visual = 0; int event_base, error_base; if(XRenderQueryExtension(dpy, &event_base, &error_base)) { int nvi; XVisualInfo templ; templ.screen = screen; templ.depth = 32; templ.c_class = TrueColor; XVisualInfo *xvi = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi); for(int i = 0; i < nvi; i++) { XRenderPictFormat *format = XRenderFindVisualFormat(dpy, xvi[i].visual); if(format->type == PictTypeDirect && format->direct.alphaMask) { visual = xvi[i].visual; colormap = XCreateColormap(dpy, RootWindow(dpy, screen), visual, AllocNone); kdDebug() << "found visual with alpha support" << endl; argb_visual = true; break; } } } // The QApplication ctor used is normally intended for applications not using Qt // as the primary toolkit (e.g. Motif apps also using Qt), with some slightly // unpleasant side effects (e.g. #83974). This code checks if qt-copy patch #0078 // is applied, which allows turning this off. bool *qt_no_foreign_hack = static_cast< bool * >(dlsym(RTLD_DEFAULT, "qt_no_foreign_hack")); if(qt_no_foreign_hack) *qt_no_foreign_hack = true; // else argb_visual = false ... ? *shrug* if(argb_visual) a = new KApplication(dpy, Qt::HANDLE(visual), Qt::HANDLE(colormap)); else XCloseDisplay(dpy); } if(a == NULL) a = new KApplication; #else KApplication *a = new KApplication; #endif QString dataPathBase = KStandardDirs::kde_default("data").append("konsole/"); KGlobal::dirs()->addResourceType("wallpaper", dataPathBase + "wallpapers"); KImageIO::registerFormats(); // add io for additional image formats // 2.1 secs QString title; if(args->isSet("T")) { title = QFile::decodeName(args->getOption("T")); } if(qtargs->isSet("title")) { title = QFile::decodeName(qtargs->getOption("title")); } QString term = ""; if(args->isSet("tn")) { term = QString::fromLatin1(args->getOption("tn")); } login_shell = args->isSet("ls"); QStrList eargs; const char *shell = 0; if(!args->getOption("e").isEmpty()) { if(args->isSet("ls")) KCmdLineArgs::usage(i18n("You can't use BOTH -ls and -e.\n")); shell = strdup(args->getOption("e")); eargs.append(shell); for(int i = 0; i < args->count(); i++) eargs.append(args->arg(i)); if(title.isEmpty() && (kapp->caption() == kapp->aboutData()->programName())) { title = QFile::decodeName(shell); // program executed in the title bar } showtip = false; } QCString sz = ""; sz = args->getOption("vt_sz"); histon = args->isSet("hist"); menubaron = args->isSet("menubar"); tabbaron = args->isSet("tabbar") && args->isSet("toolbar"); frameon = args->isSet("frame"); scrollbaron = args->isSet("scrollbar"); QCString wname = qtargs->getOption("name"); full_script = args->isSet("script"); auto_close = args->isSet("close"); fixed_size = !args->isSet("resize"); if(!full_script) a->dcopClient()->setQtBridgeEnabled(false); QCString type = ""; if(args->isSet("type")) { type = args->getOption("type"); } if(args->isSet("types")) { QStringList types = KGlobal::dirs()->findAllResources("appdata", "*.desktop", false, true); types.sort(); for(QStringList::ConstIterator it = types.begin(); it != types.end(); ++it) { QString file = *it; file = file.mid(file.findRev('/') + 1); if(file.endsWith(".desktop")) file = file.left(file.length() - 8); printf("%s\n", QFile::encodeName(file).data()); } return 0; } if(args->isSet("schemas") || args->isSet("schemata")) { ColorSchemaList colors; colors.checkSchemas(); for(int i = 0; i < (int)colors.count(); i++) { ColorSchema *schema = colors.find(i); QString relPath = schema->relPath(); if(!relPath.isEmpty()) printf("%s\n", QFile::encodeName(relPath).data()); } return 0; } if(args->isSet("keytabs")) { QStringList lst = KGlobal::dirs()->findAllResources("data", "konsole/*.keytab"); printf("default\n"); // 'buildin' keytab lst.sort(); for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it) { QFileInfo fi(*it); QString file = fi.baseName(); printf("%s\n", QFile::encodeName(file).data()); } return 0; } QString workDir = QFile::decodeName(args->getOption("workdir")); QString keytab = ""; if(args->isSet("keytab")) keytab = QFile::decodeName(args->getOption("keytab")); QString schema = ""; if(args->isSet("schema")) schema = args->getOption("schema"); KConfig *sessionconfig = 0; QString profile = ""; if(args->isSet("profile")) { profile = args->getOption("profile"); QString path = locate("data", "konsole/profiles/" + profile); if(QFile::exists(path)) sessionconfig = new KConfig(path, true); else profile = ""; } if(args->isSet("profiles")) { QStringList profiles = KGlobal::dirs()->findAllResources("data", "konsole/profiles/*", false, true); profiles.sort(); for(QStringList::ConstIterator it = profiles.begin(); it != profiles.end(); ++it) { QString file = *it; file = file.mid(file.findRev('/') + 1); printf("%s\n", QFile::encodeName(file).data()); } return 0; } // FIXME: more: font args->clear(); int c = 0, l = 0; if(!sz.isEmpty()) { char *ls = (char *)strchr(sz.data(), 'x'); if(ls != NULL) { *ls = '\0'; ls++; c = atoi(sz.data()); l = atoi(ls); } else { KCmdLineArgs::usage(i18n("expected --vt_sz <#columns>x<#lines> e.g. 80x40\n")); } } if(!kapp->authorizeKAction("size")) fixed_size = true; // /////////////////////////////////////////////// // Ignore SIGHUP so that we don't get killed when // our parent-shell gets closed. signal(SIGHUP, SIG_IGN); putenv((char *)"COLORTERM="); // to trigger mc's color detection KonsoleSessionManaged ksm; if(a->isRestored() || !profile.isEmpty()) { if(!shell) shell = konsole_shell(eargs); if(profile.isEmpty()) sessionconfig = a->sessionConfig(); sessionconfig->setDesktopGroup(); int n = 1; QString key; QString sTitle; QString sPgm; QString sTerm; QString sIcon; QString sCwd; int n_tabbar; // TODO: Session management stores everything in same group, // should use one group / mainwindow while(KMainWindow::canBeRestored(n) || !profile.isEmpty()) { sessionconfig->setGroup(QString("%1").arg(n)); if(!sessionconfig->hasKey("Pgm0")) sessionconfig->setDesktopGroup(); // Backwards compatible int session_count = sessionconfig->readNumEntry("numSes"); int counter = 0; wname = sessionconfig->readEntry("class", wname).latin1(); sPgm = sessionconfig->readEntry("Pgm0", shell); sessionconfig->readListEntry("Args0", eargs); sTitle = sessionconfig->readEntry("Title0", title); sTerm = sessionconfig->readEntry("Term0"); sIcon = sessionconfig->readEntry("Icon0", "konsole"); sCwd = sessionconfig->readPathEntry("Cwd0"); workDir = sessionconfig->readPathEntry("workdir"); n_tabbar = QMIN(sessionconfig->readUnsignedNumEntry("tabbar", Konsole::TabBottom), 2); Konsole *m = new Konsole(wname, histon, menubaron, tabbaron, frameon, scrollbaron, 0 /*type*/, true, n_tabbar, workDir); m->newSession(sPgm, eargs, sTerm, sIcon, sTitle, sCwd); m->enableFullScripting(full_script); m->enableFixedSize(fixed_size); m->restore(n); sessionconfig->setGroup(QString("%1").arg(n)); if(!sessionconfig->hasKey("Pgm0")) sessionconfig->setDesktopGroup(); // Backwards compatible m->makeGUI(); m->setEncoding(sessionconfig->readNumEntry("Encoding0")); m->setSchema(sessionconfig->readEntry("Schema0")); // Use konsolerc default as tmpFont instead? QFont tmpFont = KGlobalSettings::fixedFont(); m->initSessionFont(sessionconfig->readFontEntry("SessionFont0", &tmpFont)); m->initSessionKeyTab(sessionconfig->readEntry("KeyTab0")); m->initMonitorActivity(sessionconfig->readBoolEntry("MonitorActivity0", false)); m->initMonitorSilence(sessionconfig->readBoolEntry("MonitorSilence0", false)); m->initMasterMode(sessionconfig->readBoolEntry("MasterMode0", false)); m->initTabColor(sessionconfig->readColorEntry("TabColor0")); // -1 will be changed to the default history in konsolerc m->initHistory(sessionconfig->readNumEntry("History0", -1), sessionconfig->readBoolEntry("HistoryEnabled0", true)); counter++; // show() before 2nd+ sessions are created allows --profile to // initialize the TE size correctly. m->show(); while(counter < session_count) { key = QString("Title%1").arg(counter); sTitle = sessionconfig->readEntry(key, title); key = QString("Args%1").arg(counter); sessionconfig->readListEntry(key, eargs); key = QString("Pgm%1").arg(counter); // if the -e option is passed on the command line, this overrides the program specified // in the profile file if(args->isSet("e")) sPgm = (shell ? QFile::decodeName(shell) : QString::null); else sPgm = sessionconfig->readEntry(key, shell); key = QString("Term%1").arg(counter); sTerm = sessionconfig->readEntry(key); key = QString("Icon%1").arg(counter); sIcon = sessionconfig->readEntry(key, "konsole"); key = QString("Cwd%1").arg(counter); sCwd = sessionconfig->readPathEntry(key); m->newSession(sPgm, eargs, sTerm, sIcon, sTitle, sCwd); m->setSessionTitle(sTitle); // Use title as is key = QString("Schema%1").arg(counter); m->setSchema(sessionconfig->readEntry(key)); key = QString("Encoding%1").arg(counter); m->setEncoding(sessionconfig->readNumEntry(key)); key = QString("SessionFont%1").arg(counter); QFont tmpFont = KGlobalSettings::fixedFont(); m->initSessionFont(sessionconfig->readFontEntry(key, &tmpFont)); key = QString("KeyTab%1").arg(counter); m->initSessionKeyTab(sessionconfig->readEntry(key)); key = QString("MonitorActivity%1").arg(counter); m->initMonitorActivity(sessionconfig->readBoolEntry(key, false)); key = QString("MonitorSilence%1").arg(counter); m->initMonitorSilence(sessionconfig->readBoolEntry(key, false)); key = QString("MasterMode%1").arg(counter); m->initMasterMode(sessionconfig->readBoolEntry(key, false)); key = QString("TabColor%1").arg(counter); m->initTabColor(sessionconfig->readColorEntry(key)); // -1 will be changed to the default history in konsolerc key = QString("History%1").arg(counter); QString key2 = QString("HistoryEnabled%1").arg(counter); m->initHistory(sessionconfig->readNumEntry(key, -1), sessionconfig->readBoolEntry(key2, true)); counter++; } m->setDefaultSession(sessionconfig->readEntry("DefaultSession", "shell.desktop")); m->initFullScreen(); if(!profile.isEmpty()) { m->callReadPropertiesInternal(sessionconfig, 1); profile = ""; // Hack to work-around sessions initialized with minimum size for(int i = 0; i < counter; i++) m->activateSession(i); m->setColLin(c, l); // will use default height and width if called with (0,0) } // works only for the first one, but there won't be more. n++; m->activateSession(sessionconfig->readNumEntry("ActiveSession", 0)); m->setAutoClose(auto_close); } } else { Konsole *m = new Konsole(wname, histon, menubaron, tabbaron, frameon, scrollbaron, type, false, 0, workDir); m->newSession((shell ? QFile::decodeName(shell) : QString::null), eargs, term, QString::null, title, workDir); m->enableFullScripting(full_script); m->enableFixedSize(fixed_size); // 3.8 :-( // exit(0); if(!keytab.isEmpty()) m->initSessionKeyTab(keytab); if(!schema.isEmpty()) { if(schema.right(7) != ".schema") schema += ".schema"; m->setSchema(schema); m->activateSession(0); // Fixes BR83162, transp. schema + notabbar } m->setColLin(c, l); // will use default height and width if called with (0,0) m->initFullScreen(); m->show(); if(showtip) m->showTipOnStart(); m->setAutoClose(auto_close); } int ret = a->exec(); //// Temporary code, waiting for Qt to do this properly // Delete all toplevel widgets that have WDestructiveClose QWidgetList *list = QApplication::topLevelWidgets(); // remove all toplevel widgets that have a parent (i.e. they // got WTopLevel explicitly), they'll be deleted by the parent list->first(); while(list->current()) { if(list->current()->parentWidget() != NULL || !list->current()->testWFlags(Qt::WDestructiveClose)) { list->remove(); continue; } list->next(); } QWidgetListIt it(*list); QWidget *w; while((w = it.current()) != 0) { ++it; delete w; } delete list; delete a; return ret; }
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 KfmView::setHTMLWidgetOptions(){ int fSize; QString stdName; QString fixedName; QColor bgColor; QColor textColor; QColor linkColor; QColor vLinkColor; KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "KFM HTML Defaults" ); QString fs = config->readEntry( "BaseFontSize" ); if ( !fs.isEmpty() ) { fSize = fs.toInt(); if ( fSize < 3 ) fSize = 3; else if ( fSize > 5 ) fSize = 5; } else fSize = 3; stdName = config->readEntry( "StandardFont" ); if ( stdName.isEmpty() ) stdName = DEFAULT_VIEW_FONT; fixedName = config->readEntry( "FixedFont" ); if ( fixedName.isEmpty() ) fixedName = DEFAULT_VIEW_FIXED_FONT; QString aStr = config->readEntry( "DefaultCharset" ); if(!aStr.isEmpty()) kapp->getCharsets()->setDefault(aStr); bool changeCursor = config->readNumEntry("ChangeCursor",false); bool underlineLinks = config->readNumEntry("UnderlineLinks",true); KHTMLWidget* htmlview; htmlview=getKHTMLWidget(); htmlview->setFixedFont( fixedName); htmlview->setStandardFont( stdName ); htmlview->setDefaultFontBase( fSize ); htmlview->setUnderlineLinks(underlineLinks); if(changeCursor) htmlview->setURLCursor( KCursor::handCursor() ); else htmlview->setURLCursor( KCursor::arrowCursor() ); config->setGroup( "KFM HTML Defaults" ); bgColor = config->readColorEntry( "BgColor", &HTML_DEFAULT_BG_COLOR ); textColor = config->readColorEntry( "TextColor", &HTML_DEFAULT_TXT_COLOR ); linkColor = config->readColorEntry( "LinkColor", &HTML_DEFAULT_LNK_COLOR ); vLinkColor = config->readColorEntry( "VLinkColor", &HTML_DEFAULT_VLNK_COLOR); bool forceDefaults = config->readBoolEntry( "ForceDefaultColors", false ); view->setForceDefault( forceDefaults ); setDefaultTextColors(textColor,linkColor,vLinkColor); setDefaultBGColor(bgColor); }
void KMDITitleLabel::readConfiguration(){ KConfig* config; QString key; // int i; killTimers(); config = new("KConfig") KConfig(KApplication::kde_configdir() + "/kwmrc", KApplication::localconfigdir() + "/kwmrc"); // this belongs in kapp.... config->setGroup("WM"); activeTitleBlend = config->readColorEntry( "activeBlend",&black); inactiveTitleBlend = config->readColorEntry( "inactiveBlend",&kapp->backgroundColor); config->setGroup( "General" ); //BORDER = 4; key = config->readEntry("WindowMoveType"); if( key == "Transparent") options.WindowMoveType = TRANSPARENT; else if( key == "Opaque") options.WindowMoveType = OPAQUE; else{ config->writeEntry("WindowMoveType","Transparent"); options.WindowMoveType = TRANSPARENT; } key = config->readEntry("WindowResizeType"); if( key == "Transparent") options.WindowResizeType = TRANSPARENT; else if( key == "Opaque") options.WindowResizeType = OPAQUE; else{ config->writeEntry("WindowResizeType","Transparent"); options.WindowResizeType = TRANSPARENT; } key = config->readEntry("FocusPolicy"); if( key == "ClickToFocus") options.FocusPolicy = CLICK_TO_FOCUS; else if( key == "FocusFollowsMouse" || key == "FocusFollowMouse") options.FocusPolicy = FOCUS_FOLLOWS_MOUSE; else if( key == "ClassicFocusFollowsMouse" || key == "ClassicFocusFollowMouse") options.FocusPolicy = CLASSIC_FOCUS_FOLLOWS_MOUSE; else if( key == "ClassicSloppyFocus") options.FocusPolicy = CLASSIC_SLOPPY_FOCUS; else{ config->writeEntry("FocusPolicy","ClickToFocus"); options.FocusPolicy = CLICK_TO_FOCUS; } key = config->readEntry("AltTabMode"); if( key == "KDE") options.AltTabMode = KDE_STYLE; else if( key == "CDE") options.AltTabMode = CDE_STYLE; else{ config->writeEntry("AltTabMode","KDE"); options.AltTabMode = KDE_STYLE; } if (CLASSIC_FOCUS) options.AltTabMode = CDE_STYLE; key = config->readEntry("TitlebarLook"); if( key == "shadedHorizontal") options.TitlebarLook = H_SHADED; else if( key == "shadedVertical") options.TitlebarLook = V_SHADED; else if( key == "plain") options.TitlebarLook = PLAIN; else if( key == "pixmap") options.TitlebarLook = PIXMAP; else{ config->writeEntry("TitlebarLook", "shadedHorizontal"); options.TitlebarLook = H_SHADED; } //CT 23Sep1998 - fixed the name of the titlebar pixmaps to become // consistent with the buttons pixmaps definition technique if (options.TitlebarLook == PIXMAP) { *options.titlebarPixmapActive = loadIcon("activetitlebar.xpm"); *options.titlebarPixmapInactive = loadIcon("inactivetitlebar.xpm"); if (options.titlebarPixmapInactive->size() == QSize(0,0)) *options.titlebarPixmapInactive = *options.titlebarPixmapActive; if (options.titlebarPixmapActive->size() == QSize(0,0)) options.TitlebarLook = PLAIN; } //CT 12Jun1998 - variable animation speed from 0 (none!!) to 10 (max) if (config->hasKey("ResizeAnimation")) { options.ResizeAnimation = config->readNumEntry("ResizeAnimation"); if( options.ResizeAnimation < 1 ) options.ResizeAnimation = 0; if( options.ResizeAnimation > 10 ) options.ResizeAnimation = 10; } else{ options.ResizeAnimation = 1; config->writeEntry("ResizeAnimation", options.ResizeAnimation); } config->sync(); delete config; }