• 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
korg_uniqueapp.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KDE Kontact.
3 
4  Copyright (c) 2003 David Faure <faure@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library 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 GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "korg_uniqueapp.h"
23 #include "korganizer/korganizer_options.h"
24 
25 #include <KontactInterface/Core>
26 
27 #include <KStartupInfo>
28 #include <KWindowSystem>
29 
30 #include <QDBusMessage>
31 #include <QDBusConnection>
32 
33 void KOrganizerUniqueAppHandler::loadCommandLineOptions()
34 {
35  KCmdLineArgs::addCmdLineOptions( korganizer_options() );
36 }
37 
38 int KOrganizerUniqueAppHandler::newInstance()
39 {
40  // Ensure part is loaded
41  (void)plugin()->part();
42 
43  QDBusMessage message = QDBusMessage::createMethodCall( QLatin1String("org.kde.korganizer"),
44  QLatin1String("/Korganizer"),
45  QLatin1String("org.kde.korganizer.Korganizer"),
46  QLatin1String("handleCommandLine") );
47  QDBusConnection::sessionBus().send( message );
48 
49  // Bring korganizer's plugin to front
50  // This bit is duplicated from KUniqueApplication::newInstance()
51  QWidget *mWidget = mainWidget();
52  if ( mWidget ) {
53  mWidget->show();
54  KWindowSystem::forceActiveWindow( mWidget->winId() );
55  KStartupInfo::appStarted();
56  }
57 
58  // Then ensure the part appears in kontact.
59  // ALWAYS use the korganizer plugin; i.e. never show the todo nor journal
60  // plugins when creating a new instance via the command line, even if
61  // the command line options are empty; else we'd need to examine the
62  // options and then figure out which plugin we should show.
63  // kolab/issue3971
64  plugin()->core()->selectPlugin( QLatin1String("kontact_korganizerplugin") );
65  return 0;
66 }
QWidget
QDBusConnection::sessionBus
QDBusConnection sessionBus()
KOrganizerUniqueAppHandler::loadCommandLineOptions
virtual void loadCommandLineOptions()
Definition: korg_uniqueapp.cpp:33
QDBusConnection::send
bool send(const QDBusMessage &message) const
QWidget::winId
WId winId() const
QDBusMessage
QLatin1String
korg_uniqueapp.h
QWidget::show
void show()
KOrganizerUniqueAppHandler::newInstance
virtual int newInstance()
Definition: korg_uniqueapp.cpp:38
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