TDE personal information management applications
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.
 
 
 
 
 
 

133 lines
4.2 KiB

  1. /*******************************************************************
  2. KNotes -- Notes for the KDE project
  3. Copyright (c) 1997-2006, The KNotes Developers
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. 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
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  15. *******************************************************************/
  16. #include <kuniqueapplication.h>
  17. #include <tdecmdlineargs.h>
  18. #include <tdeaboutdata.h>
  19. #include <tdelocale.h>
  20. #include <kxerrorhandler.h>
  21. #include <X11/Xlib.h>
  22. #include <X11/Xatom.h>
  23. #include "knotesapp.h"
  24. #include "version.h"
  25. #include "main.h"
  26. void remove_sm_from_client_leader()
  27. {
  28. Atom type;
  29. int format, status;
  30. unsigned long nitems = 0;
  31. unsigned long extra = 0;
  32. unsigned char *data = 0;
  33. Atom atoms[ 2 ];
  34. char *atom_names[ 2 ] = { (char*)"WM_CLIENT_LEADER", (char*)"SM_CLIENT_ID" };
  35. XInternAtoms( tqt_xdisplay(), atom_names, 2, False, atoms );
  36. TQWidget w;
  37. KXErrorHandler handler; // ignore X errors
  38. status = XGetWindowProperty( tqt_xdisplay(), w.winId(), atoms[ 0 ], 0, 10000,
  39. FALSE, XA_WINDOW, &type, &format,
  40. &nitems, &extra, &data );
  41. if (status == Success && !handler.error( false ))
  42. {
  43. if (data && nitems > 0)
  44. {
  45. Window leader = *((Window*) data);
  46. XDeleteProperty( tqt_xdisplay(), leader, atoms[ 1 ] );
  47. }
  48. XFree(data);
  49. }
  50. }
  51. Application::Application()
  52. : KUniqueApplication(), mMainWindow( 0 )
  53. {
  54. }
  55. Application::~Application()
  56. {
  57. delete mMainWindow;
  58. }
  59. int Application::newInstance()
  60. {
  61. if ( !mMainWindow )
  62. {
  63. mMainWindow = new KNotesApp();
  64. mMainWindow->show();
  65. }
  66. else
  67. mMainWindow->newNote();
  68. return KUniqueApplication::newInstance();
  69. }
  70. int main( int argc, char* argv[] )
  71. {
  72. TQString version = TQString::number( KNOTES_VERSION );
  73. TDEAboutData aboutData(
  74. "knotes",
  75. I18N_NOOP("KNotes"),
  76. version.latin1(),
  77. I18N_NOOP( "TDE Notes" ),
  78. TDEAboutData::License_GPL,
  79. I18N_NOOP("(c) 1997-2006, The KNotes Developers")
  80. );
  81. aboutData.addAuthor("Michael Brade", I18N_NOOP("Maintainer"), "brade@kde.org");
  82. aboutData.addAuthor("Bernd Johannes Wuebben", I18N_NOOP("Original KNotes Author"), "wuebben@kde.org");
  83. aboutData.addAuthor("Wynn Wilkes", I18N_NOOP("Ported KNotes to KDE 2"), "wynnw@calderasystems.com");
  84. aboutData.addAuthor("Daniel Martin", I18N_NOOP("Network Interface"), "daniel.martin@pirack.com");
  85. aboutData.addAuthor("Bo Thorsen", I18N_NOOP("Started KDE Resource Framework Integration"), "bo@sonofthor.dk");
  86. aboutData.addCredit("Bera Debajyoti", I18N_NOOP("Idea and initial code for the new look&feel"),
  87. "debajyotibera@gmail.com");
  88. aboutData.addCredit("Matthias Ettrich", 0, "ettrich@kde.org");
  89. aboutData.addCredit("David Faure", 0, "faure@kde.org");
  90. aboutData.addCredit("Matthias Kiefer", 0, "kiefer@kde.org");
  91. aboutData.addCredit("Luboš Luňák", 0, "l.lunak@kde.org");
  92. aboutData.addCredit("Laurent Montel", 0, "montel@kde.org");
  93. aboutData.addCredit("Dirk A. Mueller", 0, "dmuell@gmx.net");
  94. aboutData.addCredit("Carsten Pfeiffer", 0, "pfeiffer@kde.org");
  95. aboutData.addCredit("Harri Porten", 0, "porten@kde.org");
  96. aboutData.addCredit("Espen Sand", 0, "espen@kde.org");
  97. TDECmdLineArgs::init( argc, argv, &aboutData );
  98. KUniqueApplication::addCmdLineOptions();
  99. Application app;
  100. app.connect( &app, TQT_SIGNAL( lastWindowClosed() ), &app, TQT_SLOT( quit() ) );
  101. remove_sm_from_client_leader();
  102. int rval = app.exec();
  103. return rval;
  104. }