-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 32 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 4 |
2 files changed, 29 insertions, 7 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index c115b32..93d80d9 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -7,4 +7,5 @@ #include <opie2/odebug.h> #include <qpe/qpeapplication.h> +#include <qpe/qcopenvelope_qws.h> #include "defines.h" @@ -87,5 +88,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) QWidget *view = new QWidget( wrapperBox ); - layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); @@ -114,4 +114,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) layout->setStretchFactor( mailView, 2 ); + m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); + slotAdjustLayout(); @@ -134,4 +136,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); + m_sysChannel = new QCopChannel( "QPE/System", this ); + connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); #endif @@ -143,4 +148,18 @@ MainWindow::~MainWindow() } +void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) +{ + int _newrotation; + QDataStream stream( data, IO_ReadOnly ); + if ( msg == "setCurrentRotation(int)" ) + { + stream >> _newrotation; + if (m_Rotate != _newrotation) { + slotAdjustLayout(); + m_Rotate = _newrotation; + } + } +} + void MainWindow::appMessage(const QCString &, const QByteArray &) { @@ -150,11 +169,10 @@ void MainWindow::appMessage(const QCString &, const QByteArray &) void MainWindow::slotAdjustLayout() { - QWidget *d = QApplication::desktop(); - - if ( d->width() < d->height() ) { - layout->setDirection( QBoxLayout::TopToBottom ); + QWidget *d = QApplication::desktop(); + if ( d->width() < d->height() ) { + layout->setDirection( QBoxLayout::TopToBottom ); } else { - layout->setDirection( QBoxLayout::LeftToRight ); - } + layout->setDirection( QBoxLayout::LeftToRight ); + } } diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 8d004c6..8cec888 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h @@ -16,4 +16,5 @@ class RecMail; +class QCopChannel; class MainWindow : public QMainWindow @@ -29,4 +30,5 @@ public slots: virtual void appMessage(const QCString &msg, const QByteArray &data); virtual void slotComposeMail(); + virtual void systemMessage( const QCString&, const QByteArray& ); protected slots: @@ -52,4 +54,6 @@ protected: QListView *mailView; QBoxLayout *layout; + int m_Rotate; + QCopChannel* m_sysChannel; }; |