docs update, needs proofreading
[kdepim.git] / knotes / main.cpp
blob2b66750ca1ba1db55c2a06d8fe2cd4d945cd5d2c
1 /*******************************************************************
2 KNotes -- Notes for the KDE project
4 Copyright (c) 1997-2007, The KNotes Developers
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.
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.
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 *******************************************************************/
21 #include "version.h"
22 #include "application.h"
24 #include <kcmdlineargs.h>
25 #include <kaboutdata.h>
26 #include <klocale.h>
27 #include <kxerrorhandler.h>
29 #ifdef Q_WS_X11
30 #include <X11/Xlib.h>
31 #include <X11/Xatom.h>
32 #include <QX11Info>
33 #endif
35 void remove_sm_from_client_leader();
36 KCmdLineOptions knotesOptions();
37 void knotesAuthors( KAboutData &aboutData );
39 int main( int argc, char *argv[] )
41 QString version = QString::number( KNOTES_VERSION );
43 KAboutData aboutData( "knotes",
45 ki18n( "KNotes" ),
46 version.toLatin1(),
47 ki18n( "KDE Notes" ),
48 KAboutData::License_GPL,
49 ki18n( "(c) 1997-2009, The KNotes Developers" ) );
51 knotesAuthors( aboutData );
53 KCmdLineArgs::init( argc, argv, &aboutData );
55 // Command line options
57 KCmdLineArgs::addCmdLineOptions( knotesOptions() );
59 KUniqueApplication::addCmdLineOptions();
62 // Create Application
64 Application app;
67 remove_sm_from_client_leader();
69 return app.exec();
72 void remove_sm_from_client_leader()
74 #ifdef Q_WS_X11
75 Atom type;
76 int format, status;
77 unsigned long nitems = 0;
78 unsigned long extra = 0;
79 unsigned char *data = 0;
81 Atom atoms[ 2 ];
82 char *atom_names[ 2 ] = { ( char * ) "WM_CLIENT_LEADER",
83 ( char * ) "SM_CLIENT_ID" };
85 XInternAtoms( QX11Info::display(), atom_names, 2, False, atoms );
87 QWidget w;
88 KXErrorHandler handler; // ignore X errors
89 status = XGetWindowProperty( QX11Info::display(), w.winId(), atoms[ 0 ], 0,
90 10000, false, XA_WINDOW, &type, &format, &nitems,
91 &extra, &data );
93 if ( ( status == Success ) && !handler.error( false ) ) {
94 if ( data && ( nitems > 0 ) ) {
95 Window leader = * ( ( Window * ) data );
96 XDeleteProperty( QX11Info::display(), leader, atoms[ 1 ] );
98 XFree( data );
100 #endif
103 KCmdLineOptions knotesOptions()
105 KCmdLineOptions options;
107 options.add( "skip-note",
108 ki18n( "Suppress creation of a new note "
109 "on a non-unique instance." ) );
111 return options;
114 void knotesAuthors( KAboutData &aboutData )
116 aboutData.addAuthor( ki18n( "Guillermo Antonio Amaral Bastidas" ),
117 ki18n( "Maintainer" ),
118 "me@guillermoamaral.com" );
119 aboutData.addAuthor( ki18n( "Michael Brade" ),
120 ki18n( "Previous Maintainer" ),
121 "brade@kde.org" );
122 aboutData.addAuthor( ki18n( "Bernd Johannes Wuebben" ),
123 ki18n( "Original KNotes Author" ),
124 "wuebben@kde.org" );
125 aboutData.addAuthor( ki18n( "Wynn Wilkes" ),
126 ki18n( "Ported KNotes to KDE 2" ),
127 "wynnw@calderasystems.com" );
128 aboutData.addAuthor( ki18n( "Daniel Martin" ),
129 ki18n( "Network Interface" ),
130 "daniel.martin@pirack.com" );
131 aboutData.addAuthor( ki18n( "Bo Thorsen" ),
132 ki18n( "Started KDE Resource Framework Integration" ),
133 "bo@sonofthor.dk" );
135 aboutData.addCredit( ki18n( "Bera Debajyoti" ),
136 ki18n( "Idea and initial code for the new look & feel" ),
137 "debajyotibera@gmail.com" );
138 aboutData.addCredit( ki18n( "Matthias Ettrich" ),
139 KLocalizedString(),
140 "ettrich@kde.org" );
141 aboutData.addCredit( ki18n( "David Faure" ),
142 KLocalizedString(),
143 "faure@kde.org" );
144 aboutData.addCredit( ki18n( "Matthias Kiefer" ),
145 KLocalizedString(),
146 "kiefer@kde.org" );
147 aboutData.addCredit( ki18n( "Luboš Luňák" ),
148 KLocalizedString(),
149 "l.lunak@kde.org" );
150 aboutData.addCredit( ki18n( "Laurent Montel" ),
151 KLocalizedString(),
152 "montel@kde.org" );
153 aboutData.addCredit( ki18n( "Dirk A. Mueller" ),
154 KLocalizedString(),
155 "dmuell@gmx.net" );
156 aboutData.addCredit( ki18n( "Carsten Pfeiffer" ),
157 KLocalizedString(),
158 "pfeiffer@kde.org" );
159 aboutData.addCredit( ki18n( "Harri Porten" ),
160 KLocalizedString(),
161 "porten@kde.org" );
162 aboutData.addCredit( ki18n( "Espen Sand" ),
163 KLocalizedString(),
164 "espen@kde.org" );