kontact

knotes_plugin.cpp

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., 51 Franklin Street, Fifth Floor,
00018        Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include <kaboutdata.h>
00022 #include <kaction.h>
00023 #include <kdebug.h>
00024 #include <kgenericfactory.h>
00025 #include <kiconloader.h>
00026 #include <kstatusbar.h>
00027 
00028 #include "core.h"
00029 #include "knotes_part.h"
00030 #include "summarywidget.h"
00031 
00032 #include "knotes_plugin.h"
00033 
00034 
00035 typedef KGenericFactory< KNotesPlugin, Kontact::Core > KNotesPluginFactory;
00036 K_EXPORT_COMPONENT_FACTORY( libkontact_knotesplugin,
00037                             KNotesPluginFactory( "kontact_knotesplugin" ) )
00038 
00039 
00040 KNotesPlugin::KNotesPlugin( Kontact::Core *core, const char *, const QStringList & )
00041   : Kontact::Plugin( core, core, "knotes" ),
00042     mAboutData( 0 )
00043 {
00044   setInstance( KNotesPluginFactory::instance() );
00045 
00046   insertNewAction( new KAction( i18n( "New Note..." ), "knotes", CTRL+SHIFT+Key_N,
00047                    this, SLOT( slotNewNote() ), actionCollection(), "new_note" ) );
00048 }
00049 
00050 KNotesPlugin::~KNotesPlugin()
00051 {
00052 }
00053 
00054 KParts::ReadOnlyPart* KNotesPlugin::createPart()
00055 {
00056   return new KNotesPart( this, "notes" );
00057 }
00058 
00059 Kontact::Summary *KNotesPlugin::createSummaryWidget( QWidget *parentWidget )
00060 {
00061   return new KNotesSummaryWidget( this, parentWidget );
00062 }
00063 
00064 const KAboutData *KNotesPlugin::aboutData()
00065 {
00066   if ( !mAboutData ) {
00067     mAboutData = new KAboutData( "knotes", I18N_NOOP( "Notes Management" ),
00068                                  "0.5", I18N_NOOP( "Notes Management" ),
00069                                   KAboutData::License_GPL_V2,
00070                                   "(c) 2003-2004 The Kontact developers" );
00071     mAboutData->addAuthor( "Michael Brade", "Current Maintainer", "brade@kde.org" );
00072     mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" );
00073   }
00074 
00075   return mAboutData;
00076 }
00077 
00078 
00079 // private slots
00080 
00081 void KNotesPlugin::slotNewNote()
00082 {
00083   if ( part() )
00084       static_cast<KNotesPart *>( part() )->newNote();
00085 }
00086 
00087 #include "knotes_plugin.moc"
00088 
KDE Home | KDE Accessibility Home | Description of Access Keys