1 /* This file is part of the KDE project
2 Copyright (C) 2008 David Faure <faure@kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License or ( at
7 your option ) version 3 or, at the discretion of KDE e.V. ( which shall
8 act as a proxy as in section 14 of the GPLv3 ), any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #include <kcmdlineargs.h>
22 #include <kiconloader.h>
23 #include <kdeversion.h>
25 #include <kapplication.h>
27 int main(int argc
, char *argv
[])
29 KCmdLineArgs::init( argc
, argv
, "kiconfinder", 0, ki18n("Icon Finder"), KDE_VERSION_STRING
, ki18n("Finds an icon based on its name"));
32 KCmdLineOptions options
;
34 options
.add("+iconname", ki18n("The icon name to look for"));
36 KCmdLineArgs::addCmdLineOptions( options
);
38 KComponentData
instance("kiconfinder");
40 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs();
41 if( args
->count() < 1 ) {
42 printf( "No icon name specified\n" );
45 const QString iconName
= args
->arg( 0 );
46 QString icon
= KIconLoader::global()->iconPath(iconName
, KIconLoader::Desktop
/*TODO configurable*/, true);
47 if ( !icon
.isEmpty() ) {
48 printf("%s\n", icon
.toLatin1().constData());