예제 #1
0
void KSaveIOConfig::setMinimumKeepSize( int _size )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( TQString() );
  cfg->writeEntry( "MinimumKeepSize", _size );
  cfg->sync();
}
예제 #2
0
void KSaveIOConfig::setProxyConnectTimeout( int _timeout )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( TQString() );
  cfg->writeEntry("ProxyConnectTimeout", TQMAX(MIN_TIMEOUT_VALUE,_timeout));
  cfg->sync();
}
예제 #3
0
void KSaveIOConfig::setProxyAuthMode(KProtocolManager::ProxyAuthMode mode)
{
  TDEConfig* cfg = config ();
  cfg->setGroup( "Proxy Settings" );
  cfg->writeEntry( "AuthMode", static_cast<int>(mode) );
  cfg->sync();
}
예제 #4
0
void KSaveIOConfig::setCacheControl(TDEIO::CacheControl policy)
{
  TDEConfig* cfg = http_config ();
  TQString tmp = TDEIO::getCacheControlString(policy);
  cfg->writeEntry("cache", tmp);
  cfg->sync();
}
예제 #5
0
void KSaveIOConfig::setUseReverseProxy( bool mode )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( "Proxy Settings" );
  cfg->writeEntry("ReversedException", mode);
  cfg->sync();
}
예제 #6
0
void KSaveIOConfig::setProxyConfigScript( const TQString& _url )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( "Proxy Settings" );
  cfg->writeEntry( "Proxy Config Script", _url );
  cfg->sync();
}
예제 #7
0
ObjKsTheme::ObjKsTheme( const TQString& theme )
  :mActiveTheme (theme), mThemeDir("/"), mThemeConfig (0L), mThemePrefix( "Themes/" ), d(0)
{
  // Get Xinerama config.
  TDEConfig *config = kapp->config();
  config->setGroup( "Xinerama" );
  TQDesktopWidget *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)
  {
    TQRect rect = desktop->screenGeometry( mXineramaScreen );
    if (!rect.contains(TQCursor::pos()))
      TQCursor::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(TDECmdLineArgs::parsedArgs());
  mThemePrefix += ( mActiveTheme + "/" );
}
예제 #8
0
void KSaveIOConfig::setMarkPartial( bool _mode )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( TQString() );
  cfg->writeEntry( "MarkPartial", _mode );
  cfg->sync();
}
예제 #9
0
main(int argc, char ** argv)
{
 TDECmdLineArgs::init(argc, argv, "test", description, version);
 
 TDEApplication app;
 TDEConfig * cfg = kapp->config();

 TQDict<char> dict;

 dict.insert("Blah", "Arse");
 dict.insert("Blah", "Smack");
 dict.insert("Blah", "Monkey");

 TQDictIterator<char> it(dict);

 TQString key = "TestConfigItem";

 for (; it.current(); ++it) {

  cerr << "Before saving: " << endl;
  cerr << "key : \"" << key << "\"" << endl;
  cerr << "val : \"" << it.current() << "\"" << endl;

  debug("got back [%s]",cfg->writeEntry(key, it.current()));
//  debug("got back [%s]",s.data());

  cerr << "After saving: " << endl;
  cerr << "key : \"" << key << "\"" << endl;
  cerr << "val : \"" << it.current() << "\"" << endl;

  cerr << endl;
 }
}
예제 #10
0
void KSaveIOConfig::setPersistentConnections( bool enable )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( TQString() );
  cfg->writeEntry( "PersistentConnections", enable );
  cfg->sync();
}
예제 #11
0
void KfindTabWidget::setURL( const KURL & url )
{
  TDEConfig *conf = TDEGlobal::config();
  conf->setGroup("History");
  m_url = url;
  TQStringList sl = conf->readPathListEntry("Directories");
  dirBox->clear(); // make sure there is no old Stuff in there

  if(!sl.isEmpty()) {
    dirBox->insertStringList(sl);
    // If the _searchPath already exists in the list we do not
    // want to add it again
    int indx = sl.findIndex(m_url.prettyURL());
    if(indx == -1)
      dirBox->insertItem(m_url.prettyURL(), 0); // make it the first one
    else
      dirBox->setCurrentItem(indx);
  }
  else {
    TQDir m_dir("/lib");
    dirBox ->insertItem( m_url.prettyURL() );
    dirBox ->insertItem( "file:" + TQDir::homeDirPath() );
    dirBox ->insertItem( "file:/" );
    dirBox ->insertItem( "file:/usr" );
    if (m_dir.exists())
      dirBox ->insertItem( "file:/lib" );
    dirBox ->insertItem( "file:/home" );
    dirBox ->insertItem( "file:/etc" );
    dirBox ->insertItem( "file:/var" );
    dirBox ->insertItem( "file:/mnt" );
  }
}
예제 #12
0
void KSaveIOConfig::setNoProxyFor( const TQString& _noproxy )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( "Proxy Settings" );
  cfg->writeEntry( "NoProxyFor", _noproxy );
  cfg->sync();
}
예제 #13
0
void KSaveIOConfig::setAutoResume( bool _mode )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( TQString() );
  cfg->writeEntry( "AutoResume", _mode );
  cfg->sync();
}
예제 #14
0
//---------------------------------------------------------------------------
//
// User clicked Cancel
//
void AmorDialog::slotCancel()
{
    // restore offset
    TDEConfig *config = kapp->config();
    TDEConfigGroupSaver cs(config, "General");
    emit offsetChanged(config->readNumEntry("Offset"));
    reject();
}
예제 #15
0
void KSaveIOConfig::setProxyFor( const TQString& protocol,
                                 const TQString& _proxy )
{
  TDEConfig* cfg = config ();
  cfg->setGroup( "Proxy Settings" );
  cfg->writeEntry( protocol.lower() + "Proxy", _proxy );
  cfg->sync();
}
예제 #16
0
TQString KIMProxy::preferredApp()
{
	TDEConfig *store = new KSimpleConfig( IM_CLIENT_PREFERENCES_FILE );
	store->setGroup( IM_CLIENT_PREFERENCES_SECTION );
	TQString preferredApp = store->readEntry( IM_CLIENT_PREFERENCES_ENTRY );
	//kdDebug( 790 ) << k_funcinfo << "found preferred app: " << preferredApp << endl;
	return preferredApp;
}	
예제 #17
0
void Existing_window_condition::cfg_write( TDEConfig& cfg_P ) const
    {
    base::cfg_write( cfg_P );
    TQString save_cfg_group = cfg_P.group();
    cfg_P.setGroup( save_cfg_group + "Window" );
    window()->cfg_write( cfg_P );
    cfg_P.setGroup( save_cfg_group );
    cfg_P.writeEntry( "Type", "EXISTING_WINDOW" ); // overwrites value set in base::cfg_write()
    }
예제 #18
0
void EvaServers::fetchAddress( bool isUdp )
{
	int num = 0;
	if(m_bIsFirst){
		m_bIsFirst = false;
		TDEConfig* config = new TDEConfig( (TQDir::homeDirPath() + "/.eva/eva.cfg") );
		config->setGroup("General");
		TQString type = config->readEntry("Server Type");
		if(!type.isEmpty()){
			TQHostAddress addr(config->readEntry("Server IP"));
			if(!addr.isNull()) {
				if( (type == "UDP" && isUdp) ||
						(type == "TCP" && !isUdp)){
					emit isReady(addr);
					return;
				}
			}
		}
		delete config;
	}
				
	if(isUdp){
		num = UDPServers.count();
		fetchType = UDP;
	} else{
		num = TCPServers.count();
		fetchType = TCP;
	}
	if(num == 0 ){
		defaultAddress();
		return;
	}
	//int index = rand() % num;

	int maxItems = isUdp?UDPServers.count():TCPServers.count();
	if(m_CurrAddrIndex>maxItems) m_CurrAddrIndex = 0;
	serverItem addr;
	if(isUdp)
		addr = UDPServers[m_CurrAddrIndex++];
	else
		addr = TCPServers[m_CurrAddrIndex++];
	
	if(addr.type == Addr_IP){
		emit isReady(TQHostAddress(addr.addr.latin1())); // this way, Red hat 9 might work properly
		return;
	}
	
	// the address should be a URL now, so we try to get the IP
	TQDns * dns =  new TQDns(addr.addr, TQDns::A);
	TQObject::connect(dns, SIGNAL(resultsReady()), this, SLOT(getResultsSlot()));


	m_Timeout = new TQTimer(this, "dns timer");
	TQObject::connect(m_Timeout, SIGNAL(timeout()), SLOT(slotTimeout()));
	m_Timeout->start(30000, true);
}
예제 #19
0
Existing_window_condition::Existing_window_condition( TDEConfig& cfg_P, Condition_list_base* parent_P )
    : Condition( cfg_P, parent_P )
    {
    TQString save_cfg_group = cfg_P.group();
    cfg_P.setGroup( save_cfg_group + "Window" );
    _window = new Windowdef_list( cfg_P );
    cfg_P.setGroup( save_cfg_group );
    init();
    set_match();
    }
예제 #20
0
void KCMStyle::loadMisc( TDEConfig& config )
{
	// TDE's Part via TDEConfig
	config.setGroup("Toolbar style");
	cbHoverButtons->setChecked(config.readBoolEntry("Highlighting", true));
	cbTransparentToolbars->setChecked(config.readBoolEntry("TransparentMoving", true));

	TQString tbIcon = config.readEntry("IconText", "IconOnly");
	if (tbIcon == "TextOnly")
		comboToolbarIcons->setCurrentItem(1);
	else if (tbIcon == "IconTextRight")
		comboToolbarIcons->setCurrentItem(2);
	else if (tbIcon == "IconTextBottom")
		comboToolbarIcons->setCurrentItem(3);
	else
		comboToolbarIcons->setCurrentItem(0);

	config.setGroup("KDE");
	cbIconsOnButtons->setChecked(config.readBoolEntry("ShowIconsOnPushButtons", false));
	cbEnableTooltips->setChecked(!config.readBoolEntry("EffectNoTooltip", false));
	cbTearOffHandles->setChecked(config.readBoolEntry("InsertTearOffHandle", false));

	TQSettings settings;
	cbScrollablePopupMenus->setChecked(settings.readBoolEntry("/TDEStyle/Settings/ScrollablePopupMenus", false));
	cbAutoHideAccelerators->setChecked(settings.readBoolEntry("/TDEStyle/Settings/AutoHideAccelerators", false));
	cbMenuAltKeyNavigation->setChecked(settings.readBoolEntry("/TDEStyle/Settings/MenuAltKeyNavigation", true));
	m_popupMenuDelay->setValue(settings.readNumEntry("/TDEStyle/Settings/PopupMenuDelay", 250));

	m_bToolbarsDirty = false;
}
예제 #21
0
void Condition_list_base::cfg_write( TDEConfig& cfg_P ) const
    {
    TQString save_cfg_group = cfg_P.group();
    int i = 0;
    for( Iterator it( *this );
         it;
         ++it, ++i )
        {
        cfg_P.setGroup( save_cfg_group + TQString::number( i ));
        it.current()->cfg_write( cfg_P );
        }
    cfg_P.setGroup( save_cfg_group );
    cfg_P.writeEntry( "ConditionsCount", i );
    }
예제 #22
0
Condition_list_base::Condition_list_base( TDEConfig& cfg_P, Condition_list_base* parent_P )
    : Condition( parent_P )
    {
    TQString save_cfg_group = cfg_P.group();
    int cnt = cfg_P.readNumEntry( "ConditionsCount", 0 );
    for( int i = 0;
         i < cnt;
         ++i )
        {
        cfg_P.setGroup( save_cfg_group + TQString::number( i ));
        (void) Condition::create_cfg_read( cfg_P, this );
        }
    cfg_P.setGroup( save_cfg_group );
    }
예제 #23
0
void KasPrefsDialog::accept()
{
   TDEConfig *conf = kasbar->config();
   if ( conf ) {
       kasbar->writeConfig( conf );

       conf->setGroup("Layout");
       // TODO: This needs to be made independent of the gui and moved to kastasker
       conf->writeEntry( "MaxBoxes", maxBoxesSpin->value() );

       conf->sync();
   }

   TQDialog::accept();
}
예제 #24
0
파일: kcmmisc.cpp 프로젝트: Fat-Zer/tdebase
void KeyboardConfig::init_keyboard()
{
	TDEConfig *config = new TDEConfig("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", 500);
		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;
}
예제 #25
0
void KMMainView::saveSettings()
{
	TDEConfig	*conf = KMFactory::self()->printConfig();
	conf->setGroup("General");
	conf->writeEntry("ViewType",(int)m_printerview->viewType());
	conf->writeEntry("Orientation",(int)orientation());
	conf->writeEntry("ViewToolBar",((TDEToggleAction*)m_actions->action("view_toolbar"))->isChecked());
	conf->writeEntry("ViewMenuBar",static_cast<TDEToggleAction*>( m_actions->action("view_menubar") )->isChecked());
	conf->writeEntry("ViewPrinterInfos",((TDEToggleAction*)m_actions->action("view_printerinfos"))->isChecked());
	conf->sync();
}
예제 #26
0
void KFSConfigPage::init()
{
  TDEConfig *config = kapp->config();
  config->setGroup( "fileselector" );
  // toolbar
  TQStringList l = config->readListEntry( "toolbar actions", ',' );
  if ( l.isEmpty() ) // default toolbar
    l << "up" << "back" << "forward" << "home" <<
                "short view" << "detailed view" <<
                "bookmarks" << "sync_dir";

  // actions from diroperator + two of our own
  TQStringList allActions;
  allActions << "up" << "back" << "forward" << "home" <<
                "reload" << "mkdir" << "delete" <<
                "short view" << "detailed view" /*<< "view menu" <<
                "show hidden" << "properties"*/ <<
                "bookmarks" << "sync_dir";
  TQRegExp re("&(?=[^&])");
  TDEAction *ac;
  TQListBox *lb;
  for ( TQStringList::Iterator it=allActions.begin(); it != allActions.end(); ++it ) {
    lb = l.contains( *it ) ? acSel->selectedListBox() : acSel->availableListBox();
    if ( *it == "bookmarks" || *it == "sync_dir" )
      ac = fileSelector->actionCollection()->action( (*it).latin1() );
    else
      ac = fileSelector->dirOperator()->actionCollection()->action( (*it).latin1() );
    if ( ac )
      new ActionLBItem( lb, SmallIcon( ac->icon() ), ac->text().replace( re, "" ), *it );
  }

  // sync
  int s = fileSelector->autoSyncEvents;
  cbSyncActive->setChecked( s & KateFileSelector::DocumentChanged );
  cbSyncShow->setChecked( s & KateFileSelector::GotVisible );
  // histories
  sbPathHistLength->setValue( fileSelector->cmbPath->maxItems() );
  sbFilterHistLength->setValue( fileSelector->filter->maxCount() );
  // session
  cbSesLocation->setChecked( config->readBoolEntry( "restore location", true ) );
  cbSesFilter->setChecked( config->readBoolEntry( "restore last filter", true ) );
}
예제 #27
0
// static
TQString TDEIconTheme::current()
{
    // Static pointer because of unloading problems wrt DSO's.
    if (_theme != 0L)
        return *_theme;

    _theme = new TQString();
    TDEConfig *config = TDEGlobal::config();
    TDEConfigGroupSaver saver(config, "Icons");
    *_theme = config->readEntry("Theme",defaultThemeName());
    if ( *_theme == TQString::fromLatin1("hicolor") ) *_theme = defaultThemeName();
/*    if (_theme->isEmpty())
    {
        if (TQPixmap::defaultDepth() > 8)
            *_theme = defaultThemeName();
        else
            *_theme = TQString::fromLatin1("locolor");
    }*/
    return *_theme;
}
예제 #28
0
void ExtensionManager::saveContainerConfig()
{
//    kdDebug(1210) << "ExtensionManager::saveContainerConfig()" << endl;

    TDEConfig *config = TDEGlobal::config();

    // build the extension list
    TQStringList elist;
    ExtensionList::iterator itEnd = _containers.end();
    for (ExtensionList::iterator it = _containers.begin(); it != itEnd; ++it)
    {
        elist.append((*it)->extensionId());
    }

    // write extension list
    config->setGroup("General");
    config->writeEntry("Extensions2", elist);

    config->sync();
}
예제 #29
0
 int main( int argc, char **argv )
{
  TDEApplication app( argc, argv, "TDEFontDialogTest" );

  TDEConfig aConfig;
  aConfig.setGroup( "TDEFontDialog-test" );

  app.setFont(TQFont("Helvetica",12));

  //  TQFont font = TQFont("Times",18,TQFont::Bold);

  TQFont font = aConfig.readFontEntry( "Chosen" );
  int nRet = TDEFontDialog::getFont(font);
  int flags;
  nRet = TDEFontDialog::getFontDiff(font, flags);
  aConfig.writeEntry( "Chosen", font, true );

  aConfig.sync();
  return nRet;
}
예제 #30
0
bool TDERootSystemDevice::canReboot() {
	TDEConfig *config = TDEGlobal::config();
	config->reparseConfiguration(); // config may have changed in the KControl module

	config->setGroup("General" );
	bool mayrb = false;
#ifdef WITH_CONSOLEKIT
	if (config->readBoolEntry( "offerShutdown", true )) {
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
		if (dbusConn.isConnected()) {
			TQT_DBusProxy consoleKitManager("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", dbusConn);
			if (consoleKitManager.canSend()) {
				// can reboot?
				TQValueList<TQT_DBusData> params;
				TQT_DBusMessage reply = consoleKitManager.sendWithReply("CanRestart", params);
				if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
					mayrb = reply[0].toBool();
				}
				else {
					mayrb = false;
				}
			}
			else {
				mayrb = false;
			}
		}
		else {
			mayrb = false;
		}
	}
#else // WITH_CONSOLEKIT
	// FIXME
	// Can we power down this system?
	// This should probably be checked via DCOP and therefore interface with TDM
	if (config->readBoolEntry( "offerShutdown", true )/* && DM().canShutdown()*/) {	// FIXME
		mayrb = true;
	}
#endif // WITH_CONSOLEKIT

	return mayrb;
}