3 * KEduca - Interactive Tests and Exams for KDE
7 * 2004: Henrique Pinto <henrique.pinto@kdemail.net>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "keduca_part.h"
25 #include "keducaview.h"
27 #include "configdialogbase.h"
29 #include <kaboutdata.h>
30 #include <kparts/genericfactory.h>
31 #include <kstdaction.h>
32 #include <kconfigdialog.h>
34 typedef KParts::GenericFactory
<KEducaPart
> KEducaPartFactory
;
35 K_EXPORT_COMPONENT_FACTORY( libkeducapart
, KEducaPartFactory
)
37 KEducaPart::KEducaPart( QWidget
*parentWidget
, const char *widgetName
,
38 QObject
*parent
, const char *name
,
39 const QStringList
&/*args*/ )
40 : KParts::ReadOnlyPart( parent
, name
)
42 setInstance( KEducaPartFactory::instance() );
44 m_view
= new KEducaView( parentWidget
, widgetName
);
50 setXMLFile( "keduca_partui.rc" );
53 KEducaPart::~KEducaPart()
57 KAboutData
* KEducaPart::createAboutData()
59 KAboutData
*data
= new KAboutData( "keduca", I18N_NOOP( "KEducaPart" ),
60 "0.2", I18N_NOOP( "KEduca KParts Component" ),
61 KAboutData::License_GPL
,
62 "(c) 2004, Henrique Pinto <henrique.pinto@kdemail.net>"
67 bool KEducaPart::openFile()
69 return m_view
->openURL( KURL( m_file
) );
72 void KEducaPart::setupActions()
74 KStdAction::preferences( this, SLOT( slotConfigure() ), actionCollection(), "configure" );
77 void KEducaPart::slotConfigure()
79 if ( KConfigDialog::showDialog( "KEducaSettings" ) )
82 KConfigDialog
*dialog
= new KConfigDialog( widget(), "KEducaSettings", Settings::self() );
83 ConfigDialogBase
*confDlg
= new ConfigDialogBase( 0, "ConfigDialogBase" );
84 dialog
->addPage( confDlg
, i18n("General"), "keduca" );
86 connect( dialog
, SIGNAL( settingsChanged() ), SLOT( updateConfiguration() ) );
91 void KEducaPart::updateConfiguration()
93 Settings::writeConfig();
96 #include "keduca_part.moc"