-rw-r--r-- | noncore/net/mailit/addresslist.cpp | 16 | ||||
-rw-r--r-- | noncore/net/mailit/addresslist.h | 16 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.h | 2 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.h | 4 | ||||
-rw-r--r-- | noncore/net/mailit/emaillistitem.cpp | 0 | ||||
-rw-r--r-- | noncore/net/mailit/popclient.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mailit/popclient.h | 4 | ||||
-rw-r--r-- | noncore/net/mailit/smtpclient.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mailit/smtpclient.h | 4 | ||||
-rw-r--r-- | noncore/net/mailit/textparser.cpp | 14 | ||||
-rw-r--r-- | noncore/net/mailit/textparser.h | 6 |
13 files changed, 43 insertions, 42 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 | |||
@@ -33,13 +33,13 @@ AddressList::AddressList() | |||
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) ) { |
@@ -48,58 +48,58 @@ void AddressList::addContact(QString email, QString name) | |||
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) |
@@ -145,13 +145,13 @@ void AddressList::read() | |||
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(); |
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 | |||
@@ -33,23 +33,23 @@ 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; |
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 | |||
@@ -463,14 +463,15 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
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);*/ |
@@ -639,13 +640,13 @@ void EmailClient::readMail() | |||
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"); |
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 | |||
@@ -103,13 +103,13 @@ public slots: | |||
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); |
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 | |||
@@ -145,13 +145,13 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo | |||
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; |
@@ -507,13 +507,13 @@ int EmailHandler::encodeMime(Email *mail) | |||
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); |
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 | |||
@@ -114,17 +114,17 @@ public: | |||
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); |
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 | |||
@@ -47,13 +47,13 @@ PopClient::PopClient() | |||
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 | ||
@@ -63,13 +63,13 @@ void PopClient::newConnection(QString target, int 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) |
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 | |||
@@ -32,14 +32,14 @@ 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: |
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 | |||
@@ -36,13 +36,13 @@ SmtpClient::SmtpClient() | |||
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 | ||
@@ -50,13 +50,13 @@ void SmtpClient::newConnection(QString target, int port) | |||
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; |
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 | |||
@@ -40,14 +40,14 @@ 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 | ||
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 | |||
@@ -16,23 +16,23 @@ | |||
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; |
@@ -57,36 +57,36 @@ void TextParser::init() | |||
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++; |
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 | |||
@@ -46,15 +46,15 @@ struct t_splitLine | |||
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(); |