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

kontact

journalplugin.cpp

Go to the documentation of this file.
00001 /*
00002   This file is part of Kontact.
00003 
00004   Copyright (c) 2004 Allen Winter <winter@kde.org>
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 "journalplugin.h"
00026 #include "korg_uniqueapp.h"
00027 #include "calendarinterface.h"
00028 
00029 #include <kontactinterfaces/core.h>
00030 
00031 #include <kaction.h>
00032 #include <kactioncollection.h>
00033 #include <kdebug.h>
00034 #include <kgenericfactory.h>
00035 #include <kicon.h>
00036 #include <kiconloader.h>
00037 #include <kmessagebox.h>
00038 
00039 #include <QtDBus/QtDBus>
00040 
00041 EXPORT_KONTACT_PLUGIN( JournalPlugin, journal )
00042 
00043 JournalPlugin::JournalPlugin( Kontact::Core *core, const QVariantList & )
00044   : Kontact::Plugin( core, core, "korganizer" ), mIface( 0 )
00045 {
00046   setComponentData( KontactPluginFactory::componentData() );
00047   KIconLoader::global()->addAppDir( "korganizer" );
00048   KIconLoader::global()->addAppDir( "kdepim" );
00049 
00050   KAction *action = new KAction( KIcon( "journal-new" ), i18n( "New Journal..." ), this );
00051   actionCollection()->addAction( "new_journal", action );
00052   action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_J ) );
00053   connect( action, SIGNAL(triggered(bool)), SLOT(slotNewJournal()) );
00054   insertNewAction( action );
00055 
00056   KAction *syncAction = new KAction( KIcon( "view-refresh" ), i18n( "Synchronize Journal" ), this );
00057   actionCollection()->addAction( "journal_sync", syncAction );
00058   connect( syncAction, SIGNAL(triggered(bool)), SLOT(slotSyncJournal()) );
00059   insertSyncAction( syncAction );
00060 
00061   mUniqueAppWatcher = new Kontact::UniqueAppWatcher(
00062     new Kontact::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this );
00063 }
00064 
00065 JournalPlugin::~JournalPlugin()
00066 {
00067 }
00068 
00069 KParts::ReadOnlyPart *JournalPlugin::createPart()
00070 {
00071   KParts::ReadOnlyPart *part = loadPart();
00072 
00073   if ( !part ) {
00074     return 0;
00075   }
00076 
00077   mIface = new OrgKdeKorganizerCalendarInterface(
00078     "org.kde.korganizer", "/Calendar", QDBusConnection::sessionBus(), this );
00079 
00080   return part;
00081 }
00082 
00083 void JournalPlugin::select()
00084 {
00085   interface()->showJournalView();
00086 }
00087 
00088 QStringList JournalPlugin::invisibleToolbarActions() const
00089 {
00090   QStringList invisible;
00091   invisible += "new_event";
00092   invisible += "new_todo";
00093   invisible += "new_journal";
00094 
00095   invisible += "view_whatsnext";
00096   invisible += "view_day";
00097   invisible += "view_nextx";
00098   invisible += "view_month";
00099   invisible += "view_workweek";
00100   invisible += "view_week";
00101   invisible += "view_list";
00102   invisible += "view_todo";
00103   invisible += "view_journal";
00104   invisible += "view_timeline";
00105   invisible += "view_timespent";
00106 
00107   return invisible;
00108 }
00109 
00110 OrgKdeKorganizerCalendarInterface *JournalPlugin::interface()
00111 {
00112   if ( !mIface ) {
00113     part();
00114   }
00115   Q_ASSERT( mIface );
00116   return mIface;
00117 }
00118 
00119 void JournalPlugin::slotNewJournal()
00120 {
00121   interface()->openJournalEditor( "", QDate() );
00122 }
00123 
00124 void JournalPlugin::slotSyncJournal()
00125 {
00126   QDBusMessage message =
00127       QDBusMessage::createMethodCall( "org.kde.kmail", "/Groupware",
00128                                       "org.kde.kmail.groupware",
00129                                       "triggerSync" );
00130   message << QString( "Journal" );
00131   QDBusConnection::sessionBus().send( message );
00132 }
00133 
00134 bool JournalPlugin::createDBUSInterface( const QString &serviceType )
00135 {
00136   if ( serviceType == "DBUS/Organizer" || serviceType == "DBUS/Calendar" ) {
00137     if ( part() ) {
00138       return true;
00139     }
00140   }
00141   return false;
00142 }
00143 
00144 bool JournalPlugin::isRunningStandalone()
00145 {
00146   return mUniqueAppWatcher->isRunningStandalone();
00147 }
00148 
00149 #include "journalplugin.moc"

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