31 #include <keduvocdocument.h>
38 :
QWidget(parent), m_doc(doc), m_showLanguages(languageSetup)
42 titleLineEdit->setText(doc->title());
43 authorLineEdit->setText(doc->author());
44 contactLineEdit->setText(doc->authorContact());
45 licenseComboBox->setEditText(doc->license());
46 commentTextEdit->setText(doc->documentComment());
47 categoryComboBox->setEditText(doc->category());
50 prepareLanguageSelection();
52 languageGroupBox->setVisible(
false);
56 void DocumentProperties::prepareLanguageSelection()
58 QStringList codes = KGlobal::locale()->allLanguagesList();
60 foreach(
const QString & code, codes) {
61 languageNames.
append(KGlobal::locale()->languageCodeToName(code));
65 firstLanguageComboBox->addItems(languageNames);
66 firstLanguageComboBox->completionObject()->insertItems(languageNames);
67 firstLanguageComboBox->completionObject()->setIgnoreCase(
true);
68 secondLanguageComboBox->addItems(languageNames);
69 secondLanguageComboBox->completionObject()->insertItems(languageNames);
70 secondLanguageComboBox->completionObject()->setIgnoreCase(
true);
72 languageGroupBox->setVisible(
true);
77 m_doc->setTitle(titleLineEdit->text());
78 m_doc->setAuthor(authorLineEdit->text());
79 m_doc->setAuthorContact(contactLineEdit->text());
80 m_doc->setLicense(licenseComboBox->currentText());
81 m_doc->setDocumentComment(commentTextEdit->toPlainText());
82 m_doc->setCategory(categoryComboBox->currentText());
84 if (m_showLanguages) {
85 acceptLanguageConfiguration();
89 void DocumentProperties::acceptLanguageConfiguration()
91 QString firstLanguage = firstLanguageComboBox->currentText();
93 QString secondLanguage = secondLanguageComboBox->currentText();
97 foreach(
const QString & code, KGlobal::locale()->allLanguagesList()) {
98 if (firstLanguage == KGlobal::locale()->languageCodeToName(code)) {
101 if (secondLanguage == KGlobal::locale()->languageCodeToName(code)) {
106 m_doc->identifier(0).setLocale(firstLocale);
107 m_doc->identifier(0).setName(firstLanguage);
108 m_doc->identifier(1).setLocale(secondLocale);
109 m_doc->identifier(1).setName(secondLanguage);
112 #include "documentproperties.moc"
void accept()
Apply the settings. This is not a KDialog, so accept is not automatically called! ...
DocumentProperties(KEduVocDocument *doc, bool languageSetup, QWidget *parent)
void append(const T &value)