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

keduca

keduca_part.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  * KEduca - Interactive Tests and Exams for KDE
00004  *
00005  * Copyright (c)
00006  *
00007  * 2004: Henrique Pinto <henrique.pinto@kdemail.net>
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License
00011  * as published by the Free Software Foundation; either version 2
00012  * of the License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00022  */
00023  
00024 #include "keduca_part.h"
00025 #include "keducaview.h"
00026 #include "settings.h"
00027 #include "configdialogbase.h"
00028 
00029 #include <kaboutdata.h>
00030 #include <kparts/genericfactory.h>
00031 #include <kstdaction.h>
00032 #include <kconfigdialog.h>
00033 
00034 typedef KParts::GenericFactory<KEducaPart> KEducaPartFactory;
00035 K_EXPORT_COMPONENT_FACTORY( libkeducapart, KEducaPartFactory )
00036 
00037 KEducaPart::KEducaPart( QWidget *parentWidget, const char *widgetName,
00038                         QObject *parent, const char *name,
00039                         const QStringList &/*args*/ )
00040     : KParts::ReadOnlyPart( parent, name )
00041 {
00042     setInstance( KEducaPartFactory::instance() );
00043     
00044     m_view = new KEducaView( parentWidget, widgetName );
00045     m_view->show();
00046     setWidget( m_view );
00047     
00048     setupActions();
00049     
00050     setXMLFile( "keduca_partui.rc" );
00051 }
00052 
00053 KEducaPart::~KEducaPart()
00054 {
00055 }
00056 
00057 KAboutData* KEducaPart::createAboutData()
00058 {
00059     KAboutData *data = new KAboutData( "keduca", I18N_NOOP( "KEducaPart" ),
00060                                        "0.2", I18N_NOOP( "KEduca KParts Component" ),
00061                                        KAboutData::License_GPL,
00062                                        "(c) 2004, Henrique Pinto <henrique.pinto@kdemail.net>"
00063                                      );
00064     return data;
00065 }
00066 
00067 bool KEducaPart::openFile()
00068 {
00069     return m_view->openURL( KURL( m_file ) );
00070 }
00071 
00072 void KEducaPart::setupActions()
00073 {
00074     KStdAction::preferences( this, SLOT( slotConfigure() ), actionCollection(), "configure" );
00075 }
00076 
00077 void KEducaPart::slotConfigure()
00078 {
00079     if ( KConfigDialog::showDialog( "KEducaSettings" ) )
00080         return;
00081         
00082     KConfigDialog *dialog = new KConfigDialog( widget(), "KEducaSettings", Settings::self() );
00083     ConfigDialogBase *confDlg = new ConfigDialogBase( 0, "ConfigDialogBase" );
00084     dialog->addPage( confDlg, i18n("General"), "keduca" );
00085     
00086     connect( dialog, SIGNAL( settingsChanged() ), SLOT( updateConfiguration() ) );
00087     
00088     dialog->show();
00089 }
00090 
00091 void KEducaPart::updateConfiguration()
00092 {
00093     Settings::writeConfig();
00094 }
00095 
00096 #include "keduca_part.moc"

keduca

Skip menu "keduca"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
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