• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kapptemplate

  • sources
  • kde-4.12
  • kdesdk
  • kapptemplate
  • templates
  • C++
  • kapp4-qml
  • src
templates/C++/kapp4-qml/src/main.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18  ***************************************************************************/
19 
20 #include "%{APPNAMELC}.h"
21 #include <KDE/KApplication>
22 #include <KDE/KAboutData>
23 #include <KDE/KCmdLineArgs>
24 #include <KDE/KLocale>
25 
26 static const char description[] =
27  I18N_NOOP("A KDE 4 Application");
28 
29 static const char version[] = "%{VERSION}";
30 
31 int main(int argc, char **argv)
32 {
33  KAboutData about("%{APPNAMELC}", 0, ki18n("%{APPNAME}"), version, ki18n(description),
34  KAboutData::License_GPL, ki18n("(C) %{CURRENT_YEAR} %{AUTHOR}"), KLocalizedString(), 0, "%{EMAIL}");
35  about.addAuthor( ki18n("%{AUTHOR}"), KLocalizedString(), "%{EMAIL}" );
36  KCmdLineArgs::init(argc, argv, &about);
37 
38  KCmdLineOptions options;
39  options.add("+[URL]", ki18n( "Document to open" ));
40  KCmdLineArgs::addCmdLineOptions(options);
41  KApplication app;
42 
43  %{APPNAME} *widget = new %{APPNAME};
44 
45  // see if we are starting with session management
46  if (app.isSessionRestored())
47  {
48  RESTORE(%{APPNAME});
49  }
50  else
51  {
52  // no session.. just start up normally
53  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
54  if (args->count() == 0)
55  {
56  //%{APPNAMELC} *widget = new %{APPNAMELC};
57  widget->show();
58  }
59  else
60  {
61  int i = 0;
62  for (; i < args->count(); i++)
63  {
64  //%{APPNAMELC} *widget = new %{APPNAMELC};
65  widget->show();
66  }
67  }
68  args->clear();
69  }
70 
71  return app.exec();
72 }
version
static const char version[]
Definition: templates/C++/kapp4-qml/src/main.cpp:29
main
int main(int argc, char **argv)
Definition: templates/C++/kapp4-qml/src/main.cpp:31
init
void init()
%{APPNAMELC}.h
description
static const char description[]
Definition: templates/C++/kapp4-qml/src/main.cpp:26
APPNAME
main APPNAME
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:23 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapptemplate

Skip menu "kapptemplate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal