author | groucho <groucho> | 2003-04-24 11:19:11 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-24 11:19:11 (UTC) |
commit | 9671975e21266e3bfa6f3c793a3278b67cea34b7 (patch) (unidiff) | |
tree | 876c77939cfd0e00fc844b1b5af09b2978564a6d /noncore/net/mailit/writemail.cpp | |
parent | 51e782b9658de61dc02579e115a9c62f396609a3 (diff) | |
download | opie-9671975e21266e3bfa6f3c793a3278b67cea34b7.zip opie-9671975e21266e3bfa6f3c793a3278b67cea34b7.tar.gz opie-9671975e21266e3bfa6f3c793a3278b67cea34b7.tar.bz2 |
- reworked size filtering
- started reworking offline download
- better tab focus switching
- Hello "Whats this" capability
- Fixed parsing of To: header files (no more Delivered-To: and Reply-To: matches)
- Good bye Settings.txt, hello Config Objects and encrypted passwords
- Translation improvements (added trs)
- Parser optimizations
Diffstat (limited to 'noncore/net/mailit/writemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index a9dcb02..0336c83 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -15,22 +15,23 @@ | |||
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qwhatsthis.h> | ||
21 | #include "writemail.h" | 22 | #include "writemail.h" |
22 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
23 | 24 | ||
24 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) | 25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) |
25 | : QMainWindow( parent, name, fl ) | 26 | : QMainWindow( parent, name, fl ) |
26 | { | 27 | { |
27 | showingAddressList = FALSE; | 28 | showingAddressList = FALSE; |
28 | init(); | 29 | init(); |
29 | 30 | ||
30 | addAtt = new AddAtt(0, "Add Attatchments"); | 31 | addAtt = new AddAtt(0, "Add Attachments"); |
31 | } | 32 | } |
32 | 33 | ||
33 | WriteMail::~WriteMail() | 34 | WriteMail::~WriteMail() |
34 | { | 35 | { |
35 | delete addAtt; | 36 | delete addAtt; |
36 | } | 37 | } |
@@ -61,92 +62,99 @@ void WriteMail::init() | |||
61 | mailMenu = new QPopupMenu(menu); | 62 | mailMenu = new QPopupMenu(menu); |
62 | menu->insertItem( tr( "&Mail" ), mailMenu); | 63 | menu->insertItem( tr( "&Mail" ), mailMenu); |
63 | addMenu = new QPopupMenu(menu); | 64 | addMenu = new QPopupMenu(menu); |
64 | menu->insertItem( tr( "&Add" ), addMenu); | 65 | menu->insertItem( tr( "&Add" ), addMenu); |
65 | 66 | ||
66 | bar = new QToolBar(this); | 67 | bar = new QToolBar(this); |
67 | attatchButton = new QAction(tr("Attatchment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); | 68 | attachButton = new QAction(tr("Attachment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); |
68 | attatchButton->addTo(bar); | 69 | attachButton->addTo(bar); |
69 | attatchButton->addTo(addMenu); | 70 | attachButton->addTo(addMenu); |
70 | connect( attatchButton, SIGNAL( activated() ), this, SLOT( attatchFile() ) ); | 71 | connect( attachButton, SIGNAL( activated() ), this, SLOT( attachFile() ) ); |
72 | attachButton->setWhatsThis(tr("Click here to attach files to your mail")); | ||
71 | 73 | ||
72 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); | 74 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); |
73 | confirmButton->addTo(bar); | 75 | confirmButton->addTo(bar); |
74 | confirmButton->addTo(mailMenu); | 76 | confirmButton->addTo(mailMenu); |
75 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); | 77 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); |
78 | confirmButton->setWhatsThis(tr("This button puts your mail in the send queue")); | ||
76 | 79 | ||
77 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 80 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
78 | newButton->addTo(mailMenu); | 81 | newButton->addTo(mailMenu); |
79 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); | 82 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); |
83 | newButton->setWhatsThis(tr("Click here to create a new mail")); | ||
80 | 84 | ||
81 | widget = new QWidget(this, "widget"); | 85 | widget = new QWidget(this, "widget"); |
82 | grid = new QGridLayout( widget ); | 86 | grid = new QGridLayout( widget ); |
83 | 87 | ||
84 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); | 88 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); |
85 | recipientsBox->insertItem( tr( "To:" ) ); | 89 | recipientsBox->insertItem( tr( "To:" ) ); |
86 | recipientsBox->insertItem( tr( "CC:" ) ); | 90 | recipientsBox->insertItem( tr( "CC:" ) ); |
87 | recipientsBox->setCurrentItem(0); | 91 | recipientsBox->setCurrentItem(0); |
88 | grid->addWidget( recipientsBox, 0, 0 ); | 92 | grid->addWidget( recipientsBox, 0, 0 ); |
89 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); | 93 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); |
90 | 94 | ||
91 | |||
92 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 95 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
93 | subjetLabel->setText( tr( "Subject:" ) ); | 96 | subjetLabel->setText( tr( "Subject:" ) ); |
94 | 97 | ||
95 | grid->addWidget( subjetLabel, 1, 0 ); | 98 | grid->addWidget( subjetLabel, 1, 0 ); |
96 | 99 | ||
97 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); | 100 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); |
98 | ToolButton13_2->setText( tr( "..." ) ); | 101 | ToolButton13_2->setText( tr( "..." ) ); |
99 | grid->addWidget( ToolButton13_2, 1, 2 ); | 102 | grid->addWidget( ToolButton13_2, 1, 2 ); |
100 | 103 | ||
101 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 104 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
102 | grid->addWidget( subjectInput, 1, 1 ); | 105 | grid->addWidget( subjectInput, 1, 1 ); |
106 | QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); | ||
103 | 107 | ||
104 | toInput = new QLineEdit( widget, "toInput" ); | 108 | toInput = new QLineEdit( widget, "toInput" ); |
105 | grid->addWidget( toInput, 0, 1 ); | 109 | grid->addWidget( toInput, 0, 1 ); |
110 | QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); | ||
106 | 111 | ||
107 | ccInput = new QLineEdit( widget, "ccInput" ); | 112 | ccInput = new QLineEdit( widget, "ccInput" ); |
108 | ccInput->hide(); | 113 | ccInput->hide(); |
109 | grid->addWidget( ccInput, 0, 1 ); | 114 | grid->addWidget( ccInput, 0, 1 ); |
110 | 115 | QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); | |
111 | 116 | ||
112 | addressButton = new QToolButton( widget, "addressButton" ); | 117 | addressButton = new QToolButton( widget, "addressButton" ); |
113 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 118 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
114 | addressButton->setToggleButton(TRUE); | 119 | addressButton->setToggleButton(TRUE); |
115 | grid->addWidget( addressButton, 0, 2 ); | 120 | grid->addWidget( addressButton, 0, 2 ); |
116 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 121 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
122 | QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); | ||
117 | 123 | ||
118 | emailInput = new QMultiLineEdit( widget, "emailInput" ); | 124 | emailInput = new QMultiLineEdit( widget, "emailInput" ); |
119 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 125 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
120 | 126 | QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here")); | |
121 | 127 | ||
122 | addressView = new QListView( widget, "addressView"); | 128 | addressView = new QListView( widget, "addressView"); |
123 | addressView->addColumn("Name"); | 129 | addressView->addColumn("Name"); |
124 | addressView->addColumn("EMail"); | 130 | addressView->addColumn("EMail"); |
125 | addressView->setAllColumnsShowFocus(TRUE); | 131 | addressView->setAllColumnsShowFocus(TRUE); |
126 | addressView->setMultiSelection(TRUE); | 132 | addressView->setMultiSelection(TRUE); |
127 | addressView->hide(); | 133 | addressView->hide(); |
128 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 134 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
135 | QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list")); | ||
129 | 136 | ||
130 | okButton = new QToolButton(bar, "ok"); | 137 | okButton = new QToolButton(bar, "ok"); |
131 | okButton->setPixmap( Resource::loadPixmap("enter") ); | 138 | okButton->setPixmap( Resource::loadPixmap("enter") ); |
132 | okButton->hide(); | 139 | okButton->hide(); |
133 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); | 140 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); |
141 | QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); | ||
134 | 142 | ||
135 | setCentralWidget(widget); | 143 | setCentralWidget(widget); |
136 | } | 144 | } |
137 | 145 | ||
138 | void WriteMail::reject() | 146 | void WriteMail::reject() |
139 | { | 147 | { |
140 | emit cancelMail(); | 148 | emit cancelMail(); |
141 | } | 149 | } |
142 | 150 | ||
143 | // need to insert date | 151 | // need to insert date |
144 | void WriteMail::accept() | 152 | void WriteMail::accept() |
145 | { | 153 | { |
146 | QStringList attatchedFiles, attatchmentsType; | 154 | QStringList attachedFiles, attachmentsType; |
147 | int idCount = 0; | 155 | int idCount = 0; |
148 | 156 | ||
149 | if (toInput->text() == "") | 157 | if (toInput->text() == "") |
150 | { | 158 | { |
151 | QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); | 159 | QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); |
152 | return; | 160 | return; |
@@ -193,19 +201,19 @@ void WriteMail::accept() | |||
193 | 201 | ||
194 | mail.rawMail += mail.from; | 202 | mail.rawMail += mail.from; |
195 | mail.rawMail += "\nSubject: "; | 203 | mail.rawMail += "\nSubject: "; |
196 | mail.rawMail += mail.subject; | 204 | mail.rawMail += mail.subject; |
197 | mail.rawMail += "\n\n"; | 205 | mail.rawMail += "\n\n"; |
198 | 206 | ||
199 | attatchedFiles = addAtt->returnAttatchedFiles(); | 207 | attachedFiles = addAtt->returnattachedFiles(); |
200 | attatchmentsType = addAtt->returnFileTypes(); | 208 | attachmentsType = addAtt->returnFileTypes(); |
201 | 209 | ||
202 | QStringList::Iterator itType = attatchmentsType.begin(); | 210 | QStringList::Iterator itType = attachmentsType.begin(); |
203 | 211 | ||
204 | Enclosure e; | 212 | Enclosure e; |
205 | for ( QStringList::Iterator it = attatchedFiles.begin(); it != attatchedFiles.end(); ++it ) { | 213 | for ( QStringList::Iterator it = attachedFiles.begin(); it != attachedFiles.end(); ++it ) { |
206 | e.id = idCount; | 214 | e.id = idCount; |
207 | e.originalName = (*it).latin1(); | 215 | e.originalName = (*it).latin1(); |
208 | e.contentType = (*itType).latin1(); | 216 | e.contentType = (*itType).latin1(); |
209 | e.contentAttribute = (*itType).latin1(); | 217 | e.contentAttribute = (*itType).latin1(); |
210 | e.saved = TRUE; | 218 | e.saved = TRUE; |
211 | mail.addEnclosure(&e); | 219 | mail.addEnclosure(&e); |
@@ -233,13 +241,13 @@ void WriteMail::getAddress() | |||
233 | addressView->hide(); | 241 | addressView->hide(); |
234 | okButton->hide(); | 242 | okButton->hide(); |
235 | emailInput->show(); | 243 | emailInput->show(); |
236 | } | 244 | } |
237 | } | 245 | } |
238 | 246 | ||
239 | void WriteMail::attatchFile() | 247 | void WriteMail::attachFile() |
240 | { | 248 | { |
241 | addAtt->showMaximized(); | 249 | addAtt->showMaximized(); |
242 | } | 250 | } |
243 | 251 | ||
244 | void WriteMail::reply(Email replyMail, bool replyAll) | 252 | void WriteMail::reply(Email replyMail, bool replyAll) |
245 | { | 253 | { |
@@ -253,13 +261,13 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
253 | 261 | ||
254 | addRecipients(replyAll); | 262 | addRecipients(replyAll); |
255 | 263 | ||
256 | subjectInput->setText(tr("Re: ") + mail.subject); | 264 | subjectInput->setText(tr("Re: ") + mail.subject); |
257 | 265 | ||
258 | pos = 0; | 266 | pos = 0; |
259 | mail.body.insert(pos, ">>"); | 267 | mail.body.insert(pos, ">"); |
260 | while (pos != -1) { | 268 | while (pos != -1) { |
261 | pos = mail.body.find('\n', pos); | 269 | pos = mail.body.find('\n', pos); |
262 | if (pos != -1) | 270 | if (pos != -1) |
263 | mail.body.insert(++pos, ">>"); | 271 | mail.body.insert(++pos, ">>"); |
264 | } | 272 | } |
265 | 273 | ||