summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-17 23:36:56 (UTC)
committer harlekin <harlekin>2003-12-17 23:36:56 (UTC)
commite996a7b13e2860280a63d089716958c7886cdc8d (patch) (unidiff)
treec4a8f3da11570d31d947528eecd63a0cfaebc755
parentd30140b2bb0f5399b7555646548296ceab65fa20 (diff)
downloadopie-e996a7b13e2860280a63d089716958c7886cdc8d.zip
opie-e996a7b13e2860280a63d089716958c7886cdc8d.tar.gz
opie-e996a7b13e2860280a63d089716958c7886cdc8d.tar.bz2
pics/mail is the picture folder for the new mailer
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/defines.h22
-rw-r--r--noncore/net/mail/mainwindow.cpp8
-rw-r--r--noncore/net/mail/opie-mail.control6
3 files changed, 18 insertions, 18 deletions
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h
index c849f1a..9036658 100644
--- a/noncore/net/mail/defines.h
+++ b/noncore/net/mail/defines.h
@@ -1,40 +1,40 @@
1#ifndef DEFINE_CONSTANTS_H 1#ifndef DEFINE_CONSTANTS_H
2#define DEFINE_CONSTANTS_H 2#define DEFINE_CONSTANTS_H
3 3
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5 5
6#define USER_AGENT "OpieMail v0.0.1-alpha" 6#define USER_AGENT "OpieMail v0.1"
7 7
8#define PIC_COMPOSEMAIL "opiemail/composemail" 8#define PIC_COMPOSEMAIL "mail/composemail"
9#define PIC_SENDQUEUED "opiemail/sendqueued" 9#define PIC_SENDQUEUED "mail/sendqueued"
10#define PIC_SHOWFOLDERS "opiemail/showfolders" 10#define PIC_SHOWFOLDERS "mail/showfolders"
11#define PIC_SEARCHMAILS "opiemail/searchmails" 11#define PIC_SEARCHMAILS "mail/searchmails"
12#define PIC_EDITSETTINGS "opiemail/editsettings" 12#define PIC_EDITSETTINGS "mail/editsettings"
13#define PIC_EDITACCOUNTS "opiemail/editaccounts" 13#define PIC_EDITACCOUNTS "mail/editaccounts"
14#define PIC_SYNC "opiemail/sync" 14#define PIC_SYNC "mail/sync"
15#define PIC_IMAPFOLDER "opiemail/imapfolder" 15#define PIC_IMAPFOLDER "mail/imapfolder"
16#define PIC_POP3FOLDER "opiemail/pop3folder" 16#define PIC_POP3FOLDER "mail/pop3folder"
17#define PIC_INBOXFOLDER "opiemail/inbox" 17#define PIC_INBOXFOLDER "mail/inbox"
18 18
19#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) 19#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) )
20#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) 20#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) )
21#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) 21#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) )
22#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) 22#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) )
23#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) 23#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) )
24#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) 24#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) )
25#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) 25#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) )
26 26
27#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) 27#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) )
28#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) ) 28#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) )
29#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) ) 29#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) )
30 30
31#define IMAP_PORT "143" 31#define IMAP_PORT "143"
32#define IMAP_SSL_PORT "993" 32#define IMAP_SSL_PORT "993"
33#define SMTP_PORT "25" 33#define SMTP_PORT "25"
34#define SMTP_SSL_PORT "465" 34#define SMTP_SSL_PORT "465"
35#define POP3_PORT "110" 35#define POP3_PORT "110"
36#define POP3_SSL_PORT "995" 36#define POP3_SSL_PORT "995"
37#define NNTP_PORT "119" 37#define NNTP_PORT "119"
38#define NNTP_SSL_PORT "563" 38#define NNTP_SSL_PORT "563"
39 39
40#endif 40#endif
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 8e2132e..89530ab 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,224 +1,224 @@
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#include <qlayout.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7 7
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10 10
11#include "defines.h" 11#include "defines.h"
12#include "mainwindow.h" 12#include "mainwindow.h"
13#include "viewmail.h" 13#include "viewmail.h"
14#include "mailtypes.h" 14#include "mailtypes.h"
15#include "mailistviewitem.h" 15#include "mailistviewitem.h"
16 16
17MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 17MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
18 : QMainWindow( parent, name, flags ) 18 : QMainWindow( parent, name, flags )
19{ 19{
20 setCaption( tr( "Mail" ) ); 20 setCaption( tr( "Mail" ) );
21 setToolBarsMovable( false ); 21 setToolBarsMovable( false );
22 22
23 toolBar = new QToolBar( this ); 23 toolBar = new QToolBar( this );
24 menuBar = new QMenuBar( toolBar ); 24 menuBar = new QMenuBar( toolBar );
25 mailMenu = new QPopupMenu( menuBar ); 25 mailMenu = new QPopupMenu( menuBar );
26 menuBar->insertItem( tr( "Mail" ), mailMenu ); 26 menuBar->insertItem( tr( "Mail" ), mailMenu );
27 settingsMenu = new QPopupMenu( menuBar ); 27 settingsMenu = new QPopupMenu( menuBar );
28 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 28 menuBar->insertItem( tr( "Settings" ), settingsMenu );
29 29
30 addToolBar( toolBar ); 30 addToolBar( toolBar );
31 toolBar->setHorizontalStretchable( true ); 31 toolBar->setHorizontalStretchable( true );
32 32
33 QLabel *spacer = new QLabel( toolBar ); 33 QLabel *spacer = new QLabel( toolBar );
34 spacer->setBackgroundMode( QWidget::PaletteButton ); 34 spacer->setBackgroundMode( QWidget::PaletteButton );
35 toolBar->setStretchableWidget( spacer ); 35 toolBar->setStretchableWidget( spacer );
36 36
37 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 37 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
38 0, 0, this ); 38 0, 0, this );
39 composeMail->addTo( toolBar ); 39 composeMail->addTo( toolBar );
40 composeMail->addTo( mailMenu ); 40 composeMail->addTo( mailMenu );
41 41
42 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 42 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
43 0, 0, this ); 43 0, 0, this );
44 sendQueued->addTo( toolBar ); 44 sendQueued->addTo( toolBar );
45 sendQueued->addTo( mailMenu ); 45 sendQueued->addTo( mailMenu );
46 46
47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
48 0, 0, this ); 48 0, 0, this );
49 syncFolders->addTo( toolBar ); 49 syncFolders->addTo( toolBar );
50 syncFolders->addTo( mailMenu ); 50 syncFolders->addTo( mailMenu );
51 51
52 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 52 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
53 0, 0, this, 0, true ); 53 0, 0, this, 0, true );
54 showFolders->addTo( toolBar ); 54 showFolders->addTo( toolBar );
55 showFolders->addTo( mailMenu ); 55 showFolders->addTo( mailMenu );
56 showFolders->setOn( true ); 56 showFolders->setOn( true );
57 connect(showFolders, SIGNAL( toggled( bool ) ), 57 connect(showFolders, SIGNAL( toggled( bool ) ),
58 SLOT( slotShowFolders( bool ) ) ); 58 SLOT( slotShowFolders( bool ) ) );
59 59
60 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, 60 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
61 0, 0, this ); 61 0, 0, this );
62 searchMails->addTo( toolBar ); 62 searchMails->addTo( toolBar );
63 searchMails->addTo( mailMenu ); 63 searchMails->addTo( mailMenu );
64 64
65 deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); 65 deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
66 deleteMails->addTo( toolBar ); 66 deleteMails->addTo( toolBar );
67 deleteMails->addTo( mailMenu ); 67 deleteMails->addTo( mailMenu );
68 connect( deleteMails, SIGNAL( activated() ), 68 connect( deleteMails, SIGNAL( activated() ),
69 SLOT( slotDeleteMail() ) ); 69 SLOT( slotDeleteMail() ) );
70 70
71 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 71 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
72 0, 0, this ); 72 0, 0, this );
73 editSettings->addTo( settingsMenu ); 73 editSettings->addTo( settingsMenu );
74 74
75 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 75 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
76 0, 0, this ); 76 0, 0, this );
77 editAccounts->addTo( settingsMenu ); 77 editAccounts->addTo( settingsMenu );
78 78
79 QWidget *view = new QWidget( this ); 79 QWidget *view = new QWidget( this );
80 setCentralWidget( view ); 80 setCentralWidget( view );
81 81
82 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 82 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
83 83
84 folderView = new AccountView( view ); 84 folderView = new AccountView( view );
85 folderView->header()->hide(); 85 folderView->header()->hide();
86 folderView->setRootIsDecorated( true ); 86 folderView->setRootIsDecorated( true );
87 folderView->addColumn( tr( "Mailbox" ) ); 87 folderView->addColumn( tr( "Mailbox" ) );
88 //folderView->hide(); 88 //folderView->hide();
89 89
90 layout->addWidget( folderView ); 90 layout->addWidget( folderView );
91 91
92 mailView = new QListView( view ); 92 mailView = new QListView( view );
93 mailView->addColumn( tr( "" ) ); 93 mailView->addColumn( tr( "" ) );
94 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 94 mailView->addColumn( tr( "Subject" ),QListView::Manual );
95 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 95 mailView->addColumn( tr( "Sender" ),QListView::Manual );
96 mailView->addColumn( tr( "Date" )); 96 mailView->addColumn( tr( "Date" ));
97 mailView->setAllColumnsShowFocus(true); 97 mailView->setAllColumnsShowFocus(true);
98 mailView->setSorting(-1); 98 mailView->setSorting(-1);
99 99
100 layout->addWidget( mailView ); 100 layout->addWidget( mailView );
101 layout->setStretchFactor( folderView, 1 ); 101 layout->setStretchFactor( folderView, 1 );
102 layout->setStretchFactor( mailView, 2 ); 102 layout->setStretchFactor( mailView, 2 );
103 103
104 slotAdjustLayout(); 104 slotAdjustLayout();
105 105
106 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, 106 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
107 SLOT( displayMail( QListViewItem * ) ) ); 107 SLOT( displayMail( QListViewItem * ) ) );
108 108
109 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 109 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
110 110
111 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 111 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
112 112
113} 113}
114 114
115 115
116void MainWindow::slotAdjustLayout() { 116void MainWindow::slotAdjustLayout() {
117 117
118 QWidget *d = QApplication::desktop(); 118 QWidget *d = QApplication::desktop();
119 119
120 if ( d->width() < d->height() ) { 120 if ( d->width() < d->height() ) {
121 layout->setDirection( QBoxLayout::TopToBottom ); 121 layout->setDirection( QBoxLayout::TopToBottom );
122 } else { 122 } else {
123 layout->setDirection( QBoxLayout::LeftToRight ); 123 layout->setDirection( QBoxLayout::LeftToRight );
124 } 124 }
125 delete d; 125 delete d;
126} 126}
127 127
128void MainWindow::slotAdjustColumns() 128void MainWindow::slotAdjustColumns()
129{ 129{
130 bool hidden = folderView->isHidden(); 130 bool hidden = folderView->isHidden();
131 if ( hidden ) folderView->show(); 131 if ( hidden ) folderView->show();
132 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 132 folderView->setColumnWidth( 0, folderView->visibleWidth() );
133 if ( hidden ) folderView->hide(); 133 if ( hidden ) folderView->hide();
134 134
135 mailView->setColumnWidth( 0, 10 ); 135 mailView->setColumnWidth( 0, 10 );
136 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 136 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
137 mailView->setColumnWidth( 2, 80 ); 137 mailView->setColumnWidth( 2, 80 );
138 mailView->setColumnWidth( 3, 50 ); 138 mailView->setColumnWidth( 3, 50 );
139} 139}
140 140
141void MainWindow::slotShowFolders( bool show ) 141void MainWindow::slotShowFolders( bool show )
142{ 142{
143 qDebug( "Show Folders" ); 143 qDebug( "Show Folders" );
144 if ( show && folderView->isHidden() ) { 144 if ( show && folderView->isHidden() ) {
145 qDebug( "-> showing" ); 145 qDebug( "-> showing" );
146 folderView->show(); 146 folderView->show();
147 } else if ( !show && !folderView->isHidden() ) { 147 } else if ( !show && !folderView->isHidden() ) {
148 qDebug( "-> hiding" ); 148 qDebug( "-> hiding" );
149 folderView->hide(); 149 folderView->hide();
150 } 150 }
151} 151}
152 152
153void MainWindow::refreshMailView(QList<RecMail>*list) 153void MainWindow::refreshMailView(QList<RecMail>*list)
154{ 154{
155 MailListViewItem*item = 0; 155 MailListViewItem*item = 0;
156 mailView->clear(); 156 mailView->clear();
157 for (unsigned int i = 0; i < list->count();++i) { 157 for (unsigned int i = 0; i < list->count();++i) {
158 item = new MailListViewItem(mailView,item); 158 item = new MailListViewItem(mailView,item);
159 item->storeData(*(list->at(i))); 159 item->storeData(*(list->at(i)));
160 item->showEntry(); 160 item->showEntry();
161 } 161 }
162} 162}
163void MainWindow::displayMail(QListViewItem*item) 163void MainWindow::displayMail(QListViewItem*item)
164{ 164{
165 165
166 if (!item) return; 166 if (!item) return;
167 RecMail mail = ((MailListViewItem*)item)->data(); 167 RecMail mail = ((MailListViewItem*)item)->data();
168 RecBody body = folderView->fetchBody(mail); 168 RecBody body = folderView->fetchBody(mail);
169 169
170 ViewMail readMail( this ); 170 ViewMail readMail( this );
171 readMail.setBody( body ); 171 readMail.setBody( body );
172 readMail.setMail( mail ); 172 readMail.setMail( mail );
173 readMail.showMaximized(); 173 readMail.showMaximized();
174 readMail.exec(); 174 readMail.exec();
175 175
176 if ( readMail.deleted ) { 176 if ( readMail.deleted ) {
177 folderView->refreshCurrent(); 177 folderView->refreshCurrent();
178 } else { 178 } else {
179 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 179 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
180 } 180 }
181} 181}
182 182
183void MainWindow::slotDeleteMail() 183void MainWindow::slotDeleteMail()
184{ 184{
185 if (!mailView->currentItem()) return; 185 if (!mailView->currentItem()) return;
186 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); 186 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
187 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { 187 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
188 mail.Wrapper()->deleteMail( mail ); 188 mail.Wrapper()->deleteMail( mail );
189 folderView->refreshCurrent(); 189 folderView->refreshCurrent();
190 } 190 }
191} 191}
192 192
193 193
194 194
195MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 195MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
196 :QListViewItem(parent,item),mail_data() 196 :QListViewItem(parent,item),mail_data()
197{ 197{
198} 198}
199 199
200void MailListViewItem::showEntry() 200void MailListViewItem::showEntry()
201{ 201{
202 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) { 202 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
203 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgreplied") ); 203 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
204 } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { 204 } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
205 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 205 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
206 } else { 206 } else {
207 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") ); 207 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") );
208 } 208 }
209 setText(1,mail_data.getSubject()); 209 setText(1,mail_data.getSubject());
210 setText(2,mail_data.getFrom()); 210 setText(2,mail_data.getFrom());
211 setText(3,mail_data.getDate()); 211 setText(3,mail_data.getDate());
212} 212}
213 213
214void MailListViewItem::storeData(const RecMail&data) 214void MailListViewItem::storeData(const RecMail&data)
215{ 215{
216 mail_data = data; 216 mail_data = data;
217} 217}
218 218
219const RecMail& MailListViewItem::data()const 219const RecMail& MailListViewItem::data()const
220{ 220{
221 return mail_data; 221 return mail_data;
222} 222}
223 223
224 224
diff --git a/noncore/net/mail/opie-mail.control b/noncore/net/mail/opie-mail.control
index 2ea860e..c1a4312 100644
--- a/noncore/net/mail/opie-mail.control
+++ b/noncore/net/mail/opie-mail.control
@@ -1,10 +1,10 @@
1Package: opie-mail 1Package: opie-mail
2Files: bin/opiemail apps/1Pim/mail.desktop pics/opiemail/*.png plugins/application/libopiemail.so* 2Files: bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png plugins/application/libopiemail.so*
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: Juergen Graf <jgf@handhelds.org> 5Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 0.0.1-$SUB_VERSION 7Version: 0.1-$SUB_VERSION
8Depends: task-opie-minimal, libopie1 8Depends: task-opie-minimal, libopie1
9Description: Opie's mail and news client (POP3, IMAP and NNTP) 9Description: Opie's mail and news client (POP3, IMAP and NNTP)
10License: LGPL 10License: LGPL