keduca
keduca_part.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 & )
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"