summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-09 12:20:41 (UTC)
committer harlekin <harlekin>2003-12-09 12:20:41 (UTC)
commite7d88d21f5b5daede2d04479b7e1157c2ffe7396 (patch) (side-by-side diff)
treece334f5144e5c8884852eb571e40e7aa422cc6d3
parent7dac080b72cc36559e72563ffc9ad88f71b0574a (diff)
downloadopie-e7d88d21f5b5daede2d04479b7e1157c2ffe7396.zip
opie-e7d88d21f5b5daede2d04479b7e1157c2ffe7396.tar.gz
opie-e7d88d21f5b5daede2d04479b7e1157c2ffe7396.tar.bz2
more flexible layout, and different base layouts based on current screen rotation
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 6e8f4d3..7af7d83 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,29 +1,31 @@
#include <qlabel.h>
#include <qvbox.h>
#include <qheader.h>
#include <qtimer.h>
+#include <qlayout.h>
+#include <qpe/qpeapplication.h>
#include "defines.h"
#include "mainwindow.h"
#include "viewmail.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
: QMainWindow( parent, name, flags )
{
setCaption( tr( "Opie-Mail" ) );
setToolBarsMovable( false );
toolBar = new QToolBar( this );
menuBar = new QMenuBar( toolBar );
mailMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Mail" ), mailMenu );
settingsMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Settings" ), settingsMenu );
addToolBar( toolBar );
toolBar->setHorizontalStretchable( true );
QLabel *spacer = new QLabel( toolBar );
spacer->setBackgroundMode( QWidget::PaletteButton );
toolBar->setStretchableWidget( spacer );
@@ -43,65 +45,79 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
syncFolders->addTo( toolBar );
syncFolders->addTo( mailMenu );
showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
connect(showFolders, SIGNAL( toggled( bool ) ),
SLOT( slotShowFolders( bool ) ) );
searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
0, 0, this );
searchMails->addTo( toolBar );
searchMails->addTo( mailMenu );
editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
0, 0, this );
editSettings->addTo( settingsMenu );
editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
0, 0, this );
editAccounts->addTo( settingsMenu );
- QVBox *view = new QVBox( this );
+ QWidget *view = new QWidget( this );
setCentralWidget( view );
+
+ QWidget *d = QApplication::desktop();
+ QBoxLayout *layout;
+
+ if ( d->width() < d->height() ) {
+ layout = new QVBoxLayout( view );
+ } else {
+ layout = new QHBoxLayout( view );
+ }
+
folderView = new AccountView( view );
folderView->header()->hide();
- folderView->setMinimumHeight( 90 );
- folderView->setMaximumHeight( 90 );
folderView->addColumn( tr( "Mailbox" ) );
folderView->hide();
+ layout->addWidget( folderView );
+
mailView = new QListView( view );
- mailView->setMinimumHeight( 50 );
mailView->addColumn( tr( "Subject" ),QListView::Manual );
mailView->addColumn( tr( "Sender" ),QListView::Manual );
mailView->addColumn( tr( "Date" ));
mailView->setAllColumnsShowFocus(true);
mailView->setSorting(-1);
+
+ layout->addWidget( mailView );
+ layout->setStretchFactor( folderView, 1 );
+ layout->setStretchFactor( mailView, 2 );
+
connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
SLOT( displayMail( QListViewItem * ) ) );
connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*)));
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
}
void MainWindow::slotAdjustColumns()
{
bool hidden = folderView->isHidden();
if ( hidden ) folderView->show();
folderView->setColumnWidth( 0, folderView->visibleWidth() );
if ( hidden ) folderView->hide();
mailView->setColumnWidth( 0, mailView->visibleWidth() - 130 );
mailView->setColumnWidth( 1, 80 );
mailView->setColumnWidth( 2, 50 );
}
void MainWindow::slotShowFolders( bool show )
{
qDebug( "Show Folders" );
if ( show && folderView->isHidden() ) {