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

kremotecontrol

  • sources
  • kde-4.12
  • kdeutils
  • kremotecontrol
  • krcdnotifieritem
main.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010 Michael Zanetti <michael_zanetti@gmx.net>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 
18  As a special exception, permission is given to link this program
19  with any edition of Qt, and distribute the resulting executable,
20  without including the source code for Qt in the source distribution.
21 */
22 
23 #include "krcdnotifieritem.h"
24 
25 #include <kremotecontrol-version.h>
26 #include <KAboutData>
27 #include <KCmdLineArgs>
28 #include <KUniqueApplication>
29 #include <kdebug.h>
30 #include <kconfiggroup.h>
31 
32 #include <QtDBus/QDBusConnection>
33 
34 class KrcdNotifierApp : public KUniqueApplication
35 {
36  public:
37  KrcdNotifierApp() : m_item( 0 ) {
38  // ensure the Quit dialog's Cancel reponse does not close the app
39  setQuitOnLastWindowClosed( false );
40  QDBusConnection::sessionBus().connect(QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/kremotecontroldaemon" ), QLatin1String( "org.kde.krcd" ), QLatin1String( "unloadTray" ), this, SLOT(quit()));
41  }
42 
43  int newInstance() {
44  // Check if we already have a running alarm daemon widget
45  if(m_item) {
46  return 0;
47  }
48  m_item = new KrcdNotifierItem();
49  return 0;
50  }
51 
52  private:
53  KrcdNotifierItem *m_item;
54 
55  private Q_SLOTS:
56  void configChanged() {
57  KConfig config(QLatin1String( "kremotecontrolrc" ));
58  KConfigGroup globalGroup(&config, "Global");
59  if(!globalGroup.readEntry("ShowTrayIcon", true)){
60  quit();
61  }
62  }
63 };
64 
65 int main( int argc, char **argv ) {
66 
67  KAboutData aboutData("krcdnotifieritem", 0, ki18n("Remote Control"), KREMOTECONTROL_VERSION_STRING, ki18n("The KDE Infrared Remote Control Server"), KAboutData::License_GPL, ki18n("(c) 2010 Michael Zanetti, (c) 2010 Frank Scheffold"), ki18n("Control your desktop with your remote."), "http://utils.kde.org/projects/kremotecontrol");
68  aboutData.addAuthor(ki18n("Michael Zanetti"), ki18n("Maintainer"), "michael_zanetti@gmx.net");
69  aboutData.addAuthor(ki18n("Frank Scheffold"), ki18n("KDeveloper"), "fscheffold@googlemail.com");
70  aboutData.addCredit(ki18n("Gav Wood"), ki18n("Original KDELirc Author"), "gav@kde.org");
71  aboutData.setProgramIconName( QLatin1String( "krcd" ));
72 
73  KCmdLineArgs::init(argc, argv, &aboutData);
74 
75  KCmdLineOptions options;
76  KCmdLineArgs::addCmdLineOptions(options);
77  KUniqueApplication::addCmdLineOptions();
78 
79  if(!KrcdNotifierApp::start()) {
80  return 0;
81  }
82 
83  KrcdNotifierApp app;
84  app.disableSessionManagement();
85 
86  return app.exec();
87  kDebug() << "exiting...";
88 }
main
int main(int argc, char **argv)
Definition: main.cpp:65
KrcdNotifierItem
Definition: krcdnotifieritem.h:26
kremotecontrol-version.h
krcdnotifieritem.h
KREMOTECONTROL_VERSION_STRING
#define KREMOTECONTROL_VERSION_STRING
Definition: kremotecontrol-version.h:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kremotecontrol

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

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

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