Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 7af7d83..b25db97 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -6,12 +6,14 @@ | |||
6 | 6 | ||
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | #include "defines.h" | 9 | #include "defines.h" |
10 | #include "mainwindow.h" | 10 | #include "mainwindow.h" |
11 | #include "viewmail.h" | 11 | #include "viewmail.h" |
12 | #include "mailtypes.h" | ||
13 | #include "mailistviewitem.h" | ||
12 | 14 | ||
13 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 15 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
14 | : QMainWindow( parent, name, flags ) | 16 | : QMainWindow( parent, name, flags ) |
15 | { | 17 | { |
16 | setCaption( tr( "Opie-Mail" ) ); | 18 | setCaption( tr( "Opie-Mail" ) ); |
17 | setToolBarsMovable( false ); | 19 | setToolBarsMovable( false ); |
@@ -97,13 +99,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
97 | layout->setStretchFactor( folderView, 1 ); | 99 | layout->setStretchFactor( folderView, 1 ); |
98 | layout->setStretchFactor( mailView, 2 ); | 100 | layout->setStretchFactor( mailView, 2 ); |
99 | 101 | ||
100 | connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, | 102 | connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, |
101 | SLOT( displayMail( QListViewItem * ) ) ); | 103 | SLOT( displayMail( QListViewItem * ) ) ); |
102 | 104 | ||
103 | connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*))); | 105 | connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); |
104 | 106 | ||
105 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 107 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
106 | } | 108 | } |
107 | 109 | ||
108 | void MainWindow::slotAdjustColumns() | 110 | void MainWindow::slotAdjustColumns() |
109 | { | 111 | { |
@@ -126,46 +128,50 @@ void MainWindow::slotShowFolders( bool show ) | |||
126 | } else if ( !show && !folderView->isHidden() ) { | 128 | } else if ( !show && !folderView->isHidden() ) { |
127 | qDebug( "-> hiding" ); | 129 | qDebug( "-> hiding" ); |
128 | folderView->hide(); | 130 | folderView->hide(); |
129 | } | 131 | } |
130 | } | 132 | } |
131 | 133 | ||
132 | void MainWindow::refreshMailView(Maillist*list) | 134 | void MainWindow::refreshMailView(QList<RecMail>*list) |
133 | { | 135 | { |
134 | MailListViewItem*item = 0; | 136 | MailListViewItem*item = 0; |
135 | mailView->clear(); | 137 | mailView->clear(); |
136 | #if 0 | ||
137 | QFont f = mailView->getFont(); | ||
138 | QFont bf = f; | ||
139 | #endif | ||
140 | for (unsigned int i = 0; i < list->count();++i) { | 138 | for (unsigned int i = 0; i < list->count();++i) { |
141 | item = new MailListViewItem(mailView,item); | 139 | item = new MailListViewItem(mailView,item); |
142 | item->storeData(*(list->at(i))); | 140 | item->storeData(*(list->at(i))); |
143 | item->showEntry(); | 141 | item->showEntry(); |
144 | #if 0 | ||
145 | if (!list->at(i)->getFlags().testBit(FLAG_SEEN)) { | ||
146 | item->setFont(bf); | ||
147 | } | ||
148 | #endif | ||
149 | } | 142 | } |
150 | } | 143 | } |
151 | void MainWindow::displayMail(QListViewItem*item) | 144 | void MainWindow::displayMail(QListViewItem*item) |
152 | { | 145 | { |
153 | if (!item) return; | 146 | if (!item) return; |
154 | qDebug("View mail"); | 147 | qDebug("View mail"); |
155 | RecMail mail = ((MailListViewItem*)item)->data(); | 148 | RecMail mail = ((MailListViewItem*)item)->data(); |
156 | QString body = folderView->fetchBody(mail); | 149 | RecBody body = folderView->fetchBody(mail); |
157 | 150 | ||
158 | ViewMail readMail( this ); | 151 | ViewMail readMail( this ); |
159 | readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body ); | 152 | readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body.Bodytext() ); |
160 | readMail.showMaximized(); | 153 | readMail.showMaximized(); |
161 | readMail.exec(); | 154 | readMail.exec(); |
155 | } | ||
162 | 156 | ||
163 | qDebug(body ); | 157 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after ) |
158 | :QListViewItem(parent,after),mail_data() | ||
159 | { | ||
164 | } | 160 | } |
165 | 161 | ||
166 | void MailListViewItem::showEntry() | 162 | void MailListViewItem::showEntry() |
167 | { | 163 | { |
168 | setText(0,mail_data.getSubject()); | 164 | setText(0,mail_data.getSubject()); |
169 | setText(1,mail_data.getFrom()); | 165 | setText(1,mail_data.getFrom()); |
170 | setText(2,mail_data.getDate()); | 166 | setText(2,mail_data.getDate()); |
171 | } | 167 | } |
168 | |||
169 | void MailListViewItem::storeData(const RecMail&data) | ||
170 | { | ||
171 | mail_data = data; | ||
172 | } | ||
173 | |||
174 | const RecMail& MailListViewItem::data()const | ||
175 | { | ||
176 | return mail_data; | ||
177 | } | ||