main.cpp 2.67 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
/***************************************************************************
 *   Copyright (C) 2002 by Wilco Greven <greven@kde.org>                   *
 *   Copyright (C) 2003 by Christophe Devriese                             *
 *                         <Christophe.Devriese@student.kuleuven.ac.be>    *
 *   Copyright (C) 2003 by Laurent Montel <montel@kde.org>                 *
 *   Copyright (C) 2003-2004 by Albert Astals Cid <tsdgeos@terra.es>       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

14
#include "kpdf_shell.h"
15
16
17
18
19
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>

Andy Goossens's avatar
Andy Goossens committed
20
static const char description[] =
21
I18N_NOOP("kpdf, a kde pdf viewer based on xpdf");
22

Albert Astals Cid's avatar
Albert Astals Cid committed
23
static const char version[] = "0.4";
24
25
26

static KCmdLineOptions options[] =
{
27
    { "+[URL]", I18N_NOOP("Document to open"), 0 },
Laurent Montel's avatar
Laurent Montel committed
28
    KCmdLineLastOption
29
30
31
32
};

int main(int argc, char** argv)
{
33
34
35
36
37
38
    KAboutData about(
        "kpdf",
        I18N_NOOP("KPDF"),
        version,
        description,
        KAboutData::License_GPL,
39
        "(C) 2002 Wilco Greven, Christophe Devriese");
40
41
42

    about.addAuthor("Wilco Greven", 0, "greven@kde.org");
    about.addAuthor("Christophe Devriese", 0, "oelewapperke@oelewapperke.org");
Laurent Montel's avatar
Laurent Montel committed
43
    about.addAuthor("Laurent Montel", 0, "montel@kde.org");
44
    about.addAuthor("Albert Astals Cid", I18N_NOOP("xpdf 3.0 integration, thumbnails"), "astals11@terra.es");
45

46
47
    about.addCredit("Derek Noonburg", I18N_NOOP("Xpdf author"), 0, "http://www.foolabs.com/xpdf/");

48
49
50
51
52
53
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions( options );
    KApplication app;

    // see if we are starting with session management
    if (app.isRestored())
54
    {
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        RESTORE(KPDF::Shell);
    } else {
        // no session.. just start up normally
        KCmdLineArgs* args = KCmdLineArgs::parsedArgs();

        if (args->count() == 0)
        {
            KPDF::Shell* widget = new KPDF::Shell;
            widget->show();
        }
        else
        {
            for (int i = 0; i < args->count(); ++i)
            {
                KPDF::Shell* widget = new KPDF::Shell;
                widget->show();
Laurent Montel's avatar
Laurent Montel committed
71
                widget->openURL(args->url(i));
72
73
74
            }
        }
        args->clear();
75
76
    }

77
    return app.exec();
78
79
80
}

// vim:ts=2:sw=2:tw=78:et