knotes_plugin.cpp
1 /*
2  This file is part of Kontact
3  Copyright (c) 2002 Daniel Molkentin <molkentin@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include <dcopref.h>
22 #include <tdeaboutdata.h>
23 #include <tdeaction.h>
24 #include <kdebug.h>
25 #include <kgenericfactory.h>
26 #include <kiconloader.h>
27 #include <kstatusbar.h>
28 
29 #include "core.h"
30 #include "knotes_part.h"
31 #include "summarywidget.h"
32 
33 #include "knotes_plugin.h"
34 
35 
36 typedef KGenericFactory< KNotesPlugin, Kontact::Core > KNotesPluginFactory;
37 K_EXPORT_COMPONENT_FACTORY( libkontact_knotesplugin,
38  KNotesPluginFactory( "kontact_knotesplugin" ) )
39 
40 
41 KNotesPlugin::KNotesPlugin( Kontact::Core *core, const char *, const TQStringList & )
42  : Kontact::Plugin( core, core, "knotes" ),
43  mAboutData( 0 )
44 {
45  setInstance( KNotesPluginFactory::instance() );
46 
47  insertNewAction( new TDEAction( i18n( "New Note..." ), "knotes", CTRL+SHIFT+Key_N,
48  this, TQ_SLOT( slotNewNote() ), actionCollection(), "new_note" ) );
49  insertSyncAction( new TDEAction( i18n( "Synchronize Notes" ), "reload", 0,
50  this, TQ_SLOT( slotSyncNotes() ), actionCollection(), "knotes_sync" ) );
51 }
52 
53 KNotesPlugin::~KNotesPlugin()
54 {
55 }
56 
57 KParts::ReadOnlyPart* KNotesPlugin::createPart()
58 {
59  return new KNotesPart( this, "notes" );
60 }
61 
62 Kontact::Summary *KNotesPlugin::createSummaryWidget( TQWidget *parentWidget )
63 {
64  return new KNotesSummaryWidget( this, parentWidget );
65 }
66 
67 const TDEAboutData *KNotesPlugin::aboutData()
68 {
69  if ( !mAboutData ) {
70  mAboutData = new TDEAboutData( "knotes", I18N_NOOP( "Notes Management" ),
71  "0.5", I18N_NOOP( "Notes Management" ),
72  TDEAboutData::License_GPL_V2,
73  "(c) 2003-2020 The Kontact developers" );
74  mAboutData->addAuthor( "Michael Brade", "", "brade@kde.org" );
75  mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" );
76  mAboutData->addAuthor( "TDE Team", "", "trinitydesktop.org" );
77  }
78 
79  return mAboutData;
80 }
81 
82 
83 // private slots
84 
85 void KNotesPlugin::slotNewNote()
86 {
87  if ( part() )
88  static_cast<KNotesPart *>( part() )->newNote();
89 }
90 
91 void KNotesPlugin::slotSyncNotes()
92 {
93  DCOPRef ref( "kmail", "KMailICalIface" );
94  ref.send( "triggerSync", TQString("Note") );
95 }
96 
97 #include "knotes_plugin.moc"
98 
Summary widget for display in the Summary View plugin.
Definition: summary.h:37