KDevelop API Documentation

knotes_plugin.cpp

Go to the documentation of this file.
00001 /*
00002        This file is part of Kontact
00003        Copyright (c) 2002 Daniel Molkentin <molkentin@kde.org>
00004        
00005        This library is free software; you can redistribute it and/or
00006        modify it under the terms of the GNU Library General Public
00007        License as published by the Free Software Foundation; either
00008        version 2 of the License, or (at your option) any later version.
00009        
00010        This library is distributed in the hope that it will be useful,
00011        but WITHOUT ANY WARRANTY; without even the implied warranty of
00012        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013        Library General Public License for more details.
00014        
00015        You should have received a copy of the GNU Library General Public License
00016        along with this library; see the file COPYING.LIB.  If not, write to
00017        the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018        Boston, MA 02111-1307, USA.
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     // showPart();
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"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:41 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003