author | alwin <alwin> | 2004-01-12 15:47:40 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-12 15:47:40 (UTC) |
commit | 334a1b57629211cdd77af4ea6857bfc41ab0cefb (patch) (unidiff) | |
tree | d9a7daf0e05efad79d05bf4dbffa19953ddbae17 | |
parent | 713a845a0d2ad3aba8230a5ba743a1c7b1622ef1 (diff) | |
download | opie-334a1b57629211cdd77af4ea6857bfc41ab0cefb.zip opie-334a1b57629211cdd77af4ea6857bfc41ab0cefb.tar.gz opie-334a1b57629211cdd77af4ea6857bfc41ab0cefb.tar.bz2 |
when flush sendmail queue the user will be asked for selecting an
smtp account to use when there are more than one smtp-accounts
-rw-r--r-- | noncore/net/mail/mail.pro | 6 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 30 | ||||
-rw-r--r-- | noncore/net/mail/selectsmtp.cpp | 56 | ||||
-rw-r--r-- | noncore/net/mail/selectsmtp.h | 27 |
4 files changed, 110 insertions, 9 deletions
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index 552f0e5..184b5b3 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro | |||
@@ -1,59 +1,61 @@ | |||
1 | CONFIG += qt warn_on debug quick-app | 1 | CONFIG += qt warn_on debug quick-app |
2 | 2 | ||
3 | HEADERS = defines.h \ | 3 | HEADERS = defines.h \ |
4 | editaccounts.h \ | 4 | editaccounts.h \ |
5 | composemail.h \ | 5 | composemail.h \ |
6 | accountview.h \ | 6 | accountview.h \ |
7 | accountitem.h \ | 7 | accountitem.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | viewmail.h \ | 9 | viewmail.h \ |
10 | viewmailbase.h \ | 10 | viewmailbase.h \ |
11 | opiemail.h \ | 11 | opiemail.h \ |
12 | mailistviewitem.h \ | 12 | mailistviewitem.h \ |
13 | settingsdialog.h \ | 13 | settingsdialog.h \ |
14 | statuswidget.h \ | 14 | statuswidget.h \ |
15 | newmaildir.h \ | 15 | newmaildir.h \ |
16 | selectstore.h | 16 | selectstore.h \ |
17 | selectsmtp.h | ||
17 | 18 | ||
18 | SOURCES = main.cpp \ | 19 | SOURCES = main.cpp \ |
19 | opiemail.cpp \ | 20 | opiemail.cpp \ |
20 | mainwindow.cpp \ | 21 | mainwindow.cpp \ |
21 | accountview.cpp \ | 22 | accountview.cpp \ |
22 | accountitem.cpp \ | 23 | accountitem.cpp \ |
23 | composemail.cpp \ | 24 | composemail.cpp \ |
24 | addresspicker.cpp \ | 25 | addresspicker.cpp \ |
25 | editaccounts.cpp \ | 26 | editaccounts.cpp \ |
26 | viewmail.cpp \ | 27 | viewmail.cpp \ |
27 | viewmailbase.cpp \ | 28 | viewmailbase.cpp \ |
28 | mailistviewitem.cpp \ | 29 | mailistviewitem.cpp \ |
29 | settingsdialog.cpp \ | 30 | settingsdialog.cpp \ |
30 | statuswidget.cpp \ | 31 | statuswidget.cpp \ |
31 | newmaildir.cpp \ | 32 | newmaildir.cpp \ |
32 | selectstore.cpp | 33 | selectstore.cpp \ |
34 | selectsmtp.cpp | ||
33 | 35 | ||
34 | INTERFACES = editaccountsui.ui \ | 36 | INTERFACES = editaccountsui.ui \ |
35 | selectmailtypeui.ui \ | 37 | selectmailtypeui.ui \ |
36 | imapconfigui.ui \ | 38 | imapconfigui.ui \ |
37 | pop3configui.ui \ | 39 | pop3configui.ui \ |
38 | nntpconfigui.ui \ | 40 | nntpconfigui.ui \ |
39 | smtpconfigui.ui \ | 41 | smtpconfigui.ui \ |
40 | addresspickerui.ui \ | 42 | addresspickerui.ui \ |
41 | composemailui.ui \ | 43 | composemailui.ui \ |
42 | settingsdialogui.ui \ | 44 | settingsdialogui.ui \ |
43 | statuswidgetui.ui \ | 45 | statuswidgetui.ui \ |
44 | newmaildirui.ui \ | 46 | newmaildirui.ui \ |
45 | selectstoreui.ui | 47 | selectstoreui.ui |
46 | 48 | ||
47 | 49 | ||
48 | INCLUDEPATH += $(OPIEDIR)/include | 50 | INCLUDEPATH += $(OPIEDIR)/include |
49 | 51 | ||
50 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 52 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
51 | contains( CONFTEST, y ){ | 53 | contains( CONFTEST, y ){ |
52 | LIBS += -lqpe -lopie -lmailwrapper -liconv | 54 | LIBS += -lqpe -lopie -lmailwrapper -liconv |
53 | }else{ | 55 | }else{ |
54 | LIBS += -lqpe -lopie -lmailwrapper | 56 | LIBS += -lqpe -lopie -lmailwrapper |
55 | } | 57 | } |
56 | 58 | ||
57 | TARGET = opiemail | 59 | TARGET = opiemail |
58 | 60 | ||
59 | include ( $(OPIEDIR)/include.pro ) | 61 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index d3d3cdb..ea0019d 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -1,212 +1,228 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include "settingsdialog.h" | 2 | #include "settingsdialog.h" |
3 | #include "opiemail.h" | 3 | #include "opiemail.h" |
4 | #include "editaccounts.h" | 4 | #include "editaccounts.h" |
5 | #include "composemail.h" | 5 | #include "composemail.h" |
6 | #include <libmailwrapper/smtpwrapper.h> | 6 | #include <libmailwrapper/smtpwrapper.h> |
7 | #include <qpe/qcopenvelope_qws.h> | 7 | #include <qpe/qcopenvelope_qws.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qaction.h> | 9 | #include <qaction.h> |
10 | #include <qapplication.h> | 10 | #include <qapplication.h> |
11 | #include <libmailwrapper/mailtypes.h> | 11 | #include <libmailwrapper/mailtypes.h> |
12 | #include <libmailwrapper/abstractmail.h> | 12 | #include <libmailwrapper/abstractmail.h> |
13 | #include "mailistviewitem.h" | 13 | #include "mailistviewitem.h" |
14 | #include "viewmail.h" | 14 | #include "viewmail.h" |
15 | #include "selectstore.h" | 15 | #include "selectstore.h" |
16 | #include "selectsmtp.h" | ||
16 | 17 | ||
17 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 18 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
18 | : MainWindow( parent, name, WStyle_ContextHelp ) | 19 | : MainWindow( parent, name, WStyle_ContextHelp ) |
19 | { | 20 | { |
20 | settings = new Settings(); | 21 | settings = new Settings(); |
21 | 22 | ||
22 | folderView->populate( settings->getAccounts() ); | 23 | folderView->populate( settings->getAccounts() ); |
23 | } | 24 | } |
24 | 25 | ||
25 | OpieMail::~OpieMail() | 26 | OpieMail::~OpieMail() |
26 | { | 27 | { |
27 | if (settings) delete settings; | 28 | if (settings) delete settings; |
28 | } | 29 | } |
29 | 30 | ||
30 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 31 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
31 | { | 32 | { |
32 | // copied from old mail2 | 33 | // copied from old mail2 |
33 | if (msg == "writeMail(QString,QString)") { | 34 | if (msg == "writeMail(QString,QString)") { |
34 | QDataStream stream(data,IO_ReadOnly); | 35 | QDataStream stream(data,IO_ReadOnly); |
35 | QString name, email; | 36 | QString name, email; |
36 | stream >> name >> email; | 37 | stream >> name >> email; |
37 | // removing the whitespaces at beginning and end is needed! | 38 | // removing the whitespaces at beginning and end is needed! |
38 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 39 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
39 | } else if (msg == "newMail()") { | 40 | } else if (msg == "newMail()") { |
40 | slotComposeMail(); | 41 | slotComposeMail(); |
41 | } | 42 | } |
42 | } | 43 | } |
43 | 44 | ||
44 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 45 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
45 | { | 46 | { |
46 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 47 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
47 | if (!email.isEmpty()) { | 48 | if (!email.isEmpty()) { |
48 | if (!name.isEmpty()) { | 49 | if (!name.isEmpty()) { |
49 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 50 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
50 | } else { | 51 | } else { |
51 | compose.setTo(email); | 52 | compose.setTo(email); |
52 | } | 53 | } |
53 | } | 54 | } |
54 | compose.showMaximized(); | 55 | compose.showMaximized(); |
55 | compose.slotAdjustColumns(); | 56 | compose.slotAdjustColumns(); |
56 | compose.exec(); | 57 | compose.exec(); |
57 | } | 58 | } |
58 | 59 | ||
59 | void OpieMail::slotComposeMail() | 60 | void OpieMail::slotComposeMail() |
60 | { | 61 | { |
61 | qDebug( "Compose Mail" ); | 62 | qDebug( "Compose Mail" ); |
62 | slotwriteMail(0l,0l); | 63 | slotwriteMail(0l,0l); |
63 | } | 64 | } |
64 | 65 | ||
65 | void OpieMail::slotSendQueued() | 66 | void OpieMail::slotSendQueued() |
66 | { | 67 | { |
67 | qDebug( "Send Queued" ); | 68 | qDebug( "Send Queued" ); |
68 | SMTPaccount *smtp = 0; | 69 | SMTPaccount *smtp = 0; |
69 | 70 | ||
70 | QList<Account> list = settings->getAccounts(); | 71 | QList<Account> list = settings->getAccounts(); |
72 | QList<SMTPaccount> smtpList; | ||
73 | smtpList.setAutoDelete(false); | ||
71 | Account *it; | 74 | Account *it; |
72 | // if (list.count()==1) { | 75 | for ( it = list.first(); it; it = list.next() ) { |
73 | for ( it = list.first(); it; it = list.next() ) { | 76 | if ( it->getType().compare( "SMTP" ) == 0 ) { |
74 | if ( it->getType().compare( "SMTP" ) == 0 ) { | 77 | smtp = static_cast<SMTPaccount *>(it); |
75 | smtp = static_cast<SMTPaccount *>(it); | 78 | smtpList.append(smtp); |
76 | break; | ||
77 | } | ||
78 | } | 79 | } |
79 | // } | 80 | } |
81 | if (smtpList.count()==0) { | ||
82 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); | ||
83 | return; | ||
84 | } | ||
85 | if (smtpList.count()==1) { | ||
86 | smtp = smtpList.at(0); | ||
87 | } else { | ||
88 | smtp = 0; | ||
89 | selectsmtp selsmtp; | ||
90 | selsmtp.setSelectionlist(&smtpList); | ||
91 | selsmtp.showMaximized(); | ||
92 | if (selsmtp.exec()==QDialog::Accepted) { | ||
93 | smtp = selsmtp.selected_smtp(); | ||
94 | } | ||
95 | } | ||
80 | if (smtp) { | 96 | if (smtp) { |
81 | SMTPwrapper * wrap = new SMTPwrapper(settings); | 97 | SMTPwrapper * wrap = new SMTPwrapper(settings); |
82 | if ( wrap->flushOutbox(smtp) ) { | 98 | if ( wrap->flushOutbox(smtp) ) { |
83 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 99 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
84 | } | 100 | } |
85 | } | 101 | } |
86 | } | 102 | } |
87 | 103 | ||
88 | void OpieMail::slotSearchMails() | 104 | void OpieMail::slotSearchMails() |
89 | { | 105 | { |
90 | qDebug( "Search Mails" ); | 106 | qDebug( "Search Mails" ); |
91 | } | 107 | } |
92 | 108 | ||
93 | void OpieMail::slotEditSettings() | 109 | void OpieMail::slotEditSettings() |
94 | { | 110 | { |
95 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 111 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
96 | settingsDialog.showMaximized(); | 112 | settingsDialog.showMaximized(); |
97 | settingsDialog.exec(); | 113 | settingsDialog.exec(); |
98 | } | 114 | } |
99 | 115 | ||
100 | void OpieMail::slotEditAccounts() | 116 | void OpieMail::slotEditAccounts() |
101 | { | 117 | { |
102 | qDebug( "Edit Accounts" ); | 118 | qDebug( "Edit Accounts" ); |
103 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 119 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
104 | eaDialog.showMaximized(); | 120 | eaDialog.showMaximized(); |
105 | eaDialog.slotAdjustColumns(); | 121 | eaDialog.slotAdjustColumns(); |
106 | eaDialog.exec(); | 122 | eaDialog.exec(); |
107 | if ( settings ) delete settings; | 123 | if ( settings ) delete settings; |
108 | settings = new Settings(); | 124 | settings = new Settings(); |
109 | 125 | ||
110 | folderView->populate( settings->getAccounts() ); | 126 | folderView->populate( settings->getAccounts() ); |
111 | } | 127 | } |
112 | 128 | ||
113 | void OpieMail::displayMail() | 129 | void OpieMail::displayMail() |
114 | { | 130 | { |
115 | QListViewItem*item = mailView->currentItem(); | 131 | QListViewItem*item = mailView->currentItem(); |
116 | if (!item) return; | 132 | if (!item) return; |
117 | RecMail mail = ((MailListViewItem*)item)->data(); | 133 | RecMail mail = ((MailListViewItem*)item)->data(); |
118 | RecBody body = folderView->fetchBody(mail); | 134 | RecBody body = folderView->fetchBody(mail); |
119 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 135 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
120 | readMail.setBody( body ); | 136 | readMail.setBody( body ); |
121 | readMail.setMail( mail ); | 137 | readMail.setMail( mail ); |
122 | readMail.showMaximized(); | 138 | readMail.showMaximized(); |
123 | readMail.exec(); | 139 | readMail.exec(); |
124 | 140 | ||
125 | if ( readMail.deleted ) { | 141 | if ( readMail.deleted ) { |
126 | folderView->refreshCurrent(); | 142 | folderView->refreshCurrent(); |
127 | } else { | 143 | } else { |
128 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); | 144 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); |
129 | } | 145 | } |
130 | } | 146 | } |
131 | 147 | ||
132 | void OpieMail::slotDeleteMail() | 148 | void OpieMail::slotDeleteMail() |
133 | { | 149 | { |
134 | if (!mailView->currentItem()) return; | 150 | if (!mailView->currentItem()) return; |
135 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 151 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
136 | 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 ) { | 152 | 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 ) { |
137 | mail.Wrapper()->deleteMail( mail ); | 153 | mail.Wrapper()->deleteMail( mail ); |
138 | folderView->refreshCurrent(); | 154 | folderView->refreshCurrent(); |
139 | } | 155 | } |
140 | } | 156 | } |
141 | 157 | ||
142 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 158 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
143 | { | 159 | { |
144 | /* just the RIGHT button - or hold on pda */ | 160 | /* just the RIGHT button - or hold on pda */ |
145 | if (button!=2) {return;} | 161 | if (button!=2) {return;} |
146 | qDebug("Event right/hold"); | 162 | qDebug("Event right/hold"); |
147 | if (!item) return; | 163 | if (!item) return; |
148 | QPopupMenu *m = new QPopupMenu(0); | 164 | QPopupMenu *m = new QPopupMenu(0); |
149 | if (m) { | 165 | if (m) { |
150 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 166 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
151 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 167 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
152 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 168 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
153 | m->setFocus(); | 169 | m->setFocus(); |
154 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 170 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
155 | delete m; | 171 | delete m; |
156 | } | 172 | } |
157 | } | 173 | } |
158 | 174 | ||
159 | void OpieMail::slotShowFolders( bool show ) | 175 | void OpieMail::slotShowFolders( bool show ) |
160 | { | 176 | { |
161 | qDebug( "Show Folders" ); | 177 | qDebug( "Show Folders" ); |
162 | if ( show && folderView->isHidden() ) { | 178 | if ( show && folderView->isHidden() ) { |
163 | qDebug( "-> showing" ); | 179 | qDebug( "-> showing" ); |
164 | folderView->show(); | 180 | folderView->show(); |
165 | } else if ( !show && !folderView->isHidden() ) { | 181 | } else if ( !show && !folderView->isHidden() ) { |
166 | qDebug( "-> hiding" ); | 182 | qDebug( "-> hiding" ); |
167 | folderView->hide(); | 183 | folderView->hide(); |
168 | } | 184 | } |
169 | } | 185 | } |
170 | 186 | ||
171 | void OpieMail::refreshMailView(QList<RecMail>*list) | 187 | void OpieMail::refreshMailView(QList<RecMail>*list) |
172 | { | 188 | { |
173 | MailListViewItem*item = 0; | 189 | MailListViewItem*item = 0; |
174 | mailView->clear(); | 190 | mailView->clear(); |
175 | for (unsigned int i = 0; i < list->count();++i) { | 191 | for (unsigned int i = 0; i < list->count();++i) { |
176 | item = new MailListViewItem(mailView,item); | 192 | item = new MailListViewItem(mailView,item); |
177 | item->storeData(*(list->at(i))); | 193 | item->storeData(*(list->at(i))); |
178 | item->showEntry(); | 194 | item->showEntry(); |
179 | } | 195 | } |
180 | } | 196 | } |
181 | 197 | ||
182 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) | 198 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) |
183 | { | 199 | { |
184 | /* just LEFT button - or tap with stylus on pda */ | 200 | /* just LEFT button - or tap with stylus on pda */ |
185 | if (button!=1) return; | 201 | if (button!=1) return; |
186 | if (!item) return; | 202 | if (!item) return; |
187 | displayMail(); | 203 | displayMail(); |
188 | } | 204 | } |
189 | 205 | ||
190 | void OpieMail::slotMoveCopyMail() | 206 | void OpieMail::slotMoveCopyMail() |
191 | { | 207 | { |
192 | if (!mailView->currentItem()) return; | 208 | if (!mailView->currentItem()) return; |
193 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 209 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
194 | AbstractMail*targetMail = 0; | 210 | AbstractMail*targetMail = 0; |
195 | QString targetFolder = ""; | 211 | QString targetFolder = ""; |
196 | Selectstore sels; | 212 | Selectstore sels; |
197 | folderView->setupFolderselect(&sels); | 213 | folderView->setupFolderselect(&sels); |
198 | if (!sels.exec()) return; | 214 | if (!sels.exec()) return; |
199 | targetMail = sels.currentMail(); | 215 | targetMail = sels.currentMail(); |
200 | targetFolder = sels.currentFolder(); | 216 | targetFolder = sels.currentFolder(); |
201 | if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || | 217 | if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || |
202 | targetFolder.isEmpty()) { | 218 | targetFolder.isEmpty()) { |
203 | return; | 219 | return; |
204 | } | 220 | } |
205 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { | 221 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { |
206 | QMessageBox::critical(0,tr("Error creating new Folder"), | 222 | QMessageBox::critical(0,tr("Error creating new Folder"), |
207 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 223 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
208 | return; | 224 | return; |
209 | } | 225 | } |
210 | mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 226 | mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
211 | folderView->refreshCurrent(); | 227 | folderView->refreshCurrent(); |
212 | } | 228 | } |
diff --git a/noncore/net/mail/selectsmtp.cpp b/noncore/net/mail/selectsmtp.cpp new file mode 100644 index 0000000..e82c6ca --- a/dev/null +++ b/noncore/net/mail/selectsmtp.cpp | |||
@@ -0,0 +1,56 @@ | |||
1 | #include "selectsmtp.h" | ||
2 | #include <libmailwrapper/mailwrapper.h> | ||
3 | #include <qlist.h> | ||
4 | #include <qlabel.h> | ||
5 | #include <qlayout.h> | ||
6 | #include <qcheckbox.h> | ||
7 | #include <qframe.h> | ||
8 | #include <qlineedit.h> | ||
9 | #include <qcombobox.h> | ||
10 | |||
11 | selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl) | ||
12 | : selectstoreui(parent,name,modal,fl) | ||
13 | { | ||
14 | //m_smtpList.setAutoDelete(false); | ||
15 | m_smtpList = 0; | ||
16 | //headlabel->setText(tr("<center>Select SMTP account to use</center>")); | ||
17 | headlabel->hide(); | ||
18 | folderSelection->hide(); | ||
19 | folderLabel->hide(); | ||
20 | accountlabel->setText("<center>SMTP Accounts</center>"); | ||
21 | Line1->hide(); | ||
22 | newFoldersel->hide(); | ||
23 | newFolderedit->hide(); | ||
24 | newFolderLabel->hide(); | ||
25 | Line2->hide(); | ||
26 | selMove->hide(); | ||
27 | m_current_smtp = 0; | ||
28 | setCaption(tr("Select SMTP Account")); | ||
29 | } | ||
30 | |||
31 | selectsmtp::~selectsmtp() | ||
32 | { | ||
33 | } | ||
34 | |||
35 | void selectsmtp::slotAccountselected(int which) | ||
36 | { | ||
37 | if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) { | ||
38 | m_current_smtp = 0; | ||
39 | return; | ||
40 | } | ||
41 | m_current_smtp = m_smtpList->at(which); | ||
42 | } | ||
43 | |||
44 | void selectsmtp::setSelectionlist(QList<SMTPaccount>*list) | ||
45 | { | ||
46 | m_smtpList = list; | ||
47 | accountSelection->clear(); | ||
48 | for (unsigned i = 0; m_smtpList!=0 && i < m_smtpList->count(); ++i) { | ||
49 | accountSelection->insertItem( m_smtpList->at(i)->getAccountName()); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | SMTPaccount*selectsmtp::selected_smtp() | ||
54 | { | ||
55 | return m_current_smtp; | ||
56 | } | ||
diff --git a/noncore/net/mail/selectsmtp.h b/noncore/net/mail/selectsmtp.h new file mode 100644 index 0000000..4bb2437 --- a/dev/null +++ b/noncore/net/mail/selectsmtp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __selectsmtp_h | ||
2 | #define __selectstmp_h | ||
3 | |||
4 | #include <qt.h> | ||
5 | #include "selectstoreui.h" | ||
6 | #include <qlist.h> | ||
7 | |||
8 | class SMTPaccount; | ||
9 | |||
10 | class selectsmtp : public selectstoreui | ||
11 | { | ||
12 | Q_OBJECT | ||
13 | public: | ||
14 | selectsmtp(QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 ); | ||
15 | virtual ~selectsmtp(); | ||
16 | void setSelectionlist(QList<SMTPaccount>*list); | ||
17 | SMTPaccount*selected_smtp(); | ||
18 | |||
19 | protected: | ||
20 | QList<SMTPaccount>*m_smtpList; | ||
21 | SMTPaccount*m_current_smtp; | ||
22 | |||
23 | protected slots: | ||
24 | virtual void slotAccountselected(int); | ||
25 | }; | ||
26 | |||
27 | #endif | ||