26 files changed, 86 insertions, 84 deletions
diff --git a/noncore/net/mailit/addresslist.cpp b/noncore/net/mailit/addresslist.cpp index 7d60ebf..18d14bc 100644 --- a/noncore/net/mailit/addresslist.cpp +++ b/noncore/net/mailit/addresslist.cpp | |||
@@ -27,85 +27,85 @@ | |||
27 | AddressList::AddressList() | 27 | AddressList::AddressList() |
28 | { | 28 | { |
29 | addresses.setAutoDelete(TRUE); | 29 | addresses.setAutoDelete(TRUE); |
30 | read(); | 30 | read(); |
31 | dirty = FALSE; | 31 | dirty = FALSE; |
32 | } | 32 | } |
33 | 33 | ||
34 | AddressList::~AddressList() | 34 | AddressList::~AddressList() |
35 | { | 35 | { |
36 | addresses.clear(); | 36 | addresses.clear(); |
37 | } | 37 | } |
38 | 38 | ||
39 | void AddressList::addContact(QString email, QString name) | 39 | void AddressList::addContact(const QString &email, const QString &name) |
40 | { | 40 | { |
41 | //skip if not a valid email address, | 41 | //skip if not a valid email address, |
42 | if (email.find( '@') == -1) | 42 | if (email.find( '@') == -1) |
43 | return; | 43 | return; |
44 | 44 | ||
45 | if ( ! containsEmail(email) ) { | 45 | if ( ! containsEmail(email) ) { |
46 | Contact *in = new Contact; | 46 | Contact *in = new Contact; |
47 | in->email = email; | 47 | in->email = email; |
48 | in->name = name; | 48 | in->name = name; |
49 | addresses.append(in); | 49 | addresses.append(in); |
50 | dirty = TRUE; | 50 | dirty = TRUE; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | bool AddressList::containsEmail(QString email) | 54 | bool AddressList::containsEmail(const QString &email) |
55 | { | 55 | { |
56 | return ( getEmailRef(email) != -1 ); | 56 | return ( getEmailRef(email) != -1 ); |
57 | } | 57 | } |
58 | 58 | ||
59 | bool AddressList::containsName(QString name) | 59 | bool AddressList::containsName(const QString &name) |
60 | { | 60 | { |
61 | return ( getNameRef(name) != -1 ); | 61 | return ( getNameRef(name) != -1 ); |
62 | } | 62 | } |
63 | 63 | ||
64 | QString AddressList::getNameByEmail(QString email) | 64 | QString AddressList::getNameByEmail(const QString &email) |
65 | { | 65 | { |
66 | int pos = getEmailRef(email); | 66 | int pos = getEmailRef(email); |
67 | if (pos != -1) { | 67 | if (pos != -1) { |
68 | Contact *ptr = addresses.at(pos); | 68 | Contact *ptr = addresses.at(pos); |
69 | return ptr->name; | 69 | return ptr->name; |
70 | } | 70 | } |
71 | 71 | ||
72 | return NULL; | 72 | return NULL; |
73 | } | 73 | } |
74 | 74 | ||
75 | QString AddressList::getEmailByName(QString name) | 75 | QString AddressList::getEmailByName(const QString &name) |
76 | { | 76 | { |
77 | int pos = getNameRef(name); | 77 | int pos = getNameRef(name); |
78 | if (pos != -1) { | 78 | if (pos != -1) { |
79 | Contact *ptr = addresses.at(pos); | 79 | Contact *ptr = addresses.at(pos); |
80 | return ptr->email; | 80 | return ptr->email; |
81 | } | 81 | } |
82 | 82 | ||
83 | return NULL; | 83 | return NULL; |
84 | } | 84 | } |
85 | 85 | ||
86 | int AddressList::getEmailRef(QString email) | 86 | int AddressList::getEmailRef(const QString &email) |
87 | { | 87 | { |
88 | int pos = 0; | 88 | int pos = 0; |
89 | Contact *ptr; | 89 | Contact *ptr; |
90 | 90 | ||
91 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { | 91 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { |
92 | if (ptr->email == email) | 92 | if (ptr->email == email) |
93 | return pos; | 93 | return pos; |
94 | pos++; | 94 | pos++; |
95 | } | 95 | } |
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
99 | int AddressList::getNameRef(QString name) | 99 | int AddressList::getNameRef(const QString &name) |
100 | { | 100 | { |
101 | int pos = 0; | 101 | int pos = 0; |
102 | Contact *ptr; | 102 | Contact *ptr; |
103 | 103 | ||
104 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { | 104 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { |
105 | if (ptr->name == name) | 105 | if (ptr->name == name) |
106 | return pos; | 106 | return pos; |
107 | pos++; | 107 | pos++; |
108 | } | 108 | } |
109 | return -1; | 109 | return -1; |
110 | } | 110 | } |
111 | 111 | ||
@@ -139,23 +139,23 @@ void AddressList::read() | |||
139 | lineEmail = stream.readLine(); | 139 | lineEmail = stream.readLine(); |
140 | if (! stream.atEnd() ) | 140 | if (! stream.atEnd() ) |
141 | lineName = stream.readLine(); | 141 | lineName = stream.readLine(); |
142 | else return; | 142 | else return; |
143 | 143 | ||
144 | email = getRightString(lineEmail); | 144 | email = getRightString(lineEmail); |
145 | name = getRightString(lineName); | 145 | name = getRightString(lineName); |
146 | addContact(email, name); | 146 | addContact(email, name); |
147 | } | 147 | } |
148 | f.close();*/ | 148 | f.close();*/ |
149 | } | 149 | } |
150 | 150 | ||
151 | QString AddressList::getRightString(QString in) | 151 | QString AddressList::getRightString(const QString &in) |
152 | { | 152 | { |
153 | QString out = ""; | 153 | QString out = ""; |
154 | 154 | ||
155 | int pos = in.find('='); | 155 | int pos = in.find('='); |
156 | if (pos != -1) { | 156 | if (pos != -1) { |
157 | out = in.mid(pos+1).stripWhiteSpace(); | 157 | out = in.mid(pos+1).stripWhiteSpace(); |
158 | } | 158 | } |
159 | return out; | 159 | return out; |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/noncore/net/mailit/addresslist.h b/noncore/net/mailit/addresslist.h index 99cef9a..b46d467 100644 --- a/noncore/net/mailit/addresslist.h +++ b/noncore/net/mailit/addresslist.h | |||
@@ -27,32 +27,32 @@ struct Contact | |||
27 | { | 27 | { |
28 | QString email; | 28 | QString email; |
29 | QString name; | 29 | QString name; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | class AddressList : public QObject | 32 | class AddressList : public QObject |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | AddressList(); | 37 | AddressList(); |
38 | ~AddressList(); | 38 | ~AddressList(); |
39 | void addContact(QString email, QString name); | 39 | void addContact(const QString &email, const QString &name); |
40 | bool containsEmail(QString email); | 40 | bool containsEmail(const QString &email); |
41 | bool containsName(QString name); | 41 | bool containsName(const QString &name); |
42 | QString getNameByEmail(QString email); | 42 | QString getNameByEmail(const QString &email); |
43 | QString getEmailByName(QString name); | 43 | QString getEmailByName(const QString &name); |
44 | QList<Contact>* getContactList(); | 44 | QList<Contact>* getContactList(); |
45 | 45 | ||
46 | private: | 46 | private: |
47 | int getEmailRef(QString email); | 47 | int getEmailRef(const QString &email); |
48 | int getNameRef(QString name); | 48 | int getNameRef(const QString &name); |
49 | QString getRightString(QString in); | 49 | QString getRightString(const QString &in); |
50 | void read(); | 50 | void read(); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | QList<Contact> addresses; | 53 | QList<Contact> addresses; |
54 | QString filename; | 54 | QString filename; |
55 | bool dirty; | 55 | bool dirty; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index b039cc4..2102ba7 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -457,26 +457,27 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
457 | item = (EmailListItem *) inboxView->firstChild(); | 457 | item = (EmailListItem *) inboxView->firstChild(); |
458 | while ((item != NULL)&&(!found)) | 458 | while ((item != NULL)&&(!found)) |
459 | { | 459 | { |
460 | mailPtr = item->getMail(); | 460 | mailPtr = item->getMail(); |
461 | if (mailPtr->id == newMail.id) { | 461 | if (mailPtr->id == newMail.id) { |
462 | item->setMail(newMail); | 462 | item->setMail(newMail); |
463 | emit mailUpdated(item->getMail()); | 463 | emit mailUpdated(item->getMail()); |
464 | found = true; | 464 | found = true; |
465 | } | 465 | } |
466 | item = (EmailListItem *) item->nextSibling(); | 466 | item = (EmailListItem *) item->nextSibling(); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE); | 469 | if ((!found)||(fromDisk)) { |
470 | 470 | item = new EmailListItem(inboxView, newMail, TRUE); | |
471 | } | ||
471 | if (item->getMail()->files.count()>0) | 472 | if (item->getMail()->files.count()>0) |
472 | { | 473 | { |
473 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); | 474 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); |
474 | } | 475 | } |
475 | /*if (!newMail.downloaded) | 476 | /*if (!newMail.downloaded) |
476 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | 477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ |
477 | 478 | ||
478 | mailboxView->setCurrentTab(0); | 479 | mailboxView->setCurrentTab(0); |
479 | 480 | ||
480 | } | 481 | } |
481 | 482 | ||
482 | void EmailClient::allMailArrived(int count) | 483 | void EmailClient::allMailArrived(int count) |
@@ -633,25 +634,25 @@ void EmailClient::readMail() | |||
633 | 634 | ||
634 | mail.rawMail = s.mid(start, stop + del.length() - start ); | 635 | mail.rawMail = s.mid(start, stop + del.length() - start ); |
635 | start = stop + del.length(); | 636 | start = stop + del.length(); |
636 | emailHandler->parse(mail.rawMail, lineShift, &mail); | 637 | emailHandler->parse(mail.rawMail, lineShift, &mail); |
637 | mail.sent = false; | 638 | mail.sent = false; |
638 | mail.received = false; | 639 | mail.received = false; |
639 | enqueMail(mail); | 640 | enqueMail(mail); |
640 | 641 | ||
641 | } | 642 | } |
642 | } | 643 | } |
643 | } | 644 | } |
644 | 645 | ||
645 | void EmailClient::saveMail(QString fileName, QListView *view) | 646 | void EmailClient::saveMail(const QString &fileName, QListView *view) |
646 | { | 647 | { |
647 | QFile f(fileName); | 648 | QFile f(fileName); |
648 | Email *mail; | 649 | Email *mail; |
649 | 650 | ||
650 | if (! f.open(IO_WriteOnly) ) { | 651 | if (! f.open(IO_WriteOnly) ) { |
651 | qWarning("could not open file"); | 652 | qWarning("could not open file"); |
652 | return; | 653 | return; |
653 | } | 654 | } |
654 | item = (EmailListItem *) view->firstChild(); | 655 | item = (EmailListItem *) view->firstChild(); |
655 | QTextStream t(&f); | 656 | QTextStream t(&f); |
656 | while (item != NULL) { | 657 | while (item != NULL) { |
657 | mail = item->getMail(); | 658 | mail = item->getMail(); |
diff --git a/noncore/net/mailit/emailclient.h b/noncore/net/mailit/emailclient.h index 994fec5..c98cfce 100644 --- a/noncore/net/mailit/emailclient.h +++ b/noncore/net/mailit/emailclient.h | |||
@@ -97,25 +97,25 @@ public slots: | |||
97 | void mailSent(); | 97 | void mailSent(); |
98 | void deleteItem(); | 98 | void deleteItem(); |
99 | void getNewMail(); | 99 | void getNewMail(); |
100 | void getAllNewMail(); | 100 | void getAllNewMail(); |
101 | void smtpError(int code); | 101 | void smtpError(int code); |
102 | void popError(int code); | 102 | void popError(int code); |
103 | void inboxItemSelected(); | 103 | void inboxItemSelected(); |
104 | void outboxItemSelected(); | 104 | void outboxItemSelected(); |
105 | void inboxItemPressed(); | 105 | void inboxItemPressed(); |
106 | void inboxItemReleased(); | 106 | void inboxItemReleased(); |
107 | void mailArrived(const Email &mail, bool fromDisk); | 107 | void mailArrived(const Email &mail, bool fromDisk); |
108 | void allMailArrived(int); | 108 | void allMailArrived(int); |
109 | void saveMail(QString fileName, QListView *view); | 109 | void saveMail(const QString &fileName, QListView *view); |
110 | void selectAccount(int); | 110 | void selectAccount(int); |
111 | void editAccount(int); | 111 | void editAccount(int); |
112 | void updateAccounts(); | 112 | void updateAccounts(); |
113 | void deleteAccount(int); | 113 | void deleteAccount(int); |
114 | void deleteMail(EmailListItem *mailItem, bool &inbox); | 114 | void deleteMail(EmailListItem *mailItem, bool &inbox); |
115 | void setTotalSize(int); | 115 | void setTotalSize(int); |
116 | void setMailSize(int); | 116 | void setMailSize(int); |
117 | void setDownloadedSize(int); | 117 | void setDownloadedSize(int); |
118 | void moveMailFront(Email *mailPtr); | 118 | void moveMailFront(Email *mailPtr); |
119 | void download(Email*); | 119 | void download(Email*); |
120 | /* void reply(); | 120 | /* void reply(); |
121 | void replyAll(); | 121 | void replyAll(); |
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index 62fa64f..59ccd90 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -139,25 +139,25 @@ void EmailHandler::getMailByList(MailList *mailList) | |||
139 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) | 139 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) |
140 | { | 140 | { |
141 | Email mail; | 141 | Email mail; |
142 | 142 | ||
143 | mail.rawMail = message; | 143 | mail.rawMail = message; |
144 | mail.serverId = id; | 144 | mail.serverId = id; |
145 | mail.size = size; | 145 | mail.size = size; |
146 | mail.downloaded = complete; | 146 | mail.downloaded = complete; |
147 | 147 | ||
148 | emit mailArrived(mail, FALSE); | 148 | emit mailArrived(mail, FALSE); |
149 | } | 149 | } |
150 | 150 | ||
151 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | 151 | bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail) |
152 | { | 152 | { |
153 | QString temp, boundary; | 153 | QString temp, boundary; |
154 | int pos; | 154 | int pos; |
155 | QString delimiter, header, body, mimeHeader, mimeBody; | 155 | QString delimiter, header, body, mimeHeader, mimeBody; |
156 | QString content, contentType, contentAttribute, id, encoding; | 156 | QString content, contentType, contentAttribute, id, encoding; |
157 | QString fileName, storedName; | 157 | QString fileName, storedName; |
158 | int enclosureId = 0; | 158 | int enclosureId = 0; |
159 | 159 | ||
160 | mail->rawMail = in; | 160 | mail->rawMail = in; |
161 | mail->received = TRUE; | 161 | mail->received = TRUE; |
162 | mail->files.setAutoDelete(TRUE); | 162 | mail->files.setAutoDelete(TRUE); |
163 | 163 | ||
@@ -501,25 +501,25 @@ int EmailHandler::encodeMime(Email *mail) | |||
501 | fi.fileName() + "\"\r\n\r\n"; | 501 | fi.fileName() + "\"\r\n\r\n"; |
502 | 502 | ||
503 | if (encodeFile(fileName, &newBody) == -1) //file not found? | 503 | if (encodeFile(fileName, &newBody) == -1) //file not found? |
504 | return -1; | 504 | return -1; |
505 | } | 505 | } |
506 | 506 | ||
507 | newBody += "\r\n\r\n--" + boundary + "--"; | 507 | newBody += "\r\n\r\n--" + boundary + "--"; |
508 | mail->rawMail = newBody; | 508 | mail->rawMail = newBody; |
509 | 509 | ||
510 | return 0; | 510 | return 0; |
511 | } | 511 | } |
512 | 512 | ||
513 | int EmailHandler::encodeFile(QString fileName, QString *toBody) | 513 | int EmailHandler::encodeFile(const QString &fileName, QString *toBody) |
514 | { | 514 | { |
515 | char *fileData; | 515 | char *fileData; |
516 | char *dataPtr; | 516 | char *dataPtr; |
517 | QString temp; | 517 | QString temp; |
518 | uint dataSize, count; | 518 | uint dataSize, count; |
519 | QFile f(fileName); | 519 | QFile f(fileName); |
520 | 520 | ||
521 | if (! f.open(IO_ReadOnly) ) { | 521 | if (! f.open(IO_ReadOnly) ) { |
522 | qWarning("could not open file: " + fileName); | 522 | qWarning("could not open file: " + fileName); |
523 | return -1; | 523 | return -1; |
524 | } | 524 | } |
525 | QTextStream s(&f); | 525 | QTextStream s(&f); |
diff --git a/noncore/net/mailit/emailhandler.h b/noncore/net/mailit/emailhandler.h index 5b59f65..e4e7f46 100644 --- a/noncore/net/mailit/emailhandler.h +++ b/noncore/net/mailit/emailhandler.h | |||
@@ -108,29 +108,29 @@ struct MailAccount | |||
108 | class EmailHandler : public QObject | 108 | class EmailHandler : public QObject |
109 | { | 109 | { |
110 | Q_OBJECT | 110 | Q_OBJECT |
111 | 111 | ||
112 | public: | 112 | public: |
113 | EmailHandler(); | 113 | EmailHandler(); |
114 | void setAccount(MailAccount account); | 114 | void setAccount(MailAccount account); |
115 | MailAccount* getAccount(){return &mailAccount;} | 115 | MailAccount* getAccount(){return &mailAccount;} |
116 | void sendMail(QList<Email> *mailList); | 116 | void sendMail(QList<Email> *mailList); |
117 | void getMail(); | 117 | void getMail(); |
118 | void getMailHeaders(); | 118 | void getMailHeaders(); |
119 | void getMailByList(MailList *mailList); | 119 | void getMailByList(MailList *mailList); |
120 | bool parse(QString in, QString lineShift, Email *mail); | 120 | bool parse(const QString &in, const QString &lineShift, Email *mail); |
121 | bool getEnclosure(Enclosure *ePtr); | 121 | bool getEnclosure(Enclosure *ePtr); |
122 | int parse64base(char *src, char *dest); | 122 | int parse64base(char *src, char *dest); |
123 | int encodeMime(Email *mail); | 123 | int encodeMime(Email *mail); |
124 | int encodeFile(QString fileName, QString *toBody); | 124 | int encodeFile(const QString &fileName, QString *toBody); |
125 | void encode64base(char *src, QString *dest, int len); | 125 | void encode64base(char *src, QString *dest, int len); |
126 | void cancel(); | 126 | void cancel(); |
127 | 127 | ||
128 | signals: | 128 | signals: |
129 | void mailSent(); | 129 | void mailSent(); |
130 | void smtpError(int); | 130 | void smtpError(int); |
131 | void popError(int); | 131 | void popError(int); |
132 | void mailArrived(const Email &, bool); | 132 | void mailArrived(const Email &, bool); |
133 | void updatePopStatus(const QString &); | 133 | void updatePopStatus(const QString &); |
134 | void updateSmtpStatus(const QString &); | 134 | void updateSmtpStatus(const QString &); |
135 | void mailTransfered(int); | 135 | void mailTransfered(int); |
136 | void mailboxSize(int); | 136 | void mailboxSize(int); |
diff --git a/noncore/net/mailit/emaillistitem.cpp b/noncore/net/mailit/emaillistitem.cpp index b925a1c..fc9f766 100644 --- a/noncore/net/mailit/emaillistitem.cpp +++ b/noncore/net/mailit/emaillistitem.cpp | |||
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp index fedc4e2..dc0116d 100644 --- a/noncore/net/mailit/popclient.cpp +++ b/noncore/net/mailit/popclient.cpp | |||
@@ -41,41 +41,41 @@ PopClient::PopClient() | |||
41 | synchronize = FALSE; | 41 | synchronize = FALSE; |
42 | lastSync = 0; | 42 | lastSync = 0; |
43 | headerLimit = 0; | 43 | headerLimit = 0; |
44 | preview = FALSE; | 44 | preview = FALSE; |
45 | } | 45 | } |
46 | 46 | ||
47 | PopClient::~PopClient() | 47 | PopClient::~PopClient() |
48 | { | 48 | { |
49 | delete socket; | 49 | delete socket; |
50 | delete stream; | 50 | delete stream; |
51 | } | 51 | } |
52 | 52 | ||
53 | void PopClient::newConnection(QString target, int port) | 53 | void PopClient::newConnection(const QString &target, int port) |
54 | { | 54 | { |
55 | if (receiving) { | 55 | if (receiving) { |
56 | qWarning("socket in use, connection refused"); | 56 | qWarning("socket in use, connection refused"); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | 59 | ||
60 | status = Init; | 60 | status = Init; |
61 | 61 | ||
62 | socket->connectToHost(target, port); | 62 | socket->connectToHost(target, port); |
63 | receiving = TRUE; | 63 | receiving = TRUE; |
64 | //selected = FALSE; | 64 | //selected = FALSE; |
65 | 65 | ||
66 | emit updateStatus("DNS lookup"); | 66 | emit updateStatus("DNS lookup"); |
67 | } | 67 | } |
68 | 68 | ||
69 | void PopClient::setAccount(QString popUser, QString popPasswd) | 69 | void PopClient::setAccount(const QString &popUser, const QString &popPasswd) |
70 | { | 70 | { |
71 | popUserName = popUser; | 71 | popUserName = popUser; |
72 | popPassword = popPasswd; | 72 | popPassword = popPasswd; |
73 | } | 73 | } |
74 | 74 | ||
75 | void PopClient::setSynchronize(int lastCount) | 75 | void PopClient::setSynchronize(int lastCount) |
76 | { | 76 | { |
77 | synchronize = TRUE; | 77 | synchronize = TRUE; |
78 | lastSync = lastCount; | 78 | lastSync = lastCount; |
79 | } | 79 | } |
80 | 80 | ||
81 | void PopClient::removeSynchronize() | 81 | void PopClient::removeSynchronize() |
diff --git a/noncore/net/mailit/popclient.h b/noncore/net/mailit/popclient.h index 10b71ab..c58bc48 100644 --- a/noncore/net/mailit/popclient.h +++ b/noncore/net/mailit/popclient.h | |||
@@ -26,26 +26,26 @@ | |||
26 | #include <qobject.h> | 26 | #include <qobject.h> |
27 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
28 | #include <qlist.h> | 28 | #include <qlist.h> |
29 | #include "maillist.h" | 29 | #include "maillist.h" |
30 | 30 | ||
31 | class PopClient: public QObject | 31 | class PopClient: public QObject |
32 | { | 32 | { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | 34 | ||
35 | public: | 35 | public: |
36 | PopClient(); | 36 | PopClient(); |
37 | ~PopClient(); | 37 | ~PopClient(); |
38 | void newConnection(QString target, int port); | 38 | void newConnection(const QString &target, int port); |
39 | void setAccount(QString popUser, QString popPasswd); | 39 | void setAccount(const QString &popUser, const QString &popPasswd); |
40 | void setSynchronize(int lastCount); | 40 | void setSynchronize(int lastCount); |
41 | void removeSynchronize(); | 41 | void removeSynchronize(); |
42 | void headersOnly(bool headers, int limit); | 42 | void headersOnly(bool headers, int limit); |
43 | void setSelectedMails(MailList *list); | 43 | void setSelectedMails(MailList *list); |
44 | 44 | ||
45 | signals: | 45 | signals: |
46 | void newMessage(const QString &, int, uint, bool); | 46 | void newMessage(const QString &, int, uint, bool); |
47 | void errorOccurred(int status); | 47 | void errorOccurred(int status); |
48 | void updateStatus(const QString &); | 48 | void updateStatus(const QString &); |
49 | void mailTransfered(int); | 49 | void mailTransfered(int); |
50 | void mailboxSize(int); | 50 | void mailboxSize(int); |
51 | void currentMailSize(int); | 51 | void currentMailSize(int); |
diff --git a/noncore/net/mailit/smtpclient.cpp b/noncore/net/mailit/smtpclient.cpp index 8a51a5b..2916f45 100644 --- a/noncore/net/mailit/smtpclient.cpp +++ b/noncore/net/mailit/smtpclient.cpp | |||
@@ -30,39 +30,39 @@ SmtpClient::SmtpClient() | |||
30 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); | 30 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); |
31 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); | 31 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); |
32 | 32 | ||
33 | sending = FALSE; | 33 | sending = FALSE; |
34 | } | 34 | } |
35 | 35 | ||
36 | SmtpClient::~SmtpClient() | 36 | SmtpClient::~SmtpClient() |
37 | { | 37 | { |
38 | delete socket; | 38 | delete socket; |
39 | delete stream; | 39 | delete stream; |
40 | } | 40 | } |
41 | 41 | ||
42 | void SmtpClient::newConnection(QString target, int port) | 42 | void SmtpClient::newConnection(const QString &target, int port) |
43 | { | 43 | { |
44 | if (sending) { | 44 | if (sending) { |
45 | qWarning("socket in use, connection refused"); | 45 | qWarning("socket in use, connection refused"); |
46 | return; | 46 | return; |
47 | } | 47 | } |
48 | 48 | ||
49 | status = Init; | 49 | status = Init; |
50 | sending = TRUE; | 50 | sending = TRUE; |
51 | socket->connectToHost(target, port); | 51 | socket->connectToHost(target, port); |
52 | 52 | ||
53 | emit updateStatus(tr("DNS lookup")); | 53 | emit updateStatus(tr("DNS lookup")); |
54 | } | 54 | } |
55 | 55 | ||
56 | void SmtpClient::addMail(QString from, QString subject, QStringList to, QString body) | 56 | void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body) |
57 | { | 57 | { |
58 | RawEmail *mail = new RawEmail; | 58 | RawEmail *mail = new RawEmail; |
59 | 59 | ||
60 | mail->from = from; | 60 | mail->from = from; |
61 | mail->subject = subject; | 61 | mail->subject = subject; |
62 | mail->to = to; | 62 | mail->to = to; |
63 | mail->body = body; | 63 | mail->body = body; |
64 | 64 | ||
65 | mailList.append(mail); | 65 | mailList.append(mail); |
66 | } | 66 | } |
67 | 67 | ||
68 | void SmtpClient::connectionEstablished() | 68 | void SmtpClient::connectionEstablished() |
diff --git a/noncore/net/mailit/smtpclient.h b/noncore/net/mailit/smtpclient.h index ca65af4..45c0703 100644 --- a/noncore/net/mailit/smtpclient.h +++ b/noncore/net/mailit/smtpclient.h | |||
@@ -34,26 +34,26 @@ struct RawEmail | |||
34 | QString subject; | 34 | QString subject; |
35 | QStringList to; | 35 | QStringList to; |
36 | QString body; | 36 | QString body; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | class SmtpClient: public QObject | 39 | class SmtpClient: public QObject |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | SmtpClient(); | 44 | SmtpClient(); |
45 | ~SmtpClient(); | 45 | ~SmtpClient(); |
46 | void newConnection(QString target, int port); | 46 | void newConnection(const QString &target, int port); |
47 | void addMail(QString from, QString subject, QStringList to, QString body); | 47 | void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body); |
48 | 48 | ||
49 | signals: | 49 | signals: |
50 | void errorOccurred(int); | 50 | void errorOccurred(int); |
51 | void updateStatus(const QString &); | 51 | void updateStatus(const QString &); |
52 | void mailSent(); | 52 | void mailSent(); |
53 | 53 | ||
54 | public slots: | 54 | public slots: |
55 | void errorHandling(int); | 55 | void errorHandling(int); |
56 | 56 | ||
57 | protected slots: | 57 | protected slots: |
58 | void connectionEstablished(); | 58 | void connectionEstablished(); |
59 | void incomingData(); | 59 | void incomingData(); |
diff --git a/noncore/net/mailit/textparser.cpp b/noncore/net/mailit/textparser.cpp index 3fa5f6e..e5c9f7c 100644 --- a/noncore/net/mailit/textparser.cpp +++ b/noncore/net/mailit/textparser.cpp | |||
@@ -10,35 +10,35 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "textparser.h" | 20 | #include "textparser.h" |
21 | 21 | ||
22 | TextParser::TextParser(QString in, QString lineBreak) | 22 | TextParser::TextParser(const QString &in, const QString &lineBreak) |
23 | { | 23 | { |
24 | data = in; | 24 | data = in; |
25 | lineSep = lineBreak; | 25 | lineSep = lineBreak; |
26 | 26 | ||
27 | init(); | 27 | init(); |
28 | createSeparators(); | 28 | createSeparators(); |
29 | split(); | 29 | split(); |
30 | } | 30 | } |
31 | 31 | ||
32 | TextParser::TextParser(QString in, QString lineBreak, QString sep) | 32 | TextParser::TextParser(const QString &in, const QString &lineBreak, const QString &sep) |
33 | { | 33 | { |
34 | data = in; | 34 | data = in; |
35 | lineSep = lineBreak; | 35 | lineSep = lineBreak; |
36 | 36 | ||
37 | init(); | 37 | init(); |
38 | separators = sep; | 38 | separators = sep; |
39 | split(); | 39 | split(); |
40 | } | 40 | } |
41 | 41 | ||
42 | void TextParser::init() | 42 | void TextParser::init() |
43 | { | 43 | { |
44 | lineCount = 0; | 44 | lineCount = 0; |
@@ -51,48 +51,48 @@ void TextParser::init() | |||
51 | wordAtLine = 0; | 51 | wordAtLine = 0; |
52 | wordAtPosElm = -1; //such that nextWord equals 0 | 52 | wordAtPosElm = -1; //such that nextWord equals 0 |
53 | atLine = 0; | 53 | atLine = 0; |
54 | atPosElm = 0; | 54 | atPosElm = 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | void TextParser::createSeparators() | 57 | void TextParser::createSeparators() |
58 | { | 58 | { |
59 | separators = " @#,.:;<>*/(){}|'?-+=_"; | 59 | separators = " @#,.:;<>*/(){}|'?-+=_"; |
60 | } | 60 | } |
61 | 61 | ||
62 | /*Returns pos of given search criteria, -1 if not found */ | 62 | /*Returns pos of given search criteria, -1 if not found */ |
63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) | 63 | int TextParser::find(const QString &target, QChar sep, int pos, bool upperCase) |
64 | { | 64 | { |
65 | 65 | ||
66 | t_splitElm parsstr; | 66 | t_splitElm parsstr; |
67 | QString pString; | 67 | QString pString, pTarget; |
68 | 68 | pTarget = target; | |
69 | int atLine = 0, atPosElm = 0; | 69 | int atLine = 0, atPosElm = 0; |
70 | 70 | ||
71 | getLineReference(pos,&atLine,&atPosElm); | 71 | getLineReference(pos,&atLine,&atPosElm); |
72 | 72 | ||
73 | for (int x = pos; x < totalElmCount; x++) | 73 | for (int x = pos; x < totalElmCount; x++) |
74 | { | 74 | { |
75 | parsstr=splitDone[atLine].elm[atPosElm++]; | 75 | parsstr=splitDone[atLine].elm[atPosElm++]; |
76 | 76 | ||
77 | if (upperCase) | 77 | if (upperCase) |
78 | { | 78 | { |
79 | pString=parsstr.str.upper(); | 79 | pString=parsstr.str.upper(); |
80 | target=target.upper(); | 80 | pTarget=pTarget.upper(); |
81 | } | 81 | } |
82 | else | 82 | else |
83 | { | 83 | { |
84 | pString=parsstr.str; | 84 | pString=parsstr.str; |
85 | } | 85 | } |
86 | if ((pString == target) && (parsstr.separator == sep)) | 86 | if ((pString == pTarget) && (parsstr.separator == sep)) |
87 | { | 87 | { |
88 | return x; | 88 | return x; |
89 | } | 89 | } |
90 | if (atPosElm >= splitDone[atLine].elmCount) | 90 | if (atPosElm >= splitDone[atLine].elmCount) |
91 | { //new Line | 91 | { //new Line |
92 | atLine++; | 92 | atLine++; |
93 | atPosElm = 0; | 93 | atPosElm = 0; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
diff --git a/noncore/net/mailit/textparser.h b/noncore/net/mailit/textparser.h index c5e88a0..03bb6d5 100644 --- a/noncore/net/mailit/textparser.h +++ b/noncore/net/mailit/textparser.h | |||
@@ -40,27 +40,27 @@ struct t_splitLine | |||
40 | { | 40 | { |
41 | t_lineType lineType; | 41 | t_lineType lineType; |
42 | QString str; //a bit redundant... | 42 | QString str; //a bit redundant... |
43 | t_splitElm elm[MAX_ELEMENTS]; | 43 | t_splitElm elm[MAX_ELEMENTS]; |
44 | int elmCount; | 44 | int elmCount; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | class TextParser: public QObject | 47 | class TextParser: public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | 50 | ||
51 | public: | 51 | public: |
52 | TextParser(QString in, QString lineBreak); | 52 | TextParser(const QString &in, const QString &lineBreak); |
53 | TextParser(QString in, QString lineBreak, QString sep); | 53 | TextParser(const QString &in, const QString &lineBreak, const QString &sep); |
54 | int find(QString target, QChar sep, int pos, bool upperCase); | 54 | int find(const QString &target, QChar sep, int pos, bool upperCase); |
55 | int elmCount(); | 55 | int elmCount(); |
56 | QChar separatorAt(int pos); | 56 | QChar separatorAt(int pos); |
57 | QChar nextSeparator(); | 57 | QChar nextSeparator(); |
58 | bool hasNextSeparator(); | 58 | bool hasNextSeparator(); |
59 | QString wordAt(int pos); | 59 | QString wordAt(int pos); |
60 | QString nextWord(); | 60 | QString nextWord(); |
61 | bool hasNextWord(); | 61 | bool hasNextWord(); |
62 | QString getString(int *pos, QChar stop, bool lineEnd); | 62 | QString getString(int *pos, QChar stop, bool lineEnd); |
63 | QString getNextLine(); | 63 | QString getNextLine(); |
64 | bool hasNextLine(); | 64 | bool hasNextLine(); |
65 | int endLinePos(int pos); | 65 | int endLinePos(int pos); |
66 | 66 | ||
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp index 7d60ebf..18d14bc 100644 --- a/noncore/unsupported/mailit/addresslist.cpp +++ b/noncore/unsupported/mailit/addresslist.cpp | |||
@@ -27,85 +27,85 @@ | |||
27 | AddressList::AddressList() | 27 | AddressList::AddressList() |
28 | { | 28 | { |
29 | addresses.setAutoDelete(TRUE); | 29 | addresses.setAutoDelete(TRUE); |
30 | read(); | 30 | read(); |
31 | dirty = FALSE; | 31 | dirty = FALSE; |
32 | } | 32 | } |
33 | 33 | ||
34 | AddressList::~AddressList() | 34 | AddressList::~AddressList() |
35 | { | 35 | { |
36 | addresses.clear(); | 36 | addresses.clear(); |
37 | } | 37 | } |
38 | 38 | ||
39 | void AddressList::addContact(QString email, QString name) | 39 | void AddressList::addContact(const QString &email, const QString &name) |
40 | { | 40 | { |
41 | //skip if not a valid email address, | 41 | //skip if not a valid email address, |
42 | if (email.find( '@') == -1) | 42 | if (email.find( '@') == -1) |
43 | return; | 43 | return; |
44 | 44 | ||
45 | if ( ! containsEmail(email) ) { | 45 | if ( ! containsEmail(email) ) { |
46 | Contact *in = new Contact; | 46 | Contact *in = new Contact; |
47 | in->email = email; | 47 | in->email = email; |
48 | in->name = name; | 48 | in->name = name; |
49 | addresses.append(in); | 49 | addresses.append(in); |
50 | dirty = TRUE; | 50 | dirty = TRUE; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | bool AddressList::containsEmail(QString email) | 54 | bool AddressList::containsEmail(const QString &email) |
55 | { | 55 | { |
56 | return ( getEmailRef(email) != -1 ); | 56 | return ( getEmailRef(email) != -1 ); |
57 | } | 57 | } |
58 | 58 | ||
59 | bool AddressList::containsName(QString name) | 59 | bool AddressList::containsName(const QString &name) |
60 | { | 60 | { |
61 | return ( getNameRef(name) != -1 ); | 61 | return ( getNameRef(name) != -1 ); |
62 | } | 62 | } |
63 | 63 | ||
64 | QString AddressList::getNameByEmail(QString email) | 64 | QString AddressList::getNameByEmail(const QString &email) |
65 | { | 65 | { |
66 | int pos = getEmailRef(email); | 66 | int pos = getEmailRef(email); |
67 | if (pos != -1) { | 67 | if (pos != -1) { |
68 | Contact *ptr = addresses.at(pos); | 68 | Contact *ptr = addresses.at(pos); |
69 | return ptr->name; | 69 | return ptr->name; |
70 | } | 70 | } |
71 | 71 | ||
72 | return NULL; | 72 | return NULL; |
73 | } | 73 | } |
74 | 74 | ||
75 | QString AddressList::getEmailByName(QString name) | 75 | QString AddressList::getEmailByName(const QString &name) |
76 | { | 76 | { |
77 | int pos = getNameRef(name); | 77 | int pos = getNameRef(name); |
78 | if (pos != -1) { | 78 | if (pos != -1) { |
79 | Contact *ptr = addresses.at(pos); | 79 | Contact *ptr = addresses.at(pos); |
80 | return ptr->email; | 80 | return ptr->email; |
81 | } | 81 | } |
82 | 82 | ||
83 | return NULL; | 83 | return NULL; |
84 | } | 84 | } |
85 | 85 | ||
86 | int AddressList::getEmailRef(QString email) | 86 | int AddressList::getEmailRef(const QString &email) |
87 | { | 87 | { |
88 | int pos = 0; | 88 | int pos = 0; |
89 | Contact *ptr; | 89 | Contact *ptr; |
90 | 90 | ||
91 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { | 91 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { |
92 | if (ptr->email == email) | 92 | if (ptr->email == email) |
93 | return pos; | 93 | return pos; |
94 | pos++; | 94 | pos++; |
95 | } | 95 | } |
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
99 | int AddressList::getNameRef(QString name) | 99 | int AddressList::getNameRef(const QString &name) |
100 | { | 100 | { |
101 | int pos = 0; | 101 | int pos = 0; |
102 | Contact *ptr; | 102 | Contact *ptr; |
103 | 103 | ||
104 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { | 104 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { |
105 | if (ptr->name == name) | 105 | if (ptr->name == name) |
106 | return pos; | 106 | return pos; |
107 | pos++; | 107 | pos++; |
108 | } | 108 | } |
109 | return -1; | 109 | return -1; |
110 | } | 110 | } |
111 | 111 | ||
@@ -139,23 +139,23 @@ void AddressList::read() | |||
139 | lineEmail = stream.readLine(); | 139 | lineEmail = stream.readLine(); |
140 | if (! stream.atEnd() ) | 140 | if (! stream.atEnd() ) |
141 | lineName = stream.readLine(); | 141 | lineName = stream.readLine(); |
142 | else return; | 142 | else return; |
143 | 143 | ||
144 | email = getRightString(lineEmail); | 144 | email = getRightString(lineEmail); |
145 | name = getRightString(lineName); | 145 | name = getRightString(lineName); |
146 | addContact(email, name); | 146 | addContact(email, name); |
147 | } | 147 | } |
148 | f.close();*/ | 148 | f.close();*/ |
149 | } | 149 | } |
150 | 150 | ||
151 | QString AddressList::getRightString(QString in) | 151 | QString AddressList::getRightString(const QString &in) |
152 | { | 152 | { |
153 | QString out = ""; | 153 | QString out = ""; |
154 | 154 | ||
155 | int pos = in.find('='); | 155 | int pos = in.find('='); |
156 | if (pos != -1) { | 156 | if (pos != -1) { |
157 | out = in.mid(pos+1).stripWhiteSpace(); | 157 | out = in.mid(pos+1).stripWhiteSpace(); |
158 | } | 158 | } |
159 | return out; | 159 | return out; |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/noncore/unsupported/mailit/addresslist.h b/noncore/unsupported/mailit/addresslist.h index 99cef9a..b46d467 100644 --- a/noncore/unsupported/mailit/addresslist.h +++ b/noncore/unsupported/mailit/addresslist.h | |||
@@ -27,32 +27,32 @@ struct Contact | |||
27 | { | 27 | { |
28 | QString email; | 28 | QString email; |
29 | QString name; | 29 | QString name; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | class AddressList : public QObject | 32 | class AddressList : public QObject |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | AddressList(); | 37 | AddressList(); |
38 | ~AddressList(); | 38 | ~AddressList(); |
39 | void addContact(QString email, QString name); | 39 | void addContact(const QString &email, const QString &name); |
40 | bool containsEmail(QString email); | 40 | bool containsEmail(const QString &email); |
41 | bool containsName(QString name); | 41 | bool containsName(const QString &name); |
42 | QString getNameByEmail(QString email); | 42 | QString getNameByEmail(const QString &email); |
43 | QString getEmailByName(QString name); | 43 | QString getEmailByName(const QString &name); |
44 | QList<Contact>* getContactList(); | 44 | QList<Contact>* getContactList(); |
45 | 45 | ||
46 | private: | 46 | private: |
47 | int getEmailRef(QString email); | 47 | int getEmailRef(const QString &email); |
48 | int getNameRef(QString name); | 48 | int getNameRef(const QString &name); |
49 | QString getRightString(QString in); | 49 | QString getRightString(const QString &in); |
50 | void read(); | 50 | void read(); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | QList<Contact> addresses; | 53 | QList<Contact> addresses; |
54 | QString filename; | 54 | QString filename; |
55 | bool dirty; | 55 | bool dirty; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index b039cc4..2102ba7 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -457,26 +457,27 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
457 | item = (EmailListItem *) inboxView->firstChild(); | 457 | item = (EmailListItem *) inboxView->firstChild(); |
458 | while ((item != NULL)&&(!found)) | 458 | while ((item != NULL)&&(!found)) |
459 | { | 459 | { |
460 | mailPtr = item->getMail(); | 460 | mailPtr = item->getMail(); |
461 | if (mailPtr->id == newMail.id) { | 461 | if (mailPtr->id == newMail.id) { |
462 | item->setMail(newMail); | 462 | item->setMail(newMail); |
463 | emit mailUpdated(item->getMail()); | 463 | emit mailUpdated(item->getMail()); |
464 | found = true; | 464 | found = true; |
465 | } | 465 | } |
466 | item = (EmailListItem *) item->nextSibling(); | 466 | item = (EmailListItem *) item->nextSibling(); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE); | 469 | if ((!found)||(fromDisk)) { |
470 | 470 | item = new EmailListItem(inboxView, newMail, TRUE); | |
471 | } | ||
471 | if (item->getMail()->files.count()>0) | 472 | if (item->getMail()->files.count()>0) |
472 | { | 473 | { |
473 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); | 474 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); |
474 | } | 475 | } |
475 | /*if (!newMail.downloaded) | 476 | /*if (!newMail.downloaded) |
476 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | 477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ |
477 | 478 | ||
478 | mailboxView->setCurrentTab(0); | 479 | mailboxView->setCurrentTab(0); |
479 | 480 | ||
480 | } | 481 | } |
481 | 482 | ||
482 | void EmailClient::allMailArrived(int count) | 483 | void EmailClient::allMailArrived(int count) |
@@ -633,25 +634,25 @@ void EmailClient::readMail() | |||
633 | 634 | ||
634 | mail.rawMail = s.mid(start, stop + del.length() - start ); | 635 | mail.rawMail = s.mid(start, stop + del.length() - start ); |
635 | start = stop + del.length(); | 636 | start = stop + del.length(); |
636 | emailHandler->parse(mail.rawMail, lineShift, &mail); | 637 | emailHandler->parse(mail.rawMail, lineShift, &mail); |
637 | mail.sent = false; | 638 | mail.sent = false; |
638 | mail.received = false; | 639 | mail.received = false; |
639 | enqueMail(mail); | 640 | enqueMail(mail); |
640 | 641 | ||
641 | } | 642 | } |
642 | } | 643 | } |
643 | } | 644 | } |
644 | 645 | ||
645 | void EmailClient::saveMail(QString fileName, QListView *view) | 646 | void EmailClient::saveMail(const QString &fileName, QListView *view) |
646 | { | 647 | { |
647 | QFile f(fileName); | 648 | QFile f(fileName); |
648 | Email *mail; | 649 | Email *mail; |
649 | 650 | ||
650 | if (! f.open(IO_WriteOnly) ) { | 651 | if (! f.open(IO_WriteOnly) ) { |
651 | qWarning("could not open file"); | 652 | qWarning("could not open file"); |
652 | return; | 653 | return; |
653 | } | 654 | } |
654 | item = (EmailListItem *) view->firstChild(); | 655 | item = (EmailListItem *) view->firstChild(); |
655 | QTextStream t(&f); | 656 | QTextStream t(&f); |
656 | while (item != NULL) { | 657 | while (item != NULL) { |
657 | mail = item->getMail(); | 658 | mail = item->getMail(); |
diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h index 994fec5..c98cfce 100644 --- a/noncore/unsupported/mailit/emailclient.h +++ b/noncore/unsupported/mailit/emailclient.h | |||
@@ -97,25 +97,25 @@ public slots: | |||
97 | void mailSent(); | 97 | void mailSent(); |
98 | void deleteItem(); | 98 | void deleteItem(); |
99 | void getNewMail(); | 99 | void getNewMail(); |
100 | void getAllNewMail(); | 100 | void getAllNewMail(); |
101 | void smtpError(int code); | 101 | void smtpError(int code); |
102 | void popError(int code); | 102 | void popError(int code); |
103 | void inboxItemSelected(); | 103 | void inboxItemSelected(); |
104 | void outboxItemSelected(); | 104 | void outboxItemSelected(); |
105 | void inboxItemPressed(); | 105 | void inboxItemPressed(); |
106 | void inboxItemReleased(); | 106 | void inboxItemReleased(); |
107 | void mailArrived(const Email &mail, bool fromDisk); | 107 | void mailArrived(const Email &mail, bool fromDisk); |
108 | void allMailArrived(int); | 108 | void allMailArrived(int); |
109 | void saveMail(QString fileName, QListView *view); | 109 | void saveMail(const QString &fileName, QListView *view); |
110 | void selectAccount(int); | 110 | void selectAccount(int); |
111 | void editAccount(int); | 111 | void editAccount(int); |
112 | void updateAccounts(); | 112 | void updateAccounts(); |
113 | void deleteAccount(int); | 113 | void deleteAccount(int); |
114 | void deleteMail(EmailListItem *mailItem, bool &inbox); | 114 | void deleteMail(EmailListItem *mailItem, bool &inbox); |
115 | void setTotalSize(int); | 115 | void setTotalSize(int); |
116 | void setMailSize(int); | 116 | void setMailSize(int); |
117 | void setDownloadedSize(int); | 117 | void setDownloadedSize(int); |
118 | void moveMailFront(Email *mailPtr); | 118 | void moveMailFront(Email *mailPtr); |
119 | void download(Email*); | 119 | void download(Email*); |
120 | /* void reply(); | 120 | /* void reply(); |
121 | void replyAll(); | 121 | void replyAll(); |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index 62fa64f..59ccd90 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -139,25 +139,25 @@ void EmailHandler::getMailByList(MailList *mailList) | |||
139 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) | 139 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) |
140 | { | 140 | { |
141 | Email mail; | 141 | Email mail; |
142 | 142 | ||
143 | mail.rawMail = message; | 143 | mail.rawMail = message; |
144 | mail.serverId = id; | 144 | mail.serverId = id; |
145 | mail.size = size; | 145 | mail.size = size; |
146 | mail.downloaded = complete; | 146 | mail.downloaded = complete; |
147 | 147 | ||
148 | emit mailArrived(mail, FALSE); | 148 | emit mailArrived(mail, FALSE); |
149 | } | 149 | } |
150 | 150 | ||
151 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | 151 | bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail) |
152 | { | 152 | { |
153 | QString temp, boundary; | 153 | QString temp, boundary; |
154 | int pos; | 154 | int pos; |
155 | QString delimiter, header, body, mimeHeader, mimeBody; | 155 | QString delimiter, header, body, mimeHeader, mimeBody; |
156 | QString content, contentType, contentAttribute, id, encoding; | 156 | QString content, contentType, contentAttribute, id, encoding; |
157 | QString fileName, storedName; | 157 | QString fileName, storedName; |
158 | int enclosureId = 0; | 158 | int enclosureId = 0; |
159 | 159 | ||
160 | mail->rawMail = in; | 160 | mail->rawMail = in; |
161 | mail->received = TRUE; | 161 | mail->received = TRUE; |
162 | mail->files.setAutoDelete(TRUE); | 162 | mail->files.setAutoDelete(TRUE); |
163 | 163 | ||
@@ -501,25 +501,25 @@ int EmailHandler::encodeMime(Email *mail) | |||
501 | fi.fileName() + "\"\r\n\r\n"; | 501 | fi.fileName() + "\"\r\n\r\n"; |
502 | 502 | ||
503 | if (encodeFile(fileName, &newBody) == -1) //file not found? | 503 | if (encodeFile(fileName, &newBody) == -1) //file not found? |
504 | return -1; | 504 | return -1; |
505 | } | 505 | } |
506 | 506 | ||
507 | newBody += "\r\n\r\n--" + boundary + "--"; | 507 | newBody += "\r\n\r\n--" + boundary + "--"; |
508 | mail->rawMail = newBody; | 508 | mail->rawMail = newBody; |
509 | 509 | ||
510 | return 0; | 510 | return 0; |
511 | } | 511 | } |
512 | 512 | ||
513 | int EmailHandler::encodeFile(QString fileName, QString *toBody) | 513 | int EmailHandler::encodeFile(const QString &fileName, QString *toBody) |
514 | { | 514 | { |
515 | char *fileData; | 515 | char *fileData; |
516 | char *dataPtr; | 516 | char *dataPtr; |
517 | QString temp; | 517 | QString temp; |
518 | uint dataSize, count; | 518 | uint dataSize, count; |
519 | QFile f(fileName); | 519 | QFile f(fileName); |
520 | 520 | ||
521 | if (! f.open(IO_ReadOnly) ) { | 521 | if (! f.open(IO_ReadOnly) ) { |
522 | qWarning("could not open file: " + fileName); | 522 | qWarning("could not open file: " + fileName); |
523 | return -1; | 523 | return -1; |
524 | } | 524 | } |
525 | QTextStream s(&f); | 525 | QTextStream s(&f); |
diff --git a/noncore/unsupported/mailit/emailhandler.h b/noncore/unsupported/mailit/emailhandler.h index 5b59f65..e4e7f46 100644 --- a/noncore/unsupported/mailit/emailhandler.h +++ b/noncore/unsupported/mailit/emailhandler.h | |||
@@ -108,29 +108,29 @@ struct MailAccount | |||
108 | class EmailHandler : public QObject | 108 | class EmailHandler : public QObject |
109 | { | 109 | { |
110 | Q_OBJECT | 110 | Q_OBJECT |
111 | 111 | ||
112 | public: | 112 | public: |
113 | EmailHandler(); | 113 | EmailHandler(); |
114 | void setAccount(MailAccount account); | 114 | void setAccount(MailAccount account); |
115 | MailAccount* getAccount(){return &mailAccount;} | 115 | MailAccount* getAccount(){return &mailAccount;} |
116 | void sendMail(QList<Email> *mailList); | 116 | void sendMail(QList<Email> *mailList); |
117 | void getMail(); | 117 | void getMail(); |
118 | void getMailHeaders(); | 118 | void getMailHeaders(); |
119 | void getMailByList(MailList *mailList); | 119 | void getMailByList(MailList *mailList); |
120 | bool parse(QString in, QString lineShift, Email *mail); | 120 | bool parse(const QString &in, const QString &lineShift, Email *mail); |
121 | bool getEnclosure(Enclosure *ePtr); | 121 | bool getEnclosure(Enclosure *ePtr); |
122 | int parse64base(char *src, char *dest); | 122 | int parse64base(char *src, char *dest); |
123 | int encodeMime(Email *mail); | 123 | int encodeMime(Email *mail); |
124 | int encodeFile(QString fileName, QString *toBody); | 124 | int encodeFile(const QString &fileName, QString *toBody); |
125 | void encode64base(char *src, QString *dest, int len); | 125 | void encode64base(char *src, QString *dest, int len); |
126 | void cancel(); | 126 | void cancel(); |
127 | 127 | ||
128 | signals: | 128 | signals: |
129 | void mailSent(); | 129 | void mailSent(); |
130 | void smtpError(int); | 130 | void smtpError(int); |
131 | void popError(int); | 131 | void popError(int); |
132 | void mailArrived(const Email &, bool); | 132 | void mailArrived(const Email &, bool); |
133 | void updatePopStatus(const QString &); | 133 | void updatePopStatus(const QString &); |
134 | void updateSmtpStatus(const QString &); | 134 | void updateSmtpStatus(const QString &); |
135 | void mailTransfered(int); | 135 | void mailTransfered(int); |
136 | void mailboxSize(int); | 136 | void mailboxSize(int); |
diff --git a/noncore/unsupported/mailit/emaillistitem.cpp b/noncore/unsupported/mailit/emaillistitem.cpp index b925a1c..fc9f766 100644 --- a/noncore/unsupported/mailit/emaillistitem.cpp +++ b/noncore/unsupported/mailit/emaillistitem.cpp | |||
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index fedc4e2..dc0116d 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp | |||
@@ -41,41 +41,41 @@ PopClient::PopClient() | |||
41 | synchronize = FALSE; | 41 | synchronize = FALSE; |
42 | lastSync = 0; | 42 | lastSync = 0; |
43 | headerLimit = 0; | 43 | headerLimit = 0; |
44 | preview = FALSE; | 44 | preview = FALSE; |
45 | } | 45 | } |
46 | 46 | ||
47 | PopClient::~PopClient() | 47 | PopClient::~PopClient() |
48 | { | 48 | { |
49 | delete socket; | 49 | delete socket; |
50 | delete stream; | 50 | delete stream; |
51 | } | 51 | } |
52 | 52 | ||
53 | void PopClient::newConnection(QString target, int port) | 53 | void PopClient::newConnection(const QString &target, int port) |
54 | { | 54 | { |
55 | if (receiving) { | 55 | if (receiving) { |
56 | qWarning("socket in use, connection refused"); | 56 | qWarning("socket in use, connection refused"); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | 59 | ||
60 | status = Init; | 60 | status = Init; |
61 | 61 | ||
62 | socket->connectToHost(target, port); | 62 | socket->connectToHost(target, port); |
63 | receiving = TRUE; | 63 | receiving = TRUE; |
64 | //selected = FALSE; | 64 | //selected = FALSE; |
65 | 65 | ||
66 | emit updateStatus("DNS lookup"); | 66 | emit updateStatus("DNS lookup"); |
67 | } | 67 | } |
68 | 68 | ||
69 | void PopClient::setAccount(QString popUser, QString popPasswd) | 69 | void PopClient::setAccount(const QString &popUser, const QString &popPasswd) |
70 | { | 70 | { |
71 | popUserName = popUser; | 71 | popUserName = popUser; |
72 | popPassword = popPasswd; | 72 | popPassword = popPasswd; |
73 | } | 73 | } |
74 | 74 | ||
75 | void PopClient::setSynchronize(int lastCount) | 75 | void PopClient::setSynchronize(int lastCount) |
76 | { | 76 | { |
77 | synchronize = TRUE; | 77 | synchronize = TRUE; |
78 | lastSync = lastCount; | 78 | lastSync = lastCount; |
79 | } | 79 | } |
80 | 80 | ||
81 | void PopClient::removeSynchronize() | 81 | void PopClient::removeSynchronize() |
diff --git a/noncore/unsupported/mailit/popclient.h b/noncore/unsupported/mailit/popclient.h index 10b71ab..c58bc48 100644 --- a/noncore/unsupported/mailit/popclient.h +++ b/noncore/unsupported/mailit/popclient.h | |||
@@ -26,26 +26,26 @@ | |||
26 | #include <qobject.h> | 26 | #include <qobject.h> |
27 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
28 | #include <qlist.h> | 28 | #include <qlist.h> |
29 | #include "maillist.h" | 29 | #include "maillist.h" |
30 | 30 | ||
31 | class PopClient: public QObject | 31 | class PopClient: public QObject |
32 | { | 32 | { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | 34 | ||
35 | public: | 35 | public: |
36 | PopClient(); | 36 | PopClient(); |
37 | ~PopClient(); | 37 | ~PopClient(); |
38 | void newConnection(QString target, int port); | 38 | void newConnection(const QString &target, int port); |
39 | void setAccount(QString popUser, QString popPasswd); | 39 | void setAccount(const QString &popUser, const QString &popPasswd); |
40 | void setSynchronize(int lastCount); | 40 | void setSynchronize(int lastCount); |
41 | void removeSynchronize(); | 41 | void removeSynchronize(); |
42 | void headersOnly(bool headers, int limit); | 42 | void headersOnly(bool headers, int limit); |
43 | void setSelectedMails(MailList *list); | 43 | void setSelectedMails(MailList *list); |
44 | 44 | ||
45 | signals: | 45 | signals: |
46 | void newMessage(const QString &, int, uint, bool); | 46 | void newMessage(const QString &, int, uint, bool); |
47 | void errorOccurred(int status); | 47 | void errorOccurred(int status); |
48 | void updateStatus(const QString &); | 48 | void updateStatus(const QString &); |
49 | void mailTransfered(int); | 49 | void mailTransfered(int); |
50 | void mailboxSize(int); | 50 | void mailboxSize(int); |
51 | void currentMailSize(int); | 51 | void currentMailSize(int); |
diff --git a/noncore/unsupported/mailit/smtpclient.cpp b/noncore/unsupported/mailit/smtpclient.cpp index 8a51a5b..2916f45 100644 --- a/noncore/unsupported/mailit/smtpclient.cpp +++ b/noncore/unsupported/mailit/smtpclient.cpp | |||
@@ -30,39 +30,39 @@ SmtpClient::SmtpClient() | |||
30 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); | 30 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); |
31 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); | 31 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); |
32 | 32 | ||
33 | sending = FALSE; | 33 | sending = FALSE; |
34 | } | 34 | } |
35 | 35 | ||
36 | SmtpClient::~SmtpClient() | 36 | SmtpClient::~SmtpClient() |
37 | { | 37 | { |
38 | delete socket; | 38 | delete socket; |
39 | delete stream; | 39 | delete stream; |
40 | } | 40 | } |
41 | 41 | ||
42 | void SmtpClient::newConnection(QString target, int port) | 42 | void SmtpClient::newConnection(const QString &target, int port) |
43 | { | 43 | { |
44 | if (sending) { | 44 | if (sending) { |
45 | qWarning("socket in use, connection refused"); | 45 | qWarning("socket in use, connection refused"); |
46 | return; | 46 | return; |
47 | } | 47 | } |
48 | 48 | ||
49 | status = Init; | 49 | status = Init; |
50 | sending = TRUE; | 50 | sending = TRUE; |
51 | socket->connectToHost(target, port); | 51 | socket->connectToHost(target, port); |
52 | 52 | ||
53 | emit updateStatus(tr("DNS lookup")); | 53 | emit updateStatus(tr("DNS lookup")); |
54 | } | 54 | } |
55 | 55 | ||
56 | void SmtpClient::addMail(QString from, QString subject, QStringList to, QString body) | 56 | void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body) |
57 | { | 57 | { |
58 | RawEmail *mail = new RawEmail; | 58 | RawEmail *mail = new RawEmail; |
59 | 59 | ||
60 | mail->from = from; | 60 | mail->from = from; |
61 | mail->subject = subject; | 61 | mail->subject = subject; |
62 | mail->to = to; | 62 | mail->to = to; |
63 | mail->body = body; | 63 | mail->body = body; |
64 | 64 | ||
65 | mailList.append(mail); | 65 | mailList.append(mail); |
66 | } | 66 | } |
67 | 67 | ||
68 | void SmtpClient::connectionEstablished() | 68 | void SmtpClient::connectionEstablished() |
diff --git a/noncore/unsupported/mailit/smtpclient.h b/noncore/unsupported/mailit/smtpclient.h index ca65af4..45c0703 100644 --- a/noncore/unsupported/mailit/smtpclient.h +++ b/noncore/unsupported/mailit/smtpclient.h | |||
@@ -34,26 +34,26 @@ struct RawEmail | |||
34 | QString subject; | 34 | QString subject; |
35 | QStringList to; | 35 | QStringList to; |
36 | QString body; | 36 | QString body; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | class SmtpClient: public QObject | 39 | class SmtpClient: public QObject |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | SmtpClient(); | 44 | SmtpClient(); |
45 | ~SmtpClient(); | 45 | ~SmtpClient(); |
46 | void newConnection(QString target, int port); | 46 | void newConnection(const QString &target, int port); |
47 | void addMail(QString from, QString subject, QStringList to, QString body); | 47 | void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body); |
48 | 48 | ||
49 | signals: | 49 | signals: |
50 | void errorOccurred(int); | 50 | void errorOccurred(int); |
51 | void updateStatus(const QString &); | 51 | void updateStatus(const QString &); |
52 | void mailSent(); | 52 | void mailSent(); |
53 | 53 | ||
54 | public slots: | 54 | public slots: |
55 | void errorHandling(int); | 55 | void errorHandling(int); |
56 | 56 | ||
57 | protected slots: | 57 | protected slots: |
58 | void connectionEstablished(); | 58 | void connectionEstablished(); |
59 | void incomingData(); | 59 | void incomingData(); |
diff --git a/noncore/unsupported/mailit/textparser.cpp b/noncore/unsupported/mailit/textparser.cpp index 3fa5f6e..e5c9f7c 100644 --- a/noncore/unsupported/mailit/textparser.cpp +++ b/noncore/unsupported/mailit/textparser.cpp | |||
@@ -10,35 +10,35 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "textparser.h" | 20 | #include "textparser.h" |
21 | 21 | ||
22 | TextParser::TextParser(QString in, QString lineBreak) | 22 | TextParser::TextParser(const QString &in, const QString &lineBreak) |
23 | { | 23 | { |
24 | data = in; | 24 | data = in; |
25 | lineSep = lineBreak; | 25 | lineSep = lineBreak; |
26 | 26 | ||
27 | init(); | 27 | init(); |
28 | createSeparators(); | 28 | createSeparators(); |
29 | split(); | 29 | split(); |
30 | } | 30 | } |
31 | 31 | ||
32 | TextParser::TextParser(QString in, QString lineBreak, QString sep) | 32 | TextParser::TextParser(const QString &in, const QString &lineBreak, const QString &sep) |
33 | { | 33 | { |
34 | data = in; | 34 | data = in; |
35 | lineSep = lineBreak; | 35 | lineSep = lineBreak; |
36 | 36 | ||
37 | init(); | 37 | init(); |
38 | separators = sep; | 38 | separators = sep; |
39 | split(); | 39 | split(); |
40 | } | 40 | } |
41 | 41 | ||
42 | void TextParser::init() | 42 | void TextParser::init() |
43 | { | 43 | { |
44 | lineCount = 0; | 44 | lineCount = 0; |
@@ -51,48 +51,48 @@ void TextParser::init() | |||
51 | wordAtLine = 0; | 51 | wordAtLine = 0; |
52 | wordAtPosElm = -1; //such that nextWord equals 0 | 52 | wordAtPosElm = -1; //such that nextWord equals 0 |
53 | atLine = 0; | 53 | atLine = 0; |
54 | atPosElm = 0; | 54 | atPosElm = 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | void TextParser::createSeparators() | 57 | void TextParser::createSeparators() |
58 | { | 58 | { |
59 | separators = " @#,.:;<>*/(){}|'?-+=_"; | 59 | separators = " @#,.:;<>*/(){}|'?-+=_"; |
60 | } | 60 | } |
61 | 61 | ||
62 | /*Returns pos of given search criteria, -1 if not found */ | 62 | /*Returns pos of given search criteria, -1 if not found */ |
63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) | 63 | int TextParser::find(const QString &target, QChar sep, int pos, bool upperCase) |
64 | { | 64 | { |
65 | 65 | ||
66 | t_splitElm parsstr; | 66 | t_splitElm parsstr; |
67 | QString pString; | 67 | QString pString, pTarget; |
68 | 68 | pTarget = target; | |
69 | int atLine = 0, atPosElm = 0; | 69 | int atLine = 0, atPosElm = 0; |
70 | 70 | ||
71 | getLineReference(pos,&atLine,&atPosElm); | 71 | getLineReference(pos,&atLine,&atPosElm); |
72 | 72 | ||
73 | for (int x = pos; x < totalElmCount; x++) | 73 | for (int x = pos; x < totalElmCount; x++) |
74 | { | 74 | { |
75 | parsstr=splitDone[atLine].elm[atPosElm++]; | 75 | parsstr=splitDone[atLine].elm[atPosElm++]; |
76 | 76 | ||
77 | if (upperCase) | 77 | if (upperCase) |
78 | { | 78 | { |
79 | pString=parsstr.str.upper(); | 79 | pString=parsstr.str.upper(); |
80 | target=target.upper(); | 80 | pTarget=pTarget.upper(); |
81 | } | 81 | } |
82 | else | 82 | else |
83 | { | 83 | { |
84 | pString=parsstr.str; | 84 | pString=parsstr.str; |
85 | } | 85 | } |
86 | if ((pString == target) && (parsstr.separator == sep)) | 86 | if ((pString == pTarget) && (parsstr.separator == sep)) |
87 | { | 87 | { |
88 | return x; | 88 | return x; |
89 | } | 89 | } |
90 | if (atPosElm >= splitDone[atLine].elmCount) | 90 | if (atPosElm >= splitDone[atLine].elmCount) |
91 | { //new Line | 91 | { //new Line |
92 | atLine++; | 92 | atLine++; |
93 | atPosElm = 0; | 93 | atPosElm = 0; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
diff --git a/noncore/unsupported/mailit/textparser.h b/noncore/unsupported/mailit/textparser.h index c5e88a0..03bb6d5 100644 --- a/noncore/unsupported/mailit/textparser.h +++ b/noncore/unsupported/mailit/textparser.h | |||
@@ -40,27 +40,27 @@ struct t_splitLine | |||
40 | { | 40 | { |
41 | t_lineType lineType; | 41 | t_lineType lineType; |
42 | QString str; //a bit redundant... | 42 | QString str; //a bit redundant... |
43 | t_splitElm elm[MAX_ELEMENTS]; | 43 | t_splitElm elm[MAX_ELEMENTS]; |
44 | int elmCount; | 44 | int elmCount; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | class TextParser: public QObject | 47 | class TextParser: public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | 50 | ||
51 | public: | 51 | public: |
52 | TextParser(QString in, QString lineBreak); | 52 | TextParser(const QString &in, const QString &lineBreak); |
53 | TextParser(QString in, QString lineBreak, QString sep); | 53 | TextParser(const QString &in, const QString &lineBreak, const QString &sep); |
54 | int find(QString target, QChar sep, int pos, bool upperCase); | 54 | int find(const QString &target, QChar sep, int pos, bool upperCase); |
55 | int elmCount(); | 55 | int elmCount(); |
56 | QChar separatorAt(int pos); | 56 | QChar separatorAt(int pos); |
57 | QChar nextSeparator(); | 57 | QChar nextSeparator(); |
58 | bool hasNextSeparator(); | 58 | bool hasNextSeparator(); |
59 | QString wordAt(int pos); | 59 | QString wordAt(int pos); |
60 | QString nextWord(); | 60 | QString nextWord(); |
61 | bool hasNextWord(); | 61 | bool hasNextWord(); |
62 | QString getString(int *pos, QChar stop, bool lineEnd); | 62 | QString getString(int *pos, QChar stop, bool lineEnd); |
63 | QString getNextLine(); | 63 | QString getNextLine(); |
64 | bool hasNextLine(); | 64 | bool hasNextLine(); |
65 | int endLinePos(int pos); | 65 | int endLinePos(int pos); |
66 | 66 | ||