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

« back to all changes in this revision

Viewing changes to languages/cpp/app_templates/kde4app/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 <KDE/KLocale>
8
 
 
9
 
static const char description[] =
10
 
    I18N_NOOP("A KDE 4 Application");
11
 
 
12
 
static const char version[] = "%{VERSION}";
13
 
 
14
 
int main(int argc, char **argv)
15
 
{
16
 
    KAboutData about("%{APPNAMELC}", 0, ki18n("%{APPNAME}"), version, ki18n(description),
17
 
                     KAboutData::License_%{LICENSE}, ki18n("(C) %{YEAR} %{AUTHOR}"), KLocalizedString(), 0, "%{EMAIL}");
18
 
    about.addAuthor( ki18n("%{AUTHOR}"), KLocalizedString(), "%{EMAIL}" );
19
 
    KCmdLineArgs::init(argc, argv, &about);
20
 
 
21
 
    KCmdLineOptions options;
22
 
    options.add("+[URL]", ki18n( "Document to open" ));
23
 
    KCmdLineArgs::addCmdLineOptions(options);
24
 
    KApplication app;
25
 
 
26
 
    %{APPNAME} *widget = new %{APPNAME};
27
 
 
28
 
    // see if we are starting with session management
29
 
    if (app.isSessionRestored())
30
 
    {
31
 
        RESTORE(%{APPNAME});
32
 
    }
33
 
    else
34
 
    {
35
 
        // no session.. just start up normally
36
 
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
37
 
        if (args->count() == 0)
38
 
        {
39
 
            //%{APPNAMELC} *widget = new %{APPNAMELC};
40
 
            widget->show();
41
 
        }
42
 
        else
43
 
        {
44
 
            int i = 0;
45
 
            for (; i < args->count(); i++)
46
 
            {
47
 
                //%{APPNAMELC} *widget = new %{APPNAMELC};
48
 
                widget->show();
49
 
            }
50
 
        }
51
 
        args->clear();
52
 
    }
53
 
 
54
 
    return app.exec();
55
 
}