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

knotes

  • sources
  • kde-4.12
  • kdepim
  • knotes
  • apps
main.cpp
Go to the documentation of this file.
1 /*******************************************************************
2  KNotes -- Notes for the KDE project
3 
4  Copyright (c) 1997-2013, The KNotes Developers
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (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
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *******************************************************************/
20 
21 #include "kdepim-version.h"
22 #include "apps/application.h"
23 
24 #include <kcmdlineargs.h>
25 #include <kaboutdata.h>
26 #include <klocale.h>
27 #include <kxerrorhandler.h>
28 
29 #ifdef Q_WS_X11
30 #include <X11/Xlib.h>
31 #include <X11/Xatom.h>
32 #include <QX11Info>
33 #endif
34 
35 void remove_sm_from_client_leader();
36 KCmdLineOptions knotesOptions();
37 void knotesAuthors( KAboutData &aboutData );
38 
39 int main( int argc, char *argv[] )
40 {
41  KAboutData aboutData( "knotes",
42  0,
43  ki18n( "KNotes" ),
44  KDEPIM_VERSION,
45  ki18n( "KDE Notes" ),
46  KAboutData::License_GPL,
47  ki18n( "Copyright © 1997–2013 KNotes authors" ) );
48 
49  knotesAuthors( aboutData );
50 
51  KCmdLineArgs::init( argc, argv, &aboutData );
52 
53  // Command line options
54 
55  KCmdLineArgs::addCmdLineOptions( knotesOptions() );
56 
57  KUniqueApplication::addCmdLineOptions();
58 
59 
60  // Create Application
61 
62  Application app;
63  KGlobal::locale()->insertCatalog(QLatin1String("libkdepim"));
64 
65  remove_sm_from_client_leader();
66 
67  return app.exec();
68 }
69 
70 void remove_sm_from_client_leader()
71 {
72 #ifdef Q_WS_X11
73  Atom type;
74  int format, status;
75  unsigned long nitems = 0;
76  unsigned long extra = 0;
77  unsigned char *data = 0;
78 
79  Atom atoms[ 2 ];
80  char *atom_names[ 2 ] = { ( char * ) "WM_CLIENT_LEADER",
81  ( char * ) "SM_CLIENT_ID" };
82 
83  XInternAtoms( QX11Info::display(), atom_names, 2, False, atoms );
84 
85  QWidget w;
86  KXErrorHandler handler; // ignore X errors
87  status = XGetWindowProperty( QX11Info::display(), w.winId(), atoms[ 0 ], 0,
88  10000, false, XA_WINDOW, &type, &format, &nitems,
89  &extra, &data );
90 
91  if ( ( status == Success ) && !handler.error( false ) ) {
92  if ( data && ( nitems > 0 ) ) {
93  Window leader = * ( ( Window * ) data );
94  XDeleteProperty( QX11Info::display(), leader, atoms[ 1 ] );
95  }
96  XFree( data );
97  }
98 #endif
99 }
100 
101 KCmdLineOptions knotesOptions()
102 {
103  KCmdLineOptions options;
104 
105  options.add( "skip-note",
106  ki18n( "Suppress creation of a new note "
107  "on a non-unique instance." ) );
108 
109  return options;
110 }
111 
112 void knotesAuthors( KAboutData &aboutData )
113 {
114  aboutData.addAuthor( ki18n( "Guillermo Antonio Amaral Bastidas" ),
115  ki18n( "Maintainer" ),
116  "me@guillermoamaral.com" );
117  aboutData.addAuthor( ki18n( "Michael Brade" ),
118  ki18n( "Previous Maintainer" ),
119  "brade@kde.org" );
120  aboutData.addAuthor( ki18n( "Bernd Johannes Wuebben" ),
121  ki18n( "Original KNotes Author" ),
122  "wuebben@kde.org" );
123  aboutData.addAuthor( ki18n( "Wynn Wilkes" ),
124  ki18n( "Ported KNotes to KDE 2" ),
125  "wynnw@calderasystems.com" );
126  aboutData.addAuthor( ki18n( "Daniel Martin" ),
127  ki18n( "Network Interface" ),
128  "daniel.martin@pirack.com" );
129  aboutData.addAuthor( ki18n( "Bo Thorsen" ),
130  ki18n( "Started KDE Resource Framework Integration" ),
131  "bo@sonofthor.dk" );
132 
133  aboutData.addCredit( ki18n( "Bera Debajyoti" ),
134  ki18n( "Idea and initial code for the new look & feel" ),
135  "debajyotibera@gmail.com" );
136  aboutData.addCredit( ki18n( "Matthias Ettrich" ),
137  KLocalizedString(),
138  "ettrich@kde.org" );
139  aboutData.addCredit( ki18n( "David Faure" ),
140  KLocalizedString(),
141  "faure@kde.org" );
142  aboutData.addCredit( ki18n( "Matthias Kiefer" ),
143  KLocalizedString(),
144  "kiefer@kde.org" );
145  aboutData.addCredit( ki18n( "Luboš Luňák" ),
146  KLocalizedString(),
147  "l.lunak@kde.org" );
148  aboutData.addCredit( ki18n( "Laurent Montel" ),
149  KLocalizedString(),
150  "montel@kde.org" );
151  aboutData.addCredit( ki18n( "Dirk A. Mueller" ),
152  KLocalizedString(),
153  "dmuell@gmx.net" );
154  aboutData.addCredit( ki18n( "Carsten Pfeiffer" ),
155  KLocalizedString(),
156  "pfeiffer@kde.org" );
157  aboutData.addCredit( ki18n( "Harri Porten" ),
158  KLocalizedString(),
159  "porten@kde.org" );
160  aboutData.addCredit( ki18n( "Espen Sand" ),
161  KLocalizedString(),
162  "espen@kde.org" );
163 }
application.h
QWidget
knotesOptions
KCmdLineOptions knotesOptions()
Definition: main.cpp:101
knotesAuthors
void knotesAuthors(KAboutData &aboutData)
Definition: main.cpp:112
Application
Definition: application.h:28
remove_sm_from_client_leader
void remove_sm_from_client_leader()
Definition: main.cpp:70
main
int main(int argc, char *argv[])
Definition: main.cpp:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knotes

Skip menu "knotes"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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

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