Esempio n. 1
0
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;
}
Esempio n. 2
0
void FontDialog::load()
{
    KConfig *cfg = kapp->config();
    {
        KConfigGroupSaver groupSaver(cfg, "HTML Settings");

        m_minFontSize->setValue(cfg->readNumEntry("MinimumFontSize", HTML_DEFAULT_MIN_FONT_SIZE));
        m_medFontSize->setValue(cfg->readNumEntry("MediumFontSize", 10));

        QStringList fonts = cfg->readListEntry("Fonts");
        if(fonts.isEmpty())
            fonts << KGlobalSettings::generalFont().family() << KGlobalSettings::fixedFont().family() << HTML_DEFAULT_VIEW_SERIF_FONT
                  << HTML_DEFAULT_VIEW_SANSSERIF_FONT << HTML_DEFAULT_VIEW_CURSIVE_FONT << HTML_DEFAULT_VIEW_FANTASY_FONT;

        m_standardFontCombo->setCurrentFont(fonts[0]);
        m_fixedFontCombo->setCurrentFont(fonts[1]);
        m_serifFontCombo->setCurrentFont(fonts[2]);
        m_sansSerifFontCombo->setCurrentFont(fonts[3]);
        m_italicFontCombo->setCurrentFont(fonts[4]);
        m_fantasyFontCombo->setCurrentFont(fonts[5]);

        m_defaultEncoding->setCurrentItem(cfg->readEntry("DefaultEncoding"));
        m_fontSizeAdjustement->setValue(fonts[6].toInt());
    }
}
GuiSpectrumAnalyser::GuiSpectrumAnalyser()
  : WaWidget(_WA_MAPPING_ANALYSER)
{
    connect(WaSkinModel::instance(), SIGNAL(skinChanged()), this, SLOT(pixmapChange()));

    contextMenu = new QPopupMenu(this);
    visualizationMenu = new QPopupMenu();
    analyserMenu = new QPopupMenu();

    contextMenu->insertItem(i18n("Visualization Mode"), visualizationMenu);
    contextMenu->insertItem(i18n("Analyzer Mode"), analyserMenu);

    visualizationMenu->insertItem(i18n("Analyzer"), (int)MODE_ANALYSER);
    visualizationMenu->insertItem(i18n("Disabled"), (int)MODE_DISABLED);
    visualizationMenu->setCheckable(true);
    connect(visualizationMenu, SIGNAL(activated(int)), this, SLOT(setVisualizationMode(int)));

    analyserMenu->insertItem(i18n("Normal"), (int)MODE_NORMAL);
    analyserMenu->insertItem(i18n("Fire"), (int)MODE_FIRE);
    analyserMenu->insertItem(i18n("Vertical Lines"), (int)MODE_VERTICAL_LINES);
    analyserMenu->setCheckable(true);
    connect(analyserMenu, SIGNAL(activated(int)), this, SLOT(setAnalyserMode(int)));

    analyserCache = NULL;
    winSkinVis = NULL;

    KConfig *config = KGlobal::config();
    config->setGroup("Winskin");

    setVisualizationMode(config->readNumEntry("visualizationMode", MODE_ANALYSER));
    setAnalyserMode(config->readNumEntry("analyserMode", MODE_NORMAL));
}
Esempio n. 4
0
button::button(blinkenGame::color c) : m_selected(false), m_color(c)
{
	KConfig *kc = kapp->config();
	kc->setGroup("General");
	QString cs = getColorString();
	QString pixmap = QString("images/%1h.png").arg(cs);
	
	switch (c)
	{
		case blinkenGame::blue:
			m_key = kc->readNumEntry(cs, Qt::Key_3);
		break;
		
		case blinkenGame::yellow:
			m_key = kc->readNumEntry(cs, Qt::Key_1);
		break;
		
		case blinkenGame::red:
			m_key = kc->readNumEntry(cs, Qt::Key_2);
		break;
		
		case blinkenGame::green:
			m_key = kc->readNumEntry(cs, Qt::Key_4);
		break;
		
		default:
			// never happens
		break;
	}
	
	m_highlighted = new QPixmap(locate("appdata", pixmap));
}
Esempio n. 5
0
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 );
    }
}
Esempio n. 6
0
void 
KASearchSettings::readConfig()
{
  int tmp;
  KConfig *config = KApplication::getKApplication()->getConfig();
  KConfigGroupSaver saveGroup( config, "SearchConfig" );
  
  maxhits->setValue(config->readNumEntry("hits", 95));

  switch (SearchMode::toMode( ((const char *)config->readEntry("Search", "="))[0] )) {
  case SearchMode::exactregexp: tmp=6 ; break;
  case SearchMode::exactsubcase: tmp=5 ; break;
  case SearchMode::exactsubstr: tmp=4 ; break;
  case SearchMode::regexp: tmp=3 ; break;
  case SearchMode::subcase: tmp=2 ; break;
  case SearchMode::substr: tmp=1 ; break;
  case SearchMode::exact: // fall through
  default: tmp=0 ; break;
  }
  searchmode->setCurrentItem(tmp);

  switch(NiceLevel::toLevel(config->readNumEntry("Nice", 0))) {
  case NiceLevel::nice : tmp=1 ; break;
  case NiceLevel::nicer : // fall through
  case NiceLevel::verynice : tmp=2 ; break;
  case NiceLevel::extremlynice : tmp=3 ; break;
  case NiceLevel::nicest : tmp=4 ; break;
  case NiceLevel::norm : // fall through
  default: tmp=0 ; break;
  }
  nicelevel->setCurrentItem(tmp);

}
Esempio n. 7
0
void KDevIDEExtension::createGlobalSettingsPage(KDialogBase *dlg)
{
    KConfig* config = kapp->config();
    QVBox *vbox = dlg->addVBoxPage(i18n("General"), i18n("General"), BarIcon("kdevelop", KIcon::SizeMedium) );
    gsw = new SettingsWidget(vbox, "general settings widget");

    gsw->projectsURL->setMode((int)KFile::Directory);

    config->setGroup("General Options");
    gsw->lastProjectCheckbox->setChecked(config->readBoolEntry("Read Last Project On Startup",true));
    gsw->outputFont->setFont( config->readFontEntry( "OutputViewFont" ) );
    config->setGroup("MakeOutputView");
    gsw->lineWrappingCheckBox->setChecked(config->readBoolEntry("LineWrapping",true));
    gsw->dirNavigMsgCheckBox->setChecked(config->readBoolEntry("ShowDirNavigMsg",false));
    gsw->compileOutputCombo->setCurrentItem(config->readNumEntry("CompilerOutputLevel",2));
    gsw->forceCLocaleRadio->setChecked( config->readBoolEntry( "ForceCLocale", true ) );
    gsw->userLocaleRadio->setChecked( !config->readBoolEntry( "ForceCLocale", true ) );

    config->setGroup("General Options");
    gsw->projectsURL->setURL(config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()+"/"));
    gsw->designerButtonGroup->setButton( config->readNumEntry( "DesignerApp", 0 ) );

    QString DesignerSetting = config->readEntry( "DesignerSetting", "ExternalDesigner" );
    gsw->qtDesignerRadioButton->setChecked( DesignerSetting == "ExternalDesigner" );
    gsw->seperateAppRadioButton->setChecked( DesignerSetting == "ExternalKDevDesigner" );
    gsw->embeddedDesignerRadioButton->setChecked( DesignerSetting == "EmbeddedKDevDesigner" );

    config->setGroup("TerminalEmulator");
    gsw->terminalEdit->setText( config->readEntry( "TerminalApplication", QString::fromLatin1("konsole") ) );
    bool useKDESetting = config->readBoolEntry( "UseKDESetting", true );
    gsw->useKDETerminal->setChecked( useKDESetting );
    gsw->useOtherTerminal->setChecked( !useKDESetting );
}
Esempio n. 8
0
void KScienceSaver::readSettings()
{
    KConfig *config = KGlobal::config();
        QString sMode;

	config->setGroup( "Settings" );
	mode = config->readNumEntry( "ModeNr", SCI_DEFAULT_MODE );

	for(int i=0; i < MAX_MODES; i++)
	{
		sMode.setNum( i );
		config->setGroup( "Mode" + sMode );
		moveX[i]     = config->readNumEntry(  "MoveX",     SCI_DEFAULT_MOVEX);
		moveY[i]     = config->readNumEntry(  "MoveY",     SCI_DEFAULT_MOVEY);
		size[i]      = config->readNumEntry(  "Size",      SCI_DEFAULT_SIZE);
		speed[i]     = config->readNumEntry(  "Speed",     SCI_DEFAULT_SPEED);
		intensity[i] = config->readNumEntry(  "Intensity", SCI_DEFAULT_INTENSITY);
		inverse[i]   = config->readBoolEntry( "Inverse",   SCI_DEFAULT_INVERSE);
		gravity[i]   = config->readBoolEntry( "Gravity",   SCI_DEFAULT_GRAVITY);
		hideBG[i]    = config->readBoolEntry( "HideBG",    SCI_DEFAULT_HIDE);
	}

	vx = copysign( moveX[mode], vx );
	vy = copysign( moveY[mode], vy );
}
Esempio n. 9
0
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();
}
Esempio n. 10
0
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++;
}
Esempio n. 11
0
void KatapultSettings::readSettings()
{
	KConfig *config = kapp->config();
	_hideSessionNotification = config->readNumEntry("HideSessionNotification", 1);
	_hideUserNotification = config->readNumEntry("HideUserNotification", 0);
	_notificationTimeout = config->readNumEntry("NotificationTimeout", 5000);
	_hideDelay = config->readUnsignedNumEntry("HideDelay", 1000);
	_noResultsDelay = config->readUnsignedNumEntry("NoResultsDelay", 2500);
	_noResultsAction = (NRAction) config->readUnsignedNumEntry("NoResultsAction", NR_ClearQuery);
	_systrayIcon = config->readBoolEntry("SystrayIcon", TRUE);
	_autoExec = config->readBoolEntry("AutoExec", FALSE);
	_displayName = config->readEntry("Display", "Pure Display");
	if (_displayName == "Name=Glass Display")
	{
		_displayName = "Glass Display";
	}	

	QStringList defCatalogs;
	defCatalogs << "Program Catalog" << "Bookmark Catalog" << "Document Catalog" << "Calculator Catalog" << "Amarok Catalog" << "Spell Catalog" << "Google Catalog" << "Execution Catalog";
	_activeCatalogNames = config->readListEntry("Catalogs", defCatalogs);

	// Force a config write if notification is to be shown once.
	// (in writeSettings(), _hideSessionNotification or _hideUserNotification
	// is changed before writing [if necessary]).
	_forceWrite = ((kapp->isSessionRestored() && _hideSessionNotification == 1) ||
			(!kapp->isSessionRestored() && _hideUserNotification == 1));
}
Esempio n. 12
0
void kSwarmSaver::readSettings()
{
    KConfig *config = klock_config();
    config->setGroup( "Settings" );

	speed = MAXSPEED - config->readNumEntry( "Speed", MAXSPEED - DEFSPEED );
	maxLevels = config->readNumEntry( "MaxLevels", DEFBATCH );

	delete config;
}
Esempio n. 13
0
void KJotsMain::updateConfiguration()
{
  KConfig *config = KApplication::getKApplication()->getConfig();
  config->setGroup("kjots");
  exec_http = config->readEntry("execHttp");
  exec_ftp = config->readEntry("execFtp");
  QFont font( config->readEntry("EFontFamily"), config->readNumEntry("EFontSize"),
	      config->readNumEntry("EFontWeight"), config->readNumEntry("EFontItalic"),
	      (QFont::CharSet) config->readNumEntry("EFontCharset") );
  me_text->setFont(font);
}
Esempio n. 14
0
KPagerMainWindow::KPagerMainWindow(QWidget *parent, const char *name)
	: DCOPObject("KPagerIface"), KMainWindow(parent, name)
{
    m_reallyClose=false;

    m_pPager = new KPager(this, 0);
    setCentralWidget(m_pPager);

    KConfig *cfg = kapp->config();
    cfg->setGroup("KPager");

    // Update the last used geometry
    int w = cfg->readNumEntry(m_pPager->lWidth(),-1);
    int h = cfg->readNumEntry(m_pPager->lHeight(),-1);
    if (w > 0 && h > 0)
        resize(w,h);
    else
        resize(m_pPager->sizeHint());
    //  resize(cfg->readNumEntry(lWidth(),200),cfg->readNumEntry(lHeight(),90));

    int xpos=cfg->readNumEntry("xPos",-1);
    int ypos=cfg->readNumEntry("yPos",-1);
    if (xpos > 0 && ypos > 0)
      move(xpos,ypos);
    else
    {
//      NETRootInfo ri( qt_xdisplay(), NET::WorkArea );
//      NETRect rect=ri.workArea(1);
//      move(rect.pos.x+rect.size.width-m_pPager->width(),
//	  rect.pos.y+rect.size.height-m_pPager->height());
// antonio:The above lines don't work. I should look at them when I have
// more time
        move(kapp->desktop()->width()-m_pPager->sizeHint().width()-5,kapp->desktop()->height()-m_pPager->sizeHint().height()-25);
    }

    // Set the wm flags to this window
    KWin::setState( winId(), NET::StaysOnTop | NET::SkipTaskbar | NET::Sticky | NET::SkipPager );
    KWin::setOnAllDesktops( winId(), true);
    if ( KWin::windowInfo( winId(), NET::WMWindowType, 0 ).windowType(NET::Normal) == NET::Normal )
    {
       KWin::setType( winId(), NET::Utility );
    }

    XWMHints *hints = XGetWMHints(x11Display(), winId());
    if( hints == NULL )
        hints = XAllocWMHints();
    hints->input = false;
    hints->flags |= InputHint;
    XSetWMHints(x11Display(), winId(), hints);
    XFree(reinterpret_cast<char *>(hints));

    timeout=new QTimer(this,"timeoutToQuit");
    connect(timeout,SIGNAL(timeout()),this, SLOT(reallyClose()));
}
Esempio n. 15
0
//-----------------------------------------------------------------------------
void KMAcctPop::readConfig(KConfig& config)
{
  KMAcctPopInherited::readConfig(config);


  mLogin = config.readEntry("login", "");
  mStorePasswd = config.readNumEntry("store-passwd", TRUE);
  if (mStorePasswd) mPasswd = config.readEntry("passwd");
  else mPasswd = "";
  mHost = config.readEntry("host");
  mPort = config.readNumEntry("port");
  mProtocol = config.readNumEntry("protocol");
  mLeaveOnServer = config.readNumEntry("leave-on-server", FALSE);
  mRetrieveAll = config.readNumEntry("retrieve-all", FALSE);
}
Esempio n. 16
0
void kSwarmSetup::readSettings()
{
	KConfig *config = klock_config();
	config->setGroup( "Settings" );

	speed = config->readNumEntry( "Speed", speed );

	if ( speed > MAXSPEED )
		speed = MAXSPEED;
	else if ( speed < MINSPEED )
		speed = MINSPEED;

	maxLevels = config->readNumEntry( "MaxLevels", DEFBATCH );
	delete config;
}
Esempio n. 17
0
void UIChooserWidget::load()
{
  KConfig *config = kapp->config();
  config->setGroup("UI");

	int mdistyle = config->readNumEntry( "MDIStyle", 1 );
	switch( mdistyle )
	{
		case 0:
			IconsOnly->setChecked( true );
			break;
		case 1:
			TextOnly->setChecked( true );
			break;
		case 3:
			TextAndIcons->setChecked( true );
			break;
		default:
			TextOnly->setChecked( true );
	}

	int tabVisibility = config->readNumEntry( "TabWidgetVisibility", _AlwaysShowTabs );
	switch( tabVisibility )
	{
		case _AlwaysShowTabs:
			AlwaysShowTabs->setChecked( true );
			break;
		case _NeverShowTabs:
			NeverShowTabs->setChecked( true );
			break;
	}

	bool CloseOnHover = config->readBoolEntry( "CloseOnHover", false );

	if ( CloseOnHover )
	{
		DoCloseOnHover->setChecked( true );
	}
	else
	{
		DoNotCloseOnHover->setChecked( true );
	}
	OpenNewTabAfterCurrent->setChecked(config->readBoolEntry( "OpenNewTabAfterCurrent", false ));
	ShowTabIcons->setChecked(config->readBoolEntry( "ShowTabIcons", true ));
	ShowCloseTabsButton->setChecked(config->readBoolEntry( "ShowCloseTabsButton", true ));

	maybeEnableCloseOnHover(false);
}
Esempio n. 18
0
int KProtocolManager::responseTimeout()
{
    KConfig *cfg = config();
    cfg->setGroup(QString::null);
    int val = cfg->readNumEntry("ResponseTimeout", DEFAULT_RESPONSE_TIMEOUT);
    return QMAX(MIN_TIMEOUT_VALUE, val);
}
Esempio n. 19
0
int KProtocolManager::proxyConnectTimeout()
{
    KConfig *cfg = config();
    cfg->setGroup(QString::null);
    int val = cfg->readNumEntry("ProxyConnectTimeout", DEFAULT_PROXY_CONNECT_TIMEOUT);
    return QMAX(MIN_TIMEOUT_VALUE, val);
}
Esempio n. 20
0
void KSysTrayCmd::refresh()
{
  KWin::setSystemTrayWindowFor( winId(), win ? win : winId() );

  QToolTip::remove( this );
  if ( win ) {
    KConfig *appCfg = kapp->config();
    KConfigGroupSaver configSaver(appCfg, "System Tray");
    int iconWidth = appCfg->readNumEntry("systrayIconWidth", 22);

    // ksystraycmd's icon or app's icon
    if (ownIcon)
    {
      setPixmap( KSystemTray::loadIcon( kapp->iconName() ) );
    }
    else
    {
      setPixmap( KWin::icon( win, iconWidth, iconWidth, true ) );
    }

    QToolTip::add( this, KWin::windowInfo( win ).name() );
  }
  else {
    if ( !tooltip.isEmpty() )
      QToolTip::add( this, tooltip );
    else if ( !command.isEmpty() )
      QToolTip::add( this, command );
    else
      QToolTip::add( this, window );

    setPixmap( KSystemTray::loadIcon( kapp->iconName() ) );
  }
}
Esempio n. 21
0
ObjKsTheme::ObjKsTheme( const QString& theme )
  :mActiveTheme (theme), mThemeDir("/"), mThemeConfig (0L), mThemePrefix( "Themes/" ), d(0)
{
  // Get Xinerama config.
  KConfig *config = kapp->config();
  config->setGroup( "Xinerama" );
  QDesktopWidget *desktop = kapp->desktop();
  mXineramaScreen = config->readNumEntry("KSplashScreen", desktop->primaryScreen());

  // For Xinerama, let's put the mouse on the first head.  Otherwise it could appear anywhere!
  if (desktop->isVirtualDesktop() && mXineramaScreen != -2)
  {
    QRect rect = desktop->screenGeometry( mXineramaScreen );
    if (!rect.contains(QCursor::pos()))
      QCursor::setPos(rect.center());
  }

  // Does the active theme exist?
  if( !loadThemeRc( mActiveTheme, false ) )
    if( !loadLocalConfig( mActiveTheme, false ) )
      if( !loadThemeRc( "Default", false ) )
        loadLocalConfig( "Default", true ); //force: we need some defaults
  loadCmdLineArgs(KCmdLineArgs::parsedArgs());
  mThemePrefix += ( mActiveTheme + "/" );
}
Esempio n. 22
0
void kSpaceSetup::readSettings()
{
	KConfig *config = klock_config();
	config->setGroup( "Settings" );

	speed = config->readNumEntry( "Speed", speed );

	if ( speed > MAXSPEED )
		speed = MAXSPEED;
	else if ( speed < MINSPEED )
		speed = MINSPEED;

	warpinterval = config->readNumEntry( "WarpInterval", 15 );

	delete config;
}
Esempio n. 23
0
void KMMainView::restoreSettings()
{
    KConfig *conf = KMFactory::self()->printConfig();
    conf->setGroup("General");
    setViewType((KMPrinterView::ViewType)conf->readNumEntry("ViewType", KMPrinterView::Icons));
    setOrientation(conf->readNumEntry("Orientation", Qt::Vertical));
    bool view = conf->readBoolEntry("ViewToolBar", false);
    slotToggleToolBar(view);
    ((KToggleAction *)m_actions->action("view_toolbar"))->setChecked(view);
    view = conf->readBoolEntry("ViewMenuBar", true);
    slotToggleMenuBar(view);
    static_cast< KToggleAction * >(m_actions->action("view_menubar"))->setChecked(view);
    view = conf->readBoolEntry("ViewPrinterInfos", true);
    slotShowPrinterInfos(view);
    ((KToggleAction *)m_actions->action("view_printerinfos"))->setChecked(view);
}
Esempio n. 24
0
void KNotify::loadConfig()
{
    // load external player settings
    KConfig *kc = KGlobal::config();
    kc->setGroup("Misc");
    d->useExternal = kc->readBoolEntry("Use external player", false);
    d->externalPlayer = kc->readPathEntry("External player");

    // try to locate a suitable player if none is configured
    if(d->externalPlayer.isEmpty())
    {
        QStringList players;
        players << "wavplay"
                << "aplay"
                << "auplay";
        QStringList::Iterator it = players.begin();
        while(d->externalPlayer.isEmpty() && it != players.end())
        {
            d->externalPlayer = KStandardDirs::findExe(*it);
            ++it;
        }
    }

    // load default volume
    d->volume = kc->readNumEntry("Volume", 100);
}
Esempio n. 25
0
void KURLBar::readConfig(KConfig *appConfig, const QString &itemGroup)
{
    m_isImmutable = appConfig->groupIsImmutable(itemGroup);
    KConfigGroupSaver cs(appConfig, itemGroup);
    d->defaultIconSize = m_iconSize;
    m_iconSize = appConfig->readNumEntry("Speedbar IconSize", m_iconSize);

    if(m_useGlobal)
    { // read global items
        KConfig *globalConfig = KGlobal::config();
        KConfigGroupSaver cs(globalConfig, (QString)(itemGroup + " (Global)"));
        int num = globalConfig->readNumEntry("Number of Entries");
        for(int i = 0; i < num; i++)
        {
            readItem(i, globalConfig, false);
        }
    }

    // read application local items
    int num = appConfig->readNumEntry("Number of Entries");
    for(int i = 0; i < num; i++)
    {
        readItem(i, appConfig, true);
    }
}
Esempio n. 26
0
QPixmap KSystemTray::loadIcon(const QString &icon, KInstance *instance)
{
    KConfig *appCfg = kapp->config();
    KConfigGroupSaver configSaver(appCfg, "System Tray");
    int iconWidth = appCfg->readNumEntry("systrayIconWidth", 22);
    return instance->iconLoader()->loadIcon(icon, KIcon::Panel, iconWidth);
}
Esempio n. 27
0
WaDigit::WaDigit() : WaWidget(_WA_MAPPING_DIGITS)
{
    KConfig *config = KGlobal::config();
    config->setGroup("Winskin");

    reverse_time = config->readNumEntry("timeReversed", false);
}
void WebPresencePlugin::loadSettings()
{
	KConfig *kconfig = KGlobal::config();
	kconfig->setGroup( "Web Presence Plugin" );

	frequency = kconfig->readNumEntry("UploadFrequency", 15);
	resultURL = kconfig->readPathEntry("uploadURL");

	resultFormatting = WEB_UNDEFINED;

	if ( kconfig->readBoolEntry( "formatHTML", false ) ) {
		resultFormatting = WEB_HTML;
	} else if ( kconfig->readBoolEntry( "formatXHTML", false ) ) {
		resultFormatting = WEB_XHTML;
	} else if ( kconfig->readBoolEntry( "formatXML", false ) ) {
		resultFormatting = WEB_XML;
	} else if ( kconfig->readBoolEntry( "formatStylesheet", false ) ) {
		resultFormatting = WEB_CUSTOM;
		userStyleSheet = kconfig->readEntry("formatStylesheetURL");
	}

	// Default to HTML if we dont get anything useful from config file.
	if ( resultFormatting == WEB_UNDEFINED )
		resultFormatting = WEB_HTML;

	useImagesInHTML = kconfig->readBoolEntry( "useImagesHTML", false );
	useImName = kconfig->readBoolEntry("showName", true);
	userName = kconfig->readEntry("showThisName");
	showAddresses = kconfig->readBoolEntry("includeIMAddress", false);

	// Update file when settings are changed.
	slotWriteFile();
}
Esempio n. 29
0
TIconView::TIconView( QWidget *parent, const char* name )
    : KIconView( parent, name ), _module(0L)
{
    setResizeMode( Adjust );
    setItemsMovable( false );

    setItemTextPos( Right );

    setGridX( 200 );
    setGridY( 70 );

    QFont f = font();
    f.setWeight( QFont::Bold );
    setFont( f );

    setShowToolTips( false );

    KConfig *config = KGlobal::config();
    config->setGroup("Extra");
    showExtras = config->readNumEntry( "Selected" );

    toolTip = 0;

    connect( this, SIGNAL( executed( QIconViewItem* ) ), SLOT( slotItemSelected( QIconViewItem* ) ) );

    /* comment those signals due to bug#7761
    connect( this, SIGNAL( executed( QIconViewItem* ) ), SLOT( removeToolTip()) );
    connect( this, SIGNAL( onItem( QIconViewItem* ) ), SLOT( showToolTip( QIconViewItem* ) ) );
    connect( this, SIGNAL( onViewport() ),  SLOT( removeToolTip() ) );
    */

}
Esempio n. 30
0
//---------------------------------------------------------------------------
//
// User clicked Cancel
//
void AmorDialog::slotCancel()
{
    // restore offset
    KConfig *config = kapp->config();
    KConfigGroupSaver cs(config, "General");
    emit offsetChanged(config->readNumEntry("Offset"));
    reject();
}