author | harlekin <harlekin> | 2003-12-09 12:20:41 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-09 12:20:41 (UTC) |
commit | e7d88d21f5b5daede2d04479b7e1157c2ffe7396 (patch) (unidiff) | |
tree | ce334f5144e5c8884852eb571e40e7aa422cc6d3 | |
parent | 7dac080b72cc36559e72563ffc9ad88f71b0574a (diff) | |
download | opie-e7d88d21f5b5daede2d04479b7e1157c2ffe7396.zip opie-e7d88d21f5b5daede2d04479b7e1157c2ffe7396.tar.gz opie-e7d88d21f5b5daede2d04479b7e1157c2ffe7396.tar.bz2 |
more flexible layout, and different base layouts based on current screen rotation
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 24 |
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,17 +1,19 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qvbox.h> | 2 | #include <qvbox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qlayout.h> | ||
5 | 6 | ||
7 | #include <qpe/qpeapplication.h> | ||
6 | 8 | ||
7 | #include "defines.h" | 9 | #include "defines.h" |
8 | #include "mainwindow.h" | 10 | #include "mainwindow.h" |
9 | #include "viewmail.h" | 11 | #include "viewmail.h" |
10 | 12 | ||
11 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 13 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
12 | : QMainWindow( parent, name, flags ) | 14 | : QMainWindow( parent, name, flags ) |
13 | { | 15 | { |
14 | setCaption( tr( "Opie-Mail" ) ); | 16 | setCaption( tr( "Opie-Mail" ) ); |
15 | setToolBarsMovable( false ); | 17 | setToolBarsMovable( false ); |
16 | 18 | ||
17 | toolBar = new QToolBar( this ); | 19 | toolBar = new QToolBar( this ); |
@@ -55,41 +57,55 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
55 | searchMails->addTo( toolBar ); | 57 | searchMails->addTo( toolBar ); |
56 | searchMails->addTo( mailMenu ); | 58 | searchMails->addTo( mailMenu ); |
57 | 59 | ||
58 | 60 | ||
59 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, | 61 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, |
60 | 0, 0, this ); | 62 | 0, 0, this ); |
61 | editSettings->addTo( settingsMenu ); | 63 | editSettings->addTo( settingsMenu ); |
62 | 64 | ||
63 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, | 65 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, |
64 | 0, 0, this ); | 66 | 0, 0, this ); |
65 | editAccounts->addTo( settingsMenu ); | 67 | editAccounts->addTo( settingsMenu ); |
66 | 68 | ||
67 | QVBox *view = new QVBox( this ); | 69 | QWidget *view = new QWidget( this ); |
68 | setCentralWidget( view ); | 70 | setCentralWidget( view ); |
69 | 71 | ||
72 | |||
73 | QWidget *d = QApplication::desktop(); | ||
74 | QBoxLayout *layout; | ||
75 | |||
76 | if ( d->width() < d->height() ) { | ||
77 | layout = new QVBoxLayout( view ); | ||
78 | } else { | ||
79 | layout = new QHBoxLayout( view ); | ||
80 | } | ||
81 | |||
70 | folderView = new AccountView( view ); | 82 | folderView = new AccountView( view ); |
71 | folderView->header()->hide(); | 83 | folderView->header()->hide(); |
72 | folderView->setMinimumHeight( 90 ); | ||
73 | folderView->setMaximumHeight( 90 ); | ||
74 | folderView->addColumn( tr( "Mailbox" ) ); | 84 | folderView->addColumn( tr( "Mailbox" ) ); |
75 | folderView->hide(); | 85 | folderView->hide(); |
76 | 86 | ||
87 | layout->addWidget( folderView ); | ||
88 | |||
77 | mailView = new QListView( view ); | 89 | mailView = new QListView( view ); |
78 | mailView->setMinimumHeight( 50 ); | ||
79 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 90 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
80 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 91 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
81 | mailView->addColumn( tr( "Date" )); | 92 | mailView->addColumn( tr( "Date" )); |
82 | mailView->setAllColumnsShowFocus(true); | 93 | mailView->setAllColumnsShowFocus(true); |
83 | mailView->setSorting(-1); | 94 | mailView->setSorting(-1); |
95 | |||
96 | layout->addWidget( mailView ); | ||
97 | layout->setStretchFactor( folderView, 1 ); | ||
98 | layout->setStretchFactor( mailView, 2 ); | ||
99 | |||
84 | connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, | 100 | connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, |
85 | SLOT( displayMail( QListViewItem * ) ) ); | 101 | SLOT( displayMail( QListViewItem * ) ) ); |
86 | 102 | ||
87 | connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*))); | 103 | connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*))); |
88 | 104 | ||
89 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 105 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
90 | } | 106 | } |
91 | 107 | ||
92 | void MainWindow::slotAdjustColumns() | 108 | void MainWindow::slotAdjustColumns() |
93 | { | 109 | { |
94 | bool hidden = folderView->isHidden(); | 110 | bool hidden = folderView->isHidden(); |
95 | if ( hidden ) folderView->show(); | 111 | if ( hidden ) folderView->show(); |