void DMainWindow::loadSettings()
{
    KConfig *config = kapp->config();
    config->setGroup("UI");
    m_openTabAfterCurrent = config->readBoolEntry("OpenNewTabAfterCurrent", true);
    m_showIconsOnTabs = config->readBoolEntry("ShowTabIcons", false);
}
Esempio n. 2
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. 3
0
void KHTMLSearchConfig::load()
{
  KConfig *config = new KConfig("khelpcenterrc", true);

  config->setGroup("htdig");
  htdigBin->lineEdit()->setText(config->readPathEntry("htdig", kapp->dirs()->findExe("htdig")));
  htsearchBin->lineEdit()->setText(config->readPathEntry("htsearch", kapp->dirs()->findExe("htsearch")));
  htmergeBin->lineEdit()->setText(config->readPathEntry("htmerge", kapp->dirs()->findExe("htmerge")));

  config->setGroup("Scope");
  indexKDE->setChecked(config->readBoolEntry("KDE", true));
  indexMan->setChecked(config->readBoolEntry("Man", false));
  indexInfo->setChecked(config->readBoolEntry("Info", false));

  QStringList l = config->readPathListEntry("Paths");
  searchPaths->clear();
  QStringList::Iterator it;
  for (it=l.begin(); it != l.end(); ++it)
    searchPaths->insertItem(*it);

  config->setGroup("Locale");
  QString lang = config->readEntry("Search Language", KGlobal::locale()->language());
  language->setCurrentItem(lang);

  emit changed(false);
}
Esempio n. 4
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. 5
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. 6
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. 7
0
KPartSaver::KPartSaver( WId id )
    : KScreenSaver( id ), m_timer(), m_part(0), m_current(-1), m_back(0)
{
    // install signal handlers to make sure that nspluginviewer is shutdown correctly
    // move this into the nspluginviewer kpart code
    if( !g_inited ) {
        g_inited = true;
        g_savers.setAutoDelete( true );

        srand( time(0) );

        // install signal handler
        signal( SIGINT, exitHandler );    // Ctrl-C will cause a clean exit...
        signal( SIGTERM, exitHandler );   // "kill"...
        signal( SIGHUP, exitHandler );    // "kill -HUP" (hangup)...
        signal( SIGKILL, exitHandler );    // "kill -KILL"
        //atexit( ( void (*)(void) ) exitHandler );
    }

    g_savers.append( this );

    closeURL();

    // load config
    KConfig *cfg = kapp->config();
    cfg->setGroup( "Misc" );

    m_single = cfg->readBoolEntry( "Single", true );
    m_delay = cfg->readNumEntry( "Delay", 60 );
    m_random = cfg->readBoolEntry( "Random", false );
    m_files = cfg->readListEntry( "Files" );

    if( m_files.count()==0 ) {

        // create background widget
        m_back = new TQLabel( i18n("The screen saver is not configured yet."), this );

        m_back->tqsetAlignment( AlignCenter );
        embed( m_back );
        m_back->show();

    } else {

        // queue files
        for( unsigned int n=0; n<m_files.count(); n++ )
            queue( KURL::fromPathOrURL( m_files[n] ) );

        // play files
        if( m_single )
            next( m_random );
        else {
            next( m_random );
            m_timer = new TQTimer( this );
            m_timer->start( m_delay*1000, true );
            connect( m_timer, TQT_SIGNAL(timeout()), TQT_SLOT(timeout()) );
        }
    }
}
Esempio n. 8
0
void Kopete::Away::load()
{
    KConfig *config = KGlobal::config();
    config->setGroup("AutoAway");
    d->awayTimeout=config->readNumEntry("Timeout", 600);
    d->goAvailable=config->readBoolEntry("GoAvailable", true);
    d->useAutoAway=config->readBoolEntry("UseAutoAway", true);
    d->useAutoAwayMessage=config->readBoolEntry("UseAutoAwayMessage", false);
}
Esempio n. 9
0
void K3bCddbOptionTab::readSettings()
{
  KConfig* c = kapp->config();

  c->setGroup( "Cddb" );

  // old config <= 0.7.3
  QStringList cddbpServer = c->readListEntry( "cddbp server" );
  QStringList httpServer = c->readListEntry( "http server" );

  // new config
  QStringList cddbServer = c->readListEntry( "cddb server" );

  QStringList localCddbDirs = c->readPathListEntry( "local cddb dirs" );

  m_checkRemoteCddb->setChecked( c->readBoolEntry( "use remote cddb", true ) );
  m_checkUseLocalCddb->setChecked( c->readBoolEntry( "use local cddb query", true ) );
  m_checkSaveLocalEntries->setChecked( c->readBoolEntry( "save cddb entries locally", true ) );
  m_checkManualCgiPath->setChecked( c->readBoolEntry( "use manual cgi path", false ) );
  m_editManualCgiPath->setText( c->readEntry( "cgi path", "/~cddb/cddb.cgi" ) );

  if( localCddbDirs.isEmpty() )
    localCddbDirs.append( "~/.cddb/" );

  for( QStringList::const_iterator it = localCddbDirs.begin(); it != localCddbDirs.end(); ++it )
    (void)new KListViewItem( m_viewLocalDir, m_viewLocalDir->lastItem(), *it );


  // old config <= 0.7.3
  if( !httpServer.isEmpty() ) {
    for( QStringList::iterator it = httpServer.begin(); it != httpServer.end(); ++it ) {
      cddbServer.append( "Http " + *it );
    }
  }
  if( !cddbpServer.isEmpty() ) {
    for( QStringList::iterator it = cddbpServer.begin(); it != cddbpServer.end(); ++it ) {
      cddbServer.append( "Cddbp " + *it );
    }
  }

  if( cddbServer.isEmpty() )
    cddbServer.append( "Http freedb2.org:80" );

  for( QStringList::const_iterator it = cddbServer.begin(); it != cddbServer.end(); ++it ) {
    const QString& s = *it;
    QStringList buf = QStringList::split( ":", s.mid( s.find(" ")+1 ) );
    QString server = buf[0];
    int port = buf[1].toInt();
    if( s.startsWith("Http") )
      (void)new KListViewItem( m_viewCddbServer, m_viewCddbServer->lastItem(), "Http", server, QString::number(port) );
    else
      (void)new KListViewItem( m_viewCddbServer, m_viewCddbServer->lastItem(), "Cddbp", server, QString::number(port) );
  }

  enDisableButtons();
}
Esempio n. 10
0
/** Read settings */
void KEducaPrefs::configRead()
{
    KConfig *config = KGlobal::config();
    config->setGroup("Options");
    QSize defaultSize(500,400);
    resize( config->readSizeEntry("Geometry", &defaultSize ) );
    config->readBoolEntry("ResultFinish", true ) ? _resultAfterFinish->setChecked(true) : _resultAfterNext->setChecked(true);
    config->readBoolEntry("RandomQuestions", false ) ? _randomQuestions->setChecked(true) : _randomQuestions->setChecked(false);
    config->readBoolEntry("RandomAnswers", false ) ? _randomAnswers->setChecked(true) : _randomAnswers->setChecked(false);
}
Esempio n. 11
0
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);
}
Esempio n. 12
0
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() );
}
Esempio n. 13
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. 14
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. 15
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. 16
0
void kForceLocker()
{
	if( sendSignal() != 0 )
	{
		KConfig *kdisplayConfig = new KConfig( kapp->kde_configdir() + "/kdisplayrc",
		                                       kapp->localconfigdir() + "/kdisplayrc" );
		kdisplayConfig->setGroup("ScreenSaver");
		bool allowRoot = kdisplayConfig->readBoolEntry( "allowRoot", false );
		delete kdisplayConfig;
		char *root = "-allow-root";
		if( !allowRoot )
			root = 0;

		// either no saver is running or an old pidFile was not removed
		QString buffer = QString(KApplication::kde_bindir().data());
		buffer.append("/kblankscrn.kss");
	    
		if ( fork() == 0 )
		{
			execlp( buffer, buffer, "-install", "-delay", "0", "-lock", root, 0 );

			// if we make it here then try again using default path
			execlp("kblankscrn.kss","kblankscrn.kss", "-install", "-delay", "0", "-lock", root, 0);
		    
			// uh oh - failed
			fprintf( stderr, "Could not invoke kblankscrn.kss in $PATH or"
			         " %s/bin\n" , KApplication::kde_bindir().data());
			exit (1);
		}
	}
}
Esempio n. 17
0
static bool startArts()
{
	KConfig *config = new KConfig("kcmartsrc", true, false);

	config->setGroup("Arts");
	bool startServer = config->readBoolEntry("StartServer",true);
	bool startRealtime = config->readBoolEntry("StartRealtime",true);
	QString args = config->readEntry("Arguments","-F 10 -S 4096 -s 60 -m artsmessage -c drkonqi -l 3 -f");

	delete config;

	if (startServer)
		kapp->kdeinitExec(startRealtime?"artswrapper":"artsd",
		                  QStringList::split(" ",args));
	return startServer;
}
Esempio n. 18
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. 19
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. 20
0
KPager::KPager(KPagerMainWindow *parent, const char *name)
	: QFrame (parent, name, WStyle_Customize | WStyle_NoBorder | WStyle_Tool)
    , m_layout(0)
    , m_mnu(0)
    , m_smnu(0)
    , m_dmnu(0)
{
    m_windows.setAutoDelete(true); // delete windows info after removal

    setBackgroundColor( black );
    m_winmodule=new KWinModule(this);
    m_currentDesktop=m_winmodule->currentDesktop();

    m_grabWinTimer=new QTimer(this,"grabWinTimer");
    connect(m_grabWinTimer, SIGNAL(timeout()), this, SLOT(slotGrabWindows()));

    KPagerConfigDialog::initConfiguration();

    KConfig *cfg = kapp->config();
    cfg->setGroup("KPager");
    m_showStickyOption=cfg->readBoolEntry("ShowStickyOption",false);

    int numberOfDesktops=m_winmodule->numberOfDesktops();
    for (int i=0;i<numberOfDesktops;i++)
    {
        Desktop *dsk=new Desktop(i+1,m_winmodule->desktopName(i),this);
        m_desktops.append(dsk);
    }

    m_layoutType=static_cast<enum KPager::LayoutTypes>( KPagerConfigDialog::m_layoutType );

    connect( m_winmodule, SIGNAL( activeWindowChanged(WId)),
             SLOT(slotActiveWindowChanged(WId)));
    connect( m_winmodule, SIGNAL( windowAdded(WId) ),
             SLOT( slotWindowAdded(WId) ) );
    connect( m_winmodule, SIGNAL( windowRemoved(WId) ),
             SLOT( slotWindowRemoved(WId) ) );
    connect( m_winmodule, SIGNAL( windowChanged(WId,unsigned int) ),
             SLOT( slotWindowChanged(WId,unsigned int) ) );
    connect( m_winmodule, SIGNAL( stackingOrderChanged() ),
             SLOT( slotStackingOrderChanged() ) );
    connect( m_winmodule, SIGNAL( desktopNamesChanged() ),
             SLOT( slotDesktopNamesChanged() ) );
    connect( m_winmodule, SIGNAL( numberOfDesktopsChanged(int) ),
             SLOT( slotNumberOfDesktopsChanged(int) ) );
    connect( m_winmodule, SIGNAL( currentDesktopChanged(int)),
             SLOT( slotCurrentDesktopChanged(int) ) );
    connect(kapp, SIGNAL(backgroundChanged(int)),
            SLOT(slotBackgroundChanged(int)));

    QFont defFont(KGlobalSettings::generalFont().family(), 10, QFont::Bold);
    defFont = cfg->readFontEntry("Font", &defFont);
    setFont(defFont);

    m_prefs_action = KStdAction::preferences(this, SLOT(configureDialog()), parent->actionCollection());
    m_quit_action = KStdAction::quit(kapp, SLOT(quit()), parent->actionCollection());

    updateLayout();
}
Esempio n. 21
0
QString formattedClosingParenthesis(bool suppressSpace)
{
	KConfig * config = kapp->config();
	config->setGroup("AStyle");
	bool use_spaces = config->readBoolEntry("PadParentheses", false);
	if (not use_spaces or suppressSpace) return ")";
	return " )";
}
Esempio n. 22
0
KDiffTextEdit::KDiffTextEdit( QWidget* parent, const char* name ): QTextEdit( parent, name )
{
  KConfig* config = kapp->config();
  config->setGroup( "Diff" );
  _highlight = config->readBoolEntry( "Highlight", true );

  searchExtParts();
}
Esempio n. 23
0
void NetworkAccount::readConfig(/*const*/ KConfig/*Base*/ & config)
{
    KMAccount::readConfig(config);

    setLogin(config.readEntry("login"));

    if(config.readNumEntry("store-passwd", false))        // ### s/Num/Bool/
    {
        mStorePasswd = true;
        QString encpasswd = config.readEntry("pass");
        if(encpasswd.isEmpty())
        {
            encpasswd = config.readEntry("passwd");
            if(!encpasswd.isEmpty()) encpasswd = importPassword(encpasswd);
        }

        if(!encpasswd.isEmpty())
        {
            setPasswd(decryptStr(encpasswd), true);
            // migrate to KWallet if available
            if(Wallet::isEnabled())
            {
                config.deleteEntry("pass");
                config.deleteEntry("passwd");
                mPasswdDirty = true;
                mStorePasswdInConfig = false;
            }
            else
            {
                mPasswdDirty = false; // set by setPasswd() on first read
                mStorePasswdInConfig = true;
            }
        }
        else
        {
            // read password if wallet is already open, otherwise defer to on-demand loading
            if(Wallet::isOpen(Wallet::NetworkWallet()))
                readPassword();
        }

    }
    else
    {
        setPasswd("", false);
    }

    setHost(config.readEntry("host"));

    unsigned int port = config.readUnsignedNumEntry("port", defaultPort());
    if(port > USHRT_MAX) port = defaultPort();
    setPort(port);

    setAuth(config.readEntry("auth", "*"));
    setUseSSL(config.readBoolEntry("use-ssl", false));
    setUseTLS(config.readBoolEntry("use-tls", false));

    mSieveConfig.readConfig(config);
}
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. 25
0
void MotionAwayPlugin::loadSettings(){
	KConfig *kconfig = KGlobal::config();
	kconfig->setGroup("MotionAway Plugin");

	awayTimeout = kconfig->readNumEntry("AwayTimeout", 1);
	becomeAvailableWithActivity = kconfig->readBoolEntry("BecomeAvailableWithActivity", true);
	videoDevice = kconfig->readEntry("VideoDevice", "/dev/video0");
	m_awayTimer->changeInterval(awayTimeout * 60 * 1000);
}
Esempio n. 26
0
KCursorPrivate::KCursorPrivate()
{
    hideCursorDelay = 5000; // 5s default value

    KConfig *kc = KGlobal::config();
    KConfigGroupSaver ks( kc, QString::fromLatin1("KDE") );
    enabled = kc->readBoolEntry(
		  QString::fromLatin1("Autohiding cursor enabled"), true );
}
Esempio n. 27
0
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 );
}
Esempio n. 28
0
KSANEOCR::KSANEOCR( QWidget*, KConfig *cfg ):
    m_ocrProcessDia(0L),
    daemon(0L),
    visibleOCRRunning(false),
    m_resultImage(0),
    m_imgCanvas(0L),
    m_spell(0L),
    m_wantKSpell(true),
    m_kspellVisible(true),
    m_hideDiaWhileSpellcheck(true),
    m_spellInitialConfig(0L),
    m_parent(0L),
    m_ocrCurrLine(0),
    m_currHighlight(-1),
    m_applyFilter(false),
    m_unlinkORF(true)
{
    KConfig *konf = KGlobal::config ();
    m_ocrEngine = OCRAD;
    m_img = 0L;
    m_tmpFile = 0L;

    if( cfg )
        m_hideDiaWhileSpellcheck = cfg->readBoolEntry( HIDE_BASE_DIALOG, true );
    /*
     * a initial config is needed as a starting point for the config dialog
     * but also for ocr without visible dialog.
     */
    m_spellInitialConfig = new KSpellConfig( 0L, 0L ,0L, false );

    if( konf )
    {
        /* -- ocr dialog information -- */
        konf->setGroup( CFG_GROUP_OCR_DIA );
        QString eng = konf->readEntry(CFG_OCR_ENGINE, "ocrad");

        if( eng == "ocrad" )
        {
            m_ocrEngine = OCRAD;
        }
        else if( eng == "gocr" )
        {
            m_ocrEngine = GOCR;
        }
#ifdef HAVE_KADMOS
        else if( eng == QString("kadmos") ) m_ocrEngine = KADMOS;
#endif
        kdDebug(28000) << "OCR engine is " << eng << endl;

        m_unlinkORF = konf->readBoolEntry( CFG_OCR_CLEANUP, true );
    }

    /* resize m_blocks to size 1 since there is at least one block */
    m_blocks.resize(1);

}
Esempio n. 29
0
void ConfGeneral::load()
{
	KConfig	*conf = KGlobal::config();
	conf->setGroup("Personal");
	m_name->setText(conf->readEntry("Name", getenv("USER")));
	m_number->setText(conf->readEntry("Number"));
	m_company->setText(conf->readEntry("Company"));
	m_replace_int_char->setChecked( conf->readBoolEntry( "ReplaceIntChar", false ) );
	m_replace_int_char_val->setText( conf->readEntry( "ReplaceIntCharVal" ) );
}
Esempio n. 30
0
void ScanDialog::createOptionsTab( void )
{

   QVBox *page = addVBoxPage( i18n("&Options"));
   setMainWidget(page);

   QGroupBox *gb = new QGroupBox( 1, Qt::Horizontal, i18n("Startup Options"), page, "GB_STARTUP" );
   QLabel *label = new QLabel( i18n( "Note: changing these options will affect the scan plugin on next start." ),
			       gb );
   label->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed ) );

   /* Checkbox for asking for scanner on startup */
   cb_askOnStart = new QCheckBox( i18n( "&Ask for the scan device on plugin startup"), gb );
   QToolTip::add( cb_askOnStart,
		  i18n("You can uncheck this if you do not want to be asked which scanner to use on startup."));
   Q_CHECK_PTR( cb_askOnStart );

   /* Checkbox for network access */
   cb_network = new QCheckBox( i18n( "&Query the network for scan devices"), gb );
   QToolTip::add( cb_network,
		  i18n("Check this if you want to query for configured network scan stations."));
   Q_CHECK_PTR( cb_network );


   /* Read settings for startup behavior */
   KConfig *gcfg = KGlobal::config();
   gcfg->setGroup(QString::fromLatin1(GROUP_STARTUP));
   bool skipDialog  = gcfg->readBoolEntry( STARTUP_SKIP_ASK, false );
   bool onlyLocal   = gcfg->readBoolEntry( STARTUP_ONLY_LOCAL, false );

   /* Note: flag must be inverted because of question is 'the other way round' */
   cb_askOnStart->setChecked( !skipDialog );
   connect( cb_askOnStart, SIGNAL(toggled(bool)), this, SLOT(slotAskOnStartToggle(bool)));

   cb_network->setChecked( !onlyLocal );
   connect( cb_network, SIGNAL(toggled(bool)), this, SLOT(slotNetworkToggle(bool)));


   QWidget *spaceEater = new QWidget( page );
   Q_CHECK_PTR( spaceEater );
   spaceEater->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding) );

}