author | zautrix <zautrix> | 2004-09-11 16:44:49 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-11 16:44:49 (UTC) |
commit | 06be094df4e34cc41db113d8c0e78eccde5365b5 (patch) (unidiff) | |
tree | b99317f9c83886d05b83cdb49e066f414e0fde25 | |
parent | 53e10fa5e66620ff1eba1c9d17738103ad511c91 (diff) | |
download | kdepimpi-06be094df4e34cc41db113d8c0e78eccde5365b5.zip kdepimpi-06be094df4e34cc41db113d8c0e78eccde5365b5.tar.gz kdepimpi-06be094df4e34cc41db113d8c0e78eccde5365b5.tar.bz2 |
Mail more useful
-rw-r--r-- | kmicromail/accountitem.cpp | 14 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 4 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 4 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 7 | ||||
-rw-r--r-- | kmicromail/mainwindow.h | 1 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 10 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 1 |
8 files changed, 28 insertions, 15 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 7b9b881..59c8abb 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -1,42 +1,44 @@ | |||
1 | 1 | ||
2 | #include "accountitem.h" | 2 | #include "accountitem.h" |
3 | #include "accountview.h" | 3 | #include "accountview.h" |
4 | #include "newmaildir.h" | 4 | #include "newmaildir.h" |
5 | #include "nntpgroupsdlg.h" | 5 | #include "nntpgroupsdlg.h" |
6 | #include "defines.h" | 6 | #include "defines.h" |
7 | 7 | ||
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | //#include <qpe/qpeapplication.h> | 12 | //#include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <kiconloader.h> | 17 | #include <kiconloader.h> |
18 | 18 | ||
19 | #define GET_NEW_MAILS 101 | ||
20 | |||
19 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
20 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 22 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
21 | /** | 23 | /** |
22 | * POP3 Account stuff | 24 | * POP3 Account stuff |
23 | */ | 25 | */ |
24 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 26 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
25 | : AccountViewItem( parent ) | 27 | : AccountViewItem( parent ) |
26 | { | 28 | { |
27 | account = a; | 29 | account = a; |
28 | wrapper = AbstractMail::getWrapper( account ); | 30 | wrapper = AbstractMail::getWrapper( account ); |
29 | SETPIX(PIXMAP_POP3FOLDER); | 31 | SETPIX(PIXMAP_POP3FOLDER); |
30 | #if 0 | 32 | #if 0 |
31 | if (!account->getOffline()) | 33 | if (!account->getOffline()) |
32 | { | 34 | { |
33 | setPixmap( 0, ); | 35 | setPixmap( 0, ); |
34 | } | 36 | } |
35 | else | 37 | else |
36 | { | 38 | { |
37 | setPixmap( 0, PIXMAP_OFFLINE ); | 39 | setPixmap( 0, PIXMAP_OFFLINE ); |
38 | } | 40 | } |
39 | #endif | 41 | #endif |
40 | setText( 0, account->getAccountName() ); | 42 | setText( 0, account->getAccountName() ); |
41 | setOpen( true ); | 43 | setOpen( true ); |
42 | } | 44 | } |
@@ -71,94 +73,94 @@ void POP3viewItem::refresh() | |||
71 | QListViewItem*item = 0; | 73 | QListViewItem*item = 0; |
72 | for ( it = folders->begin(); it!=folders->end(); ++it) | 74 | for ( it = folders->begin(); it!=folders->end(); ++it) |
73 | { | 75 | { |
74 | item = new POP3folderItem( (*it), this , item ); | 76 | item = new POP3folderItem( (*it), this , item ); |
75 | item->setSelectable( (*it)->may_select()); | 77 | item->setSelectable( (*it)->may_select()); |
76 | } | 78 | } |
77 | delete folders; | 79 | delete folders; |
78 | } | 80 | } |
79 | 81 | ||
80 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
81 | { | 83 | { |
82 | 84 | ||
83 | return wrapper->fetchBody( mail ); | 85 | return wrapper->fetchBody( mail ); |
84 | } | 86 | } |
85 | 87 | ||
86 | QPopupMenu * POP3viewItem::getContextMenu() | 88 | QPopupMenu * POP3viewItem::getContextMenu() |
87 | { | 89 | { |
88 | QPopupMenu *m = new QPopupMenu(0); | 90 | QPopupMenu *m = new QPopupMenu(0); |
89 | if (m) | 91 | if (m) |
90 | { | 92 | { |
91 | if (!account->getOffline()) | 93 | if (!account->getOffline()) |
92 | { | 94 | { |
93 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 95 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
94 | m->insertItem(QObject::tr("Set offline",contextName),1); | 96 | m->insertItem(QObject::tr("Set offline",contextName),1); |
95 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); | 97 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
96 | } | 98 | } |
97 | else | 99 | else |
98 | { | 100 | { |
99 | m->insertItem(QObject::tr("Set online",contextName),1); | 101 | m->insertItem(QObject::tr("Set online",contextName),1); |
100 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); | 102 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
101 | } | 103 | } |
102 | } | 104 | } |
103 | return m; | 105 | return m; |
104 | } | 106 | } |
105 | 107 | ||
106 | void POP3viewItem::disconnect() | 108 | void POP3viewItem::disconnect() |
107 | { | 109 | { |
108 | QListViewItem *child = firstChild(); | 110 | QListViewItem *child = firstChild(); |
109 | while ( child ) | 111 | while ( child ) |
110 | { | 112 | { |
111 | QListViewItem *tmp = child; | 113 | QListViewItem *tmp = child; |
112 | child = child->nextSibling(); | 114 | child = child->nextSibling(); |
113 | delete tmp; | 115 | delete tmp; |
114 | } | 116 | } |
115 | wrapper->logout(); | 117 | wrapper->logout(); |
116 | } | 118 | } |
117 | 119 | ||
118 | void POP3viewItem::setOnOffline() | 120 | void POP3viewItem::setOnOffline() |
119 | { | 121 | { |
120 | if (!account->getOffline()) | 122 | if (!account->getOffline()) |
121 | { | 123 | { |
122 | disconnect(); | 124 | disconnect(); |
123 | } | 125 | } |
124 | account->setOffline(!account->getOffline()); | 126 | account->setOffline(!account->getOffline()); |
125 | account->save(); | 127 | account->save(); |
126 | SETPIX(PIXMAP_POP3FOLDER); | 128 | SETPIX(PIXMAP_POP3FOLDER); |
127 | refresh(); | 129 | refresh(); |
128 | } | 130 | } |
129 | 131 | ||
130 | void POP3viewItem::contextMenuSelected(int which) | 132 | void POP3viewItem::contextMenuSelected(int which) |
131 | { | 133 | { |
132 | switch (which) | 134 | switch (which) |
133 | { | 135 | { |
134 | case 0: | 136 | case 0: |
135 | disconnect(); | 137 | disconnect(); |
136 | break; | 138 | break; |
137 | case 1: | 139 | case 1: |
138 | setOnOffline(); | 140 | setOnOffline(); |
139 | break; | 141 | break; |
140 | case 2: // daunlood | 142 | case GET_NEW_MAILS: // daunlood |
141 | if (account->getOffline()) | 143 | if (account->getOffline()) |
142 | setOnOffline(); | 144 | setOnOffline(); |
143 | AccountView*bl = accountView(); | 145 | AccountView*bl = accountView(); |
144 | if (!bl) return; | 146 | if (!bl) return; |
145 | AccountViewItem* in = findSubItem( "inbox" , 0); | 147 | AccountViewItem* in = findSubItem( "inbox" , 0); |
146 | if ( ! in ) | 148 | if ( ! in ) |
147 | return; | 149 | return; |
148 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | 150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); |
149 | setOnOffline(); | 151 | setOnOffline(); |
150 | break; | 152 | break; |
151 | } | 153 | } |
152 | } | 154 | } |
153 | 155 | ||
154 | POP3folderItem::~POP3folderItem() | 156 | POP3folderItem::~POP3folderItem() |
155 | {} | 157 | {} |
156 | 158 | ||
157 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) |
158 | : AccountViewItem(folderInit,parent,after ) | 160 | : AccountViewItem(folderInit,parent,after ) |
159 | { | 161 | { |
160 | pop3 = parent; | 162 | pop3 = parent; |
161 | if (folder->getDisplayName().lower()!="inbox") | 163 | if (folder->getDisplayName().lower()!="inbox") |
162 | { | 164 | { |
163 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 165 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
164 | } | 166 | } |
@@ -496,55 +498,55 @@ void IMAPviewItem::refreshFolders(bool force) | |||
496 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); | 498 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); |
497 | item = titem; | 499 | item = titem; |
498 | } | 500 | } |
499 | else | 501 | else |
500 | { | 502 | { |
501 | item = new IMAPfolderItem( (*it), this , item ); | 503 | item = new IMAPfolderItem( (*it), this , item ); |
502 | } | 504 | } |
503 | } | 505 | } |
504 | delete folders; | 506 | delete folders; |
505 | } | 507 | } |
506 | 508 | ||
507 | QPopupMenu * IMAPviewItem::getContextMenu() | 509 | QPopupMenu * IMAPviewItem::getContextMenu() |
508 | { | 510 | { |
509 | QPopupMenu *m = new QPopupMenu(0); | 511 | QPopupMenu *m = new QPopupMenu(0); |
510 | if (m) | 512 | if (m) |
511 | { | 513 | { |
512 | if (!account->getOffline()) | 514 | if (!account->getOffline()) |
513 | { | 515 | { |
514 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
515 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 517 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
516 | m->insertSeparator(); | 518 | m->insertSeparator(); |
517 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 519 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
518 | m->insertItem(QObject::tr("Set offline",contextName),3); | 520 | m->insertItem(QObject::tr("Set offline",contextName),3); |
519 | m->insertSeparator(); | 521 | m->insertSeparator(); |
520 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); | 522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
521 | } | 523 | } |
522 | else | 524 | else |
523 | { | 525 | { |
524 | m->insertItem(QObject::tr("Set online",contextName),3); | 526 | m->insertItem(QObject::tr("Set online",contextName),3); |
525 | m->insertSeparator(); | 527 | m->insertSeparator(); |
526 | m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); | 528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
527 | } | 529 | } |
528 | } | 530 | } |
529 | return m; | 531 | return m; |
530 | } | 532 | } |
531 | 533 | ||
532 | void IMAPviewItem::createNewFolder() | 534 | void IMAPviewItem::createNewFolder() |
533 | { | 535 | { |
534 | Newmdirdlg ndirdlg; | 536 | Newmdirdlg ndirdlg; |
535 | 537 | ||
536 | ndirdlg.showMaximized(); | 538 | ndirdlg.showMaximized(); |
537 | if ( ndirdlg.exec() ) | 539 | if ( ndirdlg.exec() ) |
538 | { | 540 | { |
539 | QString ndir = ndirdlg.Newdir(); | 541 | QString ndir = ndirdlg.Newdir(); |
540 | bool makesubs = ndirdlg.subpossible(); | 542 | bool makesubs = ndirdlg.subpossible(); |
541 | QString delemiter = "/"; | 543 | QString delemiter = "/"; |
542 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
543 | if (item) | 545 | if (item) |
544 | { | 546 | { |
545 | delemiter = item->Delemiter(); | 547 | delemiter = item->Delemiter(); |
546 | } | 548 | } |
547 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 549 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
548 | { | 550 | { |
549 | refreshFolders(true); | 551 | refreshFolders(true); |
550 | } | 552 | } |
@@ -556,49 +558,49 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
556 | 558 | ||
557 | switch (id) | 559 | switch (id) |
558 | { | 560 | { |
559 | case 0: | 561 | case 0: |
560 | refreshFolders(true); | 562 | refreshFolders(true); |
561 | break; | 563 | break; |
562 | case 1: | 564 | case 1: |
563 | createNewFolder(); | 565 | createNewFolder(); |
564 | break; | 566 | break; |
565 | case 2: | 567 | case 2: |
566 | removeChilds(); | 568 | removeChilds(); |
567 | wrapper->logout(); | 569 | wrapper->logout(); |
568 | break; | 570 | break; |
569 | case 3: | 571 | case 3: |
570 | if (account->getOffline()==false) | 572 | if (account->getOffline()==false) |
571 | { | 573 | { |
572 | removeChilds(); | 574 | removeChilds(); |
573 | wrapper->logout(); | 575 | wrapper->logout(); |
574 | } | 576 | } |
575 | account->setOffline(!account->getOffline()); | 577 | account->setOffline(!account->getOffline()); |
576 | account->save(); | 578 | account->save(); |
577 | SETPIX(PIXMAP_IMAPFOLDER); | 579 | SETPIX(PIXMAP_IMAPFOLDER); |
578 | refreshFolders(false); | 580 | refreshFolders(false); |
579 | break; | 581 | break; |
580 | case 4: // daunlood | 582 | case GET_NEW_MAILS: // daunlood |
581 | { | 583 | { |
582 | if (account->getOffline()) { | 584 | if (account->getOffline()) { |
583 | contextMenuSelected( 3 ); | 585 | contextMenuSelected( 3 ); |
584 | } | 586 | } |
585 | AccountView*bl = accountView(); | 587 | AccountView*bl = accountView(); |
586 | if (!bl) return; | 588 | if (!bl) return; |
587 | AccountViewItem* in = findSubItem( "inbox" , 0); | 589 | AccountViewItem* in = findSubItem( "inbox" , 0); |
588 | if ( ! in ) | 590 | if ( ! in ) |
589 | return; | 591 | return; |
590 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | 592 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); |
591 | } | 593 | } |
592 | break; | 594 | break; |
593 | default: | 595 | default: |
594 | break; | 596 | break; |
595 | } | 597 | } |
596 | } | 598 | } |
597 | 599 | ||
598 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 600 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
599 | { | 601 | { |
600 | return new RecBody(); | 602 | return new RecBody(); |
601 | } | 603 | } |
602 | 604 | ||
603 | bool IMAPviewItem::offline() | 605 | bool IMAPviewItem::offline() |
604 | { | 606 | { |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 5441a9b..91332c3 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -150,49 +150,49 @@ void IMAPwrapper::login() | |||
150 | } else { | 150 | } else { |
151 | // cancel | 151 | // cancel |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | } else { | 154 | } else { |
155 | user = account->getUser(); | 155 | user = account->getUser(); |
156 | pass = account->getPassword(); | 156 | pass = account->getPassword(); |
157 | } | 157 | } |
158 | 158 | ||
159 | m_imap = mailimap_new( 20, &imap_progress ); | 159 | m_imap = mailimap_new( 20, &imap_progress ); |
160 | 160 | ||
161 | /* connect */ | 161 | /* connect */ |
162 | bool ssl = false; | 162 | bool ssl = false; |
163 | bool try_tls = false; | 163 | bool try_tls = false; |
164 | bool force_tls = false; | 164 | bool force_tls = false; |
165 | 165 | ||
166 | if ( account->ConnectionType() == 2 ) { | 166 | if ( account->ConnectionType() == 2 ) { |
167 | ssl = true; | 167 | ssl = true; |
168 | } | 168 | } |
169 | if (account->ConnectionType()==1) { | 169 | if (account->ConnectionType()==1) { |
170 | force_tls = true; | 170 | force_tls = true; |
171 | } | 171 | } |
172 | 172 | ||
173 | if ( ssl ) { | 173 | if ( ssl ) { |
174 | qDebug("using ssl "); | 174 | //qDebug("using ssl "); |
175 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); | 175 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); |
176 | } else { | 176 | } else { |
177 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); | 177 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); |
178 | } | 178 | } |
179 | 179 | ||
180 | if ( err != MAILIMAP_NO_ERROR && | 180 | if ( err != MAILIMAP_NO_ERROR && |
181 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && | 181 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && |
182 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { | 182 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { |
183 | QString failure = ""; | 183 | QString failure = ""; |
184 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { | 184 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { |
185 | failure="Connection refused"; | 185 | failure="Connection refused"; |
186 | } else { | 186 | } else { |
187 | failure="Unknown failure"; | 187 | failure="Unknown failure"; |
188 | } | 188 | } |
189 | Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); | 189 | Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); |
190 | mailimap_free( m_imap ); | 190 | mailimap_free( m_imap ); |
191 | m_imap = 0; | 191 | m_imap = 0; |
192 | return; | 192 | return; |
193 | } | 193 | } |
194 | 194 | ||
195 | if (!ssl) { | 195 | if (!ssl) { |
196 | try_tls = start_tls(force_tls); | 196 | try_tls = start_tls(force_tls); |
197 | } | 197 | } |
198 | 198 | ||
@@ -1226,49 +1226,49 @@ MAILLIB::ATYPE IMAPwrapper::getType()const | |||
1226 | { | 1226 | { |
1227 | return account->getType(); | 1227 | return account->getType(); |
1228 | } | 1228 | } |
1229 | 1229 | ||
1230 | const QString&IMAPwrapper::getName()const | 1230 | const QString&IMAPwrapper::getName()const |
1231 | { | 1231 | { |
1232 | // odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; | 1232 | // odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; |
1233 | return account->getAccountName(); | 1233 | return account->getAccountName(); |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) | 1236 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) |
1237 | { | 1237 | { |
1238 | // dummy | 1238 | // dummy |
1239 | QValueList<int> path; | 1239 | QValueList<int> path; |
1240 | return fetchRawPart(mail,path,false); | 1240 | return fetchRawPart(mail,path,false); |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | 1243 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, |
1244 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 1244 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
1245 | { | 1245 | { |
1246 | if (targetWrapper != this || maxSizeInKb > 0 ) { | 1246 | if (targetWrapper != this || maxSizeInKb > 0 ) { |
1247 | mMax = 0; | 1247 | mMax = 0; |
1248 | progress( tr("Copy")); | 1248 | progress( tr("Copy")); |
1249 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); | 1249 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); |
1250 | qDebug("IMAPwrapper::mvcpAllMails::Using generic"); | 1250 | //qDebug("IMAPwrapper::mvcpAllMails::Using generic"); |
1251 | // odebug << "Using generic" << oendl; | 1251 | // odebug << "Using generic" << oendl; |
1252 | return; | 1252 | return; |
1253 | } | 1253 | } |
1254 | mailimap_set *set = 0; | 1254 | mailimap_set *set = 0; |
1255 | login(); | 1255 | login(); |
1256 | if (!m_imap) { | 1256 | if (!m_imap) { |
1257 | return; | 1257 | return; |
1258 | } | 1258 | } |
1259 | int err = selectMbox(fromFolder->getName()); | 1259 | int err = selectMbox(fromFolder->getName()); |
1260 | if ( err != MAILIMAP_NO_ERROR ) { | 1260 | if ( err != MAILIMAP_NO_ERROR ) { |
1261 | return; | 1261 | return; |
1262 | } | 1262 | } |
1263 | Global::statusMessage( tr("Copying mails on server...") ); | 1263 | Global::statusMessage( tr("Copying mails on server...") ); |
1264 | int last = m_imap->imap_selection_info->sel_exists; | 1264 | int last = m_imap->imap_selection_info->sel_exists; |
1265 | set = mailimap_set_new_interval( 1, last ); | 1265 | set = mailimap_set_new_interval( 1, last ); |
1266 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | 1266 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); |
1267 | mailimap_set_free( set ); | 1267 | mailimap_set_free( set ); |
1268 | if ( err != MAILIMAP_NO_ERROR ) { | 1268 | if ( err != MAILIMAP_NO_ERROR ) { |
1269 | QString error_msg = tr("Error copy mails: %1").arg(m_imap->imap_response); | 1269 | QString error_msg = tr("Error copy mails: %1").arg(m_imap->imap_response); |
1270 | Global::statusMessage(error_msg); | 1270 | Global::statusMessage(error_msg); |
1271 | // odebug << error_msg << oendl; | 1271 | // odebug << error_msg << oendl; |
1272 | return; | 1272 | return; |
1273 | } | 1273 | } |
1274 | if (moveit) { | 1274 | if (moveit) { |
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index 962dac0..641d4d9 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp | |||
@@ -44,49 +44,48 @@ void MHwrapper::init_storage() | |||
44 | r = mailstorage_connect(m_storage); | 44 | r = mailstorage_connect(m_storage); |
45 | if (r!=MAIL_NO_ERROR) { | 45 | if (r!=MAIL_NO_ERROR) { |
46 | qDebug("error connecting storage "); | 46 | qDebug("error connecting storage "); |
47 | mailstorage_free(m_storage); | 47 | mailstorage_free(m_storage); |
48 | m_storage = 0; | 48 | m_storage = 0; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | void MHwrapper::clean_storage() | 52 | void MHwrapper::clean_storage() |
53 | { | 53 | { |
54 | if (m_storage) { | 54 | if (m_storage) { |
55 | mailstorage_disconnect(m_storage); | 55 | mailstorage_disconnect(m_storage); |
56 | mailstorage_free(m_storage); | 56 | mailstorage_free(m_storage); |
57 | m_storage = 0; | 57 | m_storage = 0; |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | MHwrapper::~MHwrapper() | 61 | MHwrapper::~MHwrapper() |
62 | { | 62 | { |
63 | clean_storage(); | 63 | clean_storage(); |
64 | } | 64 | } |
65 | 65 | ||
66 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) | 66 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
67 | { | 67 | { |
68 | qDebug("MHwrapper::listMessages "); | ||
69 | init_storage(); | 68 | init_storage(); |
70 | if (!m_storage) { | 69 | if (!m_storage) { |
71 | return; | 70 | return; |
72 | } | 71 | } |
73 | QString f = buildPath(mailbox); | 72 | QString f = buildPath(mailbox); |
74 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 73 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
75 | if (r!=MAIL_NO_ERROR) { | 74 | if (r!=MAIL_NO_ERROR) { |
76 | qDebug("listMessages: error selecting folder! "); | 75 | qDebug("listMessages: error selecting folder! "); |
77 | return; | 76 | return; |
78 | } | 77 | } |
79 | parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); | 78 | parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); |
80 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 79 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
81 | } | 80 | } |
82 | 81 | ||
83 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() | 82 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() |
84 | { | 83 | { |
85 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); | 84 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); |
86 | /* this is needed! */ | 85 | /* this is needed! */ |
87 | if (m_storage) mailstorage_disconnect(m_storage); | 86 | if (m_storage) mailstorage_disconnect(m_storage); |
88 | init_storage(); | 87 | init_storage(); |
89 | if (!m_storage) { | 88 | if (!m_storage) { |
90 | return folders; | 89 | return folders; |
91 | } | 90 | } |
92 | mail_list*flist = 0; | 91 | mail_list*flist = 0; |
@@ -173,49 +172,48 @@ QString MHwrapper::buildPath(const QString&p) | |||
173 | return f; | 172 | return f; |
174 | } | 173 | } |
175 | 174 | ||
176 | int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) | 175 | int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) |
177 | { | 176 | { |
178 | init_storage(); | 177 | init_storage(); |
179 | if (!m_storage) { | 178 | if (!m_storage) { |
180 | return 0; | 179 | return 0; |
181 | } | 180 | } |
182 | QString f; | 181 | QString f; |
183 | if (!pfolder) { | 182 | if (!pfolder) { |
184 | // toplevel folder | 183 | // toplevel folder |
185 | f = buildPath(folder); | 184 | f = buildPath(folder); |
186 | } else { | 185 | } else { |
187 | f = pfolder->getName(); | 186 | f = pfolder->getName(); |
188 | f+="/"; | 187 | f+="/"; |
189 | f+=folder; | 188 | f+=folder; |
190 | } | 189 | } |
191 | 190 | ||
192 | int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); | 191 | int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); |
193 | if (r != MAIL_NO_ERROR) { | 192 | if (r != MAIL_NO_ERROR) { |
194 | qDebug("error creating folder "); | 193 | qDebug("error creating folder "); |
195 | return 0; | 194 | return 0; |
196 | } | 195 | } |
197 | qDebug("Folder created "); | ||
198 | return 1; | 196 | return 1; |
199 | } | 197 | } |
200 | 198 | ||
201 | void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) | 199 | void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) |
202 | { | 200 | { |
203 | init_storage(); | 201 | init_storage(); |
204 | if (!m_storage) { | 202 | if (!m_storage) { |
205 | return; | 203 | return; |
206 | } | 204 | } |
207 | QString f = buildPath(Folder); | 205 | QString f = buildPath(Folder); |
208 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 206 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
209 | if (r!=MAIL_NO_ERROR) { | 207 | if (r!=MAIL_NO_ERROR) { |
210 | qDebug("error selecting folder! "); | 208 | qDebug("error selecting folder! "); |
211 | return; | 209 | return; |
212 | } | 210 | } |
213 | r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); | 211 | r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); |
214 | if (r!=MAIL_NO_ERROR) { | 212 | if (r!=MAIL_NO_ERROR) { |
215 | qDebug("error storing mail "); | 213 | qDebug("error storing mail "); |
216 | } | 214 | } |
217 | return; | 215 | return; |
218 | } | 216 | } |
219 | 217 | ||
220 | encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) | 218 | encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) |
221 | { | 219 | { |
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 766eba0..40b5591 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -5,49 +5,48 @@ | |||
5 | #include <kconfig.h> | 5 | #include <kconfig.h> |
6 | 6 | ||
7 | #include <kstandarddirs.h> | 7 | #include <kstandarddirs.h> |
8 | #include "settings.h" | 8 | #include "settings.h" |
9 | //#include "defines.h" | 9 | //#include "defines.h" |
10 | 10 | ||
11 | #define IMAP_PORT "143" | 11 | #define IMAP_PORT "143" |
12 | #define IMAP_SSL_PORT "993" | 12 | #define IMAP_SSL_PORT "993" |
13 | #define SMTP_PORT "25" | 13 | #define SMTP_PORT "25" |
14 | #define SMTP_SSL_PORT "465" | 14 | #define SMTP_SSL_PORT "465" |
15 | #define POP3_PORT "110" | 15 | #define POP3_PORT "110" |
16 | #define POP3_SSL_PORT "995" | 16 | #define POP3_SSL_PORT "995" |
17 | #define NNTP_PORT "119" | 17 | #define NNTP_PORT "119" |
18 | #define NNTP_SSL_PORT "563" | 18 | #define NNTP_SSL_PORT "563" |
19 | 19 | ||
20 | 20 | ||
21 | Settings::Settings() | 21 | Settings::Settings() |
22 | : QObject() | 22 | : QObject() |
23 | { | 23 | { |
24 | updateAccounts(); | 24 | updateAccounts(); |
25 | } | 25 | } |
26 | 26 | ||
27 | void Settings::checkDirectory() | 27 | void Settings::checkDirectory() |
28 | { | 28 | { |
29 | qDebug("Settings::checkDirectory() "); | ||
30 | return; | 29 | return; |
31 | locateLocal("data", "kopiemail" ); | 30 | locateLocal("data", "kopiemail" ); |
32 | /* | 31 | /* |
33 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 32 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
34 | system( "mkdir -p $HOME/Applications/opiemail" ); | 33 | system( "mkdir -p $HOME/Applications/opiemail" ); |
35 | qDebug("$HOME/Applications/opiemail created "); | 34 | qDebug("$HOME/Applications/opiemail created "); |
36 | } | 35 | } |
37 | */ | 36 | */ |
38 | } | 37 | } |
39 | 38 | ||
40 | QList<Account> Settings::getAccounts() | 39 | QList<Account> Settings::getAccounts() |
41 | { | 40 | { |
42 | return accounts; | 41 | return accounts; |
43 | } | 42 | } |
44 | 43 | ||
45 | void Settings::addAccount( Account *account ) | 44 | void Settings::addAccount( Account *account ) |
46 | { | 45 | { |
47 | accounts.append( account ); | 46 | accounts.append( account ); |
48 | } | 47 | } |
49 | 48 | ||
50 | void Settings::delAccount( Account *account ) | 49 | void Settings::delAccount( Account *account ) |
51 | { | 50 | { |
52 | accounts.remove( account ); | 51 | accounts.remove( account ); |
53 | account->remove(); | 52 | account->remove(); |
@@ -189,57 +188,56 @@ void IMAPaccount::read() | |||
189 | { | 188 | { |
190 | KConfig *conf = new KConfig( getFileName() ); | 189 | KConfig *conf = new KConfig( getFileName() ); |
191 | conf->setGroup( "IMAP Account" ); | 190 | conf->setGroup( "IMAP Account" ); |
192 | accountName = conf->readEntry( "Account","" ); | 191 | accountName = conf->readEntry( "Account","" ); |
193 | if (accountName.isNull()) accountName = ""; | 192 | if (accountName.isNull()) accountName = ""; |
194 | server = conf->readEntry( "Server","" ); | 193 | server = conf->readEntry( "Server","" ); |
195 | if (server.isNull()) server=""; | 194 | if (server.isNull()) server=""; |
196 | port = conf->readEntry( "Port","" ); | 195 | port = conf->readEntry( "Port","" ); |
197 | if (port.isNull()) port="143"; | 196 | if (port.isNull()) port="143"; |
198 | connectionType = conf->readNumEntry( "ConnectionType" ); | 197 | connectionType = conf->readNumEntry( "ConnectionType" ); |
199 | ssl = conf->readBoolEntry( "SSL",false ); | 198 | ssl = conf->readBoolEntry( "SSL",false ); |
200 | user = conf->readEntry( "User","" ); | 199 | user = conf->readEntry( "User","" ); |
201 | if (user.isNull()) user = ""; | 200 | if (user.isNull()) user = ""; |
202 | //password = conf->readEntryCrypt( "Password","" ); | 201 | //password = conf->readEntryCrypt( "Password","" ); |
203 | setPasswordList( conf->readListEntry( "FolderHistory")); | 202 | setPasswordList( conf->readListEntry( "FolderHistory")); |
204 | if (password.isNull()) password = ""; | 203 | if (password.isNull()) password = ""; |
205 | prefix = conf->readEntry("MailPrefix",""); | 204 | prefix = conf->readEntry("MailPrefix",""); |
206 | if (prefix.isNull()) prefix = ""; | 205 | if (prefix.isNull()) prefix = ""; |
207 | offline = conf->readBoolEntry("Offline",false); | 206 | offline = conf->readBoolEntry("Offline",false); |
208 | localFolder = conf->readEntry( "LocalFolder" ); | 207 | localFolder = conf->readEntry( "LocalFolder" ); |
209 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); | 208 | maxMailSize = conf->readNumEntry( "MaxSize",0 ); |
210 | int lf = conf->readNumEntry( "LastFetch",0 ); | 209 | int lf = conf->readNumEntry( "LastFetch",0 ); |
211 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 210 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
212 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); | 211 | leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); |
213 | qDebug("reading last fetch: %d ", lf); | ||
214 | if ( lf < 0 ) lf = 0; | 212 | if ( lf < 0 ) lf = 0; |
215 | lastFetch = dt.addSecs( lf ); | 213 | lastFetch = dt.addSecs( lf ); |
216 | delete conf; | 214 | delete conf; |
217 | } | 215 | } |
218 | 216 | ||
219 | void IMAPaccount::save() | 217 | void IMAPaccount::save() |
220 | { | 218 | { |
221 | qDebug("saving %s ",getFileName().latin1() ); | 219 | |
222 | Settings::checkDirectory(); | 220 | Settings::checkDirectory(); |
223 | 221 | ||
224 | KConfig *conf = new KConfig( getFileName() ); | 222 | KConfig *conf = new KConfig( getFileName() ); |
225 | conf->setGroup( "IMAP Account" ); | 223 | conf->setGroup( "IMAP Account" ); |
226 | conf->writeEntry( "Account", accountName ); | 224 | conf->writeEntry( "Account", accountName ); |
227 | conf->writeEntry( "Server", server ); | 225 | conf->writeEntry( "Server", server ); |
228 | conf->writeEntry( "Port", port ); | 226 | conf->writeEntry( "Port", port ); |
229 | conf->writeEntry( "SSL", ssl ); | 227 | conf->writeEntry( "SSL", ssl ); |
230 | conf->writeEntry( "ConnectionType", connectionType ); | 228 | conf->writeEntry( "ConnectionType", connectionType ); |
231 | conf->writeEntry( "User", user ); | 229 | conf->writeEntry( "User", user ); |
232 | //conf->writeEntryCrypt( "Password", password ); | 230 | //conf->writeEntryCrypt( "Password", password ); |
233 | conf->writeEntry( "FolderHistory",getPasswordList() ); | 231 | conf->writeEntry( "FolderHistory",getPasswordList() ); |
234 | conf->writeEntry( "MailPrefix",prefix); | 232 | conf->writeEntry( "MailPrefix",prefix); |
235 | conf->writeEntry( "Offline",offline); | 233 | conf->writeEntry( "Offline",offline); |
236 | conf->writeEntry( "LocalFolder", localFolder ); | 234 | conf->writeEntry( "LocalFolder", localFolder ); |
237 | conf->writeEntry( "MaxSize", maxMailSize ); | 235 | conf->writeEntry( "MaxSize", maxMailSize ); |
238 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); | 236 | QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); |
239 | int lf = dt.secsTo ( lastFetch ); | 237 | int lf = dt.secsTo ( lastFetch ); |
240 | conf->writeEntry( "LastFetch", lf ); | 238 | conf->writeEntry( "LastFetch", lf ); |
241 | conf->writeEntry( "LeaveOnServer", leaveOnServer); | 239 | conf->writeEntry( "LeaveOnServer", leaveOnServer); |
242 | conf->sync(); | 240 | conf->sync(); |
243 | delete conf; | 241 | delete conf; |
244 | } | 242 | } |
245 | 243 | ||
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 21edfd2..5f777a3 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -14,49 +14,54 @@ | |||
14 | #endif | 14 | #endif |
15 | #include "defines.h" | 15 | #include "defines.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include <KDGanttMinimizeSplitter.h> | 17 | #include <KDGanttMinimizeSplitter.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <kabc/stdaddressbook.h> | 20 | #include <kabc/stdaddressbook.h> |
21 | 21 | ||
22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
23 | : QMainWindow( parent, name ) //, flags ) | 23 | : QMainWindow( parent, name ) //, flags ) |
24 | { | 24 | { |
25 | setCaption( tr( "KOpieMail/Pi" ) ); | 25 | setCaption( tr( "KOpieMail/Pi" ) ); |
26 | setToolBarsMovable( false ); | 26 | setToolBarsMovable( false ); |
27 | //KABC::StdAddressBook::self(); | 27 | //KABC::StdAddressBook::self(); |
28 | toolBar = new QToolBar( this ); | 28 | toolBar = new QToolBar( this ); |
29 | menuBar = new QPEMenuBar( toolBar ); | 29 | menuBar = new QPEMenuBar( toolBar ); |
30 | mailMenu = new QPopupMenu( menuBar ); | 30 | mailMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
32 | settingsMenu = new QPopupMenu( menuBar ); | 32 | settingsMenu = new QPopupMenu( menuBar ); |
33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
34 | 34 | ||
35 | addToolBar( toolBar ); | 35 | addToolBar( toolBar ); |
36 | toolBar->setHorizontalStretchable( true ); | 36 | toolBar->setHorizontalStretchable( true ); |
37 | 37 | ||
38 | 38 | QAction* getMail = new QAction( tr( "Get new mail" ), SmallIcon("add"), | |
39 | 0, 0, this ); | ||
40 | getMail->addTo( toolBar ); | ||
41 | getMail->addTo( mailMenu ); | ||
42 | connect(getMail, SIGNAL( activated() ), | ||
43 | SLOT( slotGetMail() ) ); | ||
39 | 44 | ||
40 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 45 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
41 | 0, 0, this ); | 46 | 0, 0, this ); |
42 | composeMail->addTo( toolBar ); | 47 | composeMail->addTo( toolBar ); |
43 | composeMail->addTo( mailMenu ); | 48 | composeMail->addTo( mailMenu ); |
44 | 49 | ||
45 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 50 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
46 | 0, 0, this ); | 51 | 0, 0, this ); |
47 | sendQueued->addTo( toolBar ); | 52 | sendQueued->addTo( toolBar ); |
48 | sendQueued->addTo( mailMenu ); | 53 | sendQueued->addTo( mailMenu ); |
49 | 54 | ||
50 | /* | 55 | /* |
51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 56 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
52 | 0, 0, this ); | 57 | 0, 0, this ); |
53 | syncFolders->addTo( toolBar ); | 58 | syncFolders->addTo( toolBar ); |
54 | syncFolders->addTo( mailMenu ); | 59 | syncFolders->addTo( mailMenu ); |
55 | */ | 60 | */ |
56 | 61 | ||
57 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 62 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
58 | 0, 0, this, 0, true ); | 63 | 0, 0, this, 0, true ); |
59 | showFolders->addTo( toolBar ); | 64 | showFolders->addTo( toolBar ); |
60 | showFolders->addTo( mailMenu ); | 65 | showFolders->addTo( mailMenu ); |
61 | showFolders->setOn( true ); | 66 | showFolders->setOn( true ); |
62 | connect(showFolders, SIGNAL( toggled(bool) ), | 67 | connect(showFolders, SIGNAL( toggled(bool) ), |
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index 680f0a9..ff0ff20 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h | |||
@@ -20,46 +20,47 @@ | |||
20 | #include <libmailwrapper/mailtypes.h> | 20 | #include <libmailwrapper/mailtypes.h> |
21 | #include <opie2/osmartpointer.h> | 21 | #include <opie2/osmartpointer.h> |
22 | 22 | ||
23 | class RecMail; | 23 | class RecMail; |
24 | 24 | ||
25 | class MainWindow : public QMainWindow | 25 | class MainWindow : public QMainWindow |
26 | { | 26 | { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | 28 | ||
29 | public: | 29 | public: |
30 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 30 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
31 | virtual ~MainWindow(); | 31 | virtual ~MainWindow(); |
32 | 32 | ||
33 | public slots: | 33 | public slots: |
34 | virtual void slotAdjustColumns(); | 34 | virtual void slotAdjustColumns(); |
35 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 35 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
36 | virtual void slotComposeMail(); | 36 | virtual void slotComposeMail(); |
37 | 37 | ||
38 | protected slots: | 38 | protected slots: |
39 | virtual void slotSendQueued(); | 39 | virtual void slotSendQueued(); |
40 | virtual void slotEditAccounts(); | 40 | virtual void slotEditAccounts(); |
41 | virtual void slotShowFolders( bool show ); | 41 | virtual void slotShowFolders( bool show ); |
42 | virtual void refreshMailView(const QValueList<RecMailP>&); | 42 | virtual void refreshMailView(const QValueList<RecMailP>&); |
43 | virtual void displayMail(); | 43 | virtual void displayMail(); |
44 | virtual void slotGetMail() = 0; | ||
44 | virtual void slotDeleteMail(); | 45 | virtual void slotDeleteMail(); |
45 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 46 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
46 | virtual void slotAdjustLayout(); | 47 | virtual void slotAdjustLayout(); |
47 | virtual void slotEditSettings(); | 48 | virtual void slotEditSettings(); |
48 | virtual void mailLeftClicked( QListViewItem * ); | 49 | virtual void mailLeftClicked( QListViewItem * ); |
49 | void showLicence(); | 50 | void showLicence(); |
50 | void showAbout(); | 51 | void showAbout(); |
51 | void showEtpanLicence(); | 52 | void showEtpanLicence(); |
52 | 53 | ||
53 | protected: | 54 | protected: |
54 | QToolBar *toolBar; | 55 | QToolBar *toolBar; |
55 | StatusWidget *statusWidget; | 56 | StatusWidget *statusWidget; |
56 | QPEMenuBar *menuBar; | 57 | QPEMenuBar *menuBar; |
57 | QPopupMenu *mailMenu, *settingsMenu; | 58 | QPopupMenu *mailMenu, *settingsMenu; |
58 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 59 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
59 | *editSettings, *editAccounts, *syncFolders; | 60 | *editSettings, *editAccounts, *syncFolders; |
60 | AccountView *folderView; | 61 | AccountView *folderView; |
61 | QListView *mailView; | 62 | QListView *mailView; |
62 | //QBoxLayout *layout; | 63 | //QBoxLayout *layout; |
63 | }; | 64 | }; |
64 | 65 | ||
65 | #endif | 66 | #endif |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index b2119e6..19ffdb3 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,35 +1,36 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | #include "settingsdialog.h" | 4 | #include "settingsdialog.h" |
5 | #include "opiemail.h" | 5 | #include "opiemail.h" |
6 | #include "editaccounts.h" | 6 | #include "editaccounts.h" |
7 | #include "composemail.h" | 7 | #include "composemail.h" |
8 | #include "mailistviewitem.h" | 8 | #include "mailistviewitem.h" |
9 | #include "viewmail.h" | 9 | #include "viewmail.h" |
10 | #include "selectstore.h" | 10 | #include "selectstore.h" |
11 | #include "selectsmtp.h" | 11 | #include "selectsmtp.h" |
12 | #include "accountitem.h" | ||
12 | 13 | ||
13 | #include <qmessagebox.h> | 14 | #include <qmessagebox.h> |
14 | #include <qtimer.h> | 15 | #include <qtimer.h> |
15 | #include <libkdepim/externalapphandler.h> | 16 | #include <libkdepim/externalapphandler.h> |
16 | 17 | ||
17 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
18 | #include <libmailwrapper/smtpwrapper.h> | 19 | #include <libmailwrapper/smtpwrapper.h> |
19 | #include <libmailwrapper/mailtypes.h> | 20 | #include <libmailwrapper/mailtypes.h> |
20 | #include <libmailwrapper/abstractmail.h> | 21 | #include <libmailwrapper/abstractmail.h> |
21 | /* OPIE */ | 22 | /* OPIE */ |
22 | //#include <qpe/resource.h> | 23 | //#include <qpe/resource.h> |
23 | //#include <qpe/qpeapplication.h> | 24 | //#include <qpe/qpeapplication.h> |
24 | 25 | ||
25 | /* QT */ | 26 | /* QT */ |
26 | 27 | ||
27 | //using namespace Opie::Core; | 28 | //using namespace Opie::Core; |
28 | 29 | ||
29 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 30 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
30 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 31 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
31 | { | 32 | { |
32 | settings = new Settings(); | 33 | settings = new Settings(); |
33 | 34 | ||
34 | folderView->populate( settings->getAccounts() ); | 35 | folderView->populate( settings->getAccounts() ); |
35 | 36 | ||
@@ -223,49 +224,56 @@ void OpieMail::slotEditAccounts() | |||
223 | folderView->populate( settings->getAccounts() ); | 224 | folderView->populate( settings->getAccounts() ); |
224 | } | 225 | } |
225 | 226 | ||
226 | void OpieMail::displayMail() | 227 | void OpieMail::displayMail() |
227 | { | 228 | { |
228 | QListViewItem*item = mailView->currentItem(); | 229 | QListViewItem*item = mailView->currentItem(); |
229 | if (!item) return; | 230 | if (!item) return; |
230 | RecMailP mail = ((MailListViewItem*)item)->data(); | 231 | RecMailP mail = ((MailListViewItem*)item)->data(); |
231 | RecBodyP body = folderView->fetchBody(mail); | 232 | RecBodyP body = folderView->fetchBody(mail); |
232 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 233 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
233 | readMail.setBody( body ); | 234 | readMail.setBody( body ); |
234 | readMail.setMail( mail ); | 235 | readMail.setMail( mail ); |
235 | readMail.showMaximized(); | 236 | readMail.showMaximized(); |
236 | readMail.exec(); | 237 | readMail.exec(); |
237 | 238 | ||
238 | if ( readMail.deleted ) | 239 | if ( readMail.deleted ) |
239 | { | 240 | { |
240 | folderView->refreshCurrent(); | 241 | folderView->refreshCurrent(); |
241 | } | 242 | } |
242 | else | 243 | else |
243 | { | 244 | { |
244 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 245 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
245 | } | 246 | } |
246 | } | 247 | } |
247 | 248 | void OpieMail::slotGetMail() | |
249 | { | ||
250 | QListViewItem * item = folderView->currentItem(); | ||
251 | if ( ! item ) return; | ||
252 | while ( item->parent () ) | ||
253 | item = item->parent (); | ||
254 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | ||
255 | } | ||
248 | void OpieMail::slotDeleteMail() | 256 | void OpieMail::slotDeleteMail() |
249 | { | 257 | { |
250 | if (!mailView->currentItem()) return; | 258 | if (!mailView->currentItem()) return; |
251 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 259 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
252 | 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 ) | 260 | 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 ) |
253 | { | 261 | { |
254 | mail->Wrapper()->deleteMail( mail ); | 262 | mail->Wrapper()->deleteMail( mail ); |
255 | folderView->refreshCurrent(); | 263 | folderView->refreshCurrent(); |
256 | } | 264 | } |
257 | } | 265 | } |
258 | void OpieMail::slotDeleteAllMail() | 266 | void OpieMail::slotDeleteAllMail() |
259 | { | 267 | { |
260 | 268 | ||
261 | QValueList<RecMailP> t; | 269 | QValueList<RecMailP> t; |
262 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 270 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
263 | { | 271 | { |
264 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 272 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
265 | while ( item ) { | 273 | while ( item ) { |
266 | if ( item->isSelected() ) { | 274 | if ( item->isSelected() ) { |
267 | t.append( item->data() ); | 275 | t.append( item->data() ); |
268 | } | 276 | } |
269 | item = (MailListViewItem*)item->nextSibling(); | 277 | item = (MailListViewItem*)item->nextSibling(); |
270 | } | 278 | } |
271 | } | 279 | } |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 1de5f6b..e054b9e 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -9,42 +9,43 @@ | |||
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | 10 | ||
11 | class OpieMail : public MainWindow | 11 | class OpieMail : public MainWindow |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
17 | virtual ~OpieMail(); | 17 | virtual ~OpieMail(); |
18 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 18 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | virtual void slotwriteMail(const QString&name,const QString&email); | 21 | virtual void slotwriteMail(const QString&name,const QString&email); |
22 | virtual void slotwriteMail2(const QString&nameemail); | 22 | virtual void slotwriteMail2(const QString&nameemail); |
23 | virtual void slotComposeMail(); | 23 | virtual void slotComposeMail(); |
24 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 24 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
25 | virtual void message(const QCString &msg, const QByteArray &data); | 25 | virtual void message(const QCString &msg, const QByteArray &data); |
26 | protected slots: | 26 | protected slots: |
27 | virtual void slotSendQueued(); | 27 | virtual void slotSendQueued(); |
28 | virtual void slotSearchMails(); | 28 | virtual void slotSearchMails(); |
29 | virtual void slotEditSettings(); | 29 | virtual void slotEditSettings(); |
30 | virtual void slotEditAccounts(); | 30 | virtual void slotEditAccounts(); |
31 | virtual void displayMail(); | 31 | virtual void displayMail(); |
32 | virtual void slotDeleteMail(); | 32 | virtual void slotDeleteMail(); |
33 | virtual void slotGetMail(); | ||
33 | virtual void slotDeleteAllMail(); | 34 | virtual void slotDeleteAllMail(); |
34 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 35 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
35 | virtual void slotShowFolders( bool show ); | 36 | virtual void slotShowFolders( bool show ); |
36 | virtual void refreshMailView(const QValueList<RecMailP>&); | 37 | virtual void refreshMailView(const QValueList<RecMailP>&); |
37 | virtual void mailLeftClicked( QListViewItem * ); | 38 | virtual void mailLeftClicked( QListViewItem * ); |
38 | virtual void slotMoveCopyMail(); | 39 | virtual void slotMoveCopyMail(); |
39 | virtual void slotMoveCopyAllMail(); | 40 | virtual void slotMoveCopyAllMail(); |
40 | virtual void reEditMail(); | 41 | virtual void reEditMail(); |
41 | void clearSelection(); | 42 | void clearSelection(); |
42 | 43 | ||
43 | private: | 44 | private: |
44 | QString mPendingEmail; | 45 | QString mPendingEmail; |
45 | QString mPendingName; | 46 | QString mPendingName; |
46 | Settings *settings; | 47 | Settings *settings; |
47 | 48 | ||
48 | }; | 49 | }; |
49 | 50 | ||
50 | #endif | 51 | #endif |