knotes_plugin.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 #include <kmessagebox.h>
00022 #include <kaction.h>
00023 #include <kgenericfactory.h>
00024 #include <kiconloader.h>
00025 #include <kstatusbar.h>
00026
00027 #include <kdevcore.h>
00028 #include <kdevpartcontroller.h>
00029
00030 #include <kdebug.h>
00031
00032 #include "knotes_plugin.h"
00033 #include "knotes_part.h"
00034
00035 typedef KGenericFactory<KNotesPlugin> KNotesPluginFactory;
00036 K_EXPORT_COMPONENT_FACTORY( libkdevnotes, KNotesPluginFactory( "kdevnotes" ) );
00037
00038 KNotesPlugin::KNotesPlugin( QObject* parent, const char *name, const QStringList &)
00039 : KDevPlugin(i18n("Notes"), "knotes", parent, name ? name : "KDevNotes" ), m_part(0)
00040 {
00041 setInstance(KNotesPluginFactory::instance());
00042
00043 setXMLFile("kdevpart_notes.rc");
00044
00045 core()->insertNewAction(new KAction(i18n("New Note"), BarIcon("knotes"), 0, this, SLOT(slotNewNote()), actionCollection(), "new_note" ) );
00046
00047 connect( partController(), SIGNAL(partRemoved(KParts::Part*)),
00048 this, SLOT(slotPartRemoved(KParts::Part*)) );
00049
00050 (void) new KAction(i18n("Show Notes"), BarIcon("knotes"), 0, this, SLOT(slotShowNotes()), actionCollection(), "show_notes" );
00051
00052 }
00053
00054 KNotesPlugin::~KNotesPlugin()
00055 {
00056 }
00057
00058 KParts::Part* KNotesPlugin::part()
00059 {
00060 if (!m_part){
00061 m_part = new KNotesPart(this, "notes");
00062 }
00063
00064 return m_part;
00065 }
00066
00067 void KNotesPlugin::slotNewNote()
00068 {
00069 showPart();
00070 if ( m_part )
00071 m_part->slotNewNote();
00072 }
00073
00074 void KNotesPlugin::slotShowNotes()
00075 {
00076 showPart();
00077 }
00078
00079 void KNotesPlugin::slotPartRemoved( KParts::Part* part )
00080 {
00081 if( part == m_part ){
00082 m_part = 0;
00083 }
00084 }
00085
00086 #include "knotes_plugin.moc"
This file is part of the documentation for KDevelop Version 3.1.2.