summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Unidiff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oapplication.cpp12
-rw-r--r--libopie2/opiecore/oapplication.h2
2 files changed, 13 insertions, 1 deletions
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp
index 7a6c174..06d8ba2 100644
--- a/libopie2/opiecore/oapplication.cpp
+++ b/libopie2/opiecore/oapplication.cpp
@@ -10,48 +10,51 @@
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <opie2/oapplication.h> 31#include <opie2/oapplication.h>
32#include <opie2/oconfig.h> 32#include <opie2/oconfig.h>
33 33
34#include <signal.h>
35#include <stdio.h>
36
34OApplication* OApplication::_instance = 0; 37OApplication* OApplication::_instance = 0;
35 38
36/**************************************************************************************************/ 39/**************************************************************************************************/
37/* OApplicationPrivate 40/* OApplicationPrivate
38/**************************************************************************************************/ 41/**************************************************************************************************/
39 42
40class OApplicationPrivate 43class OApplicationPrivate
41{ 44{
42 public: 45 public:
43 OApplicationPrivate() {}; 46 OApplicationPrivate() {};
44 ~OApplicationPrivate() {}; 47 ~OApplicationPrivate() {};
45}; 48};
46 49
47/**************************************************************************************************/ 50/**************************************************************************************************/
48/* OApplication 51/* OApplication
49/**************************************************************************************************/ 52/**************************************************************************************************/
50 53
51 54
52OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) 55OApplication::OApplication( int& argc, char** argv, const QCString& rAppName )
53 :QPEApplication( argc, argv ), 56 :QPEApplication( argc, argv ),
54 _appname( rAppName ), 57 _appname( rAppName ),
55 _config( 0 ) 58 _config( 0 )
56{ 59{
57 init(); 60 init();
@@ -64,48 +67,57 @@ OApplication::~OApplication()
64 if ( _config ) 67 if ( _config )
65 delete _config; 68 delete _config;
66 OApplication::_instance = 0; 69 OApplication::_instance = 0;
67 // after deconstruction of the one-and-only application object, 70 // after deconstruction of the one-and-only application object,
68 // the construction of another object is allowed 71 // the construction of another object is allowed
69} 72}
70 73
71 74
72OConfig* OApplication::config() 75OConfig* OApplication::config()
73{ 76{
74 if ( !_config ) 77 if ( !_config )
75 { 78 {
76 _config = new OConfig( _appname ); 79 _config = new OConfig( _appname );
77 } 80 }
78 return _config; 81 return _config;
79} 82}
80 83
81 84
82void OApplication::init() 85void OApplication::init()
83{ 86{
84 d = new OApplicationPrivate(); 87 d = new OApplicationPrivate();
85 if ( !OApplication::_instance ) 88 if ( !OApplication::_instance )
86 { 89 {
87 OApplication::_instance = this; 90 OApplication::_instance = this;
91
92 /* register SIGSEGV handler to give programs an option
93 * to exit gracefully, e.g. save or close devices or files.
94 struct sigaction sa;
95 sa.sa_handler = ( void (*)(int) ) &segv_handler;
96 sa.sa_flags = SA_SIGINFO | SA_RESTART;
97 sigemptyset(&sa.sa_mask);
98 sigaction(SIGSEGV, &sa, NULL);
99 */
88 } 100 }
89 else 101 else
90 { 102 {
91 qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); 103 qFatal( "OApplication: Can't create more than one OApplication object. Aborting." );
92 } 104 }
93} 105}
94 106
95 107
96void OApplication::showMainWidget( QWidget* widget, bool nomax ) 108void OApplication::showMainWidget( QWidget* widget, bool nomax )
97{ 109{
98 QPEApplication::showMainWidget( widget, nomax ); 110 QPEApplication::showMainWidget( widget, nomax );
99 widget->setCaption( _appname ); 111 widget->setCaption( _appname );
100} 112}
101 113
102 114
103void OApplication::setTitle( const QString& title ) const 115void OApplication::setTitle( const QString& title ) const
104{ 116{
105 if ( mainWidget() ) 117 if ( mainWidget() )
106 { 118 {
107 if ( !title.isNull() ) 119 if ( !title.isNull() )
108 mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); 120 mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title );
109 else 121 else
110 mainWidget()->setCaption( _appname ); 122 mainWidget()->setCaption( _appname );
111 } 123 }
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h
index 94ac488..1bd34e2 100644
--- a/libopie2/opiecore/oapplication.h
+++ b/libopie2/opiecore/oapplication.h
@@ -20,49 +20,49 @@
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#ifndef OAPPLICATION_H 31#ifndef OAPPLICATION_H
32#define OAPPLICATION_H 32#define OAPPLICATION_H
33 33
34#define oApp OApplication::oApplication() 34#define oApp OApplication::oApplication()
35 35
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37 37
38class OApplicationPrivate; 38class OApplicationPrivate;
39class OConfig; 39class OConfig;
40 40
41class OApplication: public QPEApplication 41class OApplication: public QPEApplication
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44 44
45 public: 45 public:
46 /** 46 /**
47 * Constructor. Parses command-line arguments and sets the window caption. 47 * Constructor. Parses command-line arguments and sets the window caption.
48 * 48 *
49 * @param rAppName application name. Will be used for finding the 49 * @param rAppName application name. Will be used for finding the
50 * associated message, icon and configuration files 50 * associated message, icon and configuration files
51 * 51 *
52 */ 52 */
53 OApplication( int& argc, char** argv, const QCString& rAppName ); 53 OApplication( int& argc, char** argv, const QCString& rAppName );
54 /** 54 /**
55 * Destructor. Destroys the application object and its children. 55 * Destructor. Destroys the application object and its children.
56 */ 56 */
57 virtual ~OApplication(); 57 virtual ~OApplication();
58 /** 58 /**
59 * @returns the process-wide application object 59 * @returns the process-wide application object
60 * 60 *
61 * This is similar to the global @ref QApplication pointer qApp. It 61 * This is similar to the global @ref QApplication pointer qApp. It
62 * allows access to the single global OApplication object, since 62 * allows access to the single global OApplication object, since
63 * more than one cannot be created in the same application. It 63 * more than one cannot be created in the same application. It
64 * saves you the trouble of having to pass the pointer explicitly 64 * saves you the trouble of having to pass the pointer explicitly
65 * to every function that may require it. 65 * to every function that may require it.
66 */ 66 */
67 static const OApplication* oApplication() { return _instance; }; 67 static const OApplication* oApplication() { return _instance; };
68 /** 68 /**