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();
59 QStringList languageNames;
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());
79 m_doc->setAuthor(authorLineEdit->text());
80 m_doc->setAuthorContact(contactLineEdit->text());
81 m_doc->setLicense(licenseComboBox->currentText());
82 m_doc->setDocumentComment(commentTextEdit->toPlainText());
83 m_doc->setCategory(categoryComboBox->currentText());
85 if (m_showLanguages) {
86 acceptLanguageConfiguration();
90 void DocumentProperties::acceptLanguageConfiguration()
92 QString firstLanguage = firstLanguageComboBox->currentText();
94 QString secondLanguage = secondLanguageComboBox->currentText();
98 foreach (
const QString &code, KGlobal::locale()->allLanguagesList() ) {
99 if ( firstLanguage == KGlobal::locale()->languageCodeToName(code) ) {
102 if ( secondLanguage == KGlobal::locale()->languageCodeToName(code) ) {
107 m_doc->identifier(0).setLocale(firstLocale);
108 m_doc->identifier(0).setName(firstLanguage);
109 m_doc->identifier(1).setLocale(secondLocale);
110 m_doc->identifier(1).setName(secondLanguage);
113 #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)
static ParleyMainWindow * instance()
void slotUpdateWindowCaption()
Update the title bar of the main window with the current document.