summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp1
-rw-r--r--kmicromail/libmailwrapper/settings.cpp1
-rw-r--r--kmicromail/libmailwrapper/settings.h1
3 files changed, 3 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 110583f..ae667ec 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -658,192 +658,193 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
658 int err; 658 int err;
659 mailimap_fetch_type *fetchType; 659 mailimap_fetch_type *fetchType;
660 mailimap_set *set; 660 mailimap_set *set;
661 clistcell*current,*cur; 661 clistcell*current,*cur;
662 mailimap_section_part * section_part = 0; 662 mailimap_section_part * section_part = 0;
663 mailimap_section_spec * section_spec = 0; 663 mailimap_section_spec * section_spec = 0;
664 mailimap_section * section = 0; 664 mailimap_section * section = 0;
665 mailimap_fetch_att * fetch_att = 0; 665 mailimap_fetch_att * fetch_att = 0;
666 666
667 login(); 667 login();
668 if (!m_imap) { 668 if (!m_imap) {
669 return res; 669 return res;
670 } 670 }
671 if (!internal_call) { 671 if (!internal_call) {
672 err = selectMbox(mail->getMbox()); 672 err = selectMbox(mail->getMbox());
673 if ( err != MAILIMAP_NO_ERROR ) { 673 if ( err != MAILIMAP_NO_ERROR ) {
674 return res; 674 return res;
675 } 675 }
676 } 676 }
677 set = mailimap_set_new_single(mail->getNumber()); 677 set = mailimap_set_new_single(mail->getNumber());
678 678
679 clist*id_list = 0; 679 clist*id_list = 0;
680 680
681 /* if path == empty then its a request for the whole rfc822 mail and generates 681 /* if path == empty then its a request for the whole rfc822 mail and generates
682 a "fetch <id> (body[])" statement on imap server */ 682 a "fetch <id> (body[])" statement on imap server */
683 if (path.count()>0 ) { 683 if (path.count()>0 ) {
684 id_list = clist_new(); 684 id_list = clist_new();
685 for (unsigned j=0; j < path.count();++j) { 685 for (unsigned j=0; j < path.count();++j) {
686 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); 686 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id));
687 *p_id = path[j]; 687 *p_id = path[j];
688 clist_append(id_list,p_id); 688 clist_append(id_list,p_id);
689 } 689 }
690 section_part = mailimap_section_part_new(id_list); 690 section_part = mailimap_section_part_new(id_list);
691 section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); 691 section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL);
692 } 692 }
693 693
694 section = mailimap_section_new(section_spec); 694 section = mailimap_section_new(section_spec);
695 fetch_att = mailimap_fetch_att_new_body_section(section); 695 fetch_att = mailimap_fetch_att_new_body_section(section);
696 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); 696 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att);
697 697
698 clist*result = 0; 698 clist*result = 0;
699 699
700 err = mailimap_fetch( m_imap, set, fetchType, &result ); 700 err = mailimap_fetch( m_imap, set, fetchType, &result );
701 mailimap_set_free( set ); 701 mailimap_set_free( set );
702 mailimap_fetch_type_free( fetchType ); 702 mailimap_fetch_type_free( fetchType );
703 703
704 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 704 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
705 mailimap_msg_att * msg_att; 705 mailimap_msg_att * msg_att;
706 msg_att = (mailimap_msg_att*)current->data; 706 msg_att = (mailimap_msg_att*)current->data;
707 mailimap_msg_att_item*msg_att_item; 707 mailimap_msg_att_item*msg_att_item;
708 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { 708 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
709 msg_att_item = (mailimap_msg_att_item*)clist_content(cur); 709 msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
710 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { 710 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
711 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { 711 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
712 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; 712 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
713 /* detach - we take over the content */ 713 /* detach - we take over the content */
714 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; 714 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
715 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); 715 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
716 } 716 }
717 } 717 }
718 } 718 }
719 } else { 719 } else {
720 ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; 720 ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
721 } 721 }
722 if (result) mailimap_fetch_list_free(result); 722 if (result) mailimap_fetch_list_free(result);
723 return res; 723 return res;
724} 724}
725 725
726/* current_recursion is for recursive calls. 726/* current_recursion is for recursive calls.
727 current_count means the position inside the internal loop! */ 727 current_count means the position inside the internal loop! */
728void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, 728void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,
729 int current_recursion,QValueList<int>recList,int current_count) 729 int current_recursion,QValueList<int>recList,int current_count)
730{ 730{
731 if (!body || current_recursion>=10) { 731 if (!body || current_recursion>=10) {
732 return; 732 return;
733 } 733 }
734 switch (body->bd_type) { 734 switch (body->bd_type) {
735 case MAILIMAP_BODY_1PART: 735 case MAILIMAP_BODY_1PART:
736 { 736 {
737 QValueList<int>countlist = recList; 737 QValueList<int>countlist = recList;
738 countlist.append(current_count); 738 countlist.append(current_count);
739 RecPartP currentPart = new RecPart(); 739 RecPartP currentPart = new RecPart();
740 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; 740 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
741 QString id(""); 741 QString id("");
742 currentPart->setPositionlist(countlist); 742 currentPart->setPositionlist(countlist);
743 for (unsigned int j = 0; j < countlist.count();++j) { 743 for (unsigned int j = 0; j < countlist.count();++j) {
744 id+=(j>0?" ":""); 744 id+=(j>0?" ":"");
745 id+=QString("%1").arg(countlist[j]); 745 id+=QString("%1").arg(countlist[j]);
746 } 746 }
747 //odebug << "ID = " << id.latin1() << "" << oendl; 747 //odebug << "ID = " << id.latin1() << "" << oendl;
748 currentPart->setIdentifier(id); 748 currentPart->setIdentifier(id);
749 fillSinglePart(currentPart,part1); 749 fillSinglePart(currentPart,part1);
750 /* important: Check for is NULL 'cause a body can be empty! 750 /* important: Check for is NULL 'cause a body can be empty!
751 And we put it only into the mail if it is the FIRST part */ 751 And we put it only into the mail if it is the FIRST part */
752 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { 752 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
753 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); 753 QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
754 //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() );
754 target_body->setDescription(currentPart); 755 target_body->setDescription(currentPart);
755 target_body->setBodytext(body_text); 756 target_body->setBodytext(body_text);
756 if (countlist.count()>1) { 757 if (countlist.count()>1) {
757 target_body->addPart(currentPart); 758 target_body->addPart(currentPart);
758 } 759 }
759 } else { 760 } else {
760 target_body->addPart(currentPart); 761 target_body->addPart(currentPart);
761 } 762 }
762 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { 763 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) {
763 traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); 764 traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist);
764 } 765 }
765 } 766 }
766 break; 767 break;
767 case MAILIMAP_BODY_MPART: 768 case MAILIMAP_BODY_MPART:
768 { 769 {
769 QValueList<int>countlist = recList; 770 QValueList<int>countlist = recList;
770 clistcell*current=0; 771 clistcell*current=0;
771 mailimap_body*current_body=0; 772 mailimap_body*current_body=0;
772 unsigned int ccount = 1; 773 unsigned int ccount = 1;
773 mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; 774 mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart;
774 for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { 775 for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) {
775 current_body = (mailimap_body*)current->data; 776 current_body = (mailimap_body*)current->data;
776 if (current_body->bd_type==MAILIMAP_BODY_MPART) { 777 if (current_body->bd_type==MAILIMAP_BODY_MPART) {
777 RecPartP targetPart = new RecPart(); 778 RecPartP targetPart = new RecPart();
778 targetPart->setType("multipart"); 779 targetPart->setType("multipart");
779 fillMultiPart(targetPart,mailDescription); 780 fillMultiPart(targetPart,mailDescription);
780 countlist.append(current_count); 781 countlist.append(current_count);
781 targetPart->setPositionlist(countlist); 782 targetPart->setPositionlist(countlist);
782 target_body->addPart(targetPart); 783 target_body->addPart(targetPart);
783 QString id(""); 784 QString id("");
784 for (unsigned int j = 0; j < countlist.count();++j) { 785 for (unsigned int j = 0; j < countlist.count();++j) {
785 id+=(j>0?" ":""); 786 id+=(j>0?" ":"");
786 id+=QString("%1").arg(countlist[j]); 787 id+=QString("%1").arg(countlist[j]);
787 } 788 }
788 // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; 789 // odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
789 } 790 }
790 traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); 791 traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
791 if (current_body->bd_type==MAILIMAP_BODY_MPART) { 792 if (current_body->bd_type==MAILIMAP_BODY_MPART) {
792 countlist = recList; 793 countlist = recList;
793 } 794 }
794 ++ccount; 795 ++ccount;
795 } 796 }
796 } 797 }
797 break; 798 break;
798 default: 799 default:
799 break; 800 break;
800 } 801 }
801} 802}
802 803
803void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) 804void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description)
804{ 805{
805 if (!Description) { 806 if (!Description) {
806 return; 807 return;
807 } 808 }
808 switch (Description->bd_type) { 809 switch (Description->bd_type) {
809 case MAILIMAP_BODY_TYPE_1PART_TEXT: 810 case MAILIMAP_BODY_TYPE_1PART_TEXT:
810 target_part->setType("text"); 811 target_part->setType("text");
811 fillSingleTextPart(target_part,Description->bd_data.bd_type_text); 812 fillSingleTextPart(target_part,Description->bd_data.bd_type_text);
812 break; 813 break;
813 case MAILIMAP_BODY_TYPE_1PART_BASIC: 814 case MAILIMAP_BODY_TYPE_1PART_BASIC:
814 fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); 815 fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic);
815 break; 816 break;
816 case MAILIMAP_BODY_TYPE_1PART_MSG: 817 case MAILIMAP_BODY_TYPE_1PART_MSG:
817 target_part->setType("message"); 818 target_part->setType("message");
818 fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); 819 fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg);
819 break; 820 break;
820 default: 821 default:
821 break; 822 break;
822 } 823 }
823} 824}
824 825
825void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) 826void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which)
826{ 827{
827 if (!which) { 828 if (!which) {
828 return; 829 return;
829 } 830 }
830 QString sub; 831 QString sub;
831 sub = which->bd_media_text; 832 sub = which->bd_media_text;
832 //odebug << "Type= text/" << which->bd_media_text << "" << oendl; 833 //odebug << "Type= text/" << which->bd_media_text << "" << oendl;
833 target_part->setSubtype(sub.lower()); 834 target_part->setSubtype(sub.lower());
834 target_part->setLines(which->bd_lines); 835 target_part->setLines(which->bd_lines);
835 fillBodyFields(target_part,which->bd_fields); 836 fillBodyFields(target_part,which->bd_fields);
836} 837}
837 838
838void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) 839void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which)
839{ 840{
840 if (!which) { 841 if (!which) {
841 return; 842 return;
842 } 843 }
843 target_part->setSubtype("rfc822"); 844 target_part->setSubtype("rfc822");
844 //odebug << "Message part" << oendl; 845 //odebug << "Message part" << oendl;
845 /* we set this type to text/plain */ 846 /* we set this type to text/plain */
846 target_part->setLines(which->bd_lines); 847 target_part->setLines(which->bd_lines);
847 fillBodyFields(target_part,which->bd_fields); 848 fillBodyFields(target_part,which->bd_fields);
848} 849}
849 850
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 40b5591..5d2c0ad 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -1,120 +1,121 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <qdir.h> 2#include <qdir.h>
3 3
4//#include <opie2/odebug.h> 4//#include <opie2/odebug.h>
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
21Settings::Settings() 21Settings::Settings()
22 : QObject() 22 : QObject()
23{ 23{
24 updateAccounts(); 24 updateAccounts();
25 //qDebug("++++++++++++++++++new settings ");
25} 26}
26 27
27void Settings::checkDirectory() 28void Settings::checkDirectory()
28{ 29{
29 return; 30 return;
30 locateLocal("data", "kopiemail" ); 31 locateLocal("data", "kopiemail" );
31 /* 32 /*
32 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { 33 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
33 system( "mkdir -p $HOME/Applications/opiemail" ); 34 system( "mkdir -p $HOME/Applications/opiemail" );
34 qDebug("$HOME/Applications/opiemail created "); 35 qDebug("$HOME/Applications/opiemail created ");
35 } 36 }
36 */ 37 */
37} 38}
38 39
39QList<Account> Settings::getAccounts() 40QList<Account> Settings::getAccounts()
40{ 41{
41 return accounts; 42 return accounts;
42} 43}
43 44
44void Settings::addAccount( Account *account ) 45void Settings::addAccount( Account *account )
45{ 46{
46 accounts.append( account ); 47 accounts.append( account );
47} 48}
48 49
49void Settings::delAccount( Account *account ) 50void Settings::delAccount( Account *account )
50{ 51{
51 accounts.remove( account ); 52 accounts.remove( account );
52 account->remove(); 53 account->remove();
53} 54}
54 55
55void Settings::updateAccounts() 56void Settings::updateAccounts()
56{ 57{
57 accounts.clear(); 58 accounts.clear();
58 QDir dir( locateLocal("data", "kopiemail" ) ); 59 QDir dir( locateLocal("data", "kopiemail" ) );
59 QStringList::Iterator it; 60 QStringList::Iterator it;
60 61
61 QStringList imap = dir.entryList( "imap-*" ); 62 QStringList imap = dir.entryList( "imap-*" );
62 for ( it = imap.begin(); it != imap.end(); it++ ) { 63 for ( it = imap.begin(); it != imap.end(); it++ ) {
63 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); 64 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
64 accounts.append( account ); 65 accounts.append( account );
65 } 66 }
66 67
67 QStringList pop3 = dir.entryList( "pop3-*" ); 68 QStringList pop3 = dir.entryList( "pop3-*" );
68 for ( it = pop3.begin(); it != pop3.end(); it++ ) { 69 for ( it = pop3.begin(); it != pop3.end(); it++ ) {
69 POP3account *account = new POP3account( (*it).replace(0, 5, "") ); 70 POP3account *account = new POP3account( (*it).replace(0, 5, "") );
70 accounts.append( account ); 71 accounts.append( account );
71 } 72 }
72 73
73 QStringList smtp = dir.entryList( "smtp-*" ); 74 QStringList smtp = dir.entryList( "smtp-*" );
74 for ( it = smtp.begin(); it != smtp.end(); it++ ) { 75 for ( it = smtp.begin(); it != smtp.end(); it++ ) {
75 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); 76 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
76 accounts.append( account ); 77 accounts.append( account );
77 } 78 }
78 79
79 QStringList nntp = dir.entryList( "nntp-*" ); 80 QStringList nntp = dir.entryList( "nntp-*" );
80 for ( it = nntp.begin(); it != nntp.end(); it++ ) { 81 for ( it = nntp.begin(); it != nntp.end(); it++ ) {
81 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); 82 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
82 accounts.append( account ); 83 accounts.append( account );
83 } 84 }
84 85
85 readAccounts(); 86 readAccounts();
86} 87}
87 88
88void Settings::saveAccounts() 89void Settings::saveAccounts()
89{ 90{
90 checkDirectory(); 91 checkDirectory();
91 Account *it; 92 Account *it;
92 93
93 for ( it = accounts.first(); it; it = accounts.next() ) { 94 for ( it = accounts.first(); it; it = accounts.next() ) {
94 it->save(); 95 it->save();
95 } 96 }
96} 97}
97 98
98void Settings::readAccounts() 99void Settings::readAccounts()
99{ 100{
100 checkDirectory(); 101 checkDirectory();
101 Account *it; 102 Account *it;
102 103
103 for ( it = accounts.first(); it; it = accounts.next() ) { 104 for ( it = accounts.first(); it; it = accounts.next() ) {
104 it->read(); 105 it->read();
105 } 106 }
106} 107}
107 108
108Account::Account() 109Account::Account()
109{ 110{
110 accountName = "changeMe"; 111 accountName = "changeMe";
111 type = MAILLIB::A_UNDEFINED; 112 type = MAILLIB::A_UNDEFINED;
112 ssl = false; 113 ssl = false;
113 connectionType = 1; 114 connectionType = 1;
114 offline = false; 115 offline = false;
115 maxMailSize = 0; 116 maxMailSize = 0;
116 lastFetch; 117 lastFetch;
117 leaveOnServer = false; 118 leaveOnServer = false;
118} 119}
119 120
120void Account::remove() 121void Account::remove()
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index 79567ef..c996fe0 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -72,110 +72,111 @@ protected:
72 bool leaveOnServer; 72 bool leaveOnServer;
73}; 73};
74 74
75class IMAPaccount : public Account 75class IMAPaccount : public Account
76{ 76{
77 77
78public: 78public:
79 IMAPaccount(); 79 IMAPaccount();
80 IMAPaccount( QString filename ); 80 IMAPaccount( QString filename );
81 81
82 static QString getUniqueFileName(); 82 static QString getUniqueFileName();
83 83
84 virtual void read(); 84 virtual void read();
85 virtual void save(); 85 virtual void save();
86 virtual QString getFileName(); 86 virtual QString getFileName();
87 87
88 void setPrefix(const QString&str) {prefix=str;} 88 void setPrefix(const QString&str) {prefix=str;}
89 const QString&getPrefix()const{return prefix;} 89 const QString&getPrefix()const{return prefix;}
90 90
91private: 91private:
92 QString file,prefix; 92 QString file,prefix;
93 93
94}; 94};
95 95
96class POP3account : public Account 96class POP3account : public Account
97{ 97{
98 98
99public: 99public:
100 POP3account(); 100 POP3account();
101 POP3account( QString filename ); 101 POP3account( QString filename );
102 102
103 static QString getUniqueFileName(); 103 static QString getUniqueFileName();
104 104
105 virtual void read(); 105 virtual void read();
106 virtual void save(); 106 virtual void save();
107 virtual QString getFileName(); 107 virtual QString getFileName();
108 108
109private: 109private:
110 QString file; 110 QString file;
111 111
112}; 112};
113 113
114class SMTPaccount : public Account 114class SMTPaccount : public Account
115{ 115{
116 116
117public: 117public:
118 SMTPaccount(); 118 SMTPaccount();
119 SMTPaccount( QString filename ); 119 SMTPaccount( QString filename );
120 120
121 static QString getUniqueFileName(); 121 static QString getUniqueFileName();
122 122
123 virtual void read(); 123 virtual void read();
124 virtual void save(); 124 virtual void save();
125 virtual QString getFileName(); 125 virtual QString getFileName();
126 126
127 void setLogin( bool b ) { login = b; } 127 void setLogin( bool b ) { login = b; }
128 bool getLogin() { return login; } 128 bool getLogin() { return login; }
129 129
130private: 130private:
131 QString file, name, mail, org, cc, bcc, reply, signature; 131 QString file, name, mail, org, cc, bcc, reply, signature;
132 bool useCC, useBCC, useReply, login; 132 bool useCC, useBCC, useReply, login;
133 133
134}; 134};
135 135
136class NNTPaccount : public Account 136class NNTPaccount : public Account
137{ 137{
138 138
139public: 139public:
140 NNTPaccount(); 140 NNTPaccount();
141 NNTPaccount( QString filename ); 141 NNTPaccount( QString filename );
142 142
143 static QString getUniqueFileName(); 143 static QString getUniqueFileName();
144 144
145 virtual void read(); 145 virtual void read();
146 virtual void save(); 146 virtual void save();
147 virtual QString getFileName(); 147 virtual QString getFileName();
148 148
149 void setLogin( bool b ) { login = b; } 149 void setLogin( bool b ) { login = b; }
150 bool getLogin() { return login; } 150 bool getLogin() { return login; }
151 151
152 void setGroups( QStringList list ) { subscribedGroups = list; } 152 void setGroups( QStringList list ) { subscribedGroups = list; }
153 QStringList getGroups() { return subscribedGroups; } 153 QStringList getGroups() { return subscribedGroups; }
154 154
155private: 155private:
156 QString file; 156 QString file;
157 bool login; 157 bool login;
158 QStringList subscribedGroups; 158 QStringList subscribedGroups;
159 159
160}; 160};
161 161
162class Settings : public QObject 162class Settings : public QObject
163{ 163{
164 Q_OBJECT 164 Q_OBJECT
165 165
166public: 166public:
167 Settings(); 167 Settings();
168 //~Settings(){qDebug("-------------------settings "); };
168 QList<Account> getAccounts(); 169 QList<Account> getAccounts();
169 void addAccount(Account *account); 170 void addAccount(Account *account);
170 void delAccount(Account *account); 171 void delAccount(Account *account);
171 void saveAccounts(); 172 void saveAccounts();
172 void readAccounts(); 173 void readAccounts();
173 static void checkDirectory(); 174 static void checkDirectory();
174 175
175private: 176private:
176 void updateAccounts(); 177 void updateAccounts();
177 QList<Account> accounts; 178 QList<Account> accounts;
178 179
179}; 180};
180 181
181#endif 182#endif