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 *******************************************************************/
22 #include "application.h"
24 #include <kcmdlineargs.h>
25 #include <kaboutdata.h>
27 #include <kxerrorhandler.h>
31 #include <X11/Xatom.h>
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",
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();
67 remove_sm_from_client_leader();
72 void remove_sm_from_client_leader()
77 unsigned long nitems
= 0;
78 unsigned long extra
= 0;
79 unsigned char *data
= 0;
82 char *atom_names
[ 2 ] = { ( char * ) "WM_CLIENT_LEADER",
83 ( char * ) "SM_CLIENT_ID" };
85 XInternAtoms( QX11Info::display(), atom_names
, 2, False
, atoms
);
88 KXErrorHandler handler
; // ignore X errors
89 status
= XGetWindowProperty( QX11Info::display(), w
.winId(), atoms
[ 0 ], 0,
90 10000, false, XA_WINDOW
, &type
, &format
, &nitems
,
93 if ( ( status
== Success
) && !handler
.error( false ) ) {
94 if ( data
&& ( nitems
> 0 ) ) {
95 Window leader
= * ( ( Window
* ) data
);
96 XDeleteProperty( QX11Info::display(), leader
, atoms
[ 1 ] );
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." ) );
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" ),
122 aboutData
.addAuthor( ki18n( "Bernd Johannes Wuebben" ),
123 ki18n( "Original KNotes Author" ),
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" ),
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" ),
141 aboutData
.addCredit( ki18n( "David Faure" ),
144 aboutData
.addCredit( ki18n( "Matthias Kiefer" ),
147 aboutData
.addCredit( ki18n( "Luboš Luňák" ),
150 aboutData
.addCredit( ki18n( "Laurent Montel" ),
153 aboutData
.addCredit( ki18n( "Dirk A. Mueller" ),
156 aboutData
.addCredit( ki18n( "Carsten Pfeiffer" ),
158 "pfeiffer@kde.org" );
159 aboutData
.addCredit( ki18n( "Harri Porten" ),
162 aboutData
.addCredit( ki18n( "Espen Sand" ),