summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oapplication.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/oapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oapplication.cpp12
1 files changed, 12 insertions, 0 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 }