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

knotes

  • sources
  • kde-4.14
  • 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 <QDebug>
22 #include "kdepim-version.h"
23 #include "knotes_options.h"
24 #include "apps/application.h"
25 #include <KUniqueApplication>
26 #include <kcmdlineargs.h>
27 #include <kaboutdata.h>
28 #include <klocale.h>
29 #include <kxerrorhandler.h>
30 
31 #ifdef Q_WS_X11
32 #include <X11/Xlib.h>
33 #include <X11/Xatom.h>
34 #include <QX11Info>
35 #endif
36 
37 void remove_sm_from_client_leader();
38 KCmdLineOptions knotesOptions();
39 void knotesAuthors( KAboutData &aboutData );
40 
41 int main( int argc, char *argv[] )
42 {
43  KAboutData aboutData( "knotes",
44  0,
45  ki18n( "KNotes" ),
46  KDEPIM_VERSION,
47  ki18n( "KDE Notes" ),
48  KAboutData::License_GPL,
49  ki18n( "Copyright © 1997–2014 KNotes authors" ) );
50 
51  knotesAuthors( aboutData );
52 
53  KCmdLineArgs::init( argc, argv, &aboutData );
54 
55  // Command line options
56 
57  KCmdLineArgs::addCmdLineOptions( knotesOptions() );
58 
59  KUniqueApplication::addCmdLineOptions();
60 
61  if ( !Application::start() ) {
62  qDebug()<<" knotes already started";
63  return 0;
64  }
65 
66  // Create Application
67 
68  Application app;
69  KGlobal::locale()->insertCatalog(QLatin1String("libkdepim"));
70 
71  remove_sm_from_client_leader();
72 
73  return app.exec();
74 }
75 
76 void remove_sm_from_client_leader()
77 {
78 #ifdef Q_WS_X11
79  Atom type;
80  int format, status;
81  unsigned long nitems = 0;
82  unsigned long extra = 0;
83  unsigned char *data = 0;
84 
85  Atom atoms[ 2 ];
86  char *atom_names[ 2 ] = { ( char * ) "WM_CLIENT_LEADER",
87  ( char * ) "SM_CLIENT_ID" };
88 
89  XInternAtoms( QX11Info::display(), atom_names, 2, False, atoms );
90 
91  QWidget w;
92  KXErrorHandler handler; // ignore X errors
93  status = XGetWindowProperty( QX11Info::display(), w.winId(), atoms[ 0 ], 0,
94  10000, false, XA_WINDOW, &type, &format, &nitems,
95  &extra, &data );
96 
97  if ( ( status == Success ) && !handler.error( false ) ) {
98  if ( data && ( nitems > 0 ) ) {
99  Window leader = * ( ( Window * ) data );
100  XDeleteProperty( QX11Info::display(), leader, atoms[ 1 ] );
101  }
102  XFree( data );
103  }
104 #endif
105 }
106 
107 void knotesAuthors( KAboutData &aboutData )
108 {
109  aboutData.addAuthor( ki18n( "Laurent Montel" ),
110  ki18n( "Maintainer" ),
111  "montel@kde.org" );
112  aboutData.addAuthor( ki18n( "Guillermo Antonio Amaral Bastidas" ),
113  ki18n( "Previous Maintainer" ),
114  "me@guillermoamaral.com" );
115  aboutData.addAuthor( ki18n( "Michael Brade" ),
116  ki18n( "Previous Maintainer" ),
117  "brade@kde.org" );
118  aboutData.addAuthor( ki18n( "Bernd Johannes Wuebben" ),
119  ki18n( "Original KNotes Author" ),
120  "wuebben@kde.org" );
121  aboutData.addAuthor( ki18n( "Wynn Wilkes" ),
122  ki18n( "Ported KNotes to KDE 2" ),
123  "wynnw@calderasystems.com" );
124  aboutData.addAuthor( ki18n( "Daniel Martin" ),
125  ki18n( "Network Interface" ),
126  "daniel.martin@pirack.com" );
127  aboutData.addAuthor( ki18n( "Bo Thorsen" ),
128  ki18n( "Started KDE Resource Framework Integration" ),
129  "bo@sonofthor.dk" );
130  aboutData.addCredit( ki18n( "Bera Debajyoti" ),
131  ki18n( "Idea and initial code for the new look & feel" ),
132  "debajyotibera@gmail.com" );
133  aboutData.addCredit( ki18n( "Matthias Ettrich" ),
134  KLocalizedString(),
135  "ettrich@kde.org" );
136  aboutData.addCredit( ki18n( "David Faure" ),
137  KLocalizedString(),
138  "faure@kde.org" );
139  aboutData.addCredit( ki18n( "Matthias Kiefer" ),
140  KLocalizedString(),
141  "kiefer@kde.org" );
142  aboutData.addCredit( ki18n( "Luboš Luňák" ),
143  KLocalizedString(),
144  "l.lunak@kde.org" );
145  aboutData.addCredit( ki18n( "Dirk A. Mueller" ),
146  KLocalizedString(),
147  "dmuell@gmx.net" );
148  aboutData.addCredit( ki18n( "Carsten Pfeiffer" ),
149  KLocalizedString(),
150  "pfeiffer@kde.org" );
151  aboutData.addCredit( ki18n( "Harri Porten" ),
152  KLocalizedString(),
153  "porten@kde.org" );
154  aboutData.addCredit( ki18n( "Espen Sand" ),
155  KLocalizedString(),
156  "espen@kde.org" );
157 }
QWidget
application.h
QX11Info::display
Display * display()
knotes_options.h
knotesOptions
KCmdLineOptions knotesOptions()
knotesAuthors
void knotesAuthors(KAboutData &aboutData)
Definition: main.cpp:107
QWidget::winId
WId winId() const
Application
Definition: application.h:28
QLatin1String
remove_sm_from_client_leader
void remove_sm_from_client_leader()
Definition: main.cpp:76
main
int main(int argc, char *argv[])
Definition: main.cpp:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:28 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
  • 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