• 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++
  • kpartapp
  • src
templates/C++/kpartapp/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 <kapplication.h>
22 #include <kaboutdata.h>
23 #include <kcmdlineargs.h>
24 #include <klocale.h>
25 
26 static const char description[] =
27  I18N_NOOP("A KDE KPart 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), KAboutData::License_GPL, ki18n("(C) %{CURRENT_YEAR} %{AUTHOR}"), KLocalizedString(), 0, "%{EMAIL}");
34  about.addAuthor( ki18n("%{AUTHOR}"), KLocalizedString(), "%{EMAIL}" );
35  KCmdLineArgs::init(argc, argv, &about);
36 
37  KCmdLineOptions options;
38  options.add("+[URL]", ki18n( "Document to open" ));
39  KCmdLineArgs::addCmdLineOptions( options );
40  KApplication app;
41 
42  // see if we are starting with session management
43  if (app.isSessionRestored())
44  RESTORE(%{APPNAME})
45  else
46  {
47  // no session.. just start up normally
48  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
49 
50  if ( args->count() == 0 )
51  {
52  %{APPNAME} *widget = new %{APPNAME};
53  widget->show();
54  }
55  else
56  {
57  int i = 0;
58  for (; i < args->count(); i++ )
59  {
60  %{APPNAME} *widget = new %{APPNAME};
61  widget->show();
62  widget->load( args->url( i ) );
63  }
64  }
65  args->clear();
66  }
67 
68  return app.exec();
69 }
main
int main(int argc, char **argv)
Definition: templates/C++/kpartapp/src/main.cpp:31
description
static const char description[]
Definition: templates/C++/kpartapp/src/main.cpp:26
init
void init()
version
static const char version[]
Definition: templates/C++/kpartapp/src/main.cpp:29
%{APPNAMELC}.h
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