Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / apps / kappfinder / main_install.cpp
blobed44bb77e8d015a9944f8f640fe9ad6eafd36bb2
1 /*
2 KAppfinder, the KDE application finder
4 Copyright (c) 2002-2003 Tobias Koenig <tokoe@kde.org>
6 Based on code written by Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of version 2 of the GNU General Public
10 License as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <kcmdlineargs.h>
23 #include <kglobal.h>
24 #include <kcomponentdata.h>
25 #include <klocale.h>
26 #include <kstandarddirs.h>
28 #include <QtCore/QStringList>
30 #include <stdio.h>
32 #include "common.h"
35 int main( int argc, char *argv[] )
37 KComponentData componentData( "kappfinder_install" );
38 int added = 0;
40 if ( argc != 2 ) {
41 fprintf( stderr, "Usage: kappfinder_install $directory\n" );
42 return -1;
45 QStringList templates = KGlobal::dirs()->findAllResources( "data", "kappfinder/apps/*.desktop", KStandardDirs::Recursive );
47 QString dir = QString( argv[ 1 ] ) + '/';
49 QList<AppLnkCache*> appCache;
51 QStringList::Iterator it;
52 for ( it = templates.begin(); it != templates.end(); ++it )
53 scanDesktopFile( appCache, *it, dir );
55 createDesktopFiles( appCache, added );
56 decorateDirs( dir );
58 qDeleteAll(appCache);
59 appCache.clear();
61 printf( "%i application(s) added\n", added );
63 return 0;