summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Unidiff
Diffstat (limited to 'libopie2/opiecore') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/oapplication.cpp14
-rw-r--r--libopie2/opiecore/oapplication.h16
2 files changed, 30 insertions, 0 deletions
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp
index a0abcc2..12418d5 100644
--- a/libopie2/opiecore/oapplication.cpp
+++ b/libopie2/opiecore/oapplication.cpp
@@ -83,28 +83,42 @@ void OApplication::init()
83{ 83{
84 d = new OApplicationPrivate(); 84 d = new OApplicationPrivate();
85 if ( !OApplication::_instance ) 85 if ( !OApplication::_instance )
86 { 86 {
87 OApplication::_instance = this; 87 OApplication::_instance = this;
88 } 88 }
89 else 89 else
90 { 90 {
91 qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); 91 qFatal( "OApplication: Can't create more than one OApplication object. Aborting." );
92 } 92 }
93} 93}
94 94
95
95void OApplication::setMainWidget( QWidget* widget ) 96void OApplication::setMainWidget( QWidget* widget )
96{ 97{
97 showMainWidget( widget ); 98 showMainWidget( widget );
98} 99}
99 100
101
100void OApplication::showMainWidget( QWidget* widget, bool nomax ) 102void OApplication::showMainWidget( QWidget* widget, bool nomax )
101{ 103{
102 #ifdef Q_WS_QWS 104 #ifdef Q_WS_QWS
103 QPEApplication::showMainWidget( widget, nomax ); 105 QPEApplication::showMainWidget( widget, nomax );
104 #else 106 #else
105 QApplication::setMainWidget( widget ); 107 QApplication::setMainWidget( widget );
106 widget->show(); 108 widget->show();
107 #endif 109 #endif
108 widget->setCaption( _appname ); 110 widget->setCaption( _appname );
111}
109 112
113
114void OApplication::setTitle( QString title ) const
115{
116 if ( mainWidget() )
117 {
118 if ( !title.isNull() )
119 mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title );
120 else
121 mainWidget()->setCaption( _appname );
110} 122}
123}
124
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h
index 736e786..4d25202 100644
--- a/libopie2/opiecore/oapplication.h
+++ b/libopie2/opiecore/oapplication.h
@@ -60,55 +60,71 @@ class OApplication: public OApplicationBaseClass
60 * Destructor. Destroys the application object and its children. 60 * Destructor. Destroys the application object and its children.
61 */ 61 */
62 virtual ~OApplication(); 62 virtual ~OApplication();
63 63
64 /** 64 /**
65 * Returns the current application object. 65 * Returns the current application object.
66 * 66 *
67 * This is similar to the global @ref QApplication pointer qApp. It 67 * This is similar to the global @ref QApplication pointer qApp. It
68 * allows access to the single global OApplication object, since 68 * allows access to the single global OApplication object, since
69 * more than one cannot be created in the same application. It 69 * more than one cannot be created in the same application. It
70 * saves you the trouble of having to pass the pointer explicitly 70 * saves you the trouble of having to pass the pointer explicitly
71 * to every function that may require it. 71 * to every function that may require it.
72 *
72 * @return the current application object 73 * @return the current application object
73 */ 74 */
74 static const OApplication* oApplication() { return _instance; }; 75 static const OApplication* oApplication() { return _instance; };
75 76
76 /** 77 /**
77 * Returns the application name as given during creation. 78 * Returns the application name as given during creation.
78 * 79 *
79 * @return A reference to the application name 80 * @return A reference to the application name
80 */ 81 */
81 const QCString& appName() const { return _appname; }; 82 const QCString& appName() const { return _appname; };
82 83
83 /** 84 /**
84 * Returns the application session config object. 85 * Returns the application session config object.
85 * 86 *
86 * @return A pointer to the application's instance specific 87 * @return A pointer to the application's instance specific
87 * @ref OConfig object. 88 * @ref OConfig object.
88 * @see OConfig 89 * @see OConfig
89 */ 90 */
90 OConfig* config(); 91 OConfig* config();
91 92
92 /** 93 /**
93 * Sets the main widget - reimplemented to call showMainWidget() 94 * Sets the main widget - reimplemented to call showMainWidget()
94 * on Qt/Embedded. 95 * on Qt/Embedded.
96 *
97 * @param mainWidget the widget to become the main widget
98 * @see QWidget object
95 */ 99 */
96 virtual void setMainWidget( QWidget *mainWidget ); 100 virtual void setMainWidget( QWidget *mainWidget );
97 101
98 /** 102 /**
99 * Shows the main widget - reimplemented to call setMainWidget() 103 * Shows the main widget - reimplemented to call setMainWidget()
100 * on platforms other than Qt/Embedded. 104 * on platforms other than Qt/Embedded.
105 *
106 * @param mainWidget the widget to become the main widget
107 * @see QWidget object
101 */ 108 */
102 virtual void showMainWidget( QWidget* widget, bool nomax = false ); 109 virtual void showMainWidget( QWidget* widget, bool nomax = false );
103 110
111 /**
112 * Set the application title. The application title will be concatenated
113 * to the application name given in the constructor.
114 *
115 * @param title the title. If not given, resets caption to appname
116 */
117 virtual void setTitle( QString title = QString::null ) const;
118 //virtual void setTitle() const;
119
104 protected: 120 protected:
105 void init(); 121 void init();
106 122
107 private: 123 private:
108 const QCString _appname; 124 const QCString _appname;
109 static OApplication* _instance; 125 static OApplication* _instance;
110 OConfig* _config; 126 OConfig* _config;
111 OApplicationPrivate* d; 127 OApplicationPrivate* d;
112}; 128};
113 129
114#endif // OAPPLICATION_H 130#endif // OAPPLICATION_H