KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.8KB

  1. /* This file is part of the KDE project
  2. Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
  3. Copyright (C) 2000, 2001 David Faure <faure@kde.org>
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; see the file COPYING. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. * Boston, MA 02110-1301, USA.
  16. */
  17. #include <kofficeversion.h>
  18. #include <tdeaboutdata.h>
  19. #include <tdecmdlineargs.h>
  20. #include <kdebug.h>
  21. #include <tdelocale.h>
  22. #include <kuniqueapplication.h>
  23. #include <twin.h>
  24. #include <KoGlobal.h>
  25. #include "koshell_shell.h"
  26. static const char* description = I18N_NOOP("KOffice Workspace");
  27. static const char* version = KOFFICE_VERSION_STRING;
  28. class KoShellApp : public KUniqueApplication {
  29. public:
  30. KoShellApp() : mMainWindow( 0 ) {}
  31. ~KoShellApp() {}
  32. int newInstance();
  33. private:
  34. KoShellWindow *mMainWindow;
  35. };
  36. int KoShellApp::newInstance()
  37. {
  38. if ( isRestored() ) {
  39. // There can only be one main window
  40. if ( TDEMainWindow::canBeRestored( 1 ) ) {
  41. mMainWindow = new KoShellWindow();
  42. setMainWidget( mMainWindow );
  43. mMainWindow->show();
  44. mMainWindow->restore( 1 );
  45. }
  46. } else {
  47. if ( !mMainWindow ) {
  48. mMainWindow = new KoShellWindow();
  49. mMainWindow->show();
  50. setMainWidget( mMainWindow );
  51. }
  52. }
  53. // Handle startup notification and window activation
  54. // (The first time it will do nothing except note that it was called)
  55. return KUniqueApplication::newInstance();
  56. }
  57. extern "C" KOSHELL_EXPORT int kdemain( int argc, char **argv )
  58. {
  59. TDEAboutData * aboutData = new TDEAboutData( "koshell", I18N_NOOP("KOffice Workspace"),
  60. version, description, TDEAboutData::License_GPL,
  61. "(c) 1998-2006, Torben Weis\n(c) 2002-2005, David Faure\n(c) 2005, Sven Lüppken");
  62. aboutData->addAuthor("Sven Lüppken", I18N_NOOP("Current Maintainer"), "sven@kde.org");
  63. aboutData->addAuthor("Torben Weis", 0, "weis@kde.org");
  64. aboutData->addAuthor("David Faure", 0, "faure@kde.org");
  65. TDECmdLineArgs::init( argc, argv, aboutData );
  66. if ( !KoShellApp::start() ) {
  67. // Already running, brought to the foreground.
  68. return 0;
  69. }
  70. KoShellApp app;
  71. // Initialize stuff (like KoApplication does)
  72. KoGlobal::initialize();
  73. return app.exec();
  74. }