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 <dcopref.h> 00022 #include <kaboutdata.h> 00023 #include <kaction.h> 00024 #include <kdebug.h> 00025 #include <kgenericfactory.h> 00026 #include <kiconloader.h> 00027 #include <kstatusbar.h> 00028 00029 #include "core.h" 00030 #include "knotes_part.h" 00031 #include "summarywidget.h" 00032 00033 #include "knotes_plugin.h" 00034 00035 00036 typedef KGenericFactory< KNotesPlugin, Kontact::Core > KNotesPluginFactory; 00037 K_EXPORT_COMPONENT_FACTORY( libkontact_knotesplugin, 00038 KNotesPluginFactory( "kontact_knotesplugin" ) ) 00039 00040 00041 KNotesPlugin::KNotesPlugin( Kontact::Core *core, const char *, const TQStringList & ) 00042 : Kontact::Plugin( core, TQT_TQOBJECT(core), "knotes" ), 00043 mAboutData( 0 ) 00044 { 00045 setInstance( KNotesPluginFactory::instance() ); 00046 00047 insertNewAction( new KAction( i18n( "New Note..." ), "knotes", CTRL+SHIFT+Key_N, 00048 this, TQT_SLOT( slotNewNote() ), actionCollection(), "new_note" ) ); 00049 insertSyncAction( new KAction( i18n( "Synchronize Notes" ), "reload", 0, 00050 this, TQT_SLOT( slotSyncNotes() ), actionCollection(), "knotes_sync" ) ); 00051 } 00052 00053 KNotesPlugin::~KNotesPlugin() 00054 { 00055 } 00056 00057 KParts::ReadOnlyPart* KNotesPlugin::createPart() 00058 { 00059 return new KNotesPart( this, "notes" ); 00060 } 00061 00062 Kontact::Summary *KNotesPlugin::createSummaryWidget( TQWidget *parentWidget ) 00063 { 00064 return new KNotesSummaryWidget( this, parentWidget ); 00065 } 00066 00067 const KAboutData *KNotesPlugin::aboutData() 00068 { 00069 if ( !mAboutData ) { 00070 mAboutData = new KAboutData( "knotes", I18N_NOOP( "Notes Management" ), 00071 "0.5", I18N_NOOP( "Notes Management" ), 00072 KAboutData::License_GPL_V2, 00073 "(c) 2003-2004 The Kontact developers" ); 00074 mAboutData->addAuthor( "Michael Brade", "Current Maintainer", "brade@kde.org" ); 00075 mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" ); 00076 } 00077 00078 return mAboutData; 00079 } 00080 00081 00082 // private slots 00083 00084 void KNotesPlugin::slotNewNote() 00085 { 00086 if ( part() ) 00087 static_cast<KNotesPart *>( part() )->newNote(); 00088 } 00089 00090 void KNotesPlugin::slotSyncNotes() 00091 { 00092 DCOPRef ref( "kmail", "KMailICalIface" ); 00093 ref.send( "triggerSync", TQString("Note") ); 00094 } 00095 00096 #include "knotes_plugin.moc" 00097