summaryrefslogtreecommitdiffstats
path: root/kcontrol/konqhtml/khttpoptdlg.cpp
blob: 7272e6e937ce94b020f5f283d7f9e18a692255b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// File khttpoptdlg.cpp by Jacek Konieczny <jajcus@zeus.posl.gliwice.pl>
// Port to KControl by David Faure <faure@kde.org>

#include <tqlayout.h> //CT

#include <tdelocale.h>
#include <tdeglobal.h>
#include "khttpoptdlg.h"


KHTTPOptions::KHTTPOptions(TDEConfig *config, TQString group, TQWidget *parent, const char *name)
  : TDECModule( parent, name ), m_pConfig(config), m_groupname(group)
{
  TQVBoxLayout *lay = new TQVBoxLayout(this, 10, 5);

  lay->addWidget( new TQLabel(i18n("Accept languages:"), this) );

  le_languages = new TQLineEdit(this);
  lay->addWidget( le_languages );
  connect(le_languages, TQT_SIGNAL(textChanged(const TQString&)),
	  this, TQT_SLOT(slotChanged()));

  lay->addSpacing(10);
  lay->addWidget( new TQLabel(i18n("Accept character sets:"), this) );

  le_charsets = new TQLineEdit(this);
  lay->addWidget( le_charsets );
  connect(le_charsets, TQT_SIGNAL(textChanged(const TQString&)),
	  this, TQT_SLOT(slotChanged()));

  lay->addStretch(10);

  // defaultCharsets = TQString("utf-8 ")+klocale->charset()+" iso-8859-1";
  defaultCharsets = TQString("utf-8 ")+" iso-8859-1"; // TODO

  // finaly read the options
  load();
}

void KHTTPOptions::load()
{
	load( false );
}

void KHTTPOptions::load( bool useDefaults )
{
  TQString tmp;
  
  m_pConfig->setReadDefaults( useDefaults );

  m_pConfig->setGroup( "Browser Settings/HTTP" );	
  tmp = m_pConfig->readEntry( "AcceptLanguages",TDEGlobal::locale()->languageList().join(","));
  le_languages->setText( tmp );
  tmp = m_pConfig->readEntry( "AcceptCharsets",defaultCharsets);
  le_charsets->setText( tmp );

  emit changed( useDefaults );

}

void KHTTPOptions::save()
{
  m_pConfig->setGroup( "Browser Settings/HTTP" );	
  m_pConfig->writeEntry( "AcceptLanguages", le_languages->text());
  m_pConfig->writeEntry( "AcceptCharsets", le_charsets->text());
  m_pConfig->sync();
}

void KHTTPOptions::defaults()
{
	load( true );
}


void KHTTPOptions::slotChanged()
{
  emit changed(true);
}


#include "khttpoptdlg.moc"