summaryrefslogtreecommitdiff
authorsimon <simon>2003-03-25 20:30:12 (UTC)
committer simon <simon>2003-03-25 20:30:12 (UTC)
commit3a4ee8d8a53ca17703b34f84e1a411056ee7e50f (patch) (side-by-side diff)
tree6010cc8c464767725a7ab8b973428945dca62994
parentf7395e72a415322101ee3e22cb0e10b6bdf60a63 (diff)
downloadopie-3a4ee8d8a53ca17703b34f84e1a411056ee7e50f.zip
opie-3a4ee8d8a53ca17703b34f84e1a411056ee7e50f.tar.gz
opie-3a4ee8d8a53ca17703b34f84e1a411056ee7e50f.tar.bz2
- keep an eye on resize events on the desktop widget, which are an
indication for things like life rotation. upon a resize re-layout things (taskbar, tabs and maxwindow rect)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/desktop.cpp31
-rw-r--r--core/launcher/desktop.h2
-rw-r--r--core/launcher/taskbar.h3
3 files changed, 28 insertions, 8 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 86527f6..6def126 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -504,13 +504,13 @@ Desktop::Desktop() :
int displayh = qApp->desktop() ->height();
QSize sz = tb->sizeHint();
setGeometry( 0, displayh - sz.height(), displayw, sz.height() );
- tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() );
+ layout();
tb->show();
launcher->showMaximized();
launcher->show();
launcher->raise();
#if defined(QPE_HAVE_MEMALERTER)
@@ -521,12 +521,13 @@ Desktop::Desktop() :
startTransferServer();
( void ) new IrServer( this );
packageSlave = new PackageSlave( this );
qApp->installEventFilter( this );
+ qApp->desktop()->installEventFilter( this );
qApp-> setMainWidget ( launcher );
}
void Desktop::show()
{
@@ -729,18 +730,13 @@ void Desktop::toggleCapsLockState()
tb->toggleCapsLockState();
}
void Desktop::styleChange( QStyle &s )
{
QWidget::styleChange( s );
- int displayw = qApp->desktop() ->width();
- int displayh = qApp->desktop() ->height();
-
- QSize sz = tb->sizeHint();
-
- tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() );
+ layout();
}
void DesktopApplication::shutdown()
{
if ( type() != GuiServer )
return ;
@@ -803,12 +799,23 @@ void DesktopApplication::restart()
#endif
exit( 1 );
#endif
}
+void Desktop::layout()
+{
+ int displayw = qApp->desktop() ->width();
+ int displayh = qApp->desktop() ->height();
+
+ QSize sz = tb->sizeHint();
+
+ tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() );
+ tb->calcMaxWindowRect();
+}
+
void Desktop::startTransferServer()
{
// start qcop bridge server
qcopBridge = new QCopBridge( 4243 );
if ( !qcopBridge->ok() ) {
delete qcopBridge;
@@ -827,12 +834,22 @@ void Desktop::startTransferServer()
void Desktop::timerEvent( QTimerEvent *e )
{
killTimer( e->timerId() );
startTransferServer();
}
+bool Desktop::eventFilter( QObject *o, QEvent *ev )
+{
+ if ( o != qApp->desktop() || ev->type() != QEvent::Resize )
+ return QWidget::eventFilter( o, ev );
+
+ layout();
+
+ return QWidget::eventFilter( o, ev );
+}
+
void Desktop::terminateServers()
{
delete transferServer;
delete qcopBridge;
transferServer = 0;
qcopBridge = 0;
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index 4024c38..86d8aa8 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -131,18 +131,20 @@ public slots:
void terminateServers();
protected:
void executeOrModify( const QString& appLnkFile );
void styleChange( QStyle & );
void timerEvent( QTimerEvent *e );
+ virtual bool eventFilter( QObject *o, QEvent *ev );
QWidget *bg;
Launcher *launcher;
TaskBar *tb;
private:
+ void layout();
void startTransferServer();
bool recoverMemory();
QCopBridge *qcopBridge;
TransferServer *transferServer;
PackageSlave *packageSlave;
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index cd631ef..a0bf395 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -58,14 +58,15 @@ public slots:
protected:
void resizeEvent( QResizeEvent * );
void styleChange( QStyle & );
void setStatusMessage( const QString &text );
-private slots:
+public slots:
void calcMaxWindowRect();
+private slots:
void receive( const QCString &msg, const QByteArray &data );
private:
QTimer *waitTimer;
Wait *waitIcon;