• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

parley

grammardialog.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002     Copyright 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
00003  ***************************************************************************
00004 
00005  ***************************************************************************
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  ***************************************************************************/
00013 
00014 #include "grammardialog.h"
00015 
00016 #include "docprop-dialogs/UsageOptPage.h"
00017 #include "docprop-dialogs/TypeOptPage.h"
00018 #include "docprop-dialogs/TenseOptPage.h"
00019 #include "docprop-dialogs/LangPropPage.h"
00020 #include "languagesettings.h"
00021 #include <keduvocdocument.h>
00022 
00023 #include <KLocale>
00024 #include <KPageWidgetModel>
00025 #include <KIcon>
00026 #include <KConfig>
00027 #include <KGlobal>
00028 
00029 #include <QList>
00030 #include <QPixmap>
00031 
00032 
00033 GrammarDialog::GrammarDialog(KEduVocDocument *doc, QWidget *parent) : KPageDialog(parent)
00034 {
00035     setCaption(i18n("Grammar Properties"));
00036     setButtons(Ok|Cancel);
00037     setDefaultButton(Ok);
00038     setModal(true);
00039 
00040     setFaceType(KPageDialog::List);
00041 
00042     typeOptPage = new WordTypeOptionPage(doc, this);
00043     addPage(typeOptPage, i18nc("word types","Types"));
00044 
00045     tenseOptPage = new TenseOptPage(doc, 0);
00046     addPage(tenseOptPage, i18n("Tenses"));
00047 
00048     useOptPage = new UsageOptPage(doc, 0);
00049     addPage(useOptPage, i18nc("usage (area) of an expression", "Usage"));
00050 
00051     // add the language specific pages
00052     LangPropPage *lpp;
00053     for (int i = 0; i < doc->identifierCount(); i++) {
00054         QString s;
00055         s = doc->identifier(i).name();
00056 
00057         lpp = new LangPropPage(doc, i, 0);
00058         KPageWidgetItem *pageItem = new KPageWidgetItem(lpp, s);
00059         pageItem->setHeader(s);
00060 
00061         LanguageSettings currentSettings(doc->identifier(i).locale());
00062         currentSettings.readConfig();
00063         QString icon = currentSettings.icon();
00064         if ( !icon.isEmpty() ) {
00065             pageItem->setIcon(KIcon(icon));
00066         }
00067         addPage(pageItem);
00068         langPages.append(lpp);
00069     }
00070 
00071     KConfigGroup cg(KGlobal::config(), "GrammarDialog");
00072     restoreDialogSize(cg);
00073 }
00074 
00075 GrammarDialog::~GrammarDialog()
00076 {
00077     KConfigGroup cg(KGlobal::config(), "GrammarDialog");
00078     KDialog::saveDialogSize(cg);
00079     useOptPage->deleteLater();
00080     typeOptPage->deleteLater();
00081     tenseOptPage->deleteLater();
00082 }
00083 
00084 
00085 void GrammarDialog::accept()
00086 {
00087     useOptPage->accept();
00088     typeOptPage->accept();
00089     tenseOptPage->accept();
00090 
00091     foreach ( LangPropPage* langPage, langPages ) {
00092         langPage->accept();
00093     }
00094 
00095     KDialog::accept();
00096 }
00097 
00098 #include "grammardialog.moc"

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal