1 /*******************************************************************
2 KNotes -- Notes for the KDE project
4 Copyright (c) 1997-2010, 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 "kdepim-version.h"
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 KAboutData
aboutData( "knotes",
46 KAboutData::License_GPL
,
47 ki18n( "Copyright © 1997–2010 KNotes authors" ) );
49 knotesAuthors( aboutData
);
51 KCmdLineArgs::init( argc
, argv
, &aboutData
);
53 // Command line options
55 KCmdLineArgs::addCmdLineOptions( knotesOptions() );
57 KUniqueApplication::addCmdLineOptions();
63 KGlobal::locale()->insertCatalog("libkdepim");
65 remove_sm_from_client_leader();
70 void remove_sm_from_client_leader()
75 unsigned long nitems
= 0;
76 unsigned long extra
= 0;
77 unsigned char *data
= 0;
80 char *atom_names
[ 2 ] = { ( char * ) "WM_CLIENT_LEADER",
81 ( char * ) "SM_CLIENT_ID" };
83 XInternAtoms( QX11Info::display(), atom_names
, 2, False
, atoms
);
86 KXErrorHandler handler
; // ignore X errors
87 status
= XGetWindowProperty( QX11Info::display(), w
.winId(), atoms
[ 0 ], 0,
88 10000, false, XA_WINDOW
, &type
, &format
, &nitems
,
91 if ( ( status
== Success
) && !handler
.error( false ) ) {
92 if ( data
&& ( nitems
> 0 ) ) {
93 Window leader
= * ( ( Window
* ) data
);
94 XDeleteProperty( QX11Info::display(), leader
, atoms
[ 1 ] );
101 KCmdLineOptions
knotesOptions()
103 KCmdLineOptions options
;
105 options
.add( "skip-note",
106 ki18n( "Suppress creation of a new note "
107 "on a non-unique instance." ) );
112 void knotesAuthors( KAboutData
&aboutData
)
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" ),
120 aboutData
.addAuthor( ki18n( "Bernd Johannes Wuebben" ),
121 ki18n( "Original KNotes Author" ),
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" ),
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" ),
139 aboutData
.addCredit( ki18n( "David Faure" ),
142 aboutData
.addCredit( ki18n( "Matthias Kiefer" ),
145 aboutData
.addCredit( ki18n( "Luboš Luňák" ),
148 aboutData
.addCredit( ki18n( "Laurent Montel" ),
151 aboutData
.addCredit( ki18n( "Dirk A. Mueller" ),
154 aboutData
.addCredit( ki18n( "Carsten Pfeiffer" ),
156 "pfeiffer@kde.org" );
157 aboutData
.addCredit( ki18n( "Harri Porten" ),
160 aboutData
.addCredit( ki18n( "Espen Sand" ),