-rw-r--r-- | noncore/net/mail/editaccounts.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 5 |
3 files changed, 25 insertions, 18 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 1c80adb..1246037 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -1,313 +1,314 @@ | |||
1 | #include <qt.h> | 1 | #include <qt.h> |
2 | 2 | ||
3 | #include "defines.h" | 3 | #include "defines.h" |
4 | #include "editaccounts.h" | 4 | #include "editaccounts.h" |
5 | 5 | ||
6 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 6 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
7 | : QListViewItem( parent ) | 7 | : QListViewItem( parent ) |
8 | { | 8 | { |
9 | account = a; | 9 | account = a; |
10 | setText( 0, account->getAccountName() ); | 10 | setText( 0, account->getAccountName() ); |
11 | setText( 1, account->getType() ); | 11 | setText( 1, account->getType() ); |
12 | } | 12 | } |
13 | 13 | ||
14 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 14 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
15 | : EditAccountsUI( parent, name, modal, flags ) | 15 | : EditAccountsUI( parent, name, modal, flags ) |
16 | { | 16 | { |
17 | qDebug( "New Account Configuration Widget" ); | 17 | qDebug( "New Account Configuration Widget" ); |
18 | settings = s; | 18 | settings = s; |
19 | 19 | ||
20 | mailList->addColumn( tr( "Account" ) ); | 20 | mailList->addColumn( tr( "Account" ) ); |
21 | mailList->addColumn( tr( "Type" ) ); | 21 | mailList->addColumn( tr( "Type" ) ); |
22 | 22 | ||
23 | newsList->addColumn( tr( "Account" ) ); | 23 | newsList->addColumn( tr( "Account" ) ); |
24 | 24 | ||
25 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 25 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
26 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 26 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
27 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 27 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
28 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 28 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
29 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 29 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
30 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 30 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
31 | 31 | ||
32 | slotFillLists(); | 32 | slotFillLists(); |
33 | } | 33 | } |
34 | 34 | ||
35 | void EditAccounts::slotFillLists() | 35 | void EditAccounts::slotFillLists() |
36 | { | 36 | { |
37 | mailList->clear(); | 37 | mailList->clear(); |
38 | newsList->clear(); | 38 | newsList->clear(); |
39 | 39 | ||
40 | QList<Account> accounts = settings->getAccounts(); | 40 | QList<Account> accounts = settings->getAccounts(); |
41 | Account *it; | 41 | Account *it; |
42 | for ( it = accounts.first(); it; it = accounts.next() ) { | 42 | for ( it = accounts.first(); it; it = accounts.next() ) { |
43 | if ( it->getType().compare( "NNTP" ) == 0 ) { | 43 | if ( it->getType().compare( "NNTP" ) == 0 ) { |
44 | (void) new AccountListItem( newsList, it ); | 44 | (void) new AccountListItem( newsList, it ); |
45 | } else { | 45 | } else { |
46 | (void) new AccountListItem( mailList, it ); | 46 | (void) new AccountListItem( mailList, it ); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | void EditAccounts::slotNewMail() | 51 | void EditAccounts::slotNewMail() |
52 | { | 52 | { |
53 | qDebug( "New Mail Account" ); | 53 | qDebug( "New Mail Account" ); |
54 | QString *selection = new QString(); | 54 | QString *selection = new QString(); |
55 | SelectMailType selType( selection, this, 0, true ); | 55 | SelectMailType selType( selection, this, 0, true ); |
56 | selType.show(); | 56 | selType.show(); |
57 | if ( QDialog::Accepted == selType.exec() ) { | 57 | if ( QDialog::Accepted == selType.exec() ) { |
58 | slotNewAccount( *selection ); | 58 | slotNewAccount( *selection ); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | void EditAccounts::slotNewAccount( const QString &type ) | 62 | void EditAccounts::slotNewAccount( const QString &type ) |
63 | { | 63 | { |
64 | if ( type.compare( "IMAP" ) == 0 ) { | 64 | if ( type.compare( "IMAP" ) == 0 ) { |
65 | qDebug( "-> config IMAP" ); | 65 | qDebug( "-> config IMAP" ); |
66 | IMAPaccount *account = new IMAPaccount(); | 66 | IMAPaccount *account = new IMAPaccount(); |
67 | IMAPconfig imap( account, this, 0, true ); | 67 | IMAPconfig imap( account, this, 0, true ); |
68 | imap.showMaximized(); | 68 | imap.showMaximized(); |
69 | if ( QDialog::Accepted == imap.exec() ) { | 69 | if ( QDialog::Accepted == imap.exec() ) { |
70 | settings->addAccount( account ); | 70 | settings->addAccount( account ); |
71 | account->save(); | 71 | account->save(); |
72 | slotFillLists(); | 72 | slotFillLists(); |
73 | } else { | 73 | } else { |
74 | account->remove(); | 74 | account->remove(); |
75 | } | 75 | } |
76 | } else if ( type.compare( "POP3" ) == 0 ) { | 76 | } else if ( type.compare( "POP3" ) == 0 ) { |
77 | qDebug( "-> config POP3" ); | 77 | qDebug( "-> config POP3" ); |
78 | POP3account *account = new POP3account(); | 78 | POP3account *account = new POP3account(); |
79 | POP3config pop3( account, this, 0, true ); | 79 | POP3config pop3( account, this, 0, true ); |
80 | pop3.showMaximized(); | 80 | pop3.showMaximized(); |
81 | if ( QDialog::Accepted == pop3.exec() ) { | 81 | if ( QDialog::Accepted == pop3.exec() ) { |
82 | settings->addAccount( account ); | 82 | settings->addAccount( account ); |
83 | account->save(); | 83 | account->save(); |
84 | slotFillLists(); | 84 | slotFillLists(); |
85 | } else { | 85 | } else { |
86 | account->remove(); | 86 | account->remove(); |
87 | } | 87 | } |
88 | } else if ( type.compare( "SMTP" ) == 0 ) { | 88 | } else if ( type.compare( "SMTP" ) == 0 ) { |
89 | qDebug( "-> config SMTP" ); | 89 | qDebug( "-> config SMTP" ); |
90 | SMTPaccount *account = new SMTPaccount(); | 90 | SMTPaccount *account = new SMTPaccount(); |
91 | SMTPconfig smtp( account, this, 0, true ); | 91 | SMTPconfig smtp( account, this, 0, true ); |
92 | smtp.showMaximized(); | 92 | smtp.showMaximized(); |
93 | if ( QDialog::Accepted == smtp.exec() ) { | 93 | if ( QDialog::Accepted == smtp.exec() ) { |
94 | settings->addAccount( account ); | 94 | settings->addAccount( account ); |
95 | account->save(); | 95 | account->save(); |
96 | slotFillLists(); | 96 | slotFillLists(); |
97 | |||
97 | } else { | 98 | } else { |
98 | account->remove(); | 99 | account->remove(); |
99 | } | 100 | } |
100 | } else if ( type.compare( "NNTP" ) == 0 ) { | 101 | } else if ( type.compare( "NNTP" ) == 0 ) { |
101 | qDebug( "-> config NNTP" ); | 102 | qDebug( "-> config NNTP" ); |
102 | NNTPaccount *account = new NNTPaccount(); | 103 | NNTPaccount *account = new NNTPaccount(); |
103 | NNTPconfig nntp( account, this, 0, true ); | 104 | NNTPconfig nntp( account, this, 0, true ); |
104 | nntp.showMaximized(); | 105 | nntp.showMaximized(); |
105 | if ( QDialog::Accepted == nntp.exec() ) { | 106 | if ( QDialog::Accepted == nntp.exec() ) { |
106 | settings->addAccount( account ); | 107 | settings->addAccount( account ); |
107 | account->save(); | 108 | account->save(); |
108 | slotFillLists(); | 109 | slotFillLists(); |
109 | } else { | 110 | } else { |
110 | account->remove(); | 111 | account->remove(); |
111 | } | 112 | } |
112 | } | 113 | } |
113 | } | 114 | } |
114 | 115 | ||
115 | void EditAccounts::slotEditAccount( Account *account ) | 116 | void EditAccounts::slotEditAccount( Account *account ) |
116 | { | 117 | { |
117 | if ( account->getType().compare( "IMAP" ) == 0 ) { | 118 | if ( account->getType().compare( "IMAP" ) == 0 ) { |
118 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); | 119 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); |
119 | IMAPconfig imap( imapAcc, this, 0, true ); | 120 | IMAPconfig imap( imapAcc, this, 0, true ); |
120 | imap.showMaximized(); | 121 | imap.showMaximized(); |
121 | if ( QDialog::Accepted == imap.exec() ) { | 122 | if ( QDialog::Accepted == imap.exec() ) { |
122 | slotFillLists(); | 123 | slotFillLists(); |
123 | } | 124 | } |
124 | } else if ( account->getType().compare( "POP3" ) == 0 ) { | 125 | } else if ( account->getType().compare( "POP3" ) == 0 ) { |
125 | POP3account *pop3Acc = static_cast<POP3account *>(account); | 126 | POP3account *pop3Acc = static_cast<POP3account *>(account); |
126 | POP3config pop3( pop3Acc, this, 0, true ); | 127 | POP3config pop3( pop3Acc, this, 0, true ); |
127 | pop3.showMaximized(); | 128 | pop3.showMaximized(); |
128 | if ( QDialog::Accepted == pop3.exec() ) { | 129 | if ( QDialog::Accepted == pop3.exec() ) { |
129 | slotFillLists(); | 130 | slotFillLists(); |
130 | } | 131 | } |
131 | } else if ( account->getType().compare( "SMTP" ) == 0 ) { | 132 | } else if ( account->getType().compare( "SMTP" ) == 0 ) { |
132 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); | 133 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); |
133 | SMTPconfig smtp( smtpAcc, this, 0, true ); | 134 | SMTPconfig smtp( smtpAcc, this, 0, true ); |
134 | smtp.showMaximized(); | 135 | smtp.showMaximized(); |
135 | if ( QDialog::Accepted == smtp.exec() ) { | 136 | if ( QDialog::Accepted == smtp.exec() ) { |
136 | slotFillLists(); | 137 | slotFillLists(); |
137 | } | 138 | } |
138 | } else if ( account->getType().compare( "NNTP" ) == 0 ) { | 139 | } else if ( account->getType().compare( "NNTP" ) == 0 ) { |
139 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); | 140 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); |
140 | NNTPconfig nntp( nntpAcc, this, 0, true ); | 141 | NNTPconfig nntp( nntpAcc, this, 0, true ); |
141 | nntp.showMaximized(); | 142 | nntp.showMaximized(); |
142 | if ( QDialog::Accepted == nntp.exec() ) { | 143 | if ( QDialog::Accepted == nntp.exec() ) { |
143 | slotFillLists(); | 144 | slotFillLists(); |
144 | } | 145 | } |
145 | } | 146 | } |
146 | } | 147 | } |
147 | 148 | ||
148 | void EditAccounts::slotDeleteAccount( Account *account ) | 149 | void EditAccounts::slotDeleteAccount( Account *account ) |
149 | { | 150 | { |
150 | if ( QMessageBox::information( this, tr( "Question" ), | 151 | if ( QMessageBox::information( this, tr( "Question" ), |
151 | tr( "<p>Do you really want to delete the selected Account?</p>" ), | 152 | tr( "<p>Do you really want to delete the selected Account?</p>" ), |
152 | tr( "Yes" ), tr( "No" ) ) == 0 ) { | 153 | tr( "Yes" ), tr( "No" ) ) == 0 ) { |
153 | settings->delAccount( account ); | 154 | settings->delAccount( account ); |
154 | slotFillLists(); | 155 | slotFillLists(); |
155 | } | 156 | } |
156 | } | 157 | } |
157 | 158 | ||
158 | void EditAccounts::slotEditMail() | 159 | void EditAccounts::slotEditMail() |
159 | { | 160 | { |
160 | qDebug( "Edit Mail Account" ); | 161 | qDebug( "Edit Mail Account" ); |
161 | if ( !mailList->currentItem() ) { | 162 | if ( !mailList->currentItem() ) { |
162 | QMessageBox::information( this, tr( "Error" ), | 163 | QMessageBox::information( this, tr( "Error" ), |
163 | tr( "<p>Please select an account.</p>" ), | 164 | tr( "<p>Please select an account.</p>" ), |
164 | tr( "Ok" ) ); | 165 | tr( "Ok" ) ); |
165 | return; | 166 | return; |
166 | } | 167 | } |
167 | 168 | ||
168 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 169 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
169 | slotEditAccount( a ); | 170 | slotEditAccount( a ); |
170 | } | 171 | } |
171 | 172 | ||
172 | void EditAccounts::slotDeleteMail() | 173 | void EditAccounts::slotDeleteMail() |
173 | { | 174 | { |
174 | if ( !mailList->currentItem() ) { | 175 | if ( !mailList->currentItem() ) { |
175 | QMessageBox::information( this, tr( "Error" ), | 176 | QMessageBox::information( this, tr( "Error" ), |
176 | tr( "<p>Please select an account.</p>" ), | 177 | tr( "<p>Please select an account.</p>" ), |
177 | tr( "Ok" ) ); | 178 | tr( "Ok" ) ); |
178 | return; | 179 | return; |
179 | } | 180 | } |
180 | 181 | ||
181 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 182 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
182 | slotDeleteAccount( a ); | 183 | slotDeleteAccount( a ); |
183 | } | 184 | } |
184 | 185 | ||
185 | void EditAccounts::slotNewNews() | 186 | void EditAccounts::slotNewNews() |
186 | { | 187 | { |
187 | qDebug( "New News Account" ); | 188 | qDebug( "New News Account" ); |
188 | slotNewAccount( "NNTP" ); | 189 | slotNewAccount( "NNTP" ); |
189 | } | 190 | } |
190 | 191 | ||
191 | void EditAccounts::slotEditNews() | 192 | void EditAccounts::slotEditNews() |
192 | { | 193 | { |
193 | qDebug( "Edit News Account" ); | 194 | qDebug( "Edit News Account" ); |
194 | if ( !newsList->currentItem() ) { | 195 | if ( !newsList->currentItem() ) { |
195 | QMessageBox::information( this, tr( "Error" ), | 196 | QMessageBox::information( this, tr( "Error" ), |
196 | tr( "<p>Please select an account.</p>" ), | 197 | tr( "<p>Please select an account.</p>" ), |
197 | tr( "Ok" ) ); | 198 | tr( "Ok" ) ); |
198 | return; | 199 | return; |
199 | } | 200 | } |
200 | 201 | ||
201 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 202 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
202 | slotEditAccount( a ); | 203 | slotEditAccount( a ); |
203 | } | 204 | } |
204 | 205 | ||
205 | void EditAccounts::slotDeleteNews() | 206 | void EditAccounts::slotDeleteNews() |
206 | { | 207 | { |
207 | qDebug( "Delete News Account" ); | 208 | qDebug( "Delete News Account" ); |
208 | if ( !newsList->currentItem() ) { | 209 | if ( !newsList->currentItem() ) { |
209 | QMessageBox::information( this, tr( "Error" ), | 210 | QMessageBox::information( this, tr( "Error" ), |
210 | tr( "<p>Please select an account.</p>" ), | 211 | tr( "<p>Please select an account.</p>" ), |
211 | tr( "Ok" ) ); | 212 | tr( "Ok" ) ); |
212 | return; | 213 | return; |
213 | } | 214 | } |
214 | 215 | ||
215 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 216 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
216 | slotDeleteAccount( a ); | 217 | slotDeleteAccount( a ); |
217 | } | 218 | } |
218 | 219 | ||
219 | void EditAccounts::slotAdjustColumns() | 220 | void EditAccounts::slotAdjustColumns() |
220 | { | 221 | { |
221 | int currPage = configTab->currentPageIndex(); | 222 | int currPage = configTab->currentPageIndex(); |
222 | 223 | ||
223 | configTab->showPage( mailTab ); | 224 | configTab->showPage( mailTab ); |
224 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); | 225 | mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); |
225 | mailList->setColumnWidth( 1, 50 ); | 226 | mailList->setColumnWidth( 1, 50 ); |
226 | 227 | ||
227 | configTab->showPage( newsTab ); | 228 | configTab->showPage( newsTab ); |
228 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); | 229 | newsList->setColumnWidth( 0, newsList->visibleWidth() ); |
229 | 230 | ||
230 | configTab->setCurrentPage( currPage ); | 231 | configTab->setCurrentPage( currPage ); |
231 | } | 232 | } |
232 | 233 | ||
233 | void EditAccounts::accept() | 234 | void EditAccounts::accept() |
234 | { | 235 | { |
235 | settings->saveAccounts(); | 236 | settings->saveAccounts(); |
236 | 237 | ||
237 | QDialog::accept(); | 238 | QDialog::accept(); |
238 | } | 239 | } |
239 | 240 | ||
240 | /** | 241 | /** |
241 | * SelectMailType | 242 | * SelectMailType |
242 | */ | 243 | */ |
243 | 244 | ||
244 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) | 245 | SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) |
245 | : SelectMailTypeUI( parent, name, modal, flags ) | 246 | : SelectMailTypeUI( parent, name, modal, flags ) |
246 | { | 247 | { |
247 | selected = selection; | 248 | selected = selection; |
248 | selected->replace( 0, selected->length(), typeBox->currentText() ); | 249 | selected->replace( 0, selected->length(), typeBox->currentText() ); |
249 | connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) ); | 250 | connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) ); |
250 | } | 251 | } |
251 | 252 | ||
252 | void SelectMailType::slotSelection( const QString &sel ) | 253 | void SelectMailType::slotSelection( const QString &sel ) |
253 | { | 254 | { |
254 | selected->replace( 0, selected->length(), sel ); | 255 | selected->replace( 0, selected->length(), sel ); |
255 | } | 256 | } |
256 | 257 | ||
257 | /** | 258 | /** |
258 | * IMAPconfig | 259 | * IMAPconfig |
259 | */ | 260 | */ |
260 | 261 | ||
261 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 262 | IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
262 | : IMAPconfigUI( parent, name, modal, flags ) | 263 | : IMAPconfigUI( parent, name, modal, flags ) |
263 | { | 264 | { |
264 | data = account; | 265 | data = account; |
265 | 266 | ||
266 | fillValues(); | 267 | fillValues(); |
267 | 268 | ||
268 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); | 269 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); |
269 | } | 270 | } |
270 | 271 | ||
271 | void IMAPconfig::slotSSL( bool enabled ) | 272 | void IMAPconfig::slotSSL( bool enabled ) |
272 | { | 273 | { |
273 | if ( enabled ) { | 274 | if ( enabled ) { |
274 | portLine->setText( IMAP_SSL_PORT ); | 275 | portLine->setText( IMAP_SSL_PORT ); |
275 | } else { | 276 | } else { |
276 | portLine->setText( IMAP_PORT ); | 277 | portLine->setText( IMAP_PORT ); |
277 | } | 278 | } |
278 | } | 279 | } |
279 | 280 | ||
280 | void IMAPconfig::fillValues() | 281 | void IMAPconfig::fillValues() |
281 | { | 282 | { |
282 | accountLine->setText( data->getAccountName() ); | 283 | accountLine->setText( data->getAccountName() ); |
283 | serverLine->setText( data->getServer() ); | 284 | serverLine->setText( data->getServer() ); |
284 | portLine->setText( data->getPort() ); | 285 | portLine->setText( data->getPort() ); |
285 | sslBox->setChecked( data->getSSL() ); | 286 | sslBox->setChecked( data->getSSL() ); |
286 | userLine->setText( data->getUser() ); | 287 | userLine->setText( data->getUser() ); |
287 | passLine->setText( data->getPassword() ); | 288 | passLine->setText( data->getPassword() ); |
288 | prefixLine->setText(data->getPrefix()); | 289 | prefixLine->setText(data->getPrefix()); |
289 | } | 290 | } |
290 | 291 | ||
291 | void IMAPconfig::accept() | 292 | void IMAPconfig::accept() |
292 | { | 293 | { |
293 | data->setAccountName( accountLine->text() ); | 294 | data->setAccountName( accountLine->text() ); |
294 | data->setServer( serverLine->text() ); | 295 | data->setServer( serverLine->text() ); |
295 | data->setPort( portLine->text() ); | 296 | data->setPort( portLine->text() ); |
296 | data->setSSL( sslBox->isChecked() ); | 297 | data->setSSL( sslBox->isChecked() ); |
297 | data->setUser( userLine->text() ); | 298 | data->setUser( userLine->text() ); |
298 | data->setPassword( passLine->text() ); | 299 | data->setPassword( passLine->text() ); |
299 | data->setPrefix(prefixLine->text()); | 300 | data->setPrefix(prefixLine->text()); |
300 | 301 | ||
301 | QDialog::accept(); | 302 | QDialog::accept(); |
302 | } | 303 | } |
303 | 304 | ||
304 | /** | 305 | /** |
305 | * POP3config | 306 | * POP3config |
306 | */ | 307 | */ |
307 | 308 | ||
308 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 309 | POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
309 | : POP3configUI( parent, name, modal, flags ) | 310 | : POP3configUI( parent, name, modal, flags ) |
310 | { | 311 | { |
311 | data = account; | 312 | data = account; |
312 | fillValues(); | 313 | fillValues(); |
313 | 314 | ||
@@ -384,87 +385,87 @@ void SMTPconfig::fillValues() | |||
384 | userLine->setText( data->getUser() ); | 385 | userLine->setText( data->getUser() ); |
385 | passLine->setText( data->getPassword() ); | 386 | passLine->setText( data->getPassword() ); |
386 | nameLine->setText( data->getName() ); | 387 | nameLine->setText( data->getName() ); |
387 | mailLine->setText( data->getMail() ); | 388 | mailLine->setText( data->getMail() ); |
388 | orgLine->setText( data->getOrg() ); | 389 | orgLine->setText( data->getOrg() ); |
389 | ccBox->setChecked( data->getUseCC() ); | 390 | ccBox->setChecked( data->getUseCC() ); |
390 | ccLine->setText( data->getCC() ); | 391 | ccLine->setText( data->getCC() ); |
391 | bccBox->setChecked( data->getUseBCC() ); | 392 | bccBox->setChecked( data->getUseBCC() ); |
392 | bccLine->setText( data->getBCC() ); | 393 | bccLine->setText( data->getBCC() ); |
393 | replyBox->setChecked( data->getUseReply() ); | 394 | replyBox->setChecked( data->getUseReply() ); |
394 | replyLine->setText( data->getReply() ); | 395 | replyLine->setText( data->getReply() ); |
395 | sigMultiLine->setText( data->getSignature() ); | 396 | sigMultiLine->setText( data->getSignature() ); |
396 | } | 397 | } |
397 | 398 | ||
398 | void SMTPconfig::accept() | 399 | void SMTPconfig::accept() |
399 | { | 400 | { |
400 | data->setAccountName( accountLine->text() ); | 401 | data->setAccountName( accountLine->text() ); |
401 | data->setServer( serverLine->text() ); | 402 | data->setServer( serverLine->text() ); |
402 | data->setPort( portLine->text() ); | 403 | data->setPort( portLine->text() ); |
403 | data->setSSL( sslBox->isChecked() ); | 404 | data->setSSL( sslBox->isChecked() ); |
404 | data->setLogin( loginBox->isChecked() ); | 405 | data->setLogin( loginBox->isChecked() ); |
405 | data->setUser( userLine->text() ); | 406 | data->setUser( userLine->text() ); |
406 | data->setPassword( passLine->text() ); | 407 | data->setPassword( passLine->text() ); |
407 | data->setName( nameLine->text() ); | 408 | data->setName( nameLine->text() ); |
408 | data->setMail( mailLine->text() ); | 409 | data->setMail( mailLine->text() ); |
409 | data->setOrg( orgLine->text() ); | 410 | data->setOrg( orgLine->text() ); |
410 | data->setCC( ccLine->text() ); | 411 | data->setCC( ccLine->text() ); |
411 | data->setUseCC( ccBox->isChecked() ); | 412 | data->setUseCC( ccBox->isChecked() ); |
412 | data->setBCC( bccLine->text() ); | 413 | data->setBCC( bccLine->text() ); |
413 | data->setUseBCC( bccBox->isChecked() ); | 414 | data->setUseBCC( bccBox->isChecked() ); |
414 | data->setReply( replyLine->text() ); | 415 | data->setReply( replyLine->text() ); |
415 | data->setUseReply( replyBox->isChecked() ); | 416 | data->setUseReply( replyBox->isChecked() ); |
416 | data->setSignature( sigMultiLine->text() ); | 417 | data->setSignature( sigMultiLine->text() ); |
417 | 418 | ||
418 | QDialog::accept(); | 419 | QDialog::accept(); |
419 | } | 420 | } |
420 | 421 | ||
421 | /** | 422 | /** |
422 | * NNTPconfig | 423 | * NNTPconfig |
423 | */ | 424 | */ |
424 | 425 | ||
425 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) | 426 | NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) |
426 | : NNTPconfigUI( parent, name, modal, flags ) | 427 | : NNTPconfigUI( parent, name, modal, flags ) |
427 | { | 428 | { |
428 | data = account; | 429 | data = account; |
429 | 430 | ||
430 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); | 431 | connect( loginBox, SIGNAL( toggled( bool ) ), userLine, SLOT( setEnabled( bool ) ) ); |
431 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); | 432 | connect( loginBox, SIGNAL( toggled( bool ) ), passLine, SLOT( setEnabled( bool ) ) ); |
432 | 433 | ||
433 | fillValues(); | 434 | fillValues(); |
434 | 435 | ||
435 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); | 436 | connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); |
436 | } | 437 | } |
437 | 438 | ||
438 | void NNTPconfig::slotSSL( bool enabled ) | 439 | void NNTPconfig::slotSSL( bool enabled ) |
439 | { | 440 | { |
440 | if ( enabled ) { | 441 | if ( enabled ) { |
441 | portLine->setText( NNTP_SSL_PORT ); | 442 | portLine->setText( NNTP_SSL_PORT ); |
442 | } else { | 443 | } else { |
443 | portLine->setText( NNTP_PORT ); | 444 | portLine->setText( NNTP_PORT ); |
444 | } | 445 | } |
445 | } | 446 | } |
446 | 447 | ||
447 | void NNTPconfig::fillValues() | 448 | void NNTPconfig::fillValues() |
448 | { | 449 | { |
449 | accountLine->setText( data->getAccountName() ); | 450 | accountLine->setText( data->getAccountName() ); |
450 | serverLine->setText( data->getServer() ); | 451 | serverLine->setText( data->getServer() ); |
451 | portLine->setText( data->getPort() ); | 452 | portLine->setText( data->getPort() ); |
452 | sslBox->setChecked( data->getSSL() ); | 453 | sslBox->setChecked( data->getSSL() ); |
453 | loginBox->setChecked( data->getLogin() ); | 454 | loginBox->setChecked( data->getLogin() ); |
454 | userLine->setText( data->getUser() ); | 455 | userLine->setText( data->getUser() ); |
455 | passLine->setText( data->getPassword() ); | 456 | passLine->setText( data->getPassword() ); |
456 | } | 457 | } |
457 | 458 | ||
458 | void NNTPconfig::accept() | 459 | void NNTPconfig::accept() |
459 | { | 460 | { |
460 | data->setAccountName( accountLine->text() ); | 461 | data->setAccountName( accountLine->text() ); |
461 | data->setServer( serverLine->text() ); | 462 | data->setServer( serverLine->text() ); |
462 | data->setPort( portLine->text() ); | 463 | data->setPort( portLine->text() ); |
463 | data->setSSL( sslBox->isChecked() ); | 464 | data->setSSL( sslBox->isChecked() ); |
464 | data->setLogin( loginBox->isChecked() ); | 465 | data->setLogin( loginBox->isChecked() ); |
465 | data->setUser( userLine->text() ); | 466 | data->setUser( userLine->text() ); |
466 | data->setPassword( passLine->text() ); | 467 | data->setPassword( passLine->text() ); |
467 | 468 | ||
468 | QDialog::accept(); | 469 | QDialog::accept(); |
469 | } | 470 | } |
470 | 471 | ||
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 93f3bb7..740e4cf 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -1,50 +1,55 @@ | |||
1 | #include "opiemail.h" | 1 | #include "opiemail.h" |
2 | #include "editaccounts.h" | 2 | #include "editaccounts.h" |
3 | #include "composemail.h" | 3 | #include "composemail.h" |
4 | 4 | ||
5 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 5 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
6 | : MainWindow( parent, name, flags ) | 6 | : MainWindow( parent, name, flags ) |
7 | { | 7 | { |
8 | settings = new Settings(); | 8 | settings = new Settings(); |
9 | 9 | ||
10 | folderView->populate( settings->getAccounts() ); | 10 | folderView->populate( settings->getAccounts() ); |
11 | 11 | ||
12 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 12 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
13 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 13 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
14 | connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 14 | connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
15 | connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); | 15 | connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); |
16 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 16 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
17 | } | 17 | } |
18 | 18 | ||
19 | void OpieMail::slotComposeMail() | 19 | void OpieMail::slotComposeMail() |
20 | { | 20 | { |
21 | qDebug( "Compose Mail" ); | 21 | qDebug( "Compose Mail" ); |
22 | ComposeMail compose( settings, this, 0 , true ); | 22 | ComposeMail compose( settings, this, 0 , true ); |
23 | compose.showMaximized(); | 23 | compose.showMaximized(); |
24 | compose.slotAdjustColumns(); | 24 | compose.slotAdjustColumns(); |
25 | compose.exec(); | 25 | compose.exec(); |
26 | } | 26 | } |
27 | 27 | ||
28 | void OpieMail::slotSendQueued() | 28 | void OpieMail::slotSendQueued() |
29 | { | 29 | { |
30 | qDebug( "Send Queued" ); | 30 | qDebug( "Send Queued" ); |
31 | } | 31 | } |
32 | 32 | ||
33 | void OpieMail::slotSearchMails() | 33 | void OpieMail::slotSearchMails() |
34 | { | 34 | { |
35 | qDebug( "Search Mails" ); | 35 | qDebug( "Search Mails" ); |
36 | } | 36 | } |
37 | 37 | ||
38 | void OpieMail::slotEditSettings() | 38 | void OpieMail::slotEditSettings() |
39 | { | 39 | { |
40 | qDebug( "Edit Settings" ); | 40 | qDebug( "Edit Settings" ); |
41 | } | 41 | } |
42 | 42 | ||
43 | void OpieMail::slotEditAccounts() | 43 | void OpieMail::slotEditAccounts() |
44 | { | 44 | { |
45 | qDebug( "Edit Accounts" ); | 45 | qDebug( "Edit Accounts" ); |
46 | EditAccounts eaDialog( settings, this, 0, true ); | 46 | EditAccounts eaDialog( settings, this, 0, true ); |
47 | eaDialog.showMaximized(); | 47 | eaDialog.showMaximized(); |
48 | eaDialog.slotAdjustColumns(); | 48 | eaDialog.slotAdjustColumns(); |
49 | eaDialog.exec(); | 49 | eaDialog.exec(); |
50 | if ( settings ) delete settings; | ||
51 | settings = new Settings(); | ||
52 | |||
53 | folderView->populate( settings->getAccounts() ); | ||
50 | } | 54 | } |
55 | |||
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index 7bcd818..ba60297 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h | |||
@@ -1,26 +1,27 @@ | |||
1 | #ifndef OPIEMAIL_H | 1 | #ifndef OPIEMAIL_H |
2 | #define OPIEMAIL_H | 2 | #define OPIEMAIL_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include "settings.h" | 5 | #include "settings.h" |
6 | 6 | ||
7 | class OpieMail : public MainWindow | 7 | class OpieMail : public MainWindow |
8 | { | 8 | { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 12 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
13 | static QString appName() { return QString::fromLatin1("opiemail"); } | 13 | static QString appName() { return QString::fromLatin1("opiemail"); } |
14 | protected slots: | 14 | |
15 | public slots: | ||
15 | void slotComposeMail(); | 16 | void slotComposeMail(); |
17 | protected slots: | ||
16 | void slotSendQueued(); | 18 | void slotSendQueued(); |
17 | void slotSearchMails(); | 19 | void slotSearchMails(); |
18 | void slotEditSettings(); | 20 | void slotEditSettings(); |
19 | void slotEditAccounts(); | 21 | void slotEditAccounts(); |
20 | |||
21 | private: | 22 | private: |
22 | Settings *settings; | 23 | Settings *settings; |
23 | 24 | ||
24 | }; | 25 | }; |
25 | 26 | ||
26 | #endif | 27 | #endif |