• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kontact

kjots_plugin.cpp

Go to the documentation of this file.
00001 /*
00002   This file is part of KJots.
00003 
00004   Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
00005 
00006   This program is free software; you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License as published by
00008   the Free Software Foundation; either version 2 of the License, or
00009   (at your option) any later version.
00010 
00011   This program is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014   GNU General Public License for more details.
00015 
00016   You should have received a copy of the GNU General Public License along
00017   with this program; if not, write to the Free Software Foundation, Inc.,
00018   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020   As a special exception, permission is given to link this program
00021   with any edition of Qt, and distribute the resulting executable,
00022   without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #include "kjots_plugin.h"
00026 
00027 #include <kontactinterfaces/core.h>
00028 #include <kjotspart.h>
00029 
00030 #include <kactioncollection.h>
00031 #include <kaction.h>
00032 #include <kcmdlineargs.h>
00033 #include <kdebug.h>
00034 #include <kgenericfactory.h>
00035 #include <kicon.h>
00036 #include <kiconloader.h>
00037 #include <kparts/componentfactory.h>
00038 
00039 class OrgKdeKJotsComponentInterface;
00040 
00041 EXPORT_KONTACT_PLUGIN( KJotsPlugin, kjots )
00042 
00043 KJotsPlugin::KJotsPlugin( Kontact::Core *core, const QVariantList & )
00044   : Kontact::Plugin( core, core, "kjots" ), m_interface( 0 )
00045 {
00046   setComponentData( KontactPluginFactory::componentData() );
00047 
00048   KAction *action = new KAction( KIcon( "document-new" ), i18n( "New KJots Page" ), this );
00049   actionCollection()->addAction( "new_kjots_page", action );
00050   action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_J ) );
00051   connect( action, SIGNAL(triggered(bool)), SLOT( newPage()) );
00052   insertNewAction( action );
00053 
00054   action = new KAction( KIcon( "address-book-new" ), i18n( "New KJots Book" ), this );
00055   actionCollection()->addAction( "new_kjots_book", action );
00056   action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_B ) );
00057   connect( action, SIGNAL(triggered(bool)), SLOT( newBook()) );
00058   insertNewAction( action );
00059 
00060   mUniqueAppWatcher = new Kontact::UniqueAppWatcher(
00061     new Kontact::UniqueAppHandlerFactory<KJotsUniqueAppHandler>(), this );
00062 }
00063 
00064 KJotsPlugin::~KJotsPlugin()
00065 {
00066 }
00067 
00068 bool KJotsPlugin::isRunningStandalone()
00069 {
00070   return mUniqueAppWatcher->isRunningStandalone();
00071 }
00072 
00073 QStringList KJotsPlugin::invisibleToolbarActions() const
00074 {
00075   return QStringList() << "new_page" << "new_book" ;
00076 }
00077 
00078 KParts::ReadOnlyPart *KJotsPlugin::createPart()
00079 {
00080   KParts::ReadOnlyPart *part = loadPart();
00081   if ( !part ) {
00082     return 0;
00083   }
00084 
00085   m_interface = new OrgKdeKJotsComponentInterface(
00086     "org.kde.kjots", "/KJotsComponent", QDBusConnection::sessionBus() );
00087 
00088   return part;
00089 }
00090 
00091 OrgKdeKJotsComponentInterface *KJotsPlugin::interface()
00092 {
00093   if ( !m_interface ) {
00094     part();
00095   }
00096   Q_ASSERT( m_interface );
00097   return m_interface;
00098 }
00099 
00100 void KJotsPlugin::newPage()
00101 {
00102   core()->selectPlugin( this );
00103   interface()->newPage();
00104 }
00105 
00106 void KJotsPlugin::newBook()
00107 {
00108   core()->selectPlugin( this );
00109   interface()->createNewBook();
00110 }
00111 
00112 void KJotsUniqueAppHandler::loadCommandLineOptions()
00113 {
00114   //  No command line args to load.
00115   KCmdLineArgs::addCmdLineOptions( KCmdLineOptions() );
00116 }
00117 
00118 int KJotsUniqueAppHandler::newInstance()
00119 {
00120   kDebug();
00121   // Ensure part is loaded
00122   (void)plugin()->part();
00123   org::kde::KJotsComponent kjots(
00124     "org.kde.kjots", "/KJotsComponent", QDBusConnection::sessionBus() );
00125   return Kontact::UniqueAppHandler::newInstance();
00126 
00127 }
00128 

kontact

Skip menu "kontact"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal