summaryrefslogtreecommitdiff
path: root/noncore/net/mail/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index b25db97..f19f93d 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -68,21 +68,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
68 0, 0, this ); 68 0, 0, this );
69 editAccounts->addTo( settingsMenu ); 69 editAccounts->addTo( settingsMenu );
70 70
71 QWidget *view = new QWidget( this ); 71 QWidget *view = new QWidget( this );
72 setCentralWidget( view ); 72 setCentralWidget( view );
73 73
74 74 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
75 QWidget *d = QApplication::desktop();
76 QBoxLayout *layout;
77
78 if ( d->width() < d->height() ) {
79 layout = new QVBoxLayout( view );
80 } else {
81 layout = new QHBoxLayout( view );
82 }
83 75
84 folderView = new AccountView( view ); 76 folderView = new AccountView( view );
85 folderView->header()->hide(); 77 folderView->header()->hide();
86 folderView->addColumn( tr( "Mailbox" ) ); 78 folderView->addColumn( tr( "Mailbox" ) );
87 folderView->hide(); 79 folderView->hide();
88 80
@@ -96,20 +88,35 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
96 mailView->setSorting(-1); 88 mailView->setSorting(-1);
97 89
98 layout->addWidget( mailView ); 90 layout->addWidget( mailView );
99 layout->setStretchFactor( folderView, 1 ); 91 layout->setStretchFactor( folderView, 1 );
100 layout->setStretchFactor( mailView, 2 ); 92 layout->setStretchFactor( mailView, 2 );
101 93
94 slotAdjustLayout();
95
102 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, 96 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
103 SLOT( displayMail( QListViewItem * ) ) ); 97 SLOT( displayMail( QListViewItem * ) ) );
104 98
105 connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 99 connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
106 100
107 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 101 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
108} 102}
109 103
104
105void MainWindow::slotAdjustLayout() {
106
107 QWidget *d = QApplication::desktop();
108
109 if ( d->width() < d->height() ) {
110 layout->setDirection( QBoxLayout::TopToBottom );
111 } else {
112 layout->setDirection( QBoxLayout::LeftToRight );
113 }
114 delete d;
115}
116
110void MainWindow::slotAdjustColumns() 117void MainWindow::slotAdjustColumns()
111{ 118{
112 bool hidden = folderView->isHidden(); 119 bool hidden = folderView->isHidden();
113 if ( hidden ) folderView->show(); 120 if ( hidden ) folderView->show();
114 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 121 folderView->setColumnWidth( 0, folderView->visibleWidth() );
115 if ( hidden ) folderView->hide(); 122 if ( hidden ) folderView->hide();
@@ -146,13 +153,14 @@ void MainWindow::displayMail(QListViewItem*item)
146 if (!item) return; 153 if (!item) return;
147 qDebug("View mail"); 154 qDebug("View mail");
148 RecMail mail = ((MailListViewItem*)item)->data(); 155 RecMail mail = ((MailListViewItem*)item)->data();
149 RecBody body = folderView->fetchBody(mail); 156 RecBody body = folderView->fetchBody(mail);
150 157
151 ViewMail readMail( this ); 158 ViewMail readMail( this );
152 readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body.Bodytext() ); 159
160 readMail.setMailInfo( mail.getFrom(), mail.To(), mail.getSubject(), mail.CC(), mail.Bcc(), mail.getDate(), body.Bodytext() );
153 readMail.showMaximized(); 161 readMail.showMaximized();
154 readMail.exec(); 162 readMail.exec();
155} 163}
156 164
157MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after ) 165MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after )
158 :QListViewItem(parent,after),mail_data() 166 :QListViewItem(parent,after),mail_data()