summaryrefslogtreecommitdiff
path: root/libopie2/opiecore
Side-by-side diff
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
@@ -89,22 +89,36 @@ void OApplication::init()
else
{
qFatal( "OApplication: Can't create more than one OApplication object. Aborting." );
}
}
+
void OApplication::setMainWidget( QWidget* widget )
{
showMainWidget( widget );
}
+
void OApplication::showMainWidget( QWidget* widget, bool nomax )
{
#ifdef Q_WS_QWS
QPEApplication::showMainWidget( widget, nomax );
#else
QApplication::setMainWidget( widget );
widget->show();
#endif
widget->setCaption( _appname );
+}
+
+void OApplication::setTitle( QString title ) const
+{
+ if ( mainWidget() )
+ {
+ if ( !title.isNull() )
+ mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title );
+ else
+ mainWidget()->setCaption( _appname );
}
+}
+
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
@@ -66,12 +66,13 @@ class OApplication: public OApplicationBaseClass
*
* This is similar to the global @ref QApplication pointer qApp. It
* allows access to the single global OApplication object, since
* more than one cannot be created in the same application. It
* saves you the trouble of having to pass the pointer explicitly
* to every function that may require it.
+ *
* @return the current application object
*/
static const OApplication* oApplication() { return _instance; };
/**
* Returns the application name as given during creation.
@@ -89,21 +90,36 @@ class OApplication: public OApplicationBaseClass
*/
OConfig* config();
/**
* Sets the main widget - reimplemented to call showMainWidget()
* on Qt/Embedded.
+ *
+ * @param mainWidget the widget to become the main widget
+ * @see QWidget object
*/
virtual void setMainWidget( QWidget *mainWidget );
/**
* Shows the main widget - reimplemented to call setMainWidget()
* on platforms other than Qt/Embedded.
+ *
+ * @param mainWidget the widget to become the main widget
+ * @see QWidget object
*/
virtual void showMainWidget( QWidget* widget, bool nomax = false );
+ /**
+ * Set the application title. The application title will be concatenated
+ * to the application name given in the constructor.
+ *
+ * @param title the title. If not given, resets caption to appname
+ */
+ virtual void setTitle( QString title = QString::null ) const;
+ //virtual void setTitle() const;
+
protected:
void init();
private:
const QCString _appname;
static OApplication* _instance;