summaryrefslogtreecommitdiffstats
path: root/kvoctrain/kvoctrain/common-dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'kvoctrain/kvoctrain/common-dialogs')
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/Makefile.am18
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/ProgressDlg.cpp60
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/ProgressDlg.h56
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/ProgressDlgForm.ui142
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/blockoptions.cpp359
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/blockoptions.h67
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/blockoptionsbase.ui272
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/generaloptions.cpp40
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/generaloptions.h40
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/generaloptionsbase.ui189
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/groupoptions.cpp46
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/groupoptions.h42
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/groupoptionsbase.ui147
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/kvoctrain.kcfg264
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.cpp158
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.h104
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/languageoptions.cpp1285
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/languageoptions.h101
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/languageoptionsbase.ui352
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfg37
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfgc5
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/pasteoptions.cpp313
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/pasteoptions.h68
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/pasteoptionsbase.ui214
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/prefs.kcfgc7
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/presettings.kcfg27
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/presettings.kcfgc5
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/profilesdialog.cpp370
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/profilesdialog.h73
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/queryoptions.cpp72
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/queryoptions.h42
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/queryoptionsbase.ui573
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/thresholdoptions.cpp450
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/thresholdoptions.h71
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/thresholdoptionsbase.ui298
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/viewoptions.cpp44
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/viewoptions.h41
-rw-r--r--kvoctrain/kvoctrain/common-dialogs/viewoptionsbase.ui536
38 files changed, 6988 insertions, 0 deletions
diff --git a/kvoctrain/kvoctrain/common-dialogs/Makefile.am b/kvoctrain/kvoctrain/common-dialogs/Makefile.am
new file mode 100644
index 00000000..1bf3dd20
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../kvt-core $(all_includes)
+
+noinst_LTLIBRARIES = libcommondlg.la
+
+libcommondlg_la_SOURCES = ProgressDlg.cpp ProgressDlgForm.ui \
+ languagesettings.kcfgc prefs.kcfgc presettings.kcfgc kvoctrainprefs.cpp kvoctrainprefs.h \
+ generaloptionsbase.ui generaloptions.cpp viewoptionsbase.ui viewoptions.cpp \
+ pasteoptionsbase.ui pasteoptions.cpp blockoptionsbase.ui groupoptionsbase.ui \
+ languageoptionsbase.ui queryoptionsbase.ui thresholdoptionsbase.ui blockoptions.cpp \
+ groupoptions.cpp languageoptions.cpp queryoptions.cpp thresholdoptions.cpp \
+ profilesdialog.cpp
+
+METASOURCES = AUTO
+
+kde_kcfg_DATA = kvoctrain.kcfg languagesettings.kcfg presettings.kcfg
+
+noinst_HEADERS = generaloptions.h viewoptions.h pasteoptions.h blockoptions.h \
+ groupoptions.h languageoptions.h queryoptions.h thresholdoptions.h profilesdialog.h
diff --git a/kvoctrain/kvoctrain/common-dialogs/ProgressDlg.cpp b/kvoctrain/kvoctrain/common-dialogs/ProgressDlg.cpp
new file mode 100644
index 00000000..96d9c23e
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/ProgressDlg.cpp
@@ -0,0 +1,60 @@
+/***************************************************************************
+
+ progress dialog
+
+ -----------------------------------------------------------------------
+
+ begin : Mon Aug 16 17:41:11 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold
+ (C) 2001 The KDE-EDU team
+
+ email : kvoctrain@ewald-arnold.de
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#undef stack
+#include <kvoctraindoc.h>
+#include "ProgressDlg.h"
+
+#include <qprogressbar.h>
+#include <qlabel.h>
+
+#include <kstandarddirs.h>
+
+
+ProgressDlg::ProgressDlg(const QString &doctitle, const QString &filename, const QString &title, QWidget* parent, const char* name)
+ : ProgressDlgForm( parent, name )
+{
+ doc = 0;
+ setCaption (title);
+ l_title->setText (doctitle);
+ l_file->setText (filename);
+ progress-> setTotalSteps(100);
+}
+
+
+void ProgressDlg::setValue( kvoctrainDoc *new_doc, int val)
+{
+ progress->setProgress(val);
+ if (doc == 0 && new_doc != 0)
+ {
+ doc = new_doc;
+ l_title->setText (doc->getTitle());
+ l_file->setText (doc->URL().fileName());
+ }
+}
+
+
+#include "ProgressDlg.moc"
diff --git a/kvoctrain/kvoctrain/common-dialogs/ProgressDlg.h b/kvoctrain/kvoctrain/common-dialogs/ProgressDlg.h
new file mode 100644
index 00000000..6be7a8a6
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/ProgressDlg.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+
+ progress dialog
+
+ -----------------------------------------------------------------------
+
+ begin : Mon Aug 16 17:41:11 1999
+
+ copyright : (C) 1999-2001 Ewald Arnold
+ (C) 2001 The KDE-EDU team
+
+ email : kvoctrain@ewald-arnold.de
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef ProgressDlg_included
+#define ProgressDlg_included
+
+#include "ProgressDlgForm.h"
+
+class kvoctrainDoc;
+
+class ProgressDlg : public ProgressDlgForm
+{
+ Q_OBJECT
+
+public:
+
+ ProgressDlg
+ (
+ const QString &doctitle,
+ const QString &filename,
+ const QString &title,
+ QWidget* parent = NULL,
+ const char* name = NULL
+ );
+
+ public slots:
+ void setValue( kvoctrainDoc *doc, int );
+
+ protected:
+ kvoctrainDoc *doc;
+};
+#endif // ProgressDlg_included
diff --git a/kvoctrain/kvoctrain/common-dialogs/ProgressDlgForm.ui b/kvoctrain/kvoctrain/common-dialogs/ProgressDlgForm.ui
new file mode 100644
index 00000000..2c5d44cb
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/ProgressDlgForm.ui
@@ -0,0 +1,142 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ProgressDlgForm</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>127</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>400</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>-</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QFrame" row="0" column="0">
+ <property name="name">
+ <cstring>Frame3</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Filename:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Title:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>l_file</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>file.kvtml</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>l_title</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>title</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QProgressBar" row="2" column="0">
+ <property name="name">
+ <cstring>progress</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>340</width>
+ <height>22</height>
+ </size>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/blockoptions.cpp b/kvoctrain/kvoctrain/common-dialogs/blockoptions.cpp
new file mode 100644
index 00000000..3a52d912
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/blockoptions.cpp
@@ -0,0 +1,359 @@
+/***************************************************************************
+
+ blocking options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qcombobox.h>
+#include <qcheckbox.h>
+
+#include <klocale.h>
+#include <kmessagebox.h>
+
+#include "blockoptions.h"
+#include "prefs.h"
+
+struct ListRef
+{
+ const char *text;
+ long int num;
+};
+
+static ListRef date_itemlist [] =
+{
+ {I18N_NOOP("Do not Care"), 0},
+
+ {I18N_NOOP("30 Min"), 30*60},
+ {I18N_NOOP("1 Hour"), 1 * 60*60},
+ {I18N_NOOP("2 Hours"), 2 * 60*60},
+ {I18N_NOOP("4 Hours"), 4 * 60*60},
+ {I18N_NOOP("8 Hours"), 8 * 60*60},
+ {I18N_NOOP("12 Hours"), 12 * 60*60},
+ {I18N_NOOP("18 Hours"), 18 * 60*60},
+
+ {I18N_NOOP("1 Day"), 1 * 60*60*24},
+ {I18N_NOOP("2 Days"), 2 * 60*60*24},
+ {I18N_NOOP("3 Days"), 3 * 60*60*24},
+ {I18N_NOOP("4 Days"), 4 * 60*60*24},
+ {I18N_NOOP("5 Days"), 5 * 60*60*24},
+ {I18N_NOOP("6 Days"), 6 * 60*60*24},
+
+ {I18N_NOOP("1 Week"), 1 * 60*60*24*7},
+ {I18N_NOOP("2 Weeks"), 2 * 60*60*24*7},
+ {I18N_NOOP("3 Weeks"), 3 * 60*60*24*7},
+ {I18N_NOOP("4 Weeks"), 4 * 60*60*24*7},
+
+ {I18N_NOOP("1 Month"), 1 * 60*60*24*30},
+ {I18N_NOOP("2 Months"), 2 * 60*60*24*30},
+ {I18N_NOOP("3 Months"), 3 * 60*60*24*30},
+ {I18N_NOOP("4 Months"), 4 * 60*60*24*30},
+ {I18N_NOOP("5 Months"), 5 * 60*60*24*30},
+ {I18N_NOOP("6 Months"), 6 * 60*60*24*30},
+ {I18N_NOOP("10 Months"), 10 * 60*60*24*30},
+ {I18N_NOOP("12 Months"), 12 * 60*60*24*30},
+ {0 , 0}
+};
+
+
+BlockOptions::BlockOptions(QWidget* parent, const char* name, WFlags fl)
+: BlockOptionsBase(parent, name, fl)
+{
+ connect(expire1, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(block1, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(expire2, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(block2, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(expire3, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(block3, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(expire4, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(block4, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(expire5, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(block5, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(expire6, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(block6, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(expire7, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+ connect(block7, SIGNAL(activated(int)), this, SLOT(slotComboBoxActivated(int)));
+
+ connect(kcfg_Block, SIGNAL(toggled(bool)), this, SLOT(slotBlockToggled(bool)));
+ connect(kcfg_Expire, SIGNAL(toggled(bool)), this, SLOT(slotExpireToggled(bool)));
+
+ fillWidgets();
+ updateWidgets();
+}
+
+void BlockOptions::fillWidgets()
+{
+ fillComboBox(block1);
+ fillComboBox(block2);
+ fillComboBox(block3);
+ fillComboBox(block4);
+ fillComboBox(block5);
+ fillComboBox(block6);
+ fillComboBox(block7);
+
+ m_blockComboList.append(block1);
+ m_blockComboList.append(block2);
+ m_blockComboList.append(block3);
+ m_blockComboList.append(block4);
+ m_blockComboList.append(block5);
+ m_blockComboList.append(block6);
+ m_blockComboList.append(block7);
+
+ fillComboBox(expire1);
+ fillComboBox(expire2);
+ fillComboBox(expire3);
+ fillComboBox(expire4);
+ fillComboBox(expire5);
+ fillComboBox(expire6);
+ fillComboBox(expire7);
+
+ m_expireComboList.append(expire1);
+ m_expireComboList.append(expire2);
+ m_expireComboList.append(expire3);
+ m_expireComboList.append(expire4);
+ m_expireComboList.append(expire5);
+ m_expireComboList.append(expire6);
+ m_expireComboList.append(expire7);
+}
+
+void BlockOptions::updateWidgets()
+{
+ updateComboBox(Prefs::blockItem(KV_LEV1_GRADE), block1);
+ updateComboBox(Prefs::blockItem(KV_LEV2_GRADE), block2);
+ updateComboBox(Prefs::blockItem(KV_LEV3_GRADE), block3);
+ updateComboBox(Prefs::blockItem(KV_LEV4_GRADE), block4);
+ updateComboBox(Prefs::blockItem(KV_LEV5_GRADE), block5);
+ updateComboBox(Prefs::blockItem(KV_LEV6_GRADE), block6);
+ updateComboBox(Prefs::blockItem(KV_LEV7_GRADE), block7);
+
+ updateComboBox(Prefs::expireItem(KV_LEV1_GRADE), expire1);
+ updateComboBox(Prefs::expireItem(KV_LEV2_GRADE), expire2);
+ updateComboBox(Prefs::expireItem(KV_LEV3_GRADE), expire3);
+ updateComboBox(Prefs::expireItem(KV_LEV4_GRADE), expire4);
+ updateComboBox(Prefs::expireItem(KV_LEV5_GRADE), expire5);
+ updateComboBox(Prefs::expireItem(KV_LEV6_GRADE), expire6);
+ updateComboBox(Prefs::expireItem(KV_LEV7_GRADE), expire7);
+
+ bool block = Prefs::block();
+ kcfg_Block->setChecked(block);
+ block1->setEnabled(block);
+ block2->setEnabled(block);
+ block3->setEnabled(block);
+ block4->setEnabled(block);
+ block5->setEnabled(block);
+ block6->setEnabled(block);
+ block7->setEnabled(block);
+
+ bool expire = Prefs::expire();
+ kcfg_Expire->setChecked(expire);
+ expire1->setEnabled(expire);
+ expire2->setEnabled(expire);
+ expire3->setEnabled(expire);
+ expire4->setEnabled(expire);
+ expire5->setEnabled(expire);
+ expire6->setEnabled(expire);
+ expire7->setEnabled(expire);
+
+ emit blockExpireChanged(block, expire);
+}
+
+void BlockOptions::fillComboBox(QComboBox * cb)
+{
+ ListRef *ref = date_itemlist;
+
+ cb->clear();
+ while (ref->text != 0)
+ {
+ cb->insertItem (i18n(ref->text));
+ ref++;
+ }
+}
+
+void BlockOptions::updateComboBox(int value, QComboBox * cb)
+{
+ ListRef *ref = date_itemlist;
+ int index = 0;
+
+ while (ref->text != 0)
+ {
+ if (value == ref->num)
+ index = ref - date_itemlist;
+ ref++;
+ }
+ cb->setCurrentItem(index);
+}
+
+void BlockOptions::slotBlockToggled(bool state)
+{
+ block1->setEnabled(state);
+ block2->setEnabled(state);
+ block3->setEnabled(state);
+ block4->setEnabled(state);
+ block5->setEnabled(state);
+ block6->setEnabled(state);
+ block7->setEnabled(state);
+ emit blockExpireChanged(state, kcfg_Expire->isChecked());
+}
+
+void BlockOptions::slotExpireToggled(bool state)
+{
+ expire1->setEnabled(state);
+ expire2->setEnabled(state);
+ expire3->setEnabled(state);
+ expire4->setEnabled(state);
+ expire5->setEnabled(state);
+ expire6->setEnabled(state);
+ expire7->setEnabled(state);
+ emit blockExpireChanged(kcfg_Block->isChecked(), state);
+}
+
+void BlockOptions::slotComboBoxActivated(int)
+{
+ emit widgetModified();
+ checkValidity();
+}
+
+
+void BlockOptions::checkValidity()
+{
+ QString message;
+ bool found = false;
+ for (int i = 1; i <= 6; i++)
+ {
+ if (kcfg_Block->isChecked())
+ {
+ /*if(Prefs::blockItem(i-1) != 0 &&
+ Prefs::blockItem(i) != 0 &&
+ Prefs::blockItem(i-1) >= Prefs::blockItem(i))*/
+ if (date_itemlist[m_blockComboList[i - 1]->currentItem()].num != 0 &&
+ date_itemlist[m_blockComboList[i]->currentItem()].num != 0 &&
+ date_itemlist[m_blockComboList[i - 1]->currentItem()].num >= date_itemlist[m_blockComboList[i]->currentItem()].num)
+ {
+ QString format;
+ if (!found)
+ message.append(i18n("Illogical blocking times.\n"));
+ found = true;
+ message.append(i18n("The time for level %1 should be lower than the time for level %2.\n").arg(i).arg(i + 1));
+ }
+ }
+ }
+
+ for (int i = 1; i <= 6; i++)
+ {
+ found = false;
+ if (kcfg_Expire->isChecked())
+ {
+ if (date_itemlist[m_expireComboList[i - 1]->currentItem()].num != 0 &&
+ date_itemlist[m_expireComboList[i]->currentItem()].num != 0 &&
+ date_itemlist[m_expireComboList[i - 1]->currentItem()].num >=
+ date_itemlist[m_expireComboList[i]->currentItem()].num)
+ {
+ QString format;
+ if (!found)
+ message.append(i18n("\nIllogical expiration times.\n"));
+ found = true;
+ message.append(i18n("The time for level %1 should be lower than the time for level %2.\n").arg(i).arg(i + 1));
+ }
+ }
+ }
+
+ if (message.length() == 0)
+ {
+ found = false;
+ for (int i = 0; i <= 6; i++)
+ {
+ if (kcfg_Block->isChecked() &&
+ kcfg_Expire->isChecked() &&
+ date_itemlist[m_expireComboList[i]->currentItem()].num != 0 &&
+ date_itemlist[m_blockComboList[i]->currentItem()].num != 0 &&
+ date_itemlist[m_blockComboList[i]->currentItem()].num >= date_itemlist[m_expireComboList[i]->currentItem()].num)
+ {
+ QString format;
+ if (!found)
+ message.append(i18n("\nIllogical blocking vs. expiration times.\n"));
+ found = true;
+ message.append(i18n("The blocking time at level %1 should be lower than the expiration time.\n").arg(i + 1));
+ }
+ }
+ }
+
+ if (message.length() != 0)
+ KMessageBox::sorry(this, message, i18n("Illogical Values"));
+}
+
+
+bool BlockOptions::isDefault()
+{
+ return date_itemlist[block7->currentItem()].num == 5184000 &&
+ date_itemlist[block6->currentItem()].num == 2592000 &&
+ date_itemlist[block5->currentItem()].num == 1209600 &&
+ date_itemlist[block4->currentItem()].num == 604800 &&
+ date_itemlist[block3->currentItem()].num == 345600 &&
+ date_itemlist[block2->currentItem()].num == 172800 &&
+ date_itemlist[block1->currentItem()].num == 86400 &&
+ date_itemlist[expire7->currentItem()].num == 10368000 &&
+ date_itemlist[expire6->currentItem()].num == 5184000 &&
+ date_itemlist[expire5->currentItem()].num == 2592000 &&
+ date_itemlist[expire4->currentItem()].num == 1209600 &&
+ date_itemlist[expire3->currentItem()].num == 604800 &&
+ date_itemlist[expire2->currentItem()].num == 345600 &&
+ date_itemlist[expire1->currentItem()].num == 172800;
+}
+
+
+void BlockOptions::updateSettings()
+{
+ Prefs::setBlockItem(KV_LEV7_GRADE, date_itemlist[block7->currentItem()].num);
+ Prefs::setBlockItem(KV_LEV6_GRADE, date_itemlist[block6->currentItem()].num);
+ Prefs::setBlockItem(KV_LEV5_GRADE, date_itemlist[block5->currentItem()].num);
+ Prefs::setBlockItem(KV_LEV4_GRADE, date_itemlist[block4->currentItem()].num);
+ Prefs::setBlockItem(KV_LEV3_GRADE, date_itemlist[block3->currentItem()].num);
+ Prefs::setBlockItem(KV_LEV2_GRADE, date_itemlist[block2->currentItem()].num);
+ Prefs::setBlockItem(KV_LEV1_GRADE, date_itemlist[block1->currentItem()].num);
+
+ Prefs::setExpireItem(KV_LEV7_GRADE, date_itemlist[expire7->currentItem()].num);
+ Prefs::setExpireItem(KV_LEV6_GRADE, date_itemlist[expire6->currentItem()].num);
+ Prefs::setExpireItem(KV_LEV5_GRADE, date_itemlist[expire5->currentItem()].num);
+ Prefs::setExpireItem(KV_LEV4_GRADE, date_itemlist[expire4->currentItem()].num);
+ Prefs::setExpireItem(KV_LEV3_GRADE, date_itemlist[expire3->currentItem()].num);
+ Prefs::setExpireItem(KV_LEV2_GRADE, date_itemlist[expire2->currentItem()].num);
+ Prefs::setExpireItem(KV_LEV1_GRADE, date_itemlist[expire1->currentItem()].num);
+}
+
+bool BlockOptions::hasChanged()
+{
+ return date_itemlist[block7->currentItem()].num != Prefs::blockItem(KV_LEV7_GRADE) ||
+ date_itemlist[block6->currentItem()].num != Prefs::blockItem(KV_LEV6_GRADE) ||
+ date_itemlist[block5->currentItem()].num != Prefs::blockItem(KV_LEV5_GRADE) ||
+ date_itemlist[block4->currentItem()].num != Prefs::blockItem(KV_LEV4_GRADE) ||
+ date_itemlist[block3->currentItem()].num != Prefs::blockItem(KV_LEV3_GRADE) ||
+ date_itemlist[block2->currentItem()].num != Prefs::blockItem(KV_LEV2_GRADE) ||
+ date_itemlist[block1->currentItem()].num != Prefs::blockItem(KV_LEV1_GRADE) ||
+ date_itemlist[expire7->currentItem()].num != Prefs::expireItem(KV_LEV7_GRADE) ||
+ date_itemlist[expire6->currentItem()].num != Prefs::expireItem(KV_LEV6_GRADE) ||
+ date_itemlist[expire5->currentItem()].num != Prefs::expireItem(KV_LEV5_GRADE) ||
+ date_itemlist[expire4->currentItem()].num != Prefs::expireItem(KV_LEV4_GRADE) ||
+ date_itemlist[expire3->currentItem()].num != Prefs::expireItem(KV_LEV3_GRADE) ||
+ date_itemlist[expire2->currentItem()].num != Prefs::expireItem(KV_LEV2_GRADE) ||
+ date_itemlist[expire1->currentItem()].num != Prefs::expireItem(KV_LEV1_GRADE);
+}
+
+#include "blockoptions.moc"
diff --git a/kvoctrain/kvoctrain/common-dialogs/blockoptions.h b/kvoctrain/kvoctrain/common-dialogs/blockoptions.h
new file mode 100644
index 00000000..366d2eb2
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/blockoptions.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+
+ blocking options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef BLOCKOPTIONS_H
+#define BLOCKOPTIONS_H
+
+#include <qvaluelist.h>
+
+#include "blockoptionsbase.h"
+#include "QueryManager.h"
+
+class QComboBox;
+
+class BlockOptions : public BlockOptionsBase
+{
+ Q_OBJECT
+
+public:
+ BlockOptions(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ void updateWidgets();
+ bool hasChanged();
+ bool isDefault();
+ void updateSettings();
+
+signals:
+ void widgetModified();
+ void blockExpireChanged(bool block, bool expire);
+
+protected slots:
+ void slotBlockToggled(bool);
+ void slotExpireToggled(bool);
+ void slotComboBoxActivated(int);
+
+private:
+ void fillWidgets();
+ void fillComboBox(QComboBox *);
+ void updateComboBox(int, QComboBox *);
+ void checkValidity();
+
+ QValueList<QComboBox *> m_blockComboList;
+ QValueList<QComboBox *> m_expireComboList;
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/blockoptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/blockoptionsbase.ui
new file mode 100644
index 00000000..2bd5c449
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/blockoptionsbase.ui
@@ -0,0 +1,272 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>BlockOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>BlockOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>402</width>
+ <height>255</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QComboBox" row="6" column="2">
+ <property name="name">
+ <cstring>expire2</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="2">
+ <property name="name">
+ <cstring>expire7</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>l_lev2</cstring>
+ </property>
+ <property name="text">
+ <string>Level &amp;2:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>block2</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="7" column="2">
+ <property name="name">
+ <cstring>expire1</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>l_lev5</cstring>
+ </property>
+ <property name="text">
+ <string>Level &amp;5:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>block5</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>l_lev6</cstring>
+ </property>
+ <property name="text">
+ <string>Level &amp;6:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>block6</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>kcfg_Expire</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>E&amp;xpiring</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="1">
+ <property name="name">
+ <cstring>block4</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_Block</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Bl&amp;ocking</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="7" column="1">
+ <property name="name">
+ <cstring>block1</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>block7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="2">
+ <property name="name">
+ <cstring>expire6</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>l_lev4</cstring>
+ </property>
+ <property name="text">
+ <string>Level &amp;4:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>block4</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>l_lev7</cstring>
+ </property>
+ <property name="text">
+ <string>Level &amp;7:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>block7</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="2">
+ <property name="name">
+ <cstring>expire5</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="5" column="1">
+ <property name="name">
+ <cstring>block3</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="6" column="1">
+ <property name="name">
+ <cstring>block2</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="2">
+ <property name="name">
+ <cstring>expire4</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>l_lev1</cstring>
+ </property>
+ <property name="text">
+ <string>Level &amp;1:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>block1</cstring>
+ </property>
+ </widget>
+ <spacer row="0" column="0">
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QComboBox" row="5" column="2">
+ <property name="name">
+ <cstring>expire3</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1">
+ <property name="name">
+ <cstring>block5</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <property name="name">
+ <cstring>block6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>l_lev3</cstring>
+ </property>
+ <property name="text">
+ <string>Level &amp;3:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>block3</cstring>
+ </property>
+ </widget>
+ <spacer row="8" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>380</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>kcfg_Block</tabstop>
+ <tabstop>kcfg_Expire</tabstop>
+ <tabstop>block7</tabstop>
+ <tabstop>expire7</tabstop>
+ <tabstop>block6</tabstop>
+ <tabstop>expire6</tabstop>
+ <tabstop>block5</tabstop>
+ <tabstop>expire5</tabstop>
+ <tabstop>block4</tabstop>
+ <tabstop>expire4</tabstop>
+ <tabstop>block3</tabstop>
+ <tabstop>expire3</tabstop>
+ <tabstop>block2</tabstop>
+ <tabstop>expire2</tabstop>
+ <tabstop>block1</tabstop>
+ <tabstop>expire1</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/generaloptions.cpp b/kvoctrain/kvoctrain/common-dialogs/generaloptions.cpp
new file mode 100644
index 00000000..ba3f0b14
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/generaloptions.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+
+ general options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Mar 29 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qcheckbox.h>
+
+#include <knuminput.h>
+
+#include "generaloptions.h"
+
+GeneralOptions::GeneralOptions(QWidget* parent, const char* name, WFlags fl)
+: GeneralOptionsBase(parent,name,fl)
+{
+ kcfg_BackupTime->setEnabled(kcfg_AutoBackup->isChecked());
+}
+
+
+#include "generaloptions.moc"
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/generaloptions.h b/kvoctrain/kvoctrain/common-dialogs/generaloptions.h
new file mode 100644
index 00000000..c4c7cc0b
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/generaloptions.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+
+ general options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Mar 29 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef GENERALOPTIONS_H
+#define GENERALOPTIONS_H
+
+#include "generaloptionsbase.h"
+
+class GeneralOptions : public GeneralOptionsBase
+{
+ Q_OBJECT
+
+public:
+ GeneralOptions(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/generaloptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/generaloptionsbase.ui
new file mode 100644
index 00000000..3e8b5425
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/generaloptionsbase.ui
@@ -0,0 +1,189 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>GeneralOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>GeneralOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>332</width>
+ <height>369</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_AutoSave</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Save vocabularies automatically on close and quit</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Allow automatic saving of your work</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Your work will be automatically saved if you check this option</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>kcfg_AutoBackup</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Create a backup every</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Allow automatic saving of your work</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Your work will be automatically saved if you check this option</string>
+ </property>
+ </widget>
+ <widget class="KIntSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_BackupTime</cstring>
+ </property>
+ <property name="maxValue">
+ <number>120</number>
+ </property>
+ <property name="minValue">
+ <number>5</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>lblBackupInterva</cstring>
+ </property>
+ <property name="text">
+ <string>minutes</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kIntSpinBox1</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_SmartAppend</cstring>
+ </property>
+ <property name="text">
+ <string>Smart a&amp;ppending</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, the entry dialog will popup repeatedly</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If this feature is activated, you will repeatedly be prompted with the entry dialog. After entering the first original you have to enter the corresponding translations. Afterwards you proceed with the next original and its translations until you stop by pressing the ESC key.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_AutoEntryApply</cstring>
+ </property>
+ <property name="text">
+ <string>Appl&amp;y changes without asking</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Your changes will be applied automatically.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If checked, you will not be asked if you really want this change; it will be applied automatically.</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_HeaderResizeMode</cstring>
+ </property>
+ <property name="title">
+ <string>Column Resizing</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>hb_auto</cstring>
+ </property>
+ <property name="text">
+ <string>A&amp;utomatic</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>KVocTrain determines the resizing of the columns</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>KVocTrain makes each column the same width except the leftmost with the lesson names, which is half the size of the others. The second column, which contains the picture that describes the state of the row, has a fixed width.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>hb_percent</cstring>
+ </property>
+ <property name="text">
+ <string>P&amp;ercentage</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The columns resize using the same factor that the window is resized to.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If this is checked, the columns resize by the same amount as the window</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>hb_fixed</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Fixed</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>There is no resizing of the columns</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When checked, the columns are not resized</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="5" column="0">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>123</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>kcfg_AutoBackup</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_BackupTime</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/groupoptions.cpp b/kvoctrain/kvoctrain/common-dialogs/groupoptions.cpp
new file mode 100644
index 00000000..fae9cfa4
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/groupoptions.cpp
@@ -0,0 +1,46 @@
+/***************************************************************************
+
+ group options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qpushbutton.h>
+#include <qcombobox.h>
+
+#include "groupoptions.h"
+
+GroupOptions::GroupOptions(QWidget* parent, const char* name, WFlags fl)
+: GroupOptionsBase(parent,name,fl)
+{
+
+}
+
+void GroupOptions::updateButtons()
+{
+ ps_del->setEnabled (ps_name->count() > 0);
+ ps_store->setEnabled (ps_name->count() > 0);
+ ps_recall->setEnabled (ps_name->count() > 0);
+ ps_name->setEnabled (ps_name->count() > 0);
+}
+
+#include "groupoptions.moc"
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/groupoptions.h b/kvoctrain/kvoctrain/common-dialogs/groupoptions.h
new file mode 100644
index 00000000..bc8993af
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/groupoptions.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+
+ group options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef GROUPOPTIONS_H
+#define GROUPOPTIONS_H
+
+#include "groupoptionsbase.h"
+
+class GroupOptions : public GroupOptionsBase
+{
+ Q_OBJECT
+
+public:
+ GroupOptions(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+ void updateButtons();
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/groupoptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/groupoptionsbase.ui
new file mode 100644
index 00000000..ee90fe3a
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/groupoptionsbase.ui
@@ -0,0 +1,147 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>GroupOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>GroupOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>336</width>
+ <height>93</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>l_name</cstring>
+ </property>
+ <property name="text">
+ <string>N&amp;ame:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>ps_name</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ps_store</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Save</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ps_recall</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Load</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ps_new</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;New</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ps_del</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>ps_name</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>150</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>ps_name</tabstop>
+ <tabstop>ps_store</tabstop>
+ <tabstop>ps_recall</tabstop>
+ <tabstop>ps_new</tabstop>
+ <tabstop>ps_del</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/kvoctrain.kcfg b/kvoctrain/kvoctrain/common-dialogs/kvoctrain.kcfg
new file mode 100644
index 00000000..32469ed7
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/kvoctrain.kcfg
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="kvoctrainrc"/>
+ <group name="General">
+ <entry name="NumPreSetting" type="Int">
+ <label>Number of stored setting profiles</label>
+ <default>0</default>
+ </entry>
+ <entry name="NumLangSet" type="Int">
+ <label>Number of defined languages</label>
+ <default>0</default>
+ </entry>
+ <entry name="AutoEntryApply" type="Bool">
+ <label></label>
+ <default>false</default>
+ </entry>
+ <entry name="SmartAppend" type="Bool">
+ <label>If true, when using the entry dialog, new rows will be appended as needed</label>
+ <default>false</default>
+ </entry>
+ <entry name="UseCurrent" type="Bool">
+ <label>If true, it uses the same language order as the current document for the clipboard</label>
+ <default>true</default>
+ </entry>
+ <entry name="Separator" type="String">
+ <label>This sets the separator used when copying/pasting text, default is Tab</label>
+ <default code="true">QChar('\t')</default>
+ </entry>
+ <entry name="PasteOrder" type="StringList">
+ <label>The order in which languages get pasted</label>
+ <default></default>
+ </entry>
+ <entry name="EntriesPerLesson" type="Int">
+ <label>The number of entries per lesson</label>
+ <default>50</default>
+ </entry>
+ <entry name="AutoSave" type="Bool">
+ <label>If true, vocabularies are automatically saved on close and exit</label>
+ <default>false</default>
+ </entry>
+ <entry name="AutoBackup" type="Bool">
+ <label>If true, a backup is save every BackupTime minutes</label>
+ <default>false</default>
+ </entry>
+ <entry name="BackupTime" type="Int">
+ <label>Time interval between two automatic backups</label>
+ <default>15</default>
+ </entry>
+ <entry name="HeaderResizeMode" type="Enum">
+ <label>How the columns should be resized.</label>
+ <choices>
+ <choice name="Automatic"/>
+ <choice name="Fixed"/>
+ <choice name="Percent"/>
+ </choices>
+ <default>Automatic</default>
+ </entry>
+ </group>
+ <group name="QueryProperties">
+ <entry name="Block" type="Bool">
+ <label>In Blocking Query Tab Dialog, if checked then the Query is blocked</label>
+ <default>true</default>
+ </entry>
+ <entry name="Expire" type="Bool">
+ <label>In Blocking Query Tab Dialog, if checked then the Query accepts an expiring time</label>
+ <default>true</default>
+ </entry>
+ <entry name="AltLearn" type="Bool">
+ <label>Use the Leitner learning method</label>
+ <default>false</default>
+ </entry>
+ <entry name="SwapDirection" type="Bool">
+ <label>Swap direction randomly</label>
+ <default>false</default>
+ </entry>
+ <entry name="ShowCounter" type="Bool">
+ <label>Get a progress bar to show remaining time if true.</label>
+ <default>false</default>
+ </entry>
+ <entry name="QueryTimeout" type="Enum">
+ <label>If true, there is no time set to answer each query</label>
+ <choices>
+ <choice name="NoTimeout"/>
+ <choice name="Show"/>
+ <choice name="Continue"/>
+ </choices>
+ <default>NoTimeout</default>
+ </entry>
+ <entry name="MaxTimePer" type="Int">
+ <label>Maximum time allowed per query</label>
+ <default>20</default>
+ </entry>
+ <entry name="Suggestions" type="Bool">
+ <label>Enable suggestion lists in Random Query.</label>
+ <default>false</default>
+ </entry>
+ <entry name="Split" type="Bool">
+ <label>Split translations in Random Query.</label>
+ <default>false</default>
+ </entry>
+ <entry name="Periods" type="Bool">
+ <label>Split translations at periods.</label>
+ <default>true</default>
+ </entry>
+ <entry name="Colons" type="Bool">
+ <label>Split translations at colons.</label>
+ <default>false</default>
+ </entry>
+ <entry name="Semicolons" type="Bool">
+ <label>Split translations at semicolons.</label>
+ <default>true</default>
+ </entry>
+ <entry name="Commas" type="Bool">
+ <label>Split translations at commas.</label>
+ <default>false</default>
+ </entry>
+ <entry name="Fields" type="Int">
+ <label>Maximum number of fields to split translations into.</label>
+ <default>5</default>
+ </entry>
+ <entry name="ShowMore" type="Bool">
+ <label>Enable Show More button in Random Query.</label>
+ <default>true</default>
+ </entry>
+ <entry name="IKnow" type="Bool">
+ <label>Enable I Know button in Random Query.</label>
+ <default>true</default>
+ </entry>
+ </group>
+ <group name="Appearance">
+ <entry name="TableFont" type="Font">
+ <label>The font used in the vocabulary table</label>
+ <default code="true">KGlobalSettings::generalFont()</default>
+ </entry>
+ <entry name="IPAFont" type="Font">
+ <label>The font used for phonetics</label>
+ <default code="true">KGlobalSettings::generalFont()</default>
+ </entry>
+ <entry name="CurrentCol" type="Int">
+ <label>Currently selected column</label>
+ <default code="true">KV_COL_ORG</default>
+ </entry>
+ <entry name="CurrentRow" type="Int">
+ <label>Currently selected row</label>
+ <default>0</default>
+ </entry>
+ <entry name="UseGradeCol" type="Bool">
+ <label>Use your own colors</label>
+ <default>true</default>
+ </entry>
+ <entry name="GradeCol$(Number)" type="Color" key="GradeCol$(Number)">
+ <parameter name="Number" type="Int" max="7"/>
+ <label>Colors used to display different grades</label>
+ <default param="0">0, 0, 0</default>
+ <default param="1">255, 0, 0</default>
+ <default param="2">255, 0, 0</default>
+ <default param="3">255, 0, 0</default>
+ <default param="4">0, 255, 0</default>
+ <default param="5">0, 255, 0</default>
+ <default param="6">0, 255, 0</default>
+ <default param="7">0, 255, 0</default>
+ </entry>
+ </group>
+
+ <group name="QueryManager">
+ <entry name="CompType$(Type)" type="Enum" key="CompType$(Type)">
+ <parameter name="Type" type="Enum">
+ <values>
+ <value>Date</value>
+ <value>Lesson</value>
+ <value>Query</value>
+ <value>Bad</value>
+ <value>WordType</value>
+ <value>Grade</value>
+ </values>
+ </parameter>
+ <label>Types of comparisons</label>
+ <choices>
+ <choice name="DontCare"/>
+ <choice name="MoreEqThan"/>
+ <choice name="MoreThan"/>
+ <choice name="Before"/>
+ <choice name="Within"/>
+ <choice name="WorseThan"/>
+ <choice name="WorseEqThan"/>
+ <choice name="EqualTo"/>
+ <choice name="NotEqual"/>
+ <choice name="LessEqThan"/>
+ <choice name="LessThan"/>
+ <choice name="BetterThan"/>
+ <choice name="BetterEqThan"/>
+ <choice name="Current"/>
+ <choice name="NotAssigned"/>
+ <choice name="NotQueried"/>
+ <choice name="Auto_Time"/>
+ <choice name="Auto_Count"/>
+ <choice name="OneOf"/>
+ <choice name="NotOneOf"/>
+ </choices>
+ <default>DontCare</default>
+ <default param="Lesson">Current</default>
+ </entry>
+ <entry name="DateItem" type="Int">
+ <label></label>
+ <default>0</default>
+ </entry>
+ <entry name="BadItem" type="Int">
+ <label></label>
+ <default>0</default>
+ </entry>
+ <entry name="QueryItem" type="Int">
+ <label></label>
+ <default>0</default>
+ </entry>
+ <entry name="GradeItem" type="Int">
+ <label></label>
+ <default>0</default>
+ </entry>
+ <entry name="TypeItem" type="String">
+ <label></label>
+ <default code="true">QString::null</default>
+ </entry>
+ <entry name="BlockItem$(Grade)" type="Int" key="BlockItem$(Grade)">
+ <parameter name="Grade" type="Int" max="7"/>
+ <label>Amount of time different grades should be blocked</label>
+ <default param="1">86400</default>
+ <default param="2">172800</default>
+ <default param="3">345600</default>
+ <default param="4">604800</default>
+ <default param="5">1209600</default>
+ <default param="6">2592000</default>
+ <default param="7">5184000</default>
+ </entry>
+ <entry name="ExpireItem$(Grade)" type="Int" key="ExpireItem$(Grade)">
+ <parameter name="Grade" type="Int" max="7"/>
+ <label>Amount of time after which different grades should expire</label>
+ <default param="1">172800</default>
+ <default param="2">345600</default>
+ <default param="3">604800</default>
+ <default param="4">1209600</default>
+ <default param="5">2592000</default>
+ <default param="6">5184000</default>
+ <default param="7">10368000</default>
+ </entry>
+ </group>
+ <group name="KNewStuff">
+ <entry name="ProvidersUrl" type="Path">
+ <label>The Providers path for KVocTrain</label>
+ <default>"http://edu.kde.org/kvoctrain/providers.xml"</default>
+ </entry>
+ <entry name="InstallationCommand" type="String">
+ <label>The command used to start a downloaded vocabulary</label>
+ <default>kvoctrain %f</default>
+ </entry>
+ <entry name="InstallPath" type="Path">
+ <label>The folder where downloaded vocabularies are saved by
+default (relative to $HOME)</label>
+ <default>Vocabularies</default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.cpp b/kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.cpp
new file mode 100644
index 00000000..2af07f63
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.cpp
@@ -0,0 +1,158 @@
+/***************************************************************************
+ kvoctrainprefs.cpp - KVocTrain configuration dialog
+
+ -------------------
+ begin : Fri Mar 25 2005
+
+ copyright : (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qwidgetstack.h>
+#include <qlayout.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlistview.h>
+#include <qlabel.h>
+
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kiconloader.h>
+#include <krestrictedline.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+#include <kdebug.h>
+#include <kconfigskeleton.h>
+#include <kcolorbutton.h>
+#include <kfontrequester.h>
+#include <kcombobox.h>
+
+#include "kvoctrainprefs.h"
+#include "kvoctraindoc.h"
+#include "generaloptions.h"
+#include "languageoptions.h"
+#include "viewoptions.h"
+#include "pasteoptions.h"
+#include "groupoptions.h"
+#include "queryoptions.h"
+#include "thresholdoptions.h"
+#include "blockoptions.h"
+#include "langset.h"
+#include "QueryManager.h"
+#include "profilesdialog.h"
+
+static const char unapplied[] = I18N_NOOP(
+ "You have made changes that are not yet applied.\n"
+ "If you save a profile, those changes will not be included.\n"
+ "Do you wish to continue?");
+
+KVocTrainPrefs::KVocTrainPrefs(LangSet & ls, kvoctrainDoc * doc, KComboBox * lessons, QueryManager * m, QWidget *parent,
+ const char *name, KConfigSkeleton *config, DialogType dialogType, int /*dialogButtons*/, ButtonCode /*defaultButton*/,
+ bool /*modal*/)
+ : KConfigDialog(parent, name, config, dialogType, Default|Ok|Apply|Cancel|Help|User1, Ok, true), m_langSet(ls)
+{
+ m_config = config;
+ m_queryManager = m;
+
+ m_generalOptions = new GeneralOptions(0, "General Settings");
+ addPage(m_generalOptions, i18n("General"), "kvoctrain", i18n("General Settings"), true);
+
+ m_languageOptions = new LanguageOptions(m_langSet, 0, "Language Settings");
+ addPage(m_languageOptions, i18n("Languages"), "set_language", i18n("Language Settings"), true);
+ connect(m_languageOptions, SIGNAL(widgetModified()), this, SLOT(updateButtons()));
+
+ m_viewOptions = new ViewOptions(0, "View Settings");
+ addPage(m_viewOptions, i18n("View"), "view_choose", i18n("View Settings"), true);
+
+ m_pasteOptions = new PasteOptions(m_langSet, doc, 0, "Copy & Paste Settings");
+ addPage(m_pasteOptions, i18n("Copy & Paste"), "editpaste", i18n("Copy & Paste Settings"), true);
+ connect(m_pasteOptions, SIGNAL(widgetModified()), this, SLOT(updateButtons()));
+
+ m_queryOptions = new QueryOptions(0, "Query Settings");
+ addPage(m_queryOptions, i18n("Query"), "run_query", i18n("Query Settings"), true);
+
+ m_thresholdOptions = new ThresholdOptions(lessons, m_queryManager, 0, "Threshold Settings");
+ addPage(m_thresholdOptions, i18n("Thresholds"), "configure", i18n("Threshold Settings"), true);
+ connect(m_thresholdOptions, SIGNAL(widgetModified()), this, SLOT(updateButtons()));
+
+ m_blockOptions = new BlockOptions(0, "Blocking Settings");
+ addPage(m_blockOptions, i18n("Blocking"), "configure", i18n("Blocking Settings"), true);
+ connect(m_blockOptions, SIGNAL(widgetModified()), this, SLOT(updateButtons()));
+ connect(m_blockOptions, SIGNAL(blockExpireChanged(bool, bool)), m_thresholdOptions, SLOT(slotBlockExpire(bool, bool)));
+
+ setButtonGuiItem(KDialogBase::User1, KGuiItem(i18n("&Profiles...")));
+ setButtonTip(KDialogBase::User1, i18n("Save or load specific Query settings which consist in a profile"));
+ setButtonWhatsThis(KDialogBase::User1, i18n("A Profile is a set of settings (settings related to queries) which you can save/load in order to use again later. This button allows you to see existing profiles, to load a new profile and to save your current settings in a new profile."));
+}
+
+void KVocTrainPrefs::selectPage(int index)
+{
+ showPage(index);
+}
+
+bool KVocTrainPrefs::hasChanged()
+{
+ return m_pasteOptions->hasChanged() |
+ m_languageOptions->hasChanged() |
+ m_thresholdOptions->hasChanged() |
+ m_blockOptions->hasChanged();
+}
+
+bool KVocTrainPrefs::isDefault()
+{
+ return m_pasteOptions->isDefault() &&
+ m_languageOptions->isDefault() &&
+ m_thresholdOptions->isDefault() &&
+ m_blockOptions->isDefault();
+}
+
+void KVocTrainPrefs::updateSettings()
+{
+ m_pasteOptions->updateSettings();
+ m_languageOptions->updateSettings();
+ m_thresholdOptions->updateSettings();
+ m_blockOptions->updateSettings();
+ emit settingsChanged();
+}
+
+void KVocTrainPrefs::updateWidgetsDefault()
+{
+ bool bUseDefaults = m_config->useDefaults(true);
+ m_pasteOptions->updateWidgets();
+ m_languageOptions->updateWidgets();
+ m_thresholdOptions->updateWidgets();
+ m_blockOptions->updateWidgets();
+ m_config->useDefaults(bUseDefaults);
+}
+
+void KVocTrainPrefs::slotUser1()
+{
+ bool showDlg = true;
+ if (hasChanged())
+ if (KMessageBox::Yes != KMessageBox::questionYesNo(this, i18n(unapplied), i18n("Unapplied Changes")))
+ showDlg = false;
+
+ if (showDlg)
+ {
+ ProfilesDialog * dlg = new ProfilesDialog(m_queryManager, this, 0, true);
+ connect(dlg, SIGNAL(profileActivated()), this, SLOT(updateWidgets()));
+ dlg->show();
+ }
+}
+
+void KVocTrainPrefs::updateWidgets()
+{
+ m_queryOptions->updateWidgets();
+ m_thresholdOptions->updateWidgets();
+ m_blockOptions->updateWidgets();
+}
+
+#include "kvoctrainprefs.moc"
diff --git a/kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.h b/kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.h
new file mode 100644
index 00000000..ca723129
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/kvoctrainprefs.h
@@ -0,0 +1,104 @@
+/***************************************************************************
+ kvoctrainprefs.h - KVocTrain configuration dialog
+
+ -------------------
+ begin : Fri Mar 25 2005
+
+ copyright : (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KVOCTRAINPREFS_H
+#define KVOCTRAINPREFS_H
+
+#include <kconfigdialog.h>
+
+/**
+ *@author Peter Hedlund
+*/
+
+class GeneralOptions;
+class LanguageOptions;
+class ViewOptions;
+class PasteOptions;
+class QueryOptions;
+class ThresholdOptions;
+class BlockOptions;
+
+class LangSet;
+class kvoctrainDoc;
+class QueryManager;
+class KComboBox;
+
+class KVocTrainPrefs : public KConfigDialog
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Creates a configuration dialog.
+ */
+ KVocTrainPrefs(LangSet & ls, kvoctrainDoc * doc, KComboBox * lessons, QueryManager * m, QWidget *parent=0,
+ const char *name=0, KConfigSkeleton *config=0, DialogType dialogType=IconList,
+ int dialogButtons=Default|Ok|Apply|Cancel|Help, ButtonCode defaultButton=Ok, bool modal=false);
+
+ /**
+ * calls showPage() to display a particular page in the dialog.
+ * @param page The page to display
+ */
+ void selectPage(int page);
+
+protected slots:
+ /**
+ * Called when the user clicks Apply or OK.
+ */
+ void updateSettings();
+ /**
+ * Updates dialog widgets. Here only used after loading a profile.
+ * Profiles only store the settings of the last three pages in the dialog.
+ */
+ void updateWidgets();
+ /**
+ * Called when the user clicks Default
+ */
+ void updateWidgetsDefault();
+ /**
+ * Called when the user clicks Profiles...
+ */
+ void slotUser1();
+
+protected:
+ /**
+ * Returns true if the current state of the dialog is different from the saved settings
+ */
+ bool hasChanged();
+ /**
+ * Returns true if the current state of the dialog represents the default settings.
+ */
+ bool isDefault();
+
+private:
+ GeneralOptions * m_generalOptions;
+ LanguageOptions * m_languageOptions;
+ ViewOptions * m_viewOptions;
+ PasteOptions * m_pasteOptions;
+ QueryOptions * m_queryOptions;
+ ThresholdOptions * m_thresholdOptions;
+ BlockOptions * m_blockOptions;
+
+ KConfigSkeleton * m_config;
+ LangSet & m_langSet;
+ kvoctrainDoc * m_doc;
+ KComboBox m_lessons;
+ QueryManager * m_queryManager;
+};
+
+#endif
diff --git a/kvoctrain/kvoctrain/common-dialogs/languageoptions.cpp b/kvoctrain/kvoctrain/common-dialogs/languageoptions.cpp
new file mode 100644
index 00000000..cbe8f08f
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/languageoptions.cpp
@@ -0,0 +1,1285 @@
+/***************************************************************************
+
+ language options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+//based on code copyright (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
+
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qfileinfo.h>
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kcombobox.h>
+#include <dcopclient.h>
+#include <kstandarddirs.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+#include "languageoptions.h"
+#include "kvoctraincore.h"
+#include "languagesettings.h"
+#include "prefs.h"
+
+// automatically extracted from http://www.loc.gov/standards/iso639-2/englangn.html
+// with .../tools/extractlang
+
+struct KV_ISO639_Code {
+ const char *iso1code;
+ const char *iso2code;
+ const char *langname;
+};
+
+// german language names at:
+// http://www.rn.inf.tu-dresden.de/scripts_lsrn/lehre/rnd/www/iso639.htm
+
+KV_ISO639_Code kv_iso639_1[] = {
+ {"aa", "aar", I18N_NOOP("Afar")},
+ {"ab", "abk", I18N_NOOP("Abkhazian")},
+ {"ae", "ave", I18N_NOOP("Avestan")},
+ {"af", "afr", I18N_NOOP("Afrikaans")},
+ {"am", "amh", I18N_NOOP("Amharic")},
+ {"ar", "ara", I18N_NOOP("Arabic")},
+ {"as", "asm", I18N_NOOP("Assamese")},
+ {"ay", "aym", I18N_NOOP("Aymara")},
+ {"az", "aze", I18N_NOOP("Azerbaijani")},
+ {"ba", "bak", I18N_NOOP("Bashkir")},
+ {"be", "bel", I18N_NOOP("Belarusian")},
+ {"bg", "bul", I18N_NOOP("Bulgarian")},
+ {"bh", "bih", I18N_NOOP("Bihari")},
+ {"bi", "bis", I18N_NOOP("Bislama")},
+ {"bn", "ben", I18N_NOOP("Bengali")},
+ {"bo", "tib", I18N_NOOP("Tibetan")},
+ {"br", "bre", I18N_NOOP("Breton")},
+ {"bs", "bos", I18N_NOOP("Bosnian")},
+ {"ca", "cat", I18N_NOOP("Catalan")},
+ {"ce", "che", I18N_NOOP("Chechen")},
+ {"ch", "cha", I18N_NOOP("Chamorro")},
+ {"co", "cos", I18N_NOOP("Corsican")},
+ {"cs", "cze", I18N_NOOP("Czech")},
+ {"cu", "chu", I18N_NOOP("Church Slavic")},
+ {"cv", "chv", I18N_NOOP("Chuvash")},
+ {"cy", "wel", I18N_NOOP("Welsh")},
+ {"da", "dan", I18N_NOOP("Danish")},
+ {"de", "ger", I18N_NOOP("German")},
+ {"dz", "dzo", I18N_NOOP("Dzongkha")},
+ {"el", "gre", I18N_NOOP("Greek")},
+ {"en", "eng", I18N_NOOP("English")},
+ {"eo", "epo", I18N_NOOP("Esperanto")},
+ {"es", "spa", I18N_NOOP("Spanish")},
+ {"et", "est", I18N_NOOP("Estonian")},
+ {"eu", "baq", I18N_NOOP("Basque")},
+ {"fa", "per", I18N_NOOP("Persian")},
+ {"fi", "fin", I18N_NOOP("Finnish")},
+ {"fj", "fij", I18N_NOOP("Fijian")},
+ {"fo", "fao", I18N_NOOP("Faroese")},
+ {"fr", "fre", I18N_NOOP("French")},
+ {"fy", "fry", I18N_NOOP("Frisian")},
+ {"ga", "gle", I18N_NOOP("Irish")},
+ {"gd", "gla", I18N_NOOP("Gaelic")},
+ {"gd", "gla", I18N_NOOP("Scottish Gaelic")},
+ {"gl", "glg", I18N_NOOP("Gallegan")},
+ {"gn", "grn", I18N_NOOP("Guarani")},
+ {"gu", "guj", I18N_NOOP("Gujarati")},
+ {"gv", "glv", I18N_NOOP("Manx")},
+ {"ha", "hau", I18N_NOOP("Hausa")},
+ {"he", "heb", I18N_NOOP("Hebrew")},
+ {"hi", "hin", I18N_NOOP("Hindi")},
+ {"ho", "hmo", I18N_NOOP("Hiri Motu")},
+ {"hr", "scr", I18N_NOOP("Croatian")},
+ {"hu", "hun", I18N_NOOP("Hungarian")},
+ {"hy", "arm", I18N_NOOP("Armenian")},
+ {"hz", "her", I18N_NOOP("Herero")},
+ {"id", "ind", I18N_NOOP("Indonesian")},
+ {"ie", "ile", I18N_NOOP("Interlingue")},
+ {"ik", "ipk", I18N_NOOP("Inupiaq")},
+ {"is", "ice", I18N_NOOP("Icelandic")},
+ {"it", "ita", I18N_NOOP("Italian")},
+ {"iu", "iku", I18N_NOOP("Inuktitut")},
+ {"ja", "jpn", I18N_NOOP("Japanese")},
+ {"jv", "jav", I18N_NOOP("Javanese")},
+ {"ka", "geo", I18N_NOOP("Georgian")},
+ {"ki", "kik", I18N_NOOP("Kikuyu")},
+ {"kj", "kua", I18N_NOOP("Kuanyama")},
+ {"kk", "kaz", I18N_NOOP("Kazakh")},
+ {"kl", "kal", I18N_NOOP("Kalaallisut")},
+ {"km", "khm", I18N_NOOP("Khmer")},
+ {"kn", "kan", I18N_NOOP("Kannada")},
+ {"ko", "kor", I18N_NOOP("Korean")},
+ {"ks", "kas", I18N_NOOP("Kashmiri")},
+ {"ku", "kur", I18N_NOOP("Kurdish")},
+ {"kv", "kom", I18N_NOOP("Komi")},
+ {"kw", "cor", I18N_NOOP("Cornish")},
+ {"ky", "kir", I18N_NOOP("Kirghiz")},
+ {"la", "lat", I18N_NOOP("Latin")},
+ {"lb", "ltz", I18N_NOOP("Letzeburgesch")},
+ {"ln", "lin", I18N_NOOP("Lingala")},
+ {"lo", "lao", I18N_NOOP("Lao")},
+ {"lt", "lit", I18N_NOOP("Lithuanian")},
+ {"lv", "lav", I18N_NOOP("Latvian")},
+ {"mg", "mlg", I18N_NOOP("Malagasy")},
+ {"mh", "mah", I18N_NOOP("Marshall")},
+ {"mi", "mao", I18N_NOOP("Maori")},
+ {"mk", "mac", I18N_NOOP("Macedonian")},
+ {"ml", "mal", I18N_NOOP("Malayalam")},
+ {"mn", "mon", I18N_NOOP("Mongolian")},
+ {"mo", "mol", I18N_NOOP("Moldavian")},
+ {"mr", "mar", I18N_NOOP("Marathi")},
+ {"ms", "may", I18N_NOOP("Malay")},
+ {"mt", "mlt", I18N_NOOP("Maltese")},
+ {"my", "bur", I18N_NOOP("Burmese")},
+ {"na", "nau", I18N_NOOP("Nauru")},
+ {"nb", "nob", I18N_NOOP("Bokmål")},
+ {"nd", "nde", I18N_NOOP("Ndebele, North")},
+ {"ne", "nep", I18N_NOOP("Nepali")},
+ {"ng", "ndo", I18N_NOOP("Ndonga")},
+ {"nl", "dut", I18N_NOOP("Dutch")},
+ {"nn", "nno", I18N_NOOP("Norwegian Nynorsk")},
+ {"no", "nor", I18N_NOOP("Norwegian")},
+ {"nr", "nbl", I18N_NOOP("Ndebele, South")},
+ {"nv", "nav", I18N_NOOP("Navajo")},
+ {"ny", "nya", I18N_NOOP("Chichewa")},
+ {"ny", "nya", I18N_NOOP("Nyanja")},
+ {"oc", "oci", I18N_NOOP("Occitan")},
+ {"oc", "oci", I18N_NOOP("Provencal")},
+ {"om", "orm", I18N_NOOP("Oromo")},
+ {"or", "ori", I18N_NOOP("Oriya")},
+ {"os", "oss", I18N_NOOP("Ossetic")},
+ {"pa", "pan", I18N_NOOP("Panjabi")},
+ {"pi", "pli", I18N_NOOP("Pali")},
+ {"pl", "pol", I18N_NOOP("Polish")},
+ {"ps", "pus", I18N_NOOP("Pushto")},
+ {"pt", "por", I18N_NOOP("Portuguese")},
+ {"qu", "que", I18N_NOOP("Quechua")},
+ {"rm", "roh", I18N_NOOP("Raeto-Romance")},
+ {"rn", "run", I18N_NOOP("Rundi")},
+ {"ro", "rum", I18N_NOOP("Romanian")},
+ {"ru", "rus", I18N_NOOP("Russian")},
+ {"rw", "kin", I18N_NOOP("Kinyarwanda")},
+ {"sa", "san", I18N_NOOP("Sanskrit")},
+ {"sc", "srd", I18N_NOOP("Sardinian")},
+ {"sd", "snd", I18N_NOOP("Sindhi")},
+ {"se", "sme", I18N_NOOP("Northern Sami")},
+ {"sg", "sag", I18N_NOOP("Sango")},
+ {"si", "sin", I18N_NOOP("Sinhalese")},
+ {"sk", "slo", I18N_NOOP("Slovak")},
+ {"sl", "slv", I18N_NOOP("Slovenian")},
+ {"sm", "smo", I18N_NOOP("Samoan")},
+ {"sn", "sna", I18N_NOOP("Shona")},
+ {"so", "som", I18N_NOOP("Somali")},
+ {"sq", "alb", I18N_NOOP("Albanian")},
+ {"sr", "scc", I18N_NOOP("Serbian")},
+ {"ss", "ssw", I18N_NOOP("Swati")},
+ {"st", "sot", I18N_NOOP("Sotho, Southern")},
+ {"su", "sun", I18N_NOOP("Sundanese")},
+ {"sv", "swe", I18N_NOOP("Swedish")},
+ {"sw", "swa", I18N_NOOP("Swahili")},
+ {"ta", "tam", I18N_NOOP("Tamil")},
+ {"te", "tel", I18N_NOOP("Telugu")},
+ {"tg", "tgk", I18N_NOOP("Tajik")},
+ {"th", "tha", I18N_NOOP("Thai")},
+ {"ti", "tir", I18N_NOOP("Tigrinya")},
+ {"tk", "tuk", I18N_NOOP("Turkmen")},
+ {"tl", "tgl", I18N_NOOP("Tagalog")},
+ {"tn", "tsn", I18N_NOOP("Tswana")},
+ {"to", "ton", I18N_NOOP("Tonga")},
+ {"tr", "tur", I18N_NOOP("Turkish")},
+ {"ts", "tso", I18N_NOOP("Tsonga")},
+ {"tt", "tat", I18N_NOOP("Tatar")},
+ {"tw", "twi", I18N_NOOP("Twi")},
+ {"ty", "tah", I18N_NOOP("Tahitian")},
+ {"ug", "uig", I18N_NOOP("Uighur")},
+ {"uk", "ukr", I18N_NOOP("Ukrainian")},
+ {"ur", "urd", I18N_NOOP("Urdu")},
+ {"uz", "uzb", I18N_NOOP("Uzbek")},
+ {"vi", "vie", I18N_NOOP("Vietnamese")},
+ {"vo", "vol", I18N_NOOP("Volapük")},
+ {"wo", "wol", I18N_NOOP("Wolof")},
+ {"xh", "xho", I18N_NOOP("Xhosa")},
+ {"yi", "yid", I18N_NOOP("Yiddish")},
+ {"yo", "yor", I18N_NOOP("Yoruba")},
+ {"za", "zha", I18N_NOOP("Zhuang")},
+ {"zh", "chi", I18N_NOOP("Chinese")},
+ {"zu", "zul", I18N_NOOP("Zulu")},
+ {0, 0, 0}
+};
+
+/* only when really needed
+
+KV_ISO639_Code kv_iso639_2[] = {
+ {"ab", "abk", I18N_NOOP("Abkhazian")},
+ {"", "ace", I18N_NOOP("Achinese")},
+ {"", "ach", I18N_NOOP("Acoli")},
+ {"", "ada", I18N_NOOP("Adangme")},
+ {"aa", "aar", I18N_NOOP("Afar")},
+ {"", "afh", I18N_NOOP("Afrihili")},
+ {"af", "afr", I18N_NOOP("Afrikaans")},
+ {"", "afa", I18N_NOOP("Afro-Asiatic (Other)")},
+ {"", "aka", I18N_NOOP("Akan")},
+ {"", "akk", I18N_NOOP("Akkadian")},
+ {"sq", "alb", I18N_NOOP("Albanian")},
+ {"", "ale", I18N_NOOP("Aleut")},
+ {"", "alg", I18N_NOOP("Algonquian languages")},
+ {"", "tut", I18N_NOOP("Altaic (Other)")},
+ {"am", "amh", I18N_NOOP("Amharic")},
+ {"", "apa", I18N_NOOP("Apache languages")},
+ {"ar", "ara", I18N_NOOP("Arabic")},
+ {"", "arc", I18N_NOOP("Aramaic")},
+ {"", "arp", I18N_NOOP("Arapaho")},
+ {"", "arn", I18N_NOOP("Araucanian")},
+ {"", "arw", I18N_NOOP("Arawak")},
+ {"hy", "arm", I18N_NOOP("Armenian")},
+ {"", "art", I18N_NOOP("Artificial (Other)")},
+ {"as", "asm", I18N_NOOP("Assamese")},
+ {"", "ath", I18N_NOOP("Athapascan languages")},
+ {"", "aus", I18N_NOOP("Australian languages")},
+ {"", "map", I18N_NOOP("Austronesian (Other)")},
+ {"", "ava", I18N_NOOP("Avaric")},
+ {"ae", "ave", I18N_NOOP("Avestan")},
+ {"", "awa", I18N_NOOP("Awadhi")},
+ {"ay", "aym", I18N_NOOP("Aymara")},
+ {"az", "aze", I18N_NOOP("Azerbaijani")},
+ {"", "ban", I18N_NOOP("Balinese")},
+ {"", "bat", I18N_NOOP("Baltic (Other)")},
+ {"", "bal", I18N_NOOP("Baluchi")},
+ {"", "bam", I18N_NOOP("Bambara")},
+ {"", "bai", I18N_NOOP("Bamileke languages")},
+ {"", "bad", I18N_NOOP("Banda")},
+ {"", "bnt", I18N_NOOP("Bantu (Other)")},
+ {"", "bas", I18N_NOOP("Basa")},
+ {"ba", "bak", I18N_NOOP("Bashkir")},
+ {"eu", "baq", I18N_NOOP("Basque")},
+ {"", "btk", I18N_NOOP("Batak (Indonesia)")},
+ {"", "bej", I18N_NOOP("Beja")},
+ {"be", "bel", I18N_NOOP("Belarusian")},
+ {"", "bem", I18N_NOOP("Bemba")},
+ {"bn", "ben", I18N_NOOP("Bengali")},
+ {"", "ber", I18N_NOOP("Berber (Other)")},
+ {"", "bho", I18N_NOOP("Bhojpuri")},
+ {"bh", "bih", I18N_NOOP("Bihari")},
+ {"", "bik", I18N_NOOP("Bikol")},
+ {"", "bin", I18N_NOOP("Bini")},
+ {"bi", "bis", I18N_NOOP("Bislama")},
+ {"nb", "nob", I18N_NOOP("Bokm&aring;l, Norwegian; Norwegian Bokm&aring;l")},
+ {"bs", "bos", I18N_NOOP("Bosnian")},
+ {"", "bra", I18N_NOOP("Braj")},
+ {"br", "bre", I18N_NOOP("Breton")},
+ {"", "bug", I18N_NOOP("Buginese")},
+ {"bg", "bul", I18N_NOOP("Bulgarian")},
+ {"", "bua", I18N_NOOP("Buriat")},
+ {"my", "bur", I18N_NOOP("Burmese")},
+ {"", "cad", I18N_NOOP("Caddo")},
+ {"", "car", I18N_NOOP("Carib")},
+ {"es", "spa", I18N_NOOP("Castilian; Spanish")},
+ {"ca", "cat", I18N_NOOP("Catalan")},
+ {"", "cau", I18N_NOOP("Caucasian (Other)")},
+ {"", "ceb", I18N_NOOP("Cebuano")},
+ {"", "cel", I18N_NOOP("Celtic (Other)")},
+ {"", "chg", I18N_NOOP("Chagatai")},
+ {"", "cmc", I18N_NOOP("Chamic languages")},
+ {"ch", "cha", I18N_NOOP("Chamorro")},
+ {"ce", "che", I18N_NOOP("Chechen")},
+ {"", "chr", I18N_NOOP("Cherokee")},
+ {"", "chy", I18N_NOOP("Cheyenne")},
+ {"", "chb", I18N_NOOP("Chibcha")},
+ {"ny", "nya", I18N_NOOP("Chichewa; Nyanja")},
+ {"zh", "chi", I18N_NOOP("Chinese")},
+ {"", "chn", I18N_NOOP("Chinook jargon")},
+ {"", "chp", I18N_NOOP("Chipewyan")},
+ {"", "cho", I18N_NOOP("Choctaw")},
+ {"za", "zha", I18N_NOOP("Chuang; Zhuang")},
+ {"cu", "chu", I18N_NOOP("Church Slavic")},
+ {"", "chk", I18N_NOOP("Chuukese")},
+ {"cv", "chv", I18N_NOOP("Chuvash")},
+ {"", "cop", I18N_NOOP("Coptic")},
+ {"kw", "cor", I18N_NOOP("Cornish")},
+ {"co", "cos", I18N_NOOP("Corsican")},
+ {"", "cre", I18N_NOOP("Cree")},
+ {"", "mus", I18N_NOOP("Creek")},
+ {"", "crp", I18N_NOOP("Creoles and pidgins (Other)")},
+ {"hr", "scr", I18N_NOOP("Croatian")},
+ {"", "cus", I18N_NOOP("Cushitic (Other)")},
+ {"cs", "cze", I18N_NOOP("Czech")},
+ {"", "dak", I18N_NOOP("Dakota")},
+ {"da", "dan", I18N_NOOP("Danish")},
+ {"", "day", I18N_NOOP("Dayak")},
+ {"", "del", I18N_NOOP("Delaware")},
+ {"", "din", I18N_NOOP("Dinka")},
+ {"", "div", I18N_NOOP("Divehi")},
+ {"", "doi", I18N_NOOP("Dogri")},
+ {"", "dgr", I18N_NOOP("Dogrib")},
+ {"", "dra", I18N_NOOP("Dravidian (Other)")},
+ {"", "dua", I18N_NOOP("Duala")},
+ {"nl", "dut", I18N_NOOP("Dutch")},
+ {"", "dum", I18N_NOOP("Dutch, Middle (ca. 1050-1350)")},
+ {"", "dyu", I18N_NOOP("Dyula")},
+ {"dz", "dzo", I18N_NOOP("Dzongkha")},
+ {"", "efi", I18N_NOOP("Efik")},
+ {"", "egy", I18N_NOOP("Egyptian (Ancient)")},
+ {"", "eka", I18N_NOOP("Ekajuk")},
+ {"", "elx", I18N_NOOP("Elamite")},
+ {"en", "eng", I18N_NOOP("English")},
+ {"", "enm", I18N_NOOP("English, Middle (1100-1500)")},
+ {"", "ang", I18N_NOOP("English, Old (ca.450-1100)")},
+ {"eo", "epo", I18N_NOOP("Esperanto")},
+ {"et", "est", I18N_NOOP("Estonian")},
+ {"", "ewe", I18N_NOOP("Ewe")},
+ {"", "ewo", I18N_NOOP("Ewondo")},
+ {"", "fan", I18N_NOOP("Fang")},
+ {"", "fat", I18N_NOOP("Fanti")},
+ {"fo", "fao", I18N_NOOP("Faroese")},
+ {"fj", "fij", I18N_NOOP("Fijian")},
+ {"fi", "fin", I18N_NOOP("Finnish")},
+ {"", "fiu", I18N_NOOP("Finno-Ugrian (Other)")},
+ {"", "fon", I18N_NOOP("Fon")},
+ {"fr", "fre", I18N_NOOP("French")},
+ {"", "frm", I18N_NOOP("French, Middle (ca.1400-1600)")},
+ {"", "fro", I18N_NOOP("French, Old (842-ca.1400)")},
+ {"fy", "fry", I18N_NOOP("Frisian")},
+ {"", "fur", I18N_NOOP("Friulian")},
+ {"", "ful", I18N_NOOP("Fulah")},
+ {"", "gaa", I18N_NOOP("Ga")},
+ {"gd", "gla", I18N_NOOP("Gaelic; Scottish Gaelic")},
+ {"gl", "glg", I18N_NOOP("Gallegan")},
+ {"", "lug", I18N_NOOP("Ganda")},
+ {"", "gay", I18N_NOOP("Gayo")},
+ {"", "gba", I18N_NOOP("Gbaya")},
+ {"", "gez", I18N_NOOP("Geez")},
+ {"ka", "geo", I18N_NOOP("Georgian")},
+ {"de", "ger", I18N_NOOP("German")},
+ {"", "nds", I18N_NOOP("German, Low; Saxon, Low; Low German; Low Saxon")},
+ {"", "gmh", I18N_NOOP("German, Middle High (ca.1050-1500)")},
+ {"", "goh", I18N_NOOP("German, Old High (ca.750-1050)")},
+ {"", "gem", I18N_NOOP("Germanic (Other)")},
+ {"ki", "kik", I18N_NOOP("Gikuyu; Kikuyu")},
+ {"", "gil", I18N_NOOP("Gilbertese")},
+ {"", "gon", I18N_NOOP("Gondi")},
+ {"", "gor", I18N_NOOP("Gorontalo")},
+ {"", "got", I18N_NOOP("Gothic")},
+ {"", "grb", I18N_NOOP("Grebo")},
+ {"", "grc", I18N_NOOP("Greek, Ancient (to 1453)")},
+ {"el", "gre", I18N_NOOP("Greek, Modern (1453-)")},
+ {"gn", "grn", I18N_NOOP("Guarani")},
+ {"gu", "guj", I18N_NOOP("Gujarati")},
+ {"", "gwi", I18N_NOOP("Gwich&#180;in")},
+ {"", "hai", I18N_NOOP("Haida")},
+ {"ha", "hau", I18N_NOOP("Hausa")},
+ {"", "haw", I18N_NOOP("Hawaiian")},
+ {"he", "heb", I18N_NOOP("Hebrew")},
+ {"hz", "her", I18N_NOOP("Herero")},
+ {"", "hil", I18N_NOOP("Hiligaynon")},
+ {"", "him", I18N_NOOP("Himachali")},
+ {"hi", "hin", I18N_NOOP("Hindi")},
+ {"ho", "hmo", I18N_NOOP("Hiri Motu")},
+ {"", "hit", I18N_NOOP("Hittite")},
+ {"", "hmn", I18N_NOOP("Hmong")},
+ {"hu", "hun", I18N_NOOP("Hungarian")},
+ {"", "hup", I18N_NOOP("Hupa")},
+ {"", "iba", I18N_NOOP("Iban")},
+ {"is", "ice", I18N_NOOP("Icelandic")},
+ {"", "ibo", I18N_NOOP("Igbo")},
+ {"", "ijo", I18N_NOOP("Ijo")},
+ {"", "ilo", I18N_NOOP("Iloko")},
+ {"", "inc", I18N_NOOP("Indic (Other)")},
+ {"", "ine", I18N_NOOP("Indo-European (Other)")},
+ {"id", "ind", I18N_NOOP("Indonesian")},
+ {"ie", "ile", I18N_NOOP("Interlingue")},
+ {"iu", "iku", I18N_NOOP("Inuktitut")},
+ {"ik", "ipk", I18N_NOOP("Inupiaq")},
+ {"", "ira", I18N_NOOP("Iranian (Other)")},
+ {"ga", "gle", I18N_NOOP("Irish")},
+ {"", "mga", I18N_NOOP("Irish, Middle (900-1200)")},
+ {"", "sga", I18N_NOOP("Irish, Old (to 900)")},
+ {"", "iro", I18N_NOOP("Iroquoian languages")},
+ {"it", "ita", I18N_NOOP("Italian")},
+ {"ja", "jpn", I18N_NOOP("Japanese")},
+ {"jv", "jav", I18N_NOOP("Javanese")},
+ {"", "jrb", I18N_NOOP("Judeo-Arabic")},
+ {"", "jpr", I18N_NOOP("Judeo-Persian")},
+ {"", "kab", I18N_NOOP("Kabyle")},
+ {"", "kac", I18N_NOOP("Kachin")},
+ {"kl", "kal", I18N_NOOP("Kalaallisut")},
+ {"", "kam", I18N_NOOP("Kamba")},
+ {"kn", "kan", I18N_NOOP("Kannada")},
+ {"", "kau", I18N_NOOP("Kanuri")},
+ {"", "kaa", I18N_NOOP("Kara-Kalpak")},
+ {"", "kar", I18N_NOOP("Karen")},
+ {"ks", "kas", I18N_NOOP("Kashmiri")},
+ {"", "kaw", I18N_NOOP("Kawi")},
+ {"kk", "kaz", I18N_NOOP("Kazakh")},
+ {"", "kha", I18N_NOOP("Khasi")},
+ {"km", "khm", I18N_NOOP("Khmer")},
+ {"", "khi", I18N_NOOP("Khoisan (Other)")},
+ {"", "kho", I18N_NOOP("Khotanese")},
+ {"ki", "kik", I18N_NOOP("Kikuyu; Gikuyu")},
+ {"", "kmb", I18N_NOOP("Kimbundu")},
+ {"rw", "kin", I18N_NOOP("Kinyarwanda")},
+ {"ky", "kir", I18N_NOOP("Kirghiz")},
+ {"kv", "kom", I18N_NOOP("Komi")},
+ {"", "kon", I18N_NOOP("Kongo")},
+ {"", "kok", I18N_NOOP("Konkani")},
+ {"ko", "kor", I18N_NOOP("Korean")},
+ {"", "kos", I18N_NOOP("Kosraean")},
+ {"", "kpe", I18N_NOOP("Kpelle")},
+ {"", "kro", I18N_NOOP("Kru")},
+ {"kj", "kua", I18N_NOOP("Kuanyama")},
+ {"", "kum", I18N_NOOP("Kumyk")},
+ {"ku", "kur", I18N_NOOP("Kurdish")},
+ {"", "kru", I18N_NOOP("Kurukh")},
+ {"", "kut", I18N_NOOP("Kutenai")},
+ {"", "lad", I18N_NOOP("Ladino")},
+ {"", "lah", I18N_NOOP("Lahnda")},
+ {"", "lam", I18N_NOOP("Lamba")},
+ {"lo", "lao", I18N_NOOP("Lao")},
+ {"la", "lat", I18N_NOOP("Latin")},
+ {"lv", "lav", I18N_NOOP("Latvian")},
+ {"lb", "ltz", I18N_NOOP("Letzeburgesch")},
+ {"", "lez", I18N_NOOP("Lezghian")},
+ {"ln", "lin", I18N_NOOP("Lingala")},
+ {"lt", "lit", I18N_NOOP("Lithuanian")},
+ {"", "nds", I18N_NOOP("Low German; Low Saxon; German, Low; Saxon, Low")},
+ {"", "nds", I18N_NOOP("Low Saxon; Low German; Saxon, Low; German, Low")},
+ {"", "loz", I18N_NOOP("Lozi")},
+ {"", "lub", I18N_NOOP("Luba-Katanga")},
+ {"", "lua", I18N_NOOP("Luba-Lulua")},
+ {"", "lui", I18N_NOOP("Luiseno")},
+ {"", "lun", I18N_NOOP("Lunda")},
+ {"", "luo", I18N_NOOP("Luo (Kenya and Tanzania)")},
+ {"", "lus", I18N_NOOP("Lushai")},
+ {"mk", "mac", I18N_NOOP("Macedonian")},
+ {"", "mad", I18N_NOOP("Madurese")},
+ {"", "mag", I18N_NOOP("Magahi")},
+ {"", "mai", I18N_NOOP("Maithili")},
+ {"", "mak", I18N_NOOP("Makasar")},
+ {"mg", "mlg", I18N_NOOP("Malagasy")},
+ {"ms", "may", I18N_NOOP("Malay")},
+ {"ml", "mal", I18N_NOOP("Malayalam")},
+ {"mt", "mlt", I18N_NOOP("Maltese")},
+ {"", "mnc", I18N_NOOP("Manchu")},
+ {"", "mdr", I18N_NOOP("Mandar")},
+ {"", "man", I18N_NOOP("Mandingo")},
+ {"", "mni", I18N_NOOP("Manipuri")},
+ {"", "mno", I18N_NOOP("Manobo languages")},
+ {"gv", "glv", I18N_NOOP("Manx")},
+ {"mi", "mao", I18N_NOOP("Maori")},
+ {"mr", "mar", I18N_NOOP("Marathi")},
+ {"", "chm", I18N_NOOP("Mari")},
+ {"mh", "mah", I18N_NOOP("Marshall")},
+ {"", "mwr", I18N_NOOP("Marwari")},
+ {"", "mas", I18N_NOOP("Masai")},
+ {"", "myn", I18N_NOOP("Mayan languages")},
+ {"", "men", I18N_NOOP("Mende")},
+ {"", "mic", I18N_NOOP("Micmac")},
+ {"", "min", I18N_NOOP("Minangkabau")},
+ {"", "mis", I18N_NOOP("Miscellaneous languages")},
+ {"", "moh", I18N_NOOP("Mohawk")},
+ {"mo", "mol", I18N_NOOP("Moldavian")},
+ {"", "mkh", I18N_NOOP("Mon-Khmer (Other)")},
+ {"", "lol", I18N_NOOP("Mongo")},
+ {"mn", "mon", I18N_NOOP("Mongolian")},
+ {"", "mos", I18N_NOOP("Mossi")},
+ {"", "mul", I18N_NOOP("Multiple languages")},
+ {"", "mun", I18N_NOOP("Munda languages")},
+ {"", "nah", I18N_NOOP("Nahuatl")},
+ {"na", "nau", I18N_NOOP("Nauru")},
+ {"nv", "nav", I18N_NOOP("Navajo")},
+ {"nd", "nde", I18N_NOOP("Ndebele, North")},
+ {"nr", "nbl", I18N_NOOP("Ndebele, South")},
+ {"ng", "ndo", I18N_NOOP("Ndonga")},
+ {"ne", "nep", I18N_NOOP("Nepali")},
+ {"", "new", I18N_NOOP("Newari")},
+ {"", "nia", I18N_NOOP("Nias")},
+ {"", "nic", I18N_NOOP("Niger-Kordofanian (Other)")},
+ {"", "ssa", I18N_NOOP("Nilo-Saharan (Other)")},
+ {"", "niu", I18N_NOOP("Niuean")},
+ {"", "non", I18N_NOOP("Norse, Old")},
+ {"", "nai", I18N_NOOP("North American Indian (Other)")},
+ {"se", "sme", I18N_NOOP("Northern Sami")},
+ {"no", "nor", I18N_NOOP("Norwegian")},
+ {"nb", "nob", I18N_NOOP("Norwegian Bokm&aring;l; Bokm&aring;l, Norwegian")},
+ {"nn", "nno", I18N_NOOP("Norwegian Nynorsk; Nynorsk, Norwegian")},
+ {"", "nub", I18N_NOOP("Nubian languages")},
+ {"", "nym", I18N_NOOP("Nyamwezi")},
+ {"ny", "nya", I18N_NOOP("Nyanja; Chichewa")},
+ {"", "nyn", I18N_NOOP("Nyankole")},
+ {"nn", "nno", I18N_NOOP("Nynorsk, Norwegian; Norwegian Nynorsk")},
+ {"", "nyo", I18N_NOOP("Nyoro")},
+ {"", "nzi", I18N_NOOP("Nzima")},
+ {"oc", "oci", I18N_NOOP("Occitan (post 1500); Proven&ccedil;al")},
+ {"", "oji", I18N_NOOP("Ojibwa")},
+ {"or", "ori", I18N_NOOP("Oriya")},
+ {"om", "orm", I18N_NOOP("Oromo")},
+ {"", "osa", I18N_NOOP("Osage")},
+ {"os", "oss", I18N_NOOP("Ossetian; Ossetic")},
+ {"os", "oss", I18N_NOOP("Ossetic; Ossetian")},
+ {"", "oto", I18N_NOOP("Otomian languages")},
+ {"", "pal", I18N_NOOP("Pahlavi")},
+ {"", "pau", I18N_NOOP("Palauan")},
+ {"pi", "pli", I18N_NOOP("Pali")},
+ {"", "pam", I18N_NOOP("Pampanga")},
+ {"", "pag", I18N_NOOP("Pangasinan")},
+ {"pa", "pan", I18N_NOOP("Panjabi")},
+ {"", "pap", I18N_NOOP("Papiamento")},
+ {"", "paa", I18N_NOOP("Papuan (Other)")},
+ {"fa", "per", I18N_NOOP("Persian")},
+ {"", "peo", I18N_NOOP("Persian, Old (ca.600-400 B.C.)")},
+ {"", "phi", I18N_NOOP("Philippine (Other)")},
+ {"", "phn", I18N_NOOP("Phoenician")},
+ {"", "pon", I18N_NOOP("Pohnpeian")},
+ {"pl", "pol", I18N_NOOP("Polish")},
+ {"pt", "por", I18N_NOOP("Portuguese")},
+ {"", "pra", I18N_NOOP("Prakrit languages")},
+ {"oc", "oci", I18N_NOOP("Proven&#231;al; Occitan (post 1500)")},
+ {"", "pro", I18N_NOOP("Proven&#231;al, Old (to 1500)")},
+ {"ps", "pus", I18N_NOOP("Pushto")},
+ {"qu", "que", I18N_NOOP("Quechua")},
+ {"rm", "roh", I18N_NOOP("Raeto-Romance")},
+ {"", "raj", I18N_NOOP("Rajasthani")},
+ {"", "rap", I18N_NOOP("Rapanui")},
+ {"", "rar", I18N_NOOP("Rarotongan")},
+ {"", "qaa-qtz", I18N_NOOP("Reserved for local use")},
+ {"", "roa", I18N_NOOP("Romance (Other)")},
+ {"ro", "rum", I18N_NOOP("Romanian")},
+ {"", "rom", I18N_NOOP("Romany")},
+ {"rn", "run", I18N_NOOP("Rundi")},
+ {"ru", "rus", I18N_NOOP("Russian")},
+ {"", "sal", I18N_NOOP("Salishan languages")},
+ {"", "sam", I18N_NOOP("Samaritan Aramaic")},
+ {"", "smi", I18N_NOOP("Sami languages (Other)")},
+ {"sm", "smo", I18N_NOOP("Samoan")},
+ {"", "sad", I18N_NOOP("Sandawe")},
+ {"sg", "sag", I18N_NOOP("Sango")},
+ {"sa", "san", I18N_NOOP("Sanskrit")},
+ {"", "sat", I18N_NOOP("Santali")},
+ {"sc", "srd", I18N_NOOP("Sardinian")},
+ {"", "sas", I18N_NOOP("Sasak")},
+ {"", "sco", I18N_NOOP("Scots")},
+ {"gd", "gla", I18N_NOOP("Scottish Gaelic; Gaelic")},
+ {"", "sel", I18N_NOOP("Selkup")},
+ {"", "sem", I18N_NOOP("Semitic (Other)")},
+ {"sr", "scc", I18N_NOOP("Serbian")},
+ {"", "srr", I18N_NOOP("Serer")},
+ {"", "shn", I18N_NOOP("Shan")},
+ {"sn", "sna", I18N_NOOP("Shona")},
+ {"", "sid", I18N_NOOP("Sidamo")},
+ {"", "sgn", I18N_NOOP("Sign languages")},
+ {"", "bla", I18N_NOOP("Siksika")},
+ {"sd", "snd", I18N_NOOP("Sindhi")},
+ {"si", "sin", I18N_NOOP("Sinhalese")},
+ {"", "sit", I18N_NOOP("Sino-Tibetan (Other)")},
+ {"", "sio", I18N_NOOP("Siouan languages")},
+ {"", "den", I18N_NOOP("Slave (Athapascan)")},
+ {"", "sla", I18N_NOOP("Slavic (Other)")},
+ {"sk", "slo", I18N_NOOP("Slovak")},
+ {"sl", "slv", I18N_NOOP("Slovenian")},
+ {"", "sog", I18N_NOOP("Sogdian")},
+ {"so", "som", I18N_NOOP("Somali")},
+ {"", "son", I18N_NOOP("Songhai")},
+ {"", "snk", I18N_NOOP("Soninke")},
+ {"", "wen", I18N_NOOP("Sorbian languages")},
+ {"", "nso", I18N_NOOP("Sotho, Northern")},
+ {"st", "sot", I18N_NOOP("Sotho, Southern")},
+ {"", "sai", I18N_NOOP("South American Indian (Other)")},
+ {"es", "spa", I18N_NOOP("Spanish; Castilian")},
+ {"", "suk", I18N_NOOP("Sukuma")},
+ {"", "sux", I18N_NOOP("Sumerian")},
+ {"su", "sun", I18N_NOOP("Sundanese")},
+ {"", "sus", I18N_NOOP("Susu")},
+ {"sw", "swa", I18N_NOOP("Swahili")},
+ {"ss", "ssw", I18N_NOOP("Swati")},
+ {"sv", "swe", I18N_NOOP("Swedish")},
+ {"", "syr", I18N_NOOP("Syriac")},
+ {"tl", "tgl", I18N_NOOP("Tagalog")},
+ {"ty", "tah", I18N_NOOP("Tahitian")},
+ {"", "tai", I18N_NOOP("Tai (Other)")},
+ {"tg", "tgk", I18N_NOOP("Tajik")},
+ {"", "tmh", I18N_NOOP("Tamashek")},
+ {"ta", "tam", I18N_NOOP("Tamil")},
+ {"tt", "tat", I18N_NOOP("Tatar")},
+ {"te", "tel", I18N_NOOP("Telugu")},
+ {"", "ter", I18N_NOOP("Tereno")},
+ {"", "tet", I18N_NOOP("Tetum")},
+ {"th", "tha", I18N_NOOP("Thai")},
+ {"bo", "tib", I18N_NOOP("Tibetan")},
+ {"", "tig", I18N_NOOP("Tigre")},
+ {"ti", "tir", I18N_NOOP("Tigrinya")},
+ {"", "tem", I18N_NOOP("Timne")},
+ {"", "tiv", I18N_NOOP("Tiv")},
+ {"", "tli", I18N_NOOP("Tlingit")},
+ {"", "tpi", I18N_NOOP("Tok Pisin")},
+ {"", "tkl", I18N_NOOP("Tokelau")},
+ {"", "tog", I18N_NOOP("Tonga (Nyasa)")},
+ {"to", "ton", I18N_NOOP("Tonga (Tonga Islands)")},
+ {"", "tsi", I18N_NOOP("Tsimshian")},
+ {"ts", "tso", I18N_NOOP("Tsonga")},
+ {"tn", "tsn", I18N_NOOP("Tswana")},
+ {"", "tum", I18N_NOOP("Tumbuka")},
+ {"tr", "tur", I18N_NOOP("Turkish")},
+ {"", "ota", I18N_NOOP("Turkish, Ottoman (1500-1928)")},
+ {"tk", "tuk", I18N_NOOP("Turkmen")},
+ {"", "tvl", I18N_NOOP("Tuvalu")},
+ {"", "tyv", I18N_NOOP("Tuvinian")},
+ {"tw", "twi", I18N_NOOP("Twi")},
+ {"", "uga", I18N_NOOP("Ugaritic")},
+ {"ug", "uig", I18N_NOOP("Uighur")},
+ {"uk", "ukr", I18N_NOOP("Ukrainian")},
+ {"", "umb", I18N_NOOP("Umbundu")},
+ {"", "und", I18N_NOOP("Undetermined")},
+ {"ur", "urd", I18N_NOOP("Urdu")},
+ {"uz", "uzb", I18N_NOOP("Uzbek")},
+ {"", "vai", I18N_NOOP("Vai")},
+ {"", "ven", I18N_NOOP("Venda")},
+ {"vi", "vie", I18N_NOOP("Vietnamese")},
+ {"vo", "vol", I18N_NOOP("Volap&#252;k")},
+ {"", "vot", I18N_NOOP("Votic")},
+ {"", "wak", I18N_NOOP("Wakashan languages")},
+ {"", "wal", I18N_NOOP("Walamo")},
+ {"", "war", I18N_NOOP("Waray")},
+ {"", "was", I18N_NOOP("Washo")},
+ {"cy", "wel", I18N_NOOP("Welsh")},
+ {"wo", "wol", I18N_NOOP("Wolof")},
+ {"xh", "xho", I18N_NOOP("Xhosa")},
+ {"", "sah", I18N_NOOP("Yakut")},
+ {"", "yao", I18N_NOOP("Yao")},
+ {"", "yap", I18N_NOOP("Yapese")},
+ {"yi", "yid", I18N_NOOP("Yiddish")},
+ {"yo", "yor", I18N_NOOP("Yoruba")},
+ {"", "ypk", I18N_NOOP("Yupik languages")},
+ {"", "znd", I18N_NOOP("Zande")},
+ {"", "zap", I18N_NOOP("Zapotec")},
+ {"", "zen", I18N_NOOP("Zenaga")},
+ {"za", "zha", I18N_NOOP("Zhuang; Chuang")},
+ {"zu", "zul", I18N_NOOP("Zulu")},
+ {"", "zun", I18N_NOOP("Zuni")},
+ {0, 0, 0}
+};
+*/
+
+LanguageOptions::LanguageOptions(LangSet & langset, QWidget* parent, const char* name, WFlags fl)
+ : LanguageOptionsBase(parent, name, fl), m_langSet(langset)
+{
+ langset_popup = 0;
+
+ connect(b_langDel, SIGNAL(clicked()), this, SLOT(slotDeleteClicked()));
+ connect(b_langNew, SIGNAL(clicked()), this, SLOT(slotNewClicked()));
+ connect(b_langPixmap, SIGNAL(clicked()), SLOT(slotPixmapClicked()));
+ connect(e_newName, SIGNAL(textChanged(const QString&)), this, SLOT(slotNewNameChanged(const QString&)));
+ connect(d_shortName, SIGNAL(activated(const QString&)), this, SLOT(slotShortActivated(const QString&)));
+ connect(e_langLong, SIGNAL(textChanged(const QString&)), this, SLOT(slotLangChanged(const QString&)));
+ connect(e_shortName2, SIGNAL(textChanged(const QString&)), this, SLOT(slotShort2Changed(const QString&)));
+ connect(d_kblayout, SIGNAL(activated(const QString&)), this, SLOT(slotKeyboardLayoutChanged(const QString&)));
+
+ // Load the languages first, then the countries and create the
+ // menus for the languages last, so they will have flags
+ loadISO6391Data();
+
+ loadCountryData();
+ b_lang_kde->setPopup(langset_popup);
+
+ createISO6391Menus();
+ b_lang_iso1->setPopup(iso6391_popup);
+
+ b_langNew->setEnabled(false); // activate after data is entered
+
+ for (int i = 0; i < (int) m_langSet.size() && i < MAX_LANGSET; i++)
+ d_shortName->insertItem (m_langSet.shortId(i));
+
+ enableLangWidgets();
+
+ if (d_shortName->count() )
+ {
+ d_shortName->setCurrentItem(0);
+ e_langLong->setText(m_langSet.longId(0));
+ e_shortName2->setText(m_langSet.shortId2(0));
+ if (!m_langSet.PixMapFile(0).isEmpty() )
+ {
+ QPixmap pix(m_langSet.PixMapFile(0));
+ if (!pix.isNull() )
+ {
+ m_lastPix = m_langSet.PixMapFile(0);
+ b_langPixmap->setPixmap (pix);
+ }
+ else
+ b_langPixmap->setText (i18n("Picture is Invalid"));
+ }
+ else
+ b_langPixmap->setText (i18n("No Picture Selected"));
+ }
+ else
+ {
+ b_langPixmap->setText (i18n("No Picture Selected..."));
+ b_langPixmap->setEnabled(false);
+ }
+ m_hasChanged = false;
+}
+
+
+LanguageOptions::~LanguageOptions ()
+{
+ delete langset_popup;
+}
+
+void LanguageOptions::slotDeleteClicked()
+{
+ if (d_shortName->count() != 0)
+ {
+ m_langSet.erase(d_shortName->currentItem());
+ emit widgetModified();
+ m_hasChanged = true;
+ d_shortName->removeItem(d_shortName->currentItem());
+ if (d_shortName->count() != 0)
+ d_shortName->setCurrentItem (0);
+ }
+
+ if (d_shortName->count() != 0)
+ {
+ setPixmap(m_langSet.PixMapFile(d_shortName->currentItem()));
+ e_langLong->setText(m_langSet.longId(d_shortName->currentItem()));
+ e_shortName2->setText(m_langSet.shortId2(d_shortName->currentItem()));
+ }
+ else {
+ b_langPixmap->setText (i18n("No picture selected"));
+ e_langLong->setText("");
+ e_shortName2->setText("");
+ b_langPixmap->setEnabled(false);
+ }
+ enableLangWidgets();
+
+ // doesn't work yet
+ if (d_shortName->count() != 0 && d_kblayout->isEnabled())
+ {
+ for (int i = 0; i < d_kblayout->count(); i++)
+ {
+ if (d_kblayout->text(i) == m_langSet.keyboardLayout(d_shortName->currentItem()))
+ {
+ d_kblayout->setCurrentItem(i);
+ break;
+ }
+ }
+ }
+}
+
+
+void LanguageOptions::slotKeyboardLayoutChanged(const QString& layout)
+{
+ m_langSet.setKeyboardLayout(layout, d_shortName->currentItem());
+ emit widgetModified();
+ m_hasChanged = true;
+}
+
+void LanguageOptions::enableLangWidgets()
+{
+ bool enabled = d_shortName->count() != 0;
+ b_langDel->setEnabled(enabled);
+ b_langPixmap->setEnabled(enabled);
+ d_shortName->setEnabled(enabled);
+ e_langLong->setEnabled(enabled);
+ e_shortName2->setEnabled(enabled);
+
+ //kdDebug() << "enabled? " << enabled << endl;
+
+ if (enabled && KApplication::dcopClient()->isApplicationRegistered("kxkb"))
+ {
+ QByteArray data;
+ QCString replyType;
+ QByteArray replyData;
+
+ if (!KApplication::dcopClient()->call("kxkb", "kxkb", "getLayoutsList()", data, replyType, replyData))
+ {
+ //kdDebug() << "kxkb dcop error" << endl;
+ }
+ else
+ {
+ if (replyType == "QStringList")
+ {
+ QStringList layouts;
+ QDataStream stream(replyData, IO_ReadOnly);
+ stream >> layouts;
+ layouts.prepend(QString::null);
+ d_kblayout->clear();
+ d_kblayout->insertStringList(layouts);
+ }
+ }
+ }
+ else
+ {
+ //kdDebug() << "kxkb not enabled" << endl;
+ d_kblayout->clear();
+ d_kblayout->setEnabled(false);
+ }
+}
+
+
+void LanguageOptions::slotNewNameChanged(const QString& _s)
+{
+ QString s = _s;
+ b_langNew->setEnabled(s.stripWhiteSpace().length() >= 2);
+}
+
+
+void LanguageOptions::slotNewClicked()
+{
+ QString s = e_newName->text();
+ d_shortName->insertItem(s.stripWhiteSpace());
+ d_shortName->setCurrentItem(d_shortName->count()-1);
+ enableLangWidgets();
+ slotShortActivated(s);
+ e_newName->setText("");
+ e_langLong->setFocus();
+}
+
+
+void LanguageOptions::slotShortActivated(const QString& _id)
+{
+ int i = 0;
+ QString id = _id.stripWhiteSpace();
+ if (d_shortName->count() > (int) m_langSet.size() )
+ {
+ // avoid duplicates in language code
+ for (i = 0; i < d_shortName->count(); i++)
+ if (d_shortName->text(i).isNull())
+ {
+ d_shortName->removeItem(d_shortName->currentItem());
+ d_shortName->setCurrentItem(0);
+ }
+
+ for (i = 0; i < d_shortName->count()-1; i++) // omit last
+ if (id == d_shortName->text(i))
+ {
+ d_shortName->removeItem(d_shortName->currentItem());
+ d_shortName->setCurrentItem(i);
+ return;
+ }
+
+ if (d_shortName->count() > (int) m_langSet.size() && m_langSet.size() < MAX_LANGSET )
+ {
+ m_langSet.addSet(id, "", "");
+ emit widgetModified();
+ m_hasChanged = true;
+ }
+ }
+
+ if (d_shortName->count() != 0)
+ {
+ b_langPixmap->setEnabled(true);
+ e_langLong->setText(m_langSet.longId(d_shortName->currentItem()));
+ e_shortName2->setText(m_langSet.shortId2(d_shortName->currentItem()));
+
+ if (!m_langSet.PixMapFile(d_shortName->currentItem()).isEmpty())
+ {
+ QPixmap pix(m_langSet.PixMapFile(d_shortName->currentItem()));
+ if (!pix.isNull())
+ b_langPixmap->setPixmap(pix);
+ else
+ b_langPixmap->setText(i18n("Picture is Invalid"));
+ }
+ else
+ b_langPixmap->setText (i18n("No Picture Selected"));
+
+ QString layout = m_langSet.keyboardLayout(d_shortName->currentItem());
+
+ //kdDebug() << "layout to select " << layout << endl;
+
+ for (int i = 0; i < d_kblayout->count(); i++)
+ {
+ if (d_kblayout->text(i) == layout)
+ {
+ d_kblayout->setCurrentItem(i);
+ break;
+ }
+ }
+ // not found
+ if (d_kblayout->currentText() != layout)
+ {
+ d_kblayout->setCurrentItem(0);
+ }
+ }
+}
+
+
+void LanguageOptions::slotLangChanged(const QString& s)
+{
+ if (d_shortName->count() != 0 && d_shortName->currentItem() < (int) m_langSet.size())
+ {
+ m_langSet.setLongId(s, d_shortName->currentItem());
+ emit widgetModified();
+ m_hasChanged = true;
+ }
+}
+
+
+void LanguageOptions::slotShort2Changed(const QString& s)
+{
+ if (d_shortName->count() != 0 && d_shortName->currentItem() < (int) m_langSet.size())
+ {
+ m_langSet.setShortId2(s, d_shortName->currentItem());
+ emit widgetModified();
+ m_hasChanged = true;
+ }
+}
+
+
+bool LanguageOptions::setPixmap(QString pm)
+{
+ if (d_shortName->count() )
+ {
+ QPixmap pix (pm);
+ if (!pix.isNull() ) {
+ m_langSet.setPixMapFile(pm, d_shortName->currentItem());
+ b_langPixmap->setPixmap (pix);
+ emit widgetModified();
+ m_hasChanged = true;
+ return true;
+ }
+ }
+ return false;
+
+}
+
+
+void LanguageOptions::slotPixmapClicked()
+{
+ if (m_langSet.size() > 0 )
+ {
+ if (m_lastPix.isNull() || QPixmap(m_lastPix).isNull())
+ {
+ QString s;
+ if (!m_langSet.shortId(d_shortName->currentItem()).isNull())
+ {
+ s = m_langSet.shortId(d_shortName->currentItem());
+ m_lastPix = locate ("locale", "l10n/"+s+"/flag.png");
+ if (m_lastPix.isNull()) {
+ m_lastPix = locate ("locale", "l10n/");
+ }
+ }
+ else
+ {
+ m_lastPix = locate ("locale", "l10n/");
+ }
+ }
+ else
+ {
+ QFileInfo fi (m_lastPix);
+ m_lastPix = fi.dirPath()+"/flag.png";
+ }
+
+ QString s = KFileDialog::getOpenFileName (m_lastPix, "*.png *.xpm *.gif *.xbm");
+ if (!s.isEmpty() )
+ {
+ if (setPixmap (s))
+ m_lastPix = s;
+ else {
+ b_langPixmap->setText (i18n("Picture is invalid"));
+ KMessageBox::sorry(this, i18n("File does not contain a valid graphics format\n"));
+ }
+ }
+ }
+}
+
+LangSet LanguageOptions::getLangSet () const
+{
+ return m_langSet;
+}
+
+
+void LanguageOptions::loadCountryData()
+{
+ // temperary use of our locale as the global locale
+ KLocale *lsave = KGlobal::_locale;
+ QString curr_lang = lsave->language();
+
+// KLocale locale("kvoctrain");
+ KLocale locale(QString::null);
+ locale.setLanguage(curr_lang);
+ KGlobal::_locale = &locale;
+
+ QString sub = QString::fromLatin1("l10n/");
+ QStringList regionlist = KGlobal::dirs()->findAllResources("locale", sub + QString::fromLatin1("*.desktop"));
+ regionlist.sort();
+
+ QMap<QString, Region> regions;
+
+ for (QStringList::ConstIterator it = regionlist.begin(); it != regionlist.end(); ++it)
+ {
+ QString tag = *it;
+ int index;
+
+ index = tag.findRev('/');
+ if (index != -1) tag = tag.mid(index + 1);
+
+ index = tag.findRev('.');
+ if (index != -1) tag.truncate(index);
+
+ KSimpleConfig entry(*it);
+ entry.setGroup(QString::fromLatin1("KCM Locale"));
+ QString name = entry.readEntry(QString::fromLatin1("Name"), i18n("without name"));
+
+ regions.insert(tag, Region(name));
+ }
+
+ // add all languages to the list
+ QStringList countrylist = KGlobal::dirs()->findAllResources("locale", sub + QString::fromLatin1("*/entry.desktop"));
+
+ int idx = 0;
+ for (QStringList::ConstIterator sit = countrylist.begin(); sit != countrylist.end(); ++sit)
+ {
+ KSimpleConfig entry(*sit);
+ entry.setGroup(QString::fromLatin1("KCM Locale"));
+ QString name = entry.readEntry(QString::fromLatin1("Name"), i18n("without name"));
+ QString submenu = entry.readEntry(QString::fromLatin1("Region"));
+
+ QString tag = *sit;
+ int index = tag.findRev('/');
+ tag.truncate(index);
+ index = tag.findRev('/');
+ tag = tag.mid(index+1);
+
+ if (tag == "C")
+ continue;
+
+ QStringList all_langs = QStringList::split(",", entry.readEntry(QString::fromLatin1("Languages")));
+ QValueList<int> langs;
+
+ QString pixmap = *sit;
+ index = pixmap.findRev('/');
+ pixmap.truncate(index);
+ pixmap += "/flag.png";
+
+ for (QStringList::Iterator it = all_langs.begin(); it != all_langs.end(); ++it)
+ {
+ // Treat ie "en_GB" and "en_USE" as "en" because the language list
+ // only contains the first letters
+ if ((*it).find("_"))
+ *it = (*it).left((*it).find("_"));
+
+ int id = global_langset.indexShortId(*it);
+ if (id > 0)
+ {
+ langs.append(id);
+ // Set the pixmap of the language to the flag of the first contry that
+ // has the language as official language
+ if (global_langset.PixMapFile(id).isEmpty())
+ global_langset.setPixMapFile(pixmap, id);
+ }
+ //else
+ //kdDebug() << "Couldn't find the language for: " << *it << endl;
+ }
+
+ int id = idx++;
+ countryIdMap.insert(id, Country(name, langs, pixmap, id));
+ regions[submenu].countries.append(countryIdMap[id]);
+ }
+
+ langset_popup = new QPopupMenu();
+
+ // To have it sorted by name
+ QMap<QString, Region> regmap;
+ for (QMap<QString, Region>::Iterator it = regions.begin(); it != regions.end(); ++it)
+ regmap.insert(it.data().region, it.data());
+
+ connect(langset_popup, SIGNAL(activated(int)), this, SLOT(slotLangFromGlobalActivated(int)));
+ for (QMap<QString, Region>::Iterator it = regmap.begin(); it != regmap.end(); ++it)
+ {
+ QPopupMenu *regpop = new QPopupMenu();
+ connect(regpop, SIGNAL(activated(int)), this, SLOT(slotLangFromGlobalActivated(int)));
+ langset_popup->insertItem(it.key(), regpop);
+ Region r = it.data();
+
+ // To have it sorted by name
+ QMap<QString, Country> countrymap;
+ for (QValueList<Country>::Iterator it = r.countries.begin(); it != r.countries.end(); ++it)
+ {
+ countrymap.insert((*it).country, *it);
+ }
+ for (QMap<QString, Country>::Iterator it = countrymap.begin(); it != countrymap.end(); ++it)
+ {
+ regpop->insertItem(QPixmap(it.data().pixmap), it.key(), it.data().id);
+ }
+ }
+
+ // restore the old global locale
+ KGlobal::_locale = lsave;
+}
+
+
+void LanguageOptions::slotLangFromGlobalActivated(int i)
+{
+ if (countryIdMap.contains(i))
+ {
+ Country c = countryIdMap[i];
+ bool first = true;
+ for (QValueList<int>::Iterator it = c.langs.begin(); it != c.langs.end(); ++it)
+ {
+ QString s = global_langset.shortId(*it);
+
+ if (d_shortName->contains(s.stripWhiteSpace()))
+ {
+ if (first)
+ {
+ d_shortName->setCurrentItem(s);
+ slotShortActivated(s);
+ first = false;
+ }
+ continue;
+ }
+
+ d_shortName->insertItem(s.stripWhiteSpace());
+ m_langSet.addSet(s, global_langset.longId(*it), global_langset.PixMapFile(*it), global_langset.shortId2(*it));
+ emit widgetModified();
+ m_hasChanged = true;
+
+ if (first)
+ {
+ d_shortName->setCurrentItem(d_shortName->count()-1);
+ slotShortActivated(s);
+ enableLangWidgets();
+
+ e_shortName2->setText(global_langset.shortId2(*it));
+ slotShort2Changed(e_shortName2->text());
+
+ e_langLong->setText(global_langset.longId(*it));
+ slotLangChanged(global_langset.longId(*it));
+
+ setPixmap(c.pixmap);
+ e_newName->setText("");
+ e_langLong->setFocus();
+ e_langLong->selectAll();
+ first = false;
+ }
+ }
+ }
+}
+
+
+void LanguageOptions::loadISO6391Data()
+{
+ for (unsigned id = 0; id < (int)(sizeof(kv_iso639_1) / sizeof(kv_iso639_1[0])) && kv_iso639_1[id].iso1code != 0; ++id)
+ {
+ QString s = i18n(kv_iso639_1[id].langname);
+ global_langset.addSet(kv_iso639_1[id].iso1code, s, QString::null, kv_iso639_1[id].iso2code);
+ }
+}
+
+void LanguageOptions::createISO6391Menus()
+{
+ // To have it sorted by name
+ QMap<QString, int> languages;
+ for (unsigned id = 0; id < global_langset.size(); ++id)
+ {
+ QString s = global_langset.longId(id);
+ languages.insert(s, id);
+ }
+
+ iso6391_popup = new QPopupMenu();
+
+ QPopupMenu *pop = 0;
+ QString lang = "";
+ for (QMap<QString, int>::Iterator it = languages.begin(); it != languages.end(); ++it)
+ {
+ if (it.key()[0].upper() != lang[0].upper())
+ {
+ pop = new QPopupMenu();
+ connect(pop, SIGNAL(activated(int)), this, SLOT(slotLangFromISO6391Activated(int)));
+ iso6391_popup->insertItem(it.key()[0].upper(), pop, 1);
+ }
+
+ lang = it.key();
+ QString shortid = global_langset.shortId(it.data());
+ QString short2id = global_langset.shortId2(it.data());
+ lang += "\t("+shortid+")";
+ QString pixmap = global_langset.PixMapFile(it.data());
+ if (pixmap.isEmpty())
+ pop->insertItem(lang, it.data());
+ else
+ pop->insertItem(QPixmap(pixmap), lang, it.data());
+ }
+}
+
+void LanguageOptions::slotLangFromISO6391Activated(int id)
+{
+ if (id < (int)global_langset.size())
+ {
+ QString shortid = global_langset.shortId(id);
+
+ if (d_shortName->contains(shortid.stripWhiteSpace()))
+ {
+ d_shortName->setCurrentItem(shortid);
+ slotShortActivated(shortid);
+ return;
+ }
+
+ d_shortName->insertItem(shortid.stripWhiteSpace());
+ d_shortName->setCurrentItem(d_shortName->count()-1);
+ slotShortActivated(shortid);
+ enableLangWidgets();
+
+ e_shortName2->setText(global_langset.shortId2(id));
+ slotShort2Changed(global_langset.shortId2(id));
+
+ e_langLong->setText(global_langset.longId(id));
+ slotLangChanged(e_langLong->text());
+
+ setPixmap(global_langset.PixMapFile(id));
+ e_newName->setText("");
+ e_langLong->setFocus();
+ e_langLong->selectAll();
+ }
+}
+
+void LanguageOptions::updateWidgets()
+{
+//
+}
+
+bool LanguageOptions::hasChanged()
+{
+ return m_hasChanged;
+}
+
+bool LanguageOptions::isDefault()
+{
+ return true;
+}
+
+void LanguageOptions::updateSettings()
+{
+ Prefs::setNumLangSet(m_langSet.size());
+
+ for (int i = 0 ; i < (int) m_langSet.size(); i++)
+ {
+ LanguageSettings languageSettings(QString::number(i));
+ languageSettings.setShortId(m_langSet.shortId(i));
+ languageSettings.setShort2Id(m_langSet.shortId2(i));
+ languageSettings.setLongId(m_langSet.longId(i));
+ languageSettings.setPixmapFile(m_langSet.PixMapFile(i));
+ languageSettings.setKeyboardLayout(m_langSet.keyboardLayout(i));
+ languageSettings.writeConfig();
+ }
+ m_hasChanged = false;
+}
+
+
+#include "languageoptions.moc"
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/languageoptions.h b/kvoctrain/kvoctrain/common-dialogs/languageoptions.h
new file mode 100644
index 00000000..b36d49a3
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/languageoptions.h
@@ -0,0 +1,101 @@
+/***************************************************************************
+
+ language options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef LANGUAGEOPTIONS_H
+#define LANGUAGEOPTIONS_H
+
+#include <qpopupmenu.h>
+
+#include "languageoptionsbase.h"
+#include "langset.h"
+
+class LanguageOptions : public LanguageOptionsBase
+{
+ Q_OBJECT
+
+public:
+ LanguageOptions(LangSet & langset, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ virtual ~LanguageOptions ();
+
+ LangSet getLangSet () const;
+
+ struct Country
+ {
+ Country(const QString& c, const QValueList<int> l, const QString& p, int i)
+ : country(c), langs(l), pixmap(p), id(i) { }
+ Country() { }
+ QString country;
+ QValueList<int> langs;
+ QString pixmap;
+ int id;
+ };
+
+ struct Region
+ {
+ Region (const QString& reg)
+ : region(reg) {}
+ Region() {}
+ QString region;
+ QValueList<Country> countries;
+ };
+
+ void updateWidgets();
+ bool hasChanged();
+ bool isDefault();
+ void updateSettings();
+
+signals:
+ void widgetModified();
+
+protected slots:
+ void slotDeleteClicked();
+ void slotNewClicked();
+ void slotPixmapClicked();
+ void slotLangChanged(const QString&);
+ void slotShort2Changed(const QString&);
+ void slotShortActivated(const QString&);
+ void slotNewNameChanged(const QString&);
+ void slotLangFromGlobalActivated(int);
+ void slotLangFromISO6391Activated(int);
+ void slotKeyboardLayoutChanged(const QString&);
+
+private:
+ bool setPixmap(QString pm);
+ void enableLangWidgets();
+ void loadCountryData();
+ void loadISO6391Data();
+ void createISO6391Menus();
+
+ LangSet global_langset;
+ QMap<int, Country> countryIdMap;
+ QPopupMenu * langset_popup;
+ QPopupMenu * iso6391_popup;
+ LangSet m_langSet;
+ QString m_lastPix;
+ bool m_hasChanged;
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/languageoptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/languageoptionsbase.ui
new file mode 100644
index 00000000..84698be7
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/languageoptionsbase.ui
@@ -0,0 +1,352 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>LanguageOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>LanguageOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>392</width>
+ <height>327</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Available Languages</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>b_langDel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Delete the selected language</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>By clicking on this button you can delete the selected language.</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>e_shortName2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Alternative language code</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>An alternative language code is set here but you can change it if you want</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>e_langLong</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Your own description of the language code.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of the language is written here and you can modify it if you want.</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="4" column="1">
+ <property name="name">
+ <cstring>d_kblayout</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select a language or use the Add New Language Code to add one.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>You can select a language with the drop down box or use the Add New Language Code dialog below to add one.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>b_langPixmap</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The flag representing the language</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The default flag representing the language is set here but you can choose another picture by clicking on the button.</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>d_shortName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select a language or use the Add New Language Code to add one.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>You can select a language with the drop down box or use the Add New Language Code dialog below to add one.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>label_shortName</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Language c&amp;ode:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>d_shortName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>You can assign a language to each column</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Each column can be assigned a language. This is internally done with the usual international language codes.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>label_shortName2</cstring>
+ </property>
+ <property name="text">
+ <string>Alte&amp;rnative code:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>e_shortName2</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select a second language code if necessary</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Sometimes it may be useful to have a second language code because some languages have the usual short code and one or two longer codes.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>label_langLong</cstring>
+ </property>
+ <property name="text">
+ <string>Lang&amp;uage name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>e_langLong</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Describe the language in your own terms.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Here you can give the language code a descriptive name in your own language which is shown in the header buttons in the main view. </string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>label_langPixmap</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Picture:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>b_langPixmap</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Set a picture for the language</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Choose a picture to represent the language above.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>label_kblayout</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Keyboard layout:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>d_kblayout</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>You can assign a language to each column</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Each column can be assigned a language. This is internally done with the usual international language codes.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Add New Language Code</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>b_lang_kde</cstring>
+ </property>
+ <property name="text">
+ <string>Add Language Data From &amp;KDE Database</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Obtains the language choices from the KDE database</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Pressing this button opens a menu that contains all the countries that are known in your KDE installation. Ordered by country you can add your desired language properties to your personal list.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>b_lang_iso1</cstring>
+ </property>
+ <property name="text">
+ <string>Add Language Data From ISO639-&amp;1</string>
+ </property>
+ <property name="accel">
+ <string>Alt+1</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>List of languages covered by ISO639-1</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Pressing this button opens a menu that contains all the language codes that are covered by "ISO639-1"</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>b_langNew</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Allow addition of the language you typed.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This button becomes available when you type a language code in the field.</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>e_newName</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Type your language code if you know it.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Type the language code if you know it or use one of the 2 buttons below to choose a language code.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>390</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>d_shortName</tabstop>
+ <tabstop>e_shortName2</tabstop>
+ <tabstop>e_langLong</tabstop>
+ <tabstop>b_langPixmap</tabstop>
+ <tabstop>d_kblayout</tabstop>
+ <tabstop>b_langDel</tabstop>
+ <tabstop>e_newName</tabstop>
+ <tabstop>b_langNew</tabstop>
+ <tabstop>b_lang_kde</tabstop>
+ <tabstop>b_lang_iso1</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kcombobox.h</includehint>
+</includehints>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfg b/kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfg
new file mode 100644
index 00000000..0203b080
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfg
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="kvoctrainrc">
+ <parameter name="langId" />
+ </kcfgfile>
+ <group name="Language #$(langId)">
+ <entry name="ShortId" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ <default>id</default>
+ </entry>
+ <entry name="Short2Id" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ </entry>
+ <entry name="LongId" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ <default>ident</default>
+ </entry>
+ <entry name="PixmapFile" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ <default></default>
+ </entry>
+ <entry name="KeyboardLayout" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ <default></default>
+ </entry>
+
+ </group>
+
+</kcfg>
diff --git a/kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfgc b/kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfgc
new file mode 100644
index 00000000..e658d6ac
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/languagesettings.kcfgc
@@ -0,0 +1,5 @@
+File=languagesettings.kcfg
+ClassName=LanguageSettings
+Mutators=true
+ItemAccessors=true
+SetUserTexts=true
diff --git a/kvoctrain/kvoctrain/common-dialogs/pasteoptions.cpp b/kvoctrain/kvoctrain/common-dialogs/pasteoptions.cpp
new file mode 100644
index 00000000..cbfcadf4
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/pasteoptions.cpp
@@ -0,0 +1,313 @@
+/***************************************************************************
+
+ paste options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Mar 31 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qpushbutton.h>
+#include <qlistbox.h>
+#include <qcheckbox.h>
+#include <qstringlist.h>
+
+#include <kcombobox.h>
+#include <klocale.h>
+
+#include "pasteoptions.h"
+#include "prefs.h"
+#include "kvoctraindoc.h"
+#include "langset.h"
+
+static const char *separator_id[] =
+{
+ ";", // 0
+ "#", // 1
+ "!", // 2
+ "|", // 3
+ ",", // 4
+ "\t", // 5
+ " ", // 6
+ ":", // 7
+ "::", // 8
+ 0
+};
+
+PasteOptions::PasteOptions(LangSet & langset, kvoctrainDoc * doc, QWidget* parent, const char* name, WFlags fl)
+: PasteOptionsBase(parent,name,fl), m_langSet(langset)
+{
+ OrderList->setEnabled(!kcfg_UseCurrent->isChecked());
+ UpButton->setEnabled(!kcfg_UseCurrent->isChecked());
+ SkipButton->setEnabled(!kcfg_UseCurrent->isChecked());
+ DownButton->setEnabled(!kcfg_UseCurrent->isChecked());
+
+ connect(OrderList, SIGNAL(selectionChanged()), this, SLOT(syncButtons()));
+ connect(DownButton, SIGNAL(clicked()), this, SLOT(slotDownButtonClicked()));
+ connect(SkipButton, SIGNAL(clicked()), this, SLOT(slotSkipButtonClicked()));
+ connect(UpButton, SIGNAL(clicked()), this, SLOT(slotUpButtonClicked()));
+
+ connect(SeparatorCombo, SIGNAL(activated(int)), this, SLOT(slotSeparatorComboActivated(int)));
+ connect(kcfg_UseCurrent, SIGNAL(toggled(bool)), this, SLOT(slotUseCurrentDocToggled(bool)));
+
+ m_doc = doc;
+ fillWidgets();
+ updateWidgets();
+}
+
+void PasteOptions::fillWidgets()
+{
+ SeparatorCombo->insertItem(i18n(";"));
+ SeparatorCombo->insertItem(i18n("#"));
+ SeparatorCombo->insertItem(i18n("!"));
+ SeparatorCombo->insertItem(i18n("|"));
+ SeparatorCombo->insertItem(i18n(","));
+ SeparatorCombo->insertItem(i18n("TAB"));
+ SeparatorCombo->insertItem(i18n(">= 2 SPACES"));
+ SeparatorCombo->insertItem(i18n(" : "));
+ SeparatorCombo->insertItem(i18n(" :: "));
+
+ QStringList sl = Prefs::pasteOrder();
+ OrderList->clear();
+ for (int i = 0; i < (int) sl.count(); i++)
+ {
+ QString codename = m_langSet.findLongId(sl[i]);
+ if (codename.isEmpty())
+ codename = sl[i];
+ OrderList->insertItem(codename);
+ }
+ // any new languages to add to the listbox?
+ for (int i = 0; i < (int) m_langSet.size(); i++)
+ {
+ bool found = false;
+ for (int j = 0; j < (int) OrderList->count(); j++)
+ if (OrderList->text(j) == m_langSet.longId(i))
+ found = true;
+
+ if (!found)
+ OrderList->insertItem(m_langSet.longId(i));
+ }
+}
+
+void PasteOptions::updateWidgets()
+{
+ for (int i = 0; i < 9; ++i)
+ {
+ if (separator_id[i] == Prefs::separator())
+ {
+ SeparatorCombo->setCurrentItem(i);
+ break;
+ }
+ }
+}
+
+
+void PasteOptions::syncButtons()
+{
+ bool usingCurrent = kcfg_UseCurrent->isChecked();
+ OrderList->setDisabled(usingCurrent);
+ if (OrderList->count() > 1 && !usingCurrent)
+ {
+ DownButton->setEnabled(OrderList->currentItem() < (int) OrderList->count()-1);
+ SkipButton->setEnabled(true);
+ UpButton->setEnabled(OrderList->currentItem() != 0);
+ }
+ else
+ {
+ DownButton->setEnabled(false);
+ SkipButton->setEnabled(false);
+ UpButton->setEnabled(false);
+ }
+}
+
+void PasteOptions::slotUpButtonClicked()
+{
+ if (OrderList->currentItem() > 0 && (int) OrderList->count() > 1)
+ {
+ int pos = OrderList->currentItem();
+ QString item = OrderList->text(pos);
+ OrderList->removeItem(pos);
+ OrderList->insertItem(item, pos-1);
+ OrderList->setCurrentItem(pos-1);
+ emit widgetModified();
+ }
+ syncButtons();
+}
+
+void PasteOptions::slotSkipButtonClicked()
+{
+ int pos = OrderList->currentItem();
+ OrderList->insertItem("", OrderList->currentItem());
+ OrderList->setCurrentItem(pos);
+ syncButtons();
+ emit widgetModified();
+}
+
+void PasteOptions::slotDownButtonClicked()
+{
+ if ((int)OrderList->currentItem() < (int) OrderList->count()-1 && (int) OrderList->count() > 1)
+ {
+ int pos = OrderList->currentItem();
+ QString item = OrderList->text(pos);
+ OrderList->removeItem(pos);
+ OrderList->insertItem(item, pos+1);
+ OrderList->setCurrentItem(pos+1);
+ emit widgetModified();
+ }
+ syncButtons();
+}
+
+void PasteOptions::slotSeparatorComboActivated(int)
+{
+ emit widgetModified();
+}
+
+void PasteOptions::slotUseCurrentDocToggled(bool)
+{
+ OrderList->clear();
+ OrderList->insertItem (m_langSet.findLongId(m_doc->getOriginalIdent()));
+ for (int i = 1; i < (int) m_doc->numLangs(); i++)
+ OrderList->insertItem (m_langSet.findLongId(m_doc->getIdent(i)));
+
+ // any other languages to append besides those from doc?
+ for (int i = 0; i < (int) m_langSet.size(); i++)
+ {
+ bool found = false;
+ for (int j = 0; j < (int) OrderList->count(); j++)
+ if (OrderList->text(j) == m_langSet.longId(i))
+ found = true;
+
+ if (!found)
+ OrderList->insertItem(m_langSet.longId(i));
+ }
+
+ OrderList->setCurrentItem (0);
+}
+
+bool PasteOptions::hasChanged()
+{
+ bool result;
+ result = ((separator_id[SeparatorCombo->currentItem()] != Prefs::separator()));
+ if (result)
+ return true;
+ QStringList ol, pl;
+ pl = Prefs::pasteOrder();
+ ol = preparePasteOrderList();
+ result = (pl.count() != ol.count());
+ if (result)
+ return true;
+ for (uint i = 0; i < ol.count(); i--)
+ {
+ result = (ol[i] != pl[i]);
+ if (result)
+ return true;
+ }
+ return false;
+}
+
+bool PasteOptions::isDefault()
+{
+ return !strcmp(separator_id[SeparatorCombo->currentItem()], "\t");
+}
+
+void PasteOptions::updateSettings()
+{
+ Prefs::setSeparator((separator_id[SeparatorCombo->currentItem()]));
+ Prefs::setPasteOrder(preparePasteOrderList());
+}
+
+
+void PasteOptions::slotSyncPasteOrderList()
+{
+ for (int j = (int) OrderList->count()-1; j > 1; j--)
+ {
+ QString comp = OrderList->text(j);
+ for (int i = (int) j-1; i >=0; i--)
+ {
+ if (OrderList->text(i) == comp && !OrderList->text(i).isEmpty())
+ {
+ OrderList->removeItem(j);
+ break;
+ }
+ }
+ }
+
+ // order_list contains elements unknown in language set? remove them
+ for (int i = (int) OrderList->count()-1; i >=0; i--)
+ {
+ if (!OrderList->text(i).isEmpty())
+ {
+ if (m_langSet.indexLongId(OrderList->text(i)) < 0)
+ {
+ OrderList->removeItem(i);
+ }
+ }
+ }
+
+ // language set contains new elements? append them
+ for (int i = 0; i < (int) m_langSet.size(); i++)
+ {
+ bool found = false;
+ for (int j = 0; j < (int) OrderList->count(); j++)
+ if (m_langSet.longId(i) == OrderList->text(j))
+ found = true;
+
+ if (!found)
+ {
+ if (m_langSet.longId(i).isEmpty())
+ OrderList->insertItem(m_langSet.shortId(i));
+ else
+ OrderList->insertItem(m_langSet.longId(i));
+ }
+ }
+
+ // skip "skip" elements at tail
+ int i;
+ for (i = (int) OrderList->count()-1; i >= 0 && OrderList->text(i).isEmpty(); i--)
+ {
+ if (OrderList->currentItem() > (int) OrderList->count()-2)
+ OrderList->setCurrentItem(OrderList->count()-2);
+ OrderList->removeItem(i);
+ }
+}
+
+QStringList PasteOptions::preparePasteOrderList()
+{
+ slotSyncPasteOrderList();
+ QStringList sl;
+ // skip "skip" elements at tail
+ int i;
+ for (i = (int) OrderList->count()-1; i >= 0 && OrderList->text(i).isEmpty(); i--);
+
+ // insert language codes and "skips" between them
+ for ( /**/; i >= 0; i--)
+ {
+ QString code = m_langSet.findShortId(OrderList->text(i));
+ if (code.isEmpty())
+ code = OrderList->text(i); // no longId previously available
+ if (OrderList->text(i).isEmpty())
+ sl.insert (sl.begin(), "");
+ else
+ sl.insert (sl.begin(), code);
+ }
+ return sl;
+}
+
+#include "pasteoptions.moc"
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/pasteoptions.h b/kvoctrain/kvoctrain/common-dialogs/pasteoptions.h
new file mode 100644
index 00000000..15b1015b
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/pasteoptions.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+
+ paste options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Mar 31 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef PASTEOPTIONS_H
+#define PASTEOPTIONS_H
+
+#include "pasteoptionsbase.h"
+#include "langset.h"
+
+class kvoctrainDoc;
+
+class PasteOptions : public PasteOptionsBase
+{
+ Q_OBJECT
+
+public:
+ PasteOptions(LangSet & langset, kvoctrainDoc * doc, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+ void updateWidgets();
+ bool hasChanged();
+ bool isDefault();
+ void updateSettings();
+
+signals:
+ void widgetModified();
+ void syncPasteOrderList();
+
+private slots:
+ void fillWidgets();
+ void syncButtons();
+ void slotUpButtonClicked();
+ void slotSkipButtonClicked();
+ void slotDownButtonClicked();
+ void slotSeparatorComboActivated(int);
+ void slotUseCurrentDocToggled(bool);
+
+private:
+ void slotSyncPasteOrderList();
+ QStringList preparePasteOrderList();
+ kvoctrainDoc * m_doc;
+ LangSet m_langSet;
+
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/pasteoptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/pasteoptionsbase.ui
new file mode 100644
index 00000000..3ee107fc
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/pasteoptionsbase.ui
@@ -0,0 +1,214 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>PasteOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>PasteOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>379</width>
+ <height>275</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>label_sep</cstring>
+ </property>
+ <property name="text">
+ <string>Sep&amp;arator:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>SeparatorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>SeparatorCombo</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Choose which separator you want to use to separate your data.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Choose one separator which will divide the parts of an expression when transferring data from or to another application over the clipboard.</string>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>310</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>label_order</cstring>
+ </property>
+ <property name="title">
+ <string>Order</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QListBox" row="1" column="0" rowspan="4" colspan="1">
+ <property name="name">
+ <cstring>OrderList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>DownButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Down</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>SkipButton</cstring>
+ </property>
+ <property name="text">
+ <string>S&amp;kip</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>UpButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_UseCurrent</cstring>
+ </property>
+ <property name="text">
+ <string>Use &amp;current document</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Check this if you want the items in the clipboard to be in the same language order as the current document.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When checked, the items in the clipboard are assumed to be in the same language order as the current document.</string>
+ </property>
+ </widget>
+ <spacer row="4" column="1">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>kcfg_UseCurrent</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>OrderList</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseCurrent</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>UpButton</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseCurrent</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>DownButton</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseCurrent</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>SkipButton</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>SeparatorCombo</tabstop>
+ <tabstop>kcfg_UseCurrent</tabstop>
+ <tabstop>OrderList</tabstop>
+ <tabstop>UpButton</tabstop>
+ <tabstop>SkipButton</tabstop>
+ <tabstop>DownButton</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+</includehints>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/prefs.kcfgc b/kvoctrain/kvoctrain/common-dialogs/prefs.kcfgc
new file mode 100644
index 00000000..bb9ed639
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/prefs.kcfgc
@@ -0,0 +1,7 @@
+# Code generation options for kconfig_compiler
+IncludeFiles=../kv_resource.h,../kvt-core/kvoctrainexpr.h
+File=kvoctrain.kcfg
+ClassName=Prefs
+Singleton=true
+Mutators=true
+Visibility=KDE_EXPORT \ No newline at end of file
diff --git a/kvoctrain/kvoctrain/common-dialogs/presettings.kcfg b/kvoctrain/kvoctrain/common-dialogs/presettings.kcfg
new file mode 100644
index 00000000..3a20eeca
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/presettings.kcfg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="kvoctrainrc">
+ <parameter name="settingsId" />
+ </kcfgfile>
+ <group name="Presetting #$(settingsId)">
+ <entry name="Name" type="String">
+ <label>Name of the settings profile</label>
+ <whatsthis></whatsthis>
+ </entry>
+ <entry name="Query" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ </entry>
+ <entry name="Threshold" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ </entry>
+ <entry name="Blocking" type="String">
+ <label></label>
+ <whatsthis></whatsthis>
+ </entry>
+ </group>
+</kcfg>
diff --git a/kvoctrain/kvoctrain/common-dialogs/presettings.kcfgc b/kvoctrain/kvoctrain/common-dialogs/presettings.kcfgc
new file mode 100644
index 00000000..9c389dfe
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/presettings.kcfgc
@@ -0,0 +1,5 @@
+File=presettings.kcfg
+ClassName=PreSettings
+Mutators=true
+ItemAccessors=true
+SetUserTexts=true
diff --git a/kvoctrain/kvoctrain/common-dialogs/profilesdialog.cpp b/kvoctrain/kvoctrain/common-dialogs/profilesdialog.cpp
new file mode 100644
index 00000000..d6669e7b
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/profilesdialog.cpp
@@ -0,0 +1,370 @@
+/***************************************************************************
+ profilesdialog.cpp - KVocTrain profiles dialog
+
+ -------------------
+ begin : Fri Apr 29 2005
+
+ copyright : (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qcombobox.h>
+#include <qpushbutton.h>
+
+#include <kdialogbase.h>
+#include <klocale.h>
+#include <kinputdialog.h>
+#include <klocale.h>
+
+#include "profilesdialog.h"
+#include "groupoptions.h"
+#include "presettings.h"
+#include "prefs.h"
+#include "QueryManager.h"
+
+SettingsProfile::SettingsProfile( )
+{
+}
+
+SettingsProfile::SettingsProfile(QString n, QString q, QString t, QString b)
+: name(n), query_set(q), thresh_set(t), block_set(b)
+{
+}
+
+ProfilesDialog::ProfilesDialog(QueryManager * m, QWidget *parent, const char *name, bool modal)
+ : KDialogBase(Swallow, i18n("Profiles"), Close, Close, parent, name, modal, false)
+{
+ m_queryManager = m;
+ mw = new GroupOptions(this);
+ setMainWidget(mw);
+
+ connect(mw->ps_del, SIGNAL(clicked()), this, SLOT(slotDeleteGroup()));
+ connect(mw->ps_new, SIGNAL(clicked()), this, SLOT(slotNewGroup()));
+ connect(mw->ps_recall, SIGNAL(clicked()), this, SLOT(slotRecallGroup()));
+ connect(mw->ps_store, SIGNAL(clicked()), this, SLOT(slotStoreGroup()));
+
+ int ls = Prefs::numPreSetting();
+ for (int i = 0 ; i < ls; i++)
+ {
+ PreSettings preSettings(QString::number(i));
+ preSettings.readConfig();
+ profiles.append(SettingsProfile(preSettings.name(), preSettings.query(),
+ preSettings.threshold(), preSettings.blocking()));
+ mw->ps_name->insertItem(preSettings.name());
+ }
+
+ mw->updateButtons();
+}
+
+void ProfilesDialog::slotDeleteGroup()
+{
+ if (mw->ps_name->count() != 0)
+ {
+ int curr = mw->ps_name->currentItem();
+ mw->ps_name->removeItem(curr);
+ profiles.remove(profiles.at(curr));
+ if (curr >= mw->ps_name->count()-1)
+ mw->ps_name->setCurrentItem(mw->ps_name->count()-1);
+ }
+ saveProfiles();
+ mw->updateButtons();
+}
+
+void ProfilesDialog::slotNewGroup()
+{
+ bool ok;
+ QString newGroupName = KInputDialog::getText(i18n("Profile Description"),
+ i18n("Enter profile description:"), QString::null, &ok);
+
+ if (ok)
+ {
+ newGroupName = newGroupName.stripWhiteSpace();
+ mw->ps_name->insertItem(newGroupName);
+ profiles.append(SettingsProfile(newGroupName, "", "", ""));
+ modifyProfile(profiles.count()-1);
+ mw->ps_name->setCurrentItem(mw->ps_name->count()-1);
+ selectProfile(mw->ps_name->currentItem());
+ mw->updateButtons();
+ }
+}
+
+void ProfilesDialog::slotRecallGroup()
+{
+ if (mw->ps_name->count() != 0)
+ selectProfile(mw->ps_name->currentItem());
+}
+
+
+void ProfilesDialog::slotStoreGroup()
+{
+ if (mw->ps_name->count() != 0)
+ modifyProfile(mw->ps_name->currentItem());
+}
+
+
+
+static bool extract (QString &line, QString &ret)
+{
+ int lim = line.find (",");
+ if (lim < 0)
+ {
+ ret = "";
+ line = "";
+ return false;
+ }
+ else
+ {
+ ret = line.left(lim);
+ line.remove(0, lim+1);
+ }
+
+ return true;
+}
+
+void ProfilesDialog::selectProfile(int profile)
+{
+ if (profile < (int) profiles.count())
+ {
+ QString line = profiles[profile].query_set;
+ QString s;
+ Prefs::setMaxTimePer(0);
+ Prefs::setSwapDirection(false);
+ Prefs::setAltLearn(false);
+ Prefs::setShowCounter(false);
+ //kvq_timeout_t type_to = kvq_notimeout;
+ Prefs::setSuggestions(false);
+ Prefs::setSplit(false);
+ Prefs::setPeriods(true);
+ Prefs::setColons(false);
+ Prefs::setSemicolons(true);
+ Prefs::setCommas(false);
+ Prefs::setFields(5);
+ Prefs::setShowMore(true);
+ Prefs::setIKnow(true);
+ if (extract (line, s))
+ Prefs::setMaxTimePer(s.toInt());
+ if (extract (line, s))
+ Prefs::setSwapDirection((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setAltLearn((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setShowCounter((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setQueryTimeout(s.toInt());
+ if (extract (line, s))
+ Prefs::setSuggestions((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setSplit((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setPeriods((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setColons((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setSemicolons((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setCommas((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setFields(s.toInt());
+ if (extract (line, s))
+ Prefs::setShowMore((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setIKnow((bool) s.toInt());
+
+#define QCT(x) Prefs::EnumCompType::type(x)
+
+ line = profiles[profile].thresh_set;
+
+ line.stripWhiteSpace();
+ if (line.length() != 0 && line[0] == '(')
+ { // new style: multiple lessons
+ int pos;
+ line.remove(0, 1);
+ if ((pos = line.find(')')) > 0)
+ {
+ s = line.left (pos);
+ line.remove (0, pos+1);
+ }
+ else
+ {
+ s = line;
+ line = "";
+ }
+ m_queryManager->setLessonItemStr(s);
+ }
+ else if (extract (line, s))
+ m_queryManager->setLessonItemStr(s);
+
+ if (extract (line, s))
+ Prefs::setCompType(Prefs::EnumType::Lesson, QCT(s.toInt()));
+ if (extract (line, s))
+ Prefs::setTypeItem(s); // s.toInt()
+ if (extract (line, s))
+ Prefs::setCompType(Prefs::EnumType::WordType, QCT(s.toInt())) /*manager.setTypeComp(QCT(s.toInt()))*/;
+ if (extract (line, s))
+ Prefs::setGradeItem(s.toInt());
+ if (extract (line, s))
+ Prefs::setCompType(Prefs::EnumType::Grade, QCT(s.toInt()));
+ if (extract (line, s))
+ Prefs::setQueryItem(s.toInt());
+ if (extract (line, s))
+ Prefs::setCompType(Prefs::EnumType::Query, QCT(s.toInt()));
+ if (extract (line, s))
+ Prefs::setBadItem(s.toInt());
+ if (extract (line, s))
+ Prefs::setCompType(Prefs::EnumType::Bad, QCT(s.toInt()));
+ if (extract (line, s))
+ Prefs::setDateItem(s.toInt());
+ if (extract (line, s))
+ Prefs::setCompType(Prefs::EnumType::Date, QCT(s.toInt()));
+
+#undef QCT
+
+ line = profiles[profile].block_set;
+ Prefs::setBlock(false);
+ Prefs::setExpire(false);
+
+ if (extract (line, s))
+ Prefs::setBlock((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setBlockItem(KV_LEV1_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setBlockItem(KV_LEV2_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setBlockItem(KV_LEV3_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setBlockItem(KV_LEV4_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setBlockItem(KV_LEV5_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setBlockItem(KV_LEV6_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setBlockItem(KV_LEV7_GRADE, s.toInt());
+
+ if (extract (line, s))
+ Prefs::setExpire((bool) s.toInt());
+ if (extract (line, s))
+ Prefs::setExpireItem(KV_LEV1_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setExpireItem(KV_LEV2_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setExpireItem(KV_LEV3_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setExpireItem(KV_LEV4_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setExpireItem(KV_LEV5_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setExpireItem(KV_LEV6_GRADE, s.toInt());
+ if (extract (line, s))
+ Prefs::setExpireItem(KV_LEV7_GRADE, s.toInt());
+ }
+ emit profileActivated();
+}
+
+void ProfilesDialog::modifyProfile(int profile)
+{
+ if (profile == -1)
+ return;
+
+ if (profile < (int) profiles.count())
+ {
+ QString s;
+ QString line;
+
+ s.setNum(Prefs::maxTimePer());
+ line += s + ',';
+ s.setNum(Prefs::swapDirection());
+ line += s + ',';
+ s.setNum(Prefs::altLearn());
+ line += s + ',';
+ s.setNum((int) Prefs::showCounter());
+ line += s + ',';
+ s.setNum( (int) Prefs::queryTimeout() /*getTypeQueryTimeout()*/);
+ line += s + ',';
+ s.setNum((int) Prefs::suggestions());
+ line += s + ',';
+ s.setNum((int) Prefs::split());
+ line += s + ',';
+ s.setNum((int) Prefs::periods());
+ line += s + ',';
+ s.setNum((int) Prefs::colons());
+ line += s + ',';
+ s.setNum((int) Prefs::semicolons());
+ line += s + ',';
+ s.setNum((int) Prefs::commas());
+ line += s + ',';
+ s.setNum(Prefs::fields());
+ line += s + ',';
+ s.setNum((int) Prefs::showMore());
+ line += s + ',';
+ s.setNum((int) Prefs::iKnow());
+ line += s + ',';
+ profiles[profile].query_set = line;
+
+ line = '(' + m_queryManager->lessonItemStr() + ')';
+ s.setNum((int) Prefs::compType(Prefs::EnumType::Lesson));
+ line += s + ',';
+ s = Prefs::typeItem();
+ line += s + ',';
+ s.setNum((int) Prefs::compType(Prefs::EnumType::WordType) /*manager.typeComp()*/);
+ line += s + ',';
+ s.setNum(Prefs::gradeItem());
+ line += s + ',';
+ s.setNum((int) Prefs::compType(Prefs::EnumType::Grade));
+ line += s + ',';
+ s.setNum(Prefs::queryItem());
+ line += s + ',';
+ s.setNum((int) Prefs::compType(Prefs::EnumType::Query));
+ line += s + ',';
+ s.setNum(Prefs::badItem());
+ line += s + ',';
+ s.setNum((int) Prefs::compType(Prefs::EnumType::Bad));
+ line += s + ',';
+ s.setNum(Prefs::dateItem());
+ line += s + ',';
+ s.setNum((int) Prefs::compType(Prefs::EnumType::WordType));
+ line += s + ',';
+ profiles[profile].thresh_set = line;
+
+ s.setNum(Prefs::block());
+ line = s + ',';
+ for (int i = KV_LEV1_GRADE; i <= KV_MAX_GRADE; i++)
+ {
+ s.setNum(Prefs::blockItem(i));
+ line += s + ',';
+ }
+
+ s.setNum(Prefs::expire());
+ line += s + ',';
+ for (int i = KV_LEV1_GRADE; i <= KV_MAX_GRADE; i++)
+ {
+ s.setNum(Prefs::expireItem(i));
+ line += s + ',';
+ }
+ profiles[profile].block_set = line;
+ }
+ saveProfiles();
+}
+
+void ProfilesDialog::saveProfiles( )
+{
+ Prefs::setNumPreSetting(profiles.count());
+ for (int i = 0 ; i < (int) profiles.count(); i++)
+ {
+ PreSettings preSettings(QString::number(i));
+ preSettings.setName(profiles[i].name);
+ preSettings.setQuery(profiles[i].query_set);
+ preSettings.setThreshold(profiles[i].thresh_set);
+ preSettings.setBlocking(profiles[i].block_set);
+ preSettings.writeConfig();
+ }
+}
+
+#include "profilesdialog.moc"
diff --git a/kvoctrain/kvoctrain/common-dialogs/profilesdialog.h b/kvoctrain/kvoctrain/common-dialogs/profilesdialog.h
new file mode 100644
index 00000000..827ba191
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/profilesdialog.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ profilesdialog.h - KVocTrain profiles dialog
+
+ -------------------
+ begin : Fri Apr 29 2005
+
+ copyright : (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ *
+ ***************************************************************************/
+
+#ifndef PROFILESDIALOG_H
+#define PROFILESDIALOG_H
+
+#include <qvaluelist.h>
+
+#include <kdialogbase.h>
+
+/**
+@author Peter Hedlund
+*/
+
+class QueryManager;
+class GroupOptions;
+
+class SettingsProfile
+{
+public:
+ SettingsProfile();
+ SettingsProfile (QString n, QString q, QString t, QString b);
+
+ QString name;
+ QString query_set;
+ QString thresh_set;
+ QString block_set;
+};
+
+class ProfilesDialog : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ ProfilesDialog(QueryManager * m, QWidget *parent = 0, const char *name = 0, bool modal = true);
+
+signals:
+ void profileActivated();
+
+protected slots:
+ void slotDeleteGroup();
+ void slotNewGroup();
+ void slotStoreGroup();
+ void slotRecallGroup();
+
+private:
+ void selectProfile(int profile);
+ void modifyProfile(int profile);
+ void saveProfiles();
+
+ typedef QValueList<SettingsProfile> Profiles;
+ Profiles profiles;
+ QueryManager * m_queryManager;
+ GroupOptions * mw;
+};
+
+#endif
diff --git a/kvoctrain/kvoctrain/common-dialogs/queryoptions.cpp b/kvoctrain/kvoctrain/common-dialogs/queryoptions.cpp
new file mode 100644
index 00000000..b1677e3f
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/queryoptions.cpp
@@ -0,0 +1,72 @@
+/***************************************************************************
+
+ query options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qlabel.h>
+#include <qbuttongroup.h>
+
+#include <knuminput.h>
+
+#include "queryoptions.h"
+#include "prefs.h"
+
+QueryOptions::QueryOptions(QWidget* parent, const char* name, WFlags fl)
+: QueryOptionsBase(parent,name,fl)
+{
+ kcfg_MaxTimePer->setDisabled(r_no_limit->isChecked());
+ kcfg_ShowCounter->setDisabled(r_no_limit->isChecked());
+ label_mqtime->setDisabled(r_no_limit->isChecked());
+ kcfg_Periods->setEnabled(kcfg_Split->isChecked());
+ kcfg_Colons->setEnabled(kcfg_Split->isChecked());
+ kcfg_Semicolons->setEnabled(kcfg_Split->isChecked());
+ kcfg_Commas->setEnabled(kcfg_Split->isChecked());
+ kcfg_Fields->setEnabled(kcfg_Split->isChecked());
+ label_at->setEnabled(kcfg_Split->isChecked());
+ label_split_max_fields->setEnabled(kcfg_Split->isChecked());
+}
+
+void QueryOptions::updateWidgets()
+{
+ //This is required for loading profiles properly
+ kcfg_QueryTimeout->setButton((int) Prefs::queryTimeout());
+ kcfg_MaxTimePer->setValue(Prefs::maxTimePer());
+ kcfg_ShowCounter->setChecked(Prefs::showCounter());
+ kcfg_SwapDirection->setChecked(Prefs::swapDirection());
+ kcfg_AltLearn->setChecked(Prefs::altLearn());
+ kcfg_Suggestions->setChecked(Prefs::suggestions());
+ kcfg_Split->setChecked(Prefs::split());
+ kcfg_Periods->setChecked(Prefs::periods());
+ kcfg_Colons->setChecked(Prefs::colons());
+ kcfg_Semicolons->setChecked(Prefs::semicolons());
+ kcfg_Commas->setChecked(Prefs::commas());
+ kcfg_Fields->setValue(Prefs::fields());
+ kcfg_ShowMore->setChecked(Prefs::showMore());
+ kcfg_IKnow->setChecked(Prefs::iKnow());
+}
+
+#include "queryoptions.moc"
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/queryoptions.h b/kvoctrain/kvoctrain/common-dialogs/queryoptions.h
new file mode 100644
index 00000000..b424cbb2
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/queryoptions.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+
+ query options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef QUERYOPTIONS_H
+#define QUERYOPTIONS_H
+
+#include "queryoptionsbase.h"
+
+class QueryOptions : public QueryOptionsBase
+{
+ Q_OBJECT
+
+public:
+ QueryOptions(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+ void updateWidgets();
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/queryoptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/queryoptionsbase.ui
new file mode 100644
index 00000000..24e70c58
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/queryoptionsbase.ui
@@ -0,0 +1,573 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>QueryOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>QueryOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>452</width>
+ <height>404</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>kcfg_AltLearn</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Use alternative learning method</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Use the Leitner learning method</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>By checking this, you will use the Leitner method of learning which requires you to answer correctly to each question 4 times in a row. </string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>kcfg_SwapDirection</cstring>
+ </property>
+ <property name="text">
+ <string>S&amp;wap direction randomly</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="3" column="0">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="title">
+ <string>Random Query Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="7">
+ <property name="name">
+ <cstring>kcfg_Suggestions</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Enable suggestion lists</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, pressing F5 or F6 will display a list of suggestions</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this options is enabled, you can enter part of an answer, then press F5 or F6 to get a list of translations starting with or containing the text you typed.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="7">
+ <property name="name">
+ <cstring>kcfg_Split</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Split &amp;translations</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Split translations and show multiple answer fields</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this options is enabled, the program will split translations into several parts, show multiple answer fields, and you will need to answer each one of them. This is useful for example when a word has several meanings that have different translations in the other language.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>label_split_max_fields</cstring>
+ </property>
+ <property name="text">
+ <string>Maximum number of &amp;fields:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_Fields</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Maximum number of fields to split translations into</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the maximum number of answer fields you want to have. When splitting translations, the program will only split into this many parts, and the last part will contain the rest of the translation.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="7">
+ <property name="name">
+ <cstring>kcfg_IKnow</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Enable I Know &amp;button</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enable the I Know It button on the Random Query screen</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If this is checked, the I Know button will be available. It allows you to tell the query that you know the result without writing it or having it checked. This is available by default. If you uncheck this, the I Know button will not be available.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>label_at</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>at</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="2">
+ <property name="name">
+ <cstring>kcfg_Periods</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>pe&amp;riods</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Split translations at periods</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this options is enabled, translations will be split at periods if they have any (except any trailing periods that will be removed).</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="4">
+ <property name="name">
+ <cstring>kcfg_Semicolons</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>sem&amp;icolons</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Split translations at semicolons</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this options is enabled, translations that have not been split at periods or colons will be split at semicolons if they have any.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="5" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_Commas</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>co&amp;mmas</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Split translations at commas</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this options is enabled, translations that have not been split at periods, colons or semicolons will be split at commas if they have any.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="3">
+ <property name="name">
+ <cstring>kcfg_Colons</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>co&amp;lons</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Split translations at colons</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this options is enabled, translations that have not been split at periods will be split at colons if they have any.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="7">
+ <property name="name">
+ <cstring>kcfg_ShowMore</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Enable S&amp;how More button</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enable the Show More button on the Random Query screen</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this is checked, you will be able to use a Show More button which allow you to get the next letter in your answer in the query. If this is unchecked, the Show More button will not be enabled, you will not be able to use it.</string>
+ </property>
+ </widget>
+ <spacer row="2" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>48</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KIntNumInput" row="3" column="4" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_Fields</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="minValue">
+ <number>2</number>
+ </property>
+ <property name="maxValue">
+ <number>10</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Maximum number of fields to split translations into</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the maximum number of answer fields you want to have. When splitting translations, the program will only split into this many parts, and the last part will contain the rest of the translation.</string>
+ </property>
+ </widget>
+ <spacer row="3" column="6">
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>111</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>290</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>QueryTimeout</cstring>
+ </property>
+ <property name="title">
+ <string>Time Per Query</string>
+ </property>
+ <property name="exclusive" stdset="0">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>kcfg_QueryTimeout</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>r_show_to</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Show solution</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>r_no_limit</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;No time limitation</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Check this if you do not want any time limitation per query.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this is checked, there is no time limitation for each query</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="2" column="0">
+ <property name="name">
+ <cstring>r_cont_to</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Continue after timeout</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>label_mqtime</cstring>
+ </property>
+ <property name="text">
+ <string>Ma&amp;x. time (s):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_MaxTimePer</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_ShowCounter</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>S&amp;how remaining time</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, activate a progress bar to show the remaining time.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Check this button if you want to activate a progress bar to show the remaining time for each query.</string>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>83</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KIntNumInput" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_MaxTimePer</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>604800</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Set the maximum time allowed per query.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>You may set a time limit KVocTrain grants you to remember the correct answer. Set here the maximum time you want to allow per query.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>200</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>kcfg_Split</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_Periods</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_Split</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_Colons</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_Split</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_Semicolons</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_Split</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_Commas</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_Split</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_Fields</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>r_no_limit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_MaxTimePer</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>r_no_limit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_ShowCounter</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_Split</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>label_at</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_Split</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>label_split_max_fields</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>r_no_limit</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>label_mqtime</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>kcfg_MaxTimePer</tabstop>
+ <tabstop>kcfg_ShowCounter</tabstop>
+ <tabstop>kcfg_SwapDirection</tabstop>
+ <tabstop>kcfg_AltLearn</tabstop>
+ <tabstop>kcfg_Suggestions</tabstop>
+ <tabstop>kcfg_Split</tabstop>
+ <tabstop>kcfg_Periods</tabstop>
+ <tabstop>kcfg_Colons</tabstop>
+ <tabstop>kcfg_Semicolons</tabstop>
+ <tabstop>kcfg_Commas</tabstop>
+ <tabstop>kcfg_Fields</tabstop>
+ <tabstop>kcfg_ShowMore</tabstop>
+ <tabstop>kcfg_IKnow</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/thresholdoptions.cpp b/kvoctrain/kvoctrain/common-dialogs/thresholdoptions.cpp
new file mode 100644
index 00000000..e611eb36
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/thresholdoptions.cpp
@@ -0,0 +1,450 @@
+/***************************************************************************
+
+ threshold options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qcombobox.h>
+
+#include <kcombobox.h>
+#include <klocale.h>
+
+#include "thresholdoptions.h"
+#include "QueryManager.h"
+#include "prefs.h"
+
+
+static Prefs::EnumCompType::type bad_complist[] =
+ {Prefs::EnumCompType::DontCare, Prefs::EnumCompType::MoreThan, Prefs::EnumCompType::MoreEqThan,
+ Prefs::EnumCompType::EqualTo, Prefs::EnumCompType::NotEqual, Prefs::EnumCompType::LessEqThan,
+ Prefs::EnumCompType::LessThan, Prefs::EnumCompType::type(-1)};
+
+static Prefs::EnumCompType::type query_complist[] =
+ {Prefs::EnumCompType::DontCare, Prefs::EnumCompType::MoreThan, Prefs::EnumCompType::MoreEqThan,
+ Prefs::EnumCompType::EqualTo, Prefs::EnumCompType::NotEqual, Prefs::EnumCompType::LessEqThan,
+ Prefs::EnumCompType::LessThan, Prefs::EnumCompType::type(-1)};
+
+static Prefs::EnumCompType::type grade_complist[] =
+ {Prefs::EnumCompType::DontCare, Prefs::EnumCompType::WorseThan, Prefs::EnumCompType::WorseEqThan,
+ Prefs::EnumCompType::EqualTo, Prefs::EnumCompType::NotEqual, Prefs::EnumCompType::BetterEqThan,
+ Prefs::EnumCompType::BetterThan, Prefs::EnumCompType::type(-1)};
+
+static Prefs::EnumCompType::type type_complist[] =
+ {Prefs::EnumCompType::DontCare, Prefs::EnumCompType::EqualTo, Prefs::EnumCompType::NotEqual,
+ Prefs::EnumCompType::type(-1)};
+
+static Prefs::EnumCompType::type date_complist[] =
+ {Prefs::EnumCompType::DontCare, Prefs::EnumCompType::Before, Prefs::EnumCompType::Within,
+ Prefs::EnumCompType::NotQueried, Prefs::EnumCompType::type(-1)};
+
+static Prefs::EnumCompType::type less_complist[] =
+ {Prefs::EnumCompType::DontCare, Prefs::EnumCompType::OneOf, Prefs::EnumCompType::NotOneOf,
+ Prefs::EnumCompType::Current, Prefs::EnumCompType::NotAssigned, Prefs::EnumCompType::type(-1)};
+
+struct ThreshListRef
+{
+ const char *text;
+ long int num;
+};
+
+static ThreshListRef Threshdate_itemlist [] =
+ {
+ {I18N_NOOP("30 Min"), 30*60},
+ {I18N_NOOP("1 Hour"), 1 * 60*60},
+ {I18N_NOOP("2 Hours"), 2 * 60*60},
+ {I18N_NOOP("4 Hours"), 4 * 60*60},
+ {I18N_NOOP("8 Hours"), 8 * 60*60},
+ {I18N_NOOP("12 Hours"), 12 * 60*60},
+ {I18N_NOOP("18 Hours"), 18 * 60*60},
+
+ {I18N_NOOP("1 Day"), 1 * 60*60*24},
+ {I18N_NOOP("2 Days"), 2 * 60*60*24},
+ {I18N_NOOP("3 Days"), 3 * 60*60*24},
+ {I18N_NOOP("4 Days"), 4 * 60*60*24},
+ {I18N_NOOP("5 Days"), 5 * 60*60*24},
+ {I18N_NOOP("6 Days"), 6 * 60*60*24},
+
+ {I18N_NOOP("1 Week"), 1 * 60*60*24*7},
+ {I18N_NOOP("2 Weeks"), 2 * 60*60*24*7},
+ {I18N_NOOP("3 Weeks"), 3 * 60*60*24*7},
+ {I18N_NOOP("4 Weeks"), 4 * 60*60*24*7},
+
+ {I18N_NOOP("1 Month"), 1 * 60*60*24*30},
+ {I18N_NOOP("2 Months"), 2 * 60*60*24*30},
+ {I18N_NOOP("3 Months"), 3 * 60*60*24*30},
+ {I18N_NOOP("4 Months"), 4 * 60*60*24*30},
+ {I18N_NOOP("5 Months"), 5 * 60*60*24*30},
+ {I18N_NOOP("6 Months"), 6 * 60*60*24*30},
+ {0, 0}
+ };
+
+
+ThresholdOptions::ThresholdOptions(KComboBox * lessons, QueryManager * m, QWidget* parent, const char* name, WFlags fl)
+: ThresholdOptionsBase(parent, name, fl), m_lessons(lessons)
+{
+ connect(lessoncomp, SIGNAL(activated(int)), SLOT(slotSetLessonComp(int)));
+ connect(lessonlist, SIGNAL(selectionChanged()), SIGNAL(widgetModified()));
+ connect(b_all_less, SIGNAL(clicked()), SLOT(slotSelectAll()));
+ connect(b_none_less, SIGNAL(clicked()), SLOT(slotSelectNone()));
+ connect(typecomp, SIGNAL(activated(int)), SLOT(slotSetTypeComp(int)));
+ connect(typelist, SIGNAL(activated(int)), SLOT(slotComboActivated(int)));
+ connect(gradecomp, SIGNAL(activated(int)), SLOT(slotSetGradeComp(int)));
+ connect(gradelist, SIGNAL(activated(int)), SLOT(slotComboActivated(int)));
+ connect(querycomp, SIGNAL(activated(int)), SLOT(slotSetQueryComp(int)));
+ connect(querylist, SIGNAL(activated(int)), SLOT(slotComboActivated(int)));
+ connect(badcomp, SIGNAL(activated(int)), SLOT(slotSetBadComp(int)));
+ connect(badlist, SIGNAL(activated(int)), SLOT(slotComboActivated(int)));
+ connect(datecomp, SIGNAL(activated(int)), SLOT(slotSetDateComp(int)));
+ connect(datelist, SIGNAL(activated(int)), SLOT(slotComboActivated(int)));
+
+ m_queryManager = m;
+ fillWidgets();
+ updateWidgets();
+}
+
+void ThresholdOptions::fillWidgets()
+{
+ Prefs::EnumCompType::type *ct;
+ ThreshListRef *ref;
+
+ lessonlist->clear();
+ for (int i = 1; i < (int) m_lessons->count(); i++ ) // first in lessons is <no lesson> !
+ lessonlist->insertItem (m_lessons->text(i));
+
+ // limits and threshholds (the five comboboxes on the right)
+ gradelist->clear();
+ for (int i = 1; i <= KV_MAX_GRADE; i++)
+ gradelist->insertItem (m_queryManager->gradeStr(i));
+
+ typelist->clear();
+ all_maintypes = QueryManager::getRelation(true); // collect main types
+ for (int i = 0; i < (int) all_maintypes.size(); i++)
+ typelist->insertItem (all_maintypes[i].longStr());
+
+ badlist->clear();
+ querylist->clear();
+ for (int i = 0; i <= 15; i++)
+ {
+ badlist->insertItem(QString::number(i));
+ querylist->insertItem(QString::number(i));
+ }
+
+ ref = Threshdate_itemlist;
+ datelist->clear();
+ while (ref->text != 0 )
+ {
+ datelist->insertItem (i18n(ref->text));
+ ref++;
+ }
+
+ //compare-functions (the lesson combobox and the five comboboxes on the left)
+ ct = less_complist;
+ lessoncomp->clear();
+ while (*ct != Prefs::EnumCompType::type(-1) )
+ {
+ lessoncomp->insertItem (m_queryManager->compStr(*ct));
+ ct++;
+ }
+
+ ct = type_complist;
+ typecomp->clear();
+ while (*ct != Prefs::EnumCompType::type(-1) )
+ {
+ typecomp->insertItem (m_queryManager->compStr(*ct));
+ ct++;
+ }
+
+ ct = query_complist;
+ querycomp->clear();
+ while (*ct != Prefs::EnumCompType::type(-1) )
+ {
+ querycomp->insertItem (m_queryManager->compStr(*ct));
+ ct++;
+ }
+
+ ct = bad_complist;
+ badcomp->clear();
+ while (*ct != Prefs::EnumCompType::type(-1) ) {
+ badcomp->insertItem (m_queryManager->compStr(*ct));
+ ct++;
+ }
+
+ ct = grade_complist;
+ gradecomp->clear();
+ while (*ct != Prefs::EnumCompType::type(-1) ) {
+ gradecomp->insertItem (m_queryManager->compStr(*ct));
+ ct++;
+ }
+
+ ct = date_complist;
+ datecomp->clear();
+ while (*ct != Prefs::EnumCompType::type(-1) ) {
+ datecomp->insertItem (m_queryManager->compStr(*ct));
+ ct++;
+ }
+}
+
+void ThresholdOptions::updateWidgets()
+{
+ int index = 0;
+ Prefs::EnumCompType::type *ct;
+ ThreshListRef *ref;
+
+ vector<int> sel = m_queryManager->lessonItems();
+ if (sel.size() != 0)
+ {
+ for (int i = 0; i < (int) sel.size(); i++)
+ {
+ if (sel[i] > 0 && sel[i]-1 < (int) lessonlist->count()) // 0 = not assigned lesson
+ {
+ lessonlist->setCurrentItem(sel[i]-1); // important with qt1.x!
+ lessonlist->setSelected(sel[i]-1, true);
+ }
+ }
+ }
+
+ gradelist->setCurrentItem(Prefs::gradeItem());
+
+ for (int i = 0; i < typelist->count(); i++)
+ {
+ if (Prefs::typeItem() == all_maintypes[i].shortStr())
+ index = i;
+ }
+ typelist->setCurrentItem(index);
+
+ badlist->setCurrentItem(Prefs::badItem());
+ querylist->setCurrentItem(Prefs::queryItem());
+
+ ref = Threshdate_itemlist;
+ while (ref->text != 0 ) {
+ if (Prefs::dateItem() == ref->num)
+ index = ref - Threshdate_itemlist;
+ ref++;
+ }
+ datelist->setCurrentItem(index);
+
+ //compare-functions (the lesson combobox and the five comboboxes on the left)
+ ct = less_complist;
+ while (*ct != Prefs::compType(Prefs::EnumType::Lesson))
+ ct++;
+ lessoncomp->setCurrentItem (ct - less_complist);
+ slotSetLessonComp(ct - less_complist);
+
+ ct = type_complist;
+ while (*ct != Prefs::compType(Prefs::EnumType::WordType))
+ ct++;
+ typecomp->setCurrentItem(ct - type_complist);
+ typelist->setEnabled(ct - type_complist != 0); // don`t care == 0
+
+ ct = query_complist;
+ while (*ct != Prefs::compType(Prefs::EnumType::Query))
+ ct++;
+ querycomp->setCurrentItem (ct - query_complist);
+ querylist->setEnabled(ct - query_complist != 0); // don`t care == 0
+
+ ct = bad_complist;
+ while (*ct != Prefs::compType(Prefs::EnumType::Bad))
+ ct++;
+ badcomp->setCurrentItem(ct - bad_complist);
+ badlist->setEnabled(ct - bad_complist != 0); // don`t care == 0
+
+ ct = grade_complist;
+ while (*ct != Prefs::compType(Prefs::EnumType::Grade))
+ ct++;
+ gradecomp->setCurrentItem (ct - grade_complist);
+ gradelist->setEnabled(ct - grade_complist != 0); // don`t care == 0
+
+ ct = date_complist;
+ while (*ct != Prefs::compType(Prefs::EnumType::Date))
+ ct++;
+ datecomp->setCurrentItem (ct - date_complist);
+ if (date_complist[ct - date_complist] == Prefs::EnumCompType::Before ||
+ date_complist[ct - date_complist] == Prefs::EnumCompType::Within)
+ datelist->setEnabled(true);
+ else
+ datelist->setEnabled(false);
+}
+
+void ThresholdOptions::slotSelectAll()
+{
+ lessonlist->selectAll(true);
+ emit widgetModified();
+}
+
+void ThresholdOptions::slotSelectNone()
+{
+ lessonlist->selectAll(false);
+ emit widgetModified();
+}
+
+
+void ThresholdOptions::slotComboActivated(int)
+{
+ emit widgetModified();
+}
+
+
+void ThresholdOptions::slotSetGradeComp(int i)
+{
+ gradelist->setEnabled(i != 0); // don`t care == 0
+ emit widgetModified();
+}
+
+void ThresholdOptions::slotSetBadComp(int i)
+{
+ badlist->setEnabled(i != 0); // don`t care == 0
+ emit widgetModified();
+}
+
+void ThresholdOptions::slotSetQueryComp(int i)
+{
+ querylist->setEnabled(i != 0); // don`t care == 0
+ emit widgetModified();
+}
+
+void ThresholdOptions::slotSetTypeComp(int i)
+{
+ typelist->setEnabled(i != 0); // don`t care == 0
+ emit widgetModified();
+}
+
+void ThresholdOptions::slotSetLessonItems()
+{
+ vector<int> sel;
+ int cnt = 0;
+
+ for (int i = 0; i < (int) lessonlist->count(); i++)
+ {
+ if (lessonlist->isSelected(i))
+ {
+ sel.push_back(i+1); // 0 = not assigned lesson
+ cnt++;
+ }
+ }
+
+ QString s;
+ s.setNum(cnt);
+ l_count->setText (s);
+
+ m_queryManager->setLessonItems(sel);
+}
+
+void ThresholdOptions::slotSetLessonComp(int i)
+{
+ if (less_complist[i] == Prefs::EnumCompType::OneOf || less_complist[i] == Prefs::EnumCompType::NotOneOf)
+ {
+ lessonlist->setEnabled(true);
+ b_all_less->setEnabled(true);
+ b_none_less->setEnabled(true);
+ l_count->setEnabled(true);
+ l_lesson->setEnabled(true);
+ }
+ else
+ {
+ l_count->setEnabled(false);
+ lessonlist->setEnabled(false);
+ b_all_less->setEnabled(false);
+ b_none_less->setEnabled(false);
+ l_lesson->setEnabled(false);
+ }
+
+ if (i < 0)
+ return;
+
+ emit widgetModified();
+}
+
+void ThresholdOptions::slotSetDateComp(int i)
+{
+ if (date_complist[i] == Prefs::EnumCompType::Before || date_complist[i] == Prefs::EnumCompType::Within)
+ datelist->setEnabled(true);
+ else
+ datelist->setEnabled(false);
+ emit widgetModified();
+}
+
+void ThresholdOptions::slotBlockExpire(bool block, bool expire)
+{
+ bool enable = !(block | expire);
+
+ gradecomp->setEnabled(enable);
+ gradelist->setEnabled(enable && gradecomp->currentItem() != 0);
+ label_grade->setEnabled(enable);
+
+ datecomp->setEnabled(enable);
+ datelist->setEnabled(enable && datecomp->currentItem() != 0);
+ label_qdate->setEnabled(enable);
+
+ querycomp->setEnabled(enable);
+ querylist->setEnabled(enable && querycomp->currentItem() != 0);
+ label_qcount->setEnabled(enable);
+
+ badcomp->setEnabled(enable);
+ badlist->setEnabled(enable && badcomp->currentItem() != 0);
+ label_bcount->setEnabled(enable);
+}
+
+bool ThresholdOptions::isDefault()
+{
+ return less_complist[lessoncomp->currentItem()] == Prefs::EnumCompType::Current &&
+ type_complist[typecomp->currentItem()] == Prefs::EnumCompType::DontCare &&
+ grade_complist[gradecomp->currentItem()] == Prefs::EnumCompType::DontCare &&
+ date_complist[datecomp->currentItem()] == Prefs::EnumCompType::DontCare &&
+ query_complist[querycomp->currentItem()] == Prefs::EnumCompType::DontCare &&
+ bad_complist[badcomp->currentItem()] == Prefs::EnumCompType::DontCare;
+}
+
+void ThresholdOptions::updateSettings()
+{
+ Prefs::setCompType(Prefs::EnumType::Lesson, less_complist[lessoncomp->currentItem()]);
+ slotSetLessonItems();
+ Prefs::setCompType(Prefs::EnumType::WordType, type_complist[typecomp->currentItem()]);
+ Prefs::setTypeItem(all_maintypes[typelist->currentItem()].shortStr());
+ Prefs::setCompType(Prefs::EnumType::Grade, grade_complist[gradecomp->currentItem()]);
+ Prefs::setGradeItem(gradelist->currentItem() + 1);
+ Prefs::setCompType(Prefs::EnumType::Query, query_complist[querycomp->currentItem()]);
+ Prefs::setQueryItem(querylist->currentItem());
+ Prefs::setCompType(Prefs::EnumType::Bad, bad_complist[badcomp->currentItem()]);
+ Prefs::setBadItem(badlist->currentItem());
+ Prefs::setCompType(Prefs::EnumType::Date, date_complist[datecomp->currentItem()]);
+ Prefs::setDateItem(Threshdate_itemlist[datelist->currentItem()].num);
+}
+
+bool ThresholdOptions::hasChanged()
+{
+ return less_complist[lessoncomp->currentItem()] != Prefs::compType(Prefs::EnumType::Lesson) ||
+ type_complist[typecomp->currentItem()] != Prefs::compType(Prefs::EnumType::WordType) ||
+ grade_complist[gradecomp->currentItem()] != Prefs::compType(Prefs::EnumType::Grade) ||
+ query_complist[querycomp->currentItem()] != Prefs::compType(Prefs::EnumType::Query) ||
+ bad_complist[badcomp->currentItem()] != Prefs::compType(Prefs::EnumType::Bad) ||
+ date_complist[datecomp->currentItem()] != Prefs::compType(Prefs::EnumType::Date) ||
+ all_maintypes[typelist->currentItem()].shortStr() != Prefs::typeItem() ||
+ gradelist->currentItem() + 1 != Prefs::gradeItem() ||
+ querylist->currentItem() != Prefs::queryItem() ||
+ badlist->currentItem() != Prefs::badItem() ||
+ Threshdate_itemlist[datelist->currentItem()].num != Prefs::dateItem();
+}
+
+#include "thresholdoptions.moc"
diff --git a/kvoctrain/kvoctrain/common-dialogs/thresholdoptions.h b/kvoctrain/kvoctrain/common-dialogs/thresholdoptions.h
new file mode 100644
index 00000000..f64a99bb
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/thresholdoptions.h
@@ -0,0 +1,71 @@
+/***************************************************************************
+
+ threshold options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Tue Apr 5 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef THRESHOLDOPTIONS_H
+#define THRESHOLDOPTIONS_H
+
+#include "thresholdoptionsbase.h"
+#include "QueryManager.h"
+
+class KComboBox;
+
+class ThresholdOptions : public ThresholdOptionsBase
+{
+ Q_OBJECT
+
+public:
+ ThresholdOptions(KComboBox * lessons, QueryManager * m, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+ void updateWidgets();
+ bool hasChanged();
+ bool isDefault();
+ void updateSettings();
+
+signals:
+ void widgetModified();
+
+protected slots:
+ void slotSelectAll();
+ void slotSelectNone();
+ void slotComboActivated(int);
+ void slotSetGradeComp(int);
+ void slotSetBadComp(int);
+ void slotSetQueryComp(int);
+ void slotSetTypeComp(int);
+ void slotSetLessonItems();
+ void slotSetLessonComp(int);
+ void slotSetDateComp(int);
+ void slotBlockExpire(bool block, bool expire);
+
+private:
+ void fillWidgets();
+
+ KComboBox * m_lessons;
+ QueryManager * m_queryManager;
+ vector<TypeRelation> all_maintypes;
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/thresholdoptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/thresholdoptionsbase.ui
new file mode 100644
index 00000000..4cf771c2
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/thresholdoptionsbase.ui
@@ -0,0 +1,298 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ThresholdOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ThresholdOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>402</width>
+ <height>313</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>typecomp</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1">
+ <property name="name">
+ <cstring>querycomp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="1">
+ <property name="name">
+ <cstring>badcomp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>label_grade</cstring>
+ </property>
+ <property name="text">
+ <string>G&amp;rade:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>gradecomp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>label_bcount</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Bad count:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>badcomp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>label_qdate</cstring>
+ </property>
+ <property name="text">
+ <string>Last q&amp;uery:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>datecomp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="5" column="1">
+ <property name="name">
+ <cstring>datecomp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="2">
+ <property name="name">
+ <cstring>badlist</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="2">
+ <property name="name">
+ <cstring>querylist</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="5" column="2">
+ <property name="name">
+ <cstring>datelist</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="2">
+ <property name="name">
+ <cstring>typelist</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>label_type</cstring>
+ </property>
+ <property name="text">
+ <string>Word t&amp;ype:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typecomp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="2">
+ <property name="name">
+ <cstring>gradelist</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <property name="name">
+ <cstring>gradecomp</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>label_qcount</cstring>
+ </property>
+ <property name="text">
+ <string>Query c&amp;ount:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>querycomp</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>b_all_less</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;All</string>
+ </property>
+ </widget>
+ <widget class="QListBox" row="1" column="3" rowspan="3" colspan="2">
+ <property name="name">
+ <cstring>lessonlist</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="selectionMode">
+ <enum>Multi</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>b_none_less</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;None</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>l_lesson</cstring>
+ </property>
+ <property name="text">
+ <string>Selected lessons:</string>
+ </property>
+ </widget>
+ <spacer row="3" column="2">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>80</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>l_count</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>label_lesson</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Lesson:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>lessoncomp</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>lessoncomp</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="6" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>290</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kvoctrain/kvoctrain/common-dialogs/viewoptions.cpp b/kvoctrain/kvoctrain/common-dialogs/viewoptions.cpp
new file mode 100644
index 00000000..8c0cd2c6
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/viewoptions.cpp
@@ -0,0 +1,44 @@
+/***************************************************************************
+
+ view options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Mar 31 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qcheckbox.h>
+
+#include "viewoptions.h"
+
+ViewOptions::ViewOptions(QWidget* parent, const char* name, WFlags fl)
+: ViewOptionsBase(parent,name,fl)
+{
+ kcfg_GradeCol0->setEnabled(kcfg_UseGradeCol->isChecked());
+ kcfg_GradeCol1->setEnabled(kcfg_UseGradeCol->isChecked());
+ kcfg_GradeCol2->setEnabled(kcfg_UseGradeCol->isChecked());
+ kcfg_GradeCol3->setEnabled(kcfg_UseGradeCol->isChecked());
+ kcfg_GradeCol4->setEnabled(kcfg_UseGradeCol->isChecked());
+ kcfg_GradeCol5->setEnabled(kcfg_UseGradeCol->isChecked());
+ kcfg_GradeCol6->setEnabled(kcfg_UseGradeCol->isChecked());
+ kcfg_GradeCol7->setEnabled(kcfg_UseGradeCol->isChecked());
+}
+
+#include "viewoptions.moc"
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/viewoptions.h b/kvoctrain/kvoctrain/common-dialogs/viewoptions.h
new file mode 100644
index 00000000..fd3b3b1d
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/viewoptions.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+
+ view options for kvoctrain
+
+ -----------------------------------------------------------------------
+
+ begin : Thu Mar 31 2005
+
+ copyright :(C) 2005 Peter Hedlund
+
+ email : peter.hedlund@kdemail.net
+
+ -----------------------------------------------------------------------
+
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef VIEWOPTIONS_H
+#define VIEWOPTIONS_H
+
+#include "viewoptionsbase.h"
+
+class ViewOptions : public ViewOptionsBase
+{
+ Q_OBJECT
+
+public:
+ ViewOptions(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+
+};
+
+#endif
+
diff --git a/kvoctrain/kvoctrain/common-dialogs/viewoptionsbase.ui b/kvoctrain/kvoctrain/common-dialogs/viewoptionsbase.ui
new file mode 100644
index 00000000..3bb2af24
--- /dev/null
+++ b/kvoctrain/kvoctrain/common-dialogs/viewoptionsbase.ui
@@ -0,0 +1,536 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ViewOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ViewOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>592</width>
+ <height>412</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KFontRequester" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_TableFont</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TableFontLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Table font:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_TableFont</cstring>
+ </property>
+ </widget>
+ <widget class="KFontRequester" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_IPAFont</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>IPAFontLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;IPA font:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_IPAFont</cstring>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>gradegroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Grade Colors</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>l_lev4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Level &amp;4:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol4</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>l_lev5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Level &amp;5:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol5</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>l_lev7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Level &amp;7:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol7</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>l_lev6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Level &amp;6:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol6</cstring>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="8" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol0</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;N</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="8" column="0">
+ <property name="name">
+ <cstring>l_lev0</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Not &amp;queried:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol0</cstring>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="7" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;1</string>
+ </property>
+ <property name="accel">
+ <string>Alt+1</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Color for the grade 1</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Click here to change the color for grade 1.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>l_lev1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Level &amp;1:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol1</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>l_lev2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Level &amp;2:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol2</cstring>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="6" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;2</string>
+ </property>
+ <property name="accel">
+ <string>Alt+2</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Color for the grade 2</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Click here to change the color for grade 2.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>l_lev3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Level &amp;3:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_GradeCol3</cstring>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="5" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;3</string>
+ </property>
+ <property name="accel">
+ <string>Alt+3</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Color for the grade 3</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Click here to change the color for grade 3.</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="4" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;4</string>
+ </property>
+ <property name="accel">
+ <string>Alt+4</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Color for the grade 4</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Click here to change the color for grade 4.</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="3" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;5</string>
+ </property>
+ <property name="accel">
+ <string>Alt+5</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Color for the grade 5</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Click here to change the color for grade 5.</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="2" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;6</string>
+ </property>
+ <property name="accel">
+ <string>Alt+6</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Color for the grade 6</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Click here to change the color for grade 6.</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_GradeCol7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;7</string>
+ </property>
+ <property name="accel">
+ <string>Alt+7</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Color for the grade 7</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Click here to change the color for grade 7.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_UseGradeCol</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Use colors</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If it is unchecked, you will just have black on white for the grades; if it is checked, the colors below will be chosen.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If it is unchecked, you will just have black on white for the grades; if it is checked, the colors below will be chosen.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol7</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol6</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol5</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol4</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol3</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol2</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol1</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_UseGradeCol</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_GradeCol0</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>kcfg_GradeCol0</tabstop>
+ <tabstop>kcfg_GradeCol7</tabstop>
+ <tabstop>kcfg_GradeCol6</tabstop>
+ <tabstop>kcfg_GradeCol5</tabstop>
+ <tabstop>kcfg_GradeCol4</tabstop>
+ <tabstop>kcfg_GradeCol3</tabstop>
+ <tabstop>kcfg_GradeCol2</tabstop>
+ <tabstop>kcfg_GradeCol1</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in declaration">kcolorbutton.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kfontrequester.h</includehint>
+ <includehint>kfontrequester.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+</includehints>
+</UI>