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

kontact

  • sources
  • kde-4.14
  • kdepim
  • kontact
  • plugins
  • korganizer
journalplugin.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Kontact.
3 
4  Copyright (c) 2004,2009 Allen Winter <winter@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "journalplugin.h"
26 #include "calendarinterface.h"
27 #include "korg_uniqueapp.h"
28 
29 #include <KontactInterface/Core>
30 
31 #include <KActionCollection>
32 #include <KIconLoader>
33 #include <KLocalizedString>
34 #include <KDebug>
35 #include <QtDBus/QtDBus>
36 
37 EXPORT_KONTACT_PLUGIN( JournalPlugin, journal )
38 
39 JournalPlugin::JournalPlugin( KontactInterface::Core *core, const QVariantList & )
40  : KontactInterface::Plugin( core, core, "korganizer", "journal" ), mIface( 0 )
41 {
42  setComponentData( KontactPluginFactory::componentData() );
43  KIconLoader::global()->addAppDir( QLatin1String("korganizer") );
44  KIconLoader::global()->addAppDir( QLatin1String("kdepim") );
45 
46  KAction *action =
47  new KAction( KIcon( QLatin1String("journal-new") ),
48  i18nc( "@action:inmenu", "New Journal..." ), this );
49  actionCollection()->addAction( QLatin1String("new_journal"), action );
50  action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_J ) );
51  action->setHelpText(
52  i18nc( "@info:status", "Create a new journal" ) );
53  action->setWhatsThis(
54  i18nc( "@info:whatsthis",
55  "You will be presented with a dialog where you can create "
56  "a new journal entry." ) );
57  connect( action, SIGNAL(triggered(bool)), SLOT(slotNewJournal()) );
58  insertNewAction( action );
59 
60  KAction *syncAction =
61  new KAction( KIcon( QLatin1String("view-refresh") ),
62  i18nc( "@action:inmenu", "Sync Journal" ), this );
63  actionCollection()->addAction( QLatin1String("journal_sync"), syncAction );
64  syncAction->setHelpText(
65  i18nc( "@info:status", "Synchronize groupware journal" ) );
66  syncAction->setWhatsThis(
67  i18nc( "@info:whatsthis",
68  "Choose this option to synchronize your groupware journal entries." ) );
69  connect( syncAction, SIGNAL(triggered(bool)), SLOT(slotSyncJournal()) );
70  insertSyncAction( syncAction );
71 
72  mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher(
73  new KontactInterface::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this );
74 }
75 
76 JournalPlugin::~JournalPlugin()
77 {
78 }
79 
80 KParts::ReadOnlyPart *JournalPlugin::createPart()
81 {
82  KParts::ReadOnlyPart *part = loadPart();
83 
84  if ( !part ) {
85  return 0;
86  }
87 
88  mIface = new OrgKdeKorganizerCalendarInterface(
89  QLatin1String("org.kde.korganizer"), QLatin1String("/Calendar"), QDBusConnection::sessionBus(), this );
90 
91  return part;
92 }
93 
94 void JournalPlugin::select()
95 {
96  interface()->showJournalView();
97 }
98 
99 QStringList JournalPlugin::invisibleToolbarActions() const
100 {
101  QStringList invisible;
102  invisible += QLatin1String("new_event");
103  invisible += QLatin1String("new_todo");
104  invisible += QLatin1String("new_journal");
105 
106  invisible += QLatin1String("view_whatsnext");
107  invisible += QLatin1String("view_day");
108  invisible += QLatin1String("view_nextx");
109  invisible += QLatin1String("view_month");
110  invisible += QLatin1String("view_workweek");
111  invisible += QLatin1String("view_week");
112  invisible += QLatin1String("view_list");
113  invisible += QLatin1String("view_todo");
114  invisible += QLatin1String("view_journal");
115  invisible += QLatin1String("view_timeline");
116  invisible += QLatin1String("view_timespent");
117 
118  return invisible;
119 }
120 
121 OrgKdeKorganizerCalendarInterface *JournalPlugin::interface()
122 {
123  if ( !mIface ) {
124  part();
125  }
126  Q_ASSERT( mIface );
127  return mIface;
128 }
129 
130 void JournalPlugin::slotNewJournal()
131 {
132  interface()->openJournalEditor( QString(), QDate() );
133 }
134 
135 void JournalPlugin::slotSyncJournal()
136 {
137 #if 0 //TODO porting !!!!
138  QDBusMessage message =
139  QDBusMessage::createMethodCall( "org.kde.kmail", "/Groupware",
140  "org.kde.kmail.groupware",
141  "triggerSync" );
142  message << QString( "Journal" );
143  QDBusConnection::sessionBus().send( message );
144 #else
145  kWarning() << " JournalPlugin::slotSyncJournal : need to port to Akonadi";
146 #endif
147 }
148 
149 bool JournalPlugin::createDBUSInterface( const QString &serviceType )
150 {
151  if ( serviceType == QLatin1String("DBUS/Organizer") || serviceType == QLatin1String("DBUS/Calendar") ) {
152  if ( part() ) {
153  return true;
154  }
155  }
156  return false;
157 }
158 
159 bool JournalPlugin::isRunningStandalone() const
160 {
161  return mUniqueAppWatcher->isRunningStandalone();
162 }
163 
JournalPlugin::interface
OrgKdeKorganizerCalendarInterface * interface()
Definition: journalplugin.cpp:121
JournalPlugin
Definition: journalplugin.h:35
QDBusConnection::sessionBus
QDBusConnection sessionBus()
JournalPlugin::createPart
KParts::ReadOnlyPart * createPart()
Definition: journalplugin.cpp:80
JournalPlugin::invisibleToolbarActions
QStringList invisibleToolbarActions() const
Definition: journalplugin.cpp:99
JournalPlugin::select
void select()
Definition: journalplugin.cpp:94
JournalPlugin::createDBUSInterface
bool createDBUSInterface(const QString &serviceType)
Definition: journalplugin.cpp:149
QDBusConnection::send
bool send(const QDBusMessage &message) const
QDate
JournalPlugin::~JournalPlugin
~JournalPlugin()
Definition: journalplugin.cpp:76
QString
QStringList
JournalPlugin::isRunningStandalone
bool isRunningStandalone() const
Definition: journalplugin.cpp:159
QDBusMessage
QLatin1String
QKeySequence
korg_uniqueapp.h
journalplugin.h
QDBusMessage::createMethodCall
QDBusMessage createMethodCall(const QString &service, const QString &path, const QString &interface, const QString &method)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kontact

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

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal