summaryrefslogtreecommitdiffstats
path: root/kcontrol/locale/localeother.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/locale/localeother.cpp
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/locale/localeother.cpp')
-rw-r--r--kcontrol/locale/localeother.cpp142
1 files changed, 142 insertions, 0 deletions
diff --git a/kcontrol/locale/localeother.cpp b/kcontrol/locale/localeother.cpp
new file mode 100644
index 000000000..97f97ba2f
--- /dev/null
+++ b/kcontrol/locale/localeother.cpp
@@ -0,0 +1,142 @@
+/*
+ * localeother.cpp
+ *
+ * Copyright (c) 2001-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qprinter.h>
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+
+#include "localeother.h"
+#include "localeother.moc"
+
+
+KLocaleConfigOther::KLocaleConfigOther(KLocale *locale,
+ QWidget *parent, const char*name)
+ : QWidget(parent, name),
+ m_locale(locale)
+{
+ // Other
+ QGridLayout *lay = new QGridLayout(this, 3, 2,
+ KDialog::marginHint(),
+ KDialog::spacingHint());
+
+ m_labPageSize = new QLabel(this, I18N_NOOP("Paper format:"));
+ lay->addWidget(m_labPageSize, 0, 0);
+ m_combPageSize = new QComboBox(this);
+ lay->addWidget(m_combPageSize, 0, 1);
+ connect( m_combPageSize, SIGNAL( activated(int) ),
+ SLOT( slotPageSizeChanged(int) ) );
+
+ m_labMeasureSystem = new QLabel(this, I18N_NOOP("Measure system:"));
+ lay->addWidget(m_labMeasureSystem, 1, 0);
+ m_combMeasureSystem = new QComboBox(this);
+ lay->addWidget(m_combMeasureSystem, 1, 1);
+ connect( m_combMeasureSystem, SIGNAL( activated(int) ),
+ SLOT( slotMeasureSystemChanged(int) ) );
+
+ m_combPageSize->insertItem(QString::null);
+ m_combPageSize->insertItem(QString::null);
+ m_combMeasureSystem->insertItem(QString::null);
+ m_combMeasureSystem->insertItem(QString::null);
+
+ lay->setColStretch(1, 1);
+ lay->addRowSpacing(2, 0);
+
+ adjustSize();
+}
+
+KLocaleConfigOther::~KLocaleConfigOther()
+{
+}
+
+void KLocaleConfigOther::save()
+{
+ KConfig *config = KGlobal::config();
+ KConfigGroupSaver saver(config, "Locale");
+
+ KSimpleConfig ent(locate("locale",
+ QString::fromLatin1("l10n/%1/entry.desktop")
+ .arg(m_locale->country())), true);
+ ent.setGroup("KCM Locale");
+
+ // ### HPB: Add code here
+ int i;
+ i = ent.readNumEntry("PageSize", (int)QPrinter::A4);
+ config->deleteEntry("PageSize", false, true);
+ if (i != m_locale->pageSize())
+ config->writeEntry("PageSize",
+ m_locale->pageSize(), true, true);
+
+ i = ent.readNumEntry("MeasureSystem", (int)KLocale::Metric);
+ config->deleteEntry("MeasureSystem", false, true);
+ if (i != m_locale->measureSystem())
+ config->writeEntry("MeasureSystem",
+ m_locale->measureSystem(), true, true);
+
+ config->sync();
+}
+
+void KLocaleConfigOther::slotLocaleChanged()
+{
+ m_combMeasureSystem->setCurrentItem(m_locale->measureSystem());
+
+ int pageSize = m_locale->pageSize();
+
+ int i = 0; // default to A4
+ if ( pageSize == (int)QPrinter::Letter )
+ i = 1;
+ m_combPageSize->setCurrentItem(i);
+}
+
+void KLocaleConfigOther::slotTranslate()
+{
+ m_combMeasureSystem->changeItem( m_locale->translate("The Metric System",
+ "Metric"), 0 );
+ m_combMeasureSystem->changeItem( m_locale->translate("The Imperial System",
+ "Imperial"), 1 );
+
+ m_combPageSize->changeItem( m_locale->translate("A4"), 0 );
+ m_combPageSize->changeItem( m_locale->translate("US Letter"), 1 );
+}
+
+void KLocaleConfigOther::slotPageSizeChanged(int i)
+{
+ QPrinter::PageSize pageSize = QPrinter::A4;
+
+ if ( i == 1 )
+ pageSize = QPrinter::Letter;
+
+ m_locale->setPageSize((int)pageSize);
+ emit localeChanged();
+}
+
+void KLocaleConfigOther::slotMeasureSystemChanged(int i)
+{
+ m_locale->setMeasureSystem((KLocale::MeasureSystem)i);
+ emit localeChanged();
+}