1 | /*************************************************************************** |
2 | main.cpp - Main file for the KFileReplace shell |
3 | ------------------- |
4 | begin : Thu Sep 16 14:14:09 2004 |
5 | copyright : (C) 2004 by Andras Mantia <amantia@kde.org> |
6 | ***************************************************************************/ |
7 | |
8 | /*************************************************************************** |
9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * |
14 | * * |
15 | ***************************************************************************/ |
16 | |
17 | #include "kfilereplace.h" |
18 | |
19 | #include <kapplication.h> |
20 | #include <kaboutdata.h> |
21 | #include <kcmdlineargs.h> |
22 | #include <klocale.h> |
23 | |
24 | static const char description[] = |
25 | I18N_NOOP("Batch search and replace tool" ); |
26 | |
27 | static const char version[] = "0.1" ; |
28 | |
29 | int main(int argc, char *argv[]) |
30 | { |
31 | KAboutData about("kfilereplace" , 0, ki18n("KFileReplace" ), version, ki18n(description), |
32 | KAboutData::License_GPL_V2, ki18n("(C) 2004-2005 Andras Mantia\n(C) 2004-2005 Emiliano Gulmini\n(C) 1999-2002 François Dupoux" ), ki18n("Part of the KDEWebDev module." ), |
33 | "http://kde.org/applications/utilities/kfilereplace/" ); |
34 | |
35 | about.addAuthor(ki18n("Andras Mantia" ), ki18n("Shell author, KPart creator, co-maintainer" ), "amantia@kde.org" ); |
36 | about.addAuthor(ki18n("Emiliano Gulmini" ), ki18n("Current maintainer, code cleaner and rewriter" ),"emi_barbarossa@yahoo.it" ); |
37 | about.addAuthor(ki18n("François Dupoux" ), |
38 | ki18n("Original author of the KFileReplace tool" ), |
39 | "dupoux@dupoux.com" ); |
40 | |
41 | KCmdLineArgs::init(argc, argv, &about); |
42 | |
43 | KCmdLineOptions options; |
44 | options.add("+[PATH]" , ki18n( "Starting folder" )); |
45 | KCmdLineArgs::addCmdLineOptions( options ); |
46 | |
47 | KApplication app; |
48 | |
49 | // see if we are starting with session management |
50 | if (app.isSessionRestored()) |
51 | { |
52 | RESTORE(KFileReplace); |
53 | } |
54 | else |
55 | { |
56 | // no session.. just start up normally |
57 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
58 | |
59 | KFileReplace *kfr = new KFileReplace; |
60 | kfr->show(); |
61 | |
62 | if (args->count() == 0) |
63 | { |
64 | kfr->openURL(KUrl()); |
65 | } |
66 | else |
67 | { |
68 | kfr->openURL(args->url(0)); |
69 | } |
70 | args->clear(); |
71 | } |
72 | |
73 | return app.exec(); |
74 | } |
75 | |