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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

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 KPart Application");
 
11
 
 
12
static const char version[] = "0.1";
 
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
    %{APPNAME} *mainWin = 0;
 
29
 
 
30
    if (app.isRestored())
 
31
    {
 
32
        RESTORE(%{APPNAME});
 
33
    }
 
34
    else
 
35
    {
 
36
        // no session.. just start up normally
 
37
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
38
 
 
39
        /// @todo do something with the command line args here
 
40
 
 
41
        mainWin = new %{APPNAME}();
 
42
        app.setMainWidget( mainWin );
 
43
        mainWin->show();
 
44
 
 
45
        args->clear();
 
46
    }
 
47
 
 
48
    int ret = app.exec();
 
49
 
 
50
    delete mainWin;
 
51
    return ret;
 
52
}