~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to languages/cpp/app_templates/kconfig35/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%{CPP_TEMPLATE}
2
 
 
3
 
#include "%{APPNAMELC}.h"
4
 
#include <kapplication.h>
5
 
#include <kaboutdata.h>
6
 
#include <kcmdlineargs.h>
7
 
#include <klocale.h>
8
 
 
9
 
static const char description[] =
10
 
    I18N_NOOP("A KDE Application");
11
 
 
12
 
static const char version[] = "%{VERSION}";
13
 
 
14
 
static KCmdLineOptions options[] =
15
 
{
16
 
    { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
17
 
    KCmdLineLastOption
18
 
};
19
 
 
20
 
int main(int argc, char **argv)
21
 
{
22
 
    KAboutData about("%{APPNAMELC}", I18N_NOOP("%{APPNAME}"), version, description,
23
 
                     KAboutData::License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", 0, 0, "%{EMAIL}");
24
 
    about.addAuthor( "%{AUTHOR}", 0, "%{EMAIL}" );
25
 
    KCmdLineArgs::init(argc, argv, &about);
26
 
    KCmdLineArgs::addCmdLineOptions(options);
27
 
    KApplication app;
28
 
 
29
 
    // see if we are starting with session management
30
 
    if (app.isRestored())
31
 
    {
32
 
        RESTORE(%{APPNAMELC});
33
 
    }
34
 
    else
35
 
    {
36
 
        // no session.. just start up normally
37
 
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
38
 
        if (args->count() == 0)
39
 
        {
40
 
            %{APPNAMELC} *widget = new %{APPNAMELC};
41
 
            widget->show();
42
 
        }
43
 
        else
44
 
        {
45
 
            int i = 0;
46
 
            for (; i < args->count(); i++)
47
 
            {
48
 
                %{APPNAMELC} *widget = new %{APPNAMELC};
49
 
                widget->show();
50
 
            }
51
 
        }
52
 
        args->clear();
53
 
    }
54
 
 
55
 
    return app.exec();
56
 
}
57