author | llornkcor <llornkcor> | 2003-05-24 01:20:33 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-05-24 01:20:33 (UTC) |
commit | 62d2ddfb5cd77e2637cdf7fe16d76aac04975984 (patch) (side-by-side diff) | |
tree | 2157d57bab2d6e491226f5bc8468a4c2527e1456 /noncore | |
parent | 0c4b5288ccd4bcd1668816a0c4e12ce0a76b4e6e (diff) | |
download | opie-62d2ddfb5cd77e2637cdf7fe16d76aac04975984.zip opie-62d2ddfb5cd77e2637cdf7fe16d76aac04975984.tar.gz opie-62d2ddfb5cd77e2637cdf7fe16d76aac04975984.tar.bz2 |
QString to const QString
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 @@ AddressList::AddressList() { addresses.setAutoDelete(TRUE); read(); dirty = FALSE; } AddressList::~AddressList() { addresses.clear(); } -void AddressList::addContact(QString email, QString name) +void AddressList::addContact(const QString &email, const QString &name) { //skip if not a valid email address, if (email.find( '@') == -1) return; if ( ! containsEmail(email) ) { Contact *in = new Contact; in->email = email; in->name = name; addresses.append(in); dirty = TRUE; } } -bool AddressList::containsEmail(QString email) +bool AddressList::containsEmail(const QString &email) { return ( getEmailRef(email) != -1 ); } -bool AddressList::containsName(QString name) +bool AddressList::containsName(const QString &name) { return ( getNameRef(name) != -1 ); } -QString AddressList::getNameByEmail(QString email) +QString AddressList::getNameByEmail(const QString &email) { int pos = getEmailRef(email); if (pos != -1) { Contact *ptr = addresses.at(pos); return ptr->name; } return NULL; } -QString AddressList::getEmailByName(QString name) +QString AddressList::getEmailByName(const QString &name) { int pos = getNameRef(name); if (pos != -1) { Contact *ptr = addresses.at(pos); return ptr->email; } return NULL; } -int AddressList::getEmailRef(QString email) +int AddressList::getEmailRef(const QString &email) { int pos = 0; Contact *ptr; for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { if (ptr->email == email) return pos; pos++; } return -1; } -int AddressList::getNameRef(QString name) +int AddressList::getNameRef(const QString &name) { int pos = 0; Contact *ptr; for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { if (ptr->name == name) return pos; pos++; } return -1; } @@ -139,23 +139,23 @@ void AddressList::read() lineEmail = stream.readLine(); if (! stream.atEnd() ) lineName = stream.readLine(); else return; email = getRightString(lineEmail); name = getRightString(lineName); addContact(email, name); } f.close();*/ } -QString AddressList::getRightString(QString in) +QString AddressList::getRightString(const QString &in) { QString out = ""; int pos = in.find('='); if (pos != -1) { out = in.mid(pos+1).stripWhiteSpace(); } return out; } 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 { QString email; QString name; }; class AddressList : public QObject { Q_OBJECT public: AddressList(); ~AddressList(); - void addContact(QString email, QString name); - bool containsEmail(QString email); - bool containsName(QString name); - QString getNameByEmail(QString email); - QString getEmailByName(QString name); + void addContact(const QString &email, const QString &name); + bool containsEmail(const QString &email); + bool containsName(const QString &name); + QString getNameByEmail(const QString &email); + QString getEmailByName(const QString &name); QList<Contact>* getContactList(); private: - int getEmailRef(QString email); - int getNameRef(QString name); - QString getRightString(QString in); + int getEmailRef(const QString &email); + int getNameRef(const QString &name); + QString getRightString(const QString &in); void read(); private: QList<Contact> addresses; QString filename; bool dirty; }; #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) item = (EmailListItem *) inboxView->firstChild(); while ((item != NULL)&&(!found)) { mailPtr = item->getMail(); if (mailPtr->id == newMail.id) { item->setMail(newMail); emit mailUpdated(item->getMail()); found = true; } item = (EmailListItem *) item->nextSibling(); } } - if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE); - + if ((!found)||(fromDisk)) { + item = new EmailListItem(inboxView, newMail, TRUE); + } if (item->getMail()->files.count()>0) { item->setPixmap(0, Resource::loadPixmap("mailit/attach")); } /*if (!newMail.downloaded) mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ mailboxView->setCurrentTab(0); } void EmailClient::allMailArrived(int count) @@ -633,25 +634,25 @@ void EmailClient::readMail() mail.rawMail = s.mid(start, stop + del.length() - start ); start = stop + del.length(); emailHandler->parse(mail.rawMail, lineShift, &mail); mail.sent = false; mail.received = false; enqueMail(mail); } } } -void EmailClient::saveMail(QString fileName, QListView *view) +void EmailClient::saveMail(const QString &fileName, QListView *view) { QFile f(fileName); Email *mail; if (! f.open(IO_WriteOnly) ) { qWarning("could not open file"); return; } item = (EmailListItem *) view->firstChild(); QTextStream t(&f); while (item != NULL) { 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: void mailSent(); void deleteItem(); void getNewMail(); void getAllNewMail(); void smtpError(int code); void popError(int code); void inboxItemSelected(); void outboxItemSelected(); void inboxItemPressed(); void inboxItemReleased(); void mailArrived(const Email &mail, bool fromDisk); void allMailArrived(int); - void saveMail(QString fileName, QListView *view); + void saveMail(const QString &fileName, QListView *view); void selectAccount(int); void editAccount(int); void updateAccounts(); void deleteAccount(int); void deleteMail(EmailListItem *mailItem, bool &inbox); void setTotalSize(int); void setMailSize(int); void setDownloadedSize(int); void moveMailFront(Email *mailPtr); void download(Email*); /* void reply(); 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) void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) { Email mail; mail.rawMail = message; mail.serverId = id; mail.size = size; mail.downloaded = complete; emit mailArrived(mail, FALSE); } -bool EmailHandler::parse(QString in, QString lineShift, Email *mail) +bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail) { QString temp, boundary; int pos; QString delimiter, header, body, mimeHeader, mimeBody; QString content, contentType, contentAttribute, id, encoding; QString fileName, storedName; int enclosureId = 0; mail->rawMail = in; mail->received = TRUE; mail->files.setAutoDelete(TRUE); @@ -501,25 +501,25 @@ int EmailHandler::encodeMime(Email *mail) fi.fileName() + "\"\r\n\r\n"; if (encodeFile(fileName, &newBody) == -1) //file not found? return -1; } newBody += "\r\n\r\n--" + boundary + "--"; mail->rawMail = newBody; return 0; } -int EmailHandler::encodeFile(QString fileName, QString *toBody) +int EmailHandler::encodeFile(const QString &fileName, QString *toBody) { char *fileData; char *dataPtr; QString temp; uint dataSize, count; QFile f(fileName); if (! f.open(IO_ReadOnly) ) { qWarning("could not open file: " + fileName); return -1; } 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 class EmailHandler : public QObject { Q_OBJECT public: EmailHandler(); void setAccount(MailAccount account); MailAccount* getAccount(){return &mailAccount;} void sendMail(QList<Email> *mailList); void getMail(); void getMailHeaders(); void getMailByList(MailList *mailList); - bool parse(QString in, QString lineShift, Email *mail); + bool parse(const QString &in, const QString &lineShift, Email *mail); bool getEnclosure(Enclosure *ePtr); int parse64base(char *src, char *dest); int encodeMime(Email *mail); - int encodeFile(QString fileName, QString *toBody); + int encodeFile(const QString &fileName, QString *toBody); void encode64base(char *src, QString *dest, int len); void cancel(); signals: void mailSent(); void smtpError(int); void popError(int); void mailArrived(const Email &, bool); void updatePopStatus(const QString &); void updateSmtpStatus(const QString &); void mailTransfered(int); 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() synchronize = FALSE; lastSync = 0; headerLimit = 0; preview = FALSE; } PopClient::~PopClient() { delete socket; delete stream; } -void PopClient::newConnection(QString target, int port) +void PopClient::newConnection(const QString &target, int port) { if (receiving) { qWarning("socket in use, connection refused"); return; } status = Init; socket->connectToHost(target, port); receiving = TRUE; //selected = FALSE; emit updateStatus("DNS lookup"); } -void PopClient::setAccount(QString popUser, QString popPasswd) +void PopClient::setAccount(const QString &popUser, const QString &popPasswd) { popUserName = popUser; popPassword = popPasswd; } void PopClient::setSynchronize(int lastCount) { synchronize = TRUE; lastSync = lastCount; } 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 @@ #include <qobject.h> #include <qtextstream.h> #include <qlist.h> #include "maillist.h" class PopClient: public QObject { Q_OBJECT public: PopClient(); ~PopClient(); - void newConnection(QString target, int port); - void setAccount(QString popUser, QString popPasswd); + void newConnection(const QString &target, int port); + void setAccount(const QString &popUser, const QString &popPasswd); void setSynchronize(int lastCount); void removeSynchronize(); void headersOnly(bool headers, int limit); void setSelectedMails(MailList *list); signals: void newMessage(const QString &, int, uint, bool); void errorOccurred(int status); void updateStatus(const QString &); void mailTransfered(int); void mailboxSize(int); 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() connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); sending = FALSE; } SmtpClient::~SmtpClient() { delete socket; delete stream; } -void SmtpClient::newConnection(QString target, int port) +void SmtpClient::newConnection(const QString &target, int port) { if (sending) { qWarning("socket in use, connection refused"); return; } status = Init; sending = TRUE; socket->connectToHost(target, port); emit updateStatus(tr("DNS lookup")); } -void SmtpClient::addMail(QString from, QString subject, QStringList to, QString body) +void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body) { RawEmail *mail = new RawEmail; mail->from = from; mail->subject = subject; mail->to = to; mail->body = body; mailList.append(mail); } 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 QString subject; QStringList to; QString body; }; class SmtpClient: public QObject { Q_OBJECT public: SmtpClient(); ~SmtpClient(); - void newConnection(QString target, int port); - void addMail(QString from, QString subject, QStringList to, QString body); + void newConnection(const QString &target, int port); + void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body); signals: void errorOccurred(int); void updateStatus(const QString &); void mailSent(); public slots: void errorHandling(int); protected slots: void connectionEstablished(); 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 @@ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "textparser.h" -TextParser::TextParser(QString in, QString lineBreak) +TextParser::TextParser(const QString &in, const QString &lineBreak) { data = in; lineSep = lineBreak; init(); createSeparators(); split(); } -TextParser::TextParser(QString in, QString lineBreak, QString sep) +TextParser::TextParser(const QString &in, const QString &lineBreak, const QString &sep) { data = in; lineSep = lineBreak; init(); separators = sep; split(); } void TextParser::init() { lineCount = 0; @@ -51,48 +51,48 @@ void TextParser::init() wordAtLine = 0; wordAtPosElm = -1; //such that nextWord equals 0 atLine = 0; atPosElm = 0; } void TextParser::createSeparators() { separators = " @#,.:;<>*/(){}|'?-+=_"; } /* Returns pos of given search criteria, -1 if not found */ -int TextParser::find(QString target, QChar sep, int pos, bool upperCase) +int TextParser::find(const QString &target, QChar sep, int pos, bool upperCase) { t_splitElm parsstr; - QString pString; - + QString pString, pTarget; + pTarget = target; int atLine = 0, atPosElm = 0; getLineReference(pos,&atLine,&atPosElm); for (int x = pos; x < totalElmCount; x++) { parsstr=splitDone[atLine].elm[atPosElm++]; if (upperCase) { pString=parsstr.str.upper(); - target=target.upper(); + pTarget=pTarget.upper(); } else { pString=parsstr.str; } - if ((pString == target) && (parsstr.separator == sep)) + if ((pString == pTarget) && (parsstr.separator == sep)) { return x; } if (atPosElm >= splitDone[atLine].elmCount) { //new Line atLine++; atPosElm = 0; } } return -1; } 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 { t_lineType lineType; QString str; //a bit redundant... t_splitElm elm[MAX_ELEMENTS]; int elmCount; }; class TextParser: public QObject { Q_OBJECT public: - TextParser(QString in, QString lineBreak); - TextParser(QString in, QString lineBreak, QString sep); - int find(QString target, QChar sep, int pos, bool upperCase); + TextParser(const QString &in, const QString &lineBreak); + TextParser(const QString &in, const QString &lineBreak, const QString &sep); + int find(const QString &target, QChar sep, int pos, bool upperCase); int elmCount(); QChar separatorAt(int pos); QChar nextSeparator(); bool hasNextSeparator(); QString wordAt(int pos); QString nextWord(); bool hasNextWord(); QString getString(int *pos, QChar stop, bool lineEnd); QString getNextLine(); bool hasNextLine(); int endLinePos(int pos); 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 @@ AddressList::AddressList() { addresses.setAutoDelete(TRUE); read(); dirty = FALSE; } AddressList::~AddressList() { addresses.clear(); } -void AddressList::addContact(QString email, QString name) +void AddressList::addContact(const QString &email, const QString &name) { //skip if not a valid email address, if (email.find( '@') == -1) return; if ( ! containsEmail(email) ) { Contact *in = new Contact; in->email = email; in->name = name; addresses.append(in); dirty = TRUE; } } -bool AddressList::containsEmail(QString email) +bool AddressList::containsEmail(const QString &email) { return ( getEmailRef(email) != -1 ); } -bool AddressList::containsName(QString name) +bool AddressList::containsName(const QString &name) { return ( getNameRef(name) != -1 ); } -QString AddressList::getNameByEmail(QString email) +QString AddressList::getNameByEmail(const QString &email) { int pos = getEmailRef(email); if (pos != -1) { Contact *ptr = addresses.at(pos); return ptr->name; } return NULL; } -QString AddressList::getEmailByName(QString name) +QString AddressList::getEmailByName(const QString &name) { int pos = getNameRef(name); if (pos != -1) { Contact *ptr = addresses.at(pos); return ptr->email; } return NULL; } -int AddressList::getEmailRef(QString email) +int AddressList::getEmailRef(const QString &email) { int pos = 0; Contact *ptr; for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { if (ptr->email == email) return pos; pos++; } return -1; } -int AddressList::getNameRef(QString name) +int AddressList::getNameRef(const QString &name) { int pos = 0; Contact *ptr; for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { if (ptr->name == name) return pos; pos++; } return -1; } @@ -139,23 +139,23 @@ void AddressList::read() lineEmail = stream.readLine(); if (! stream.atEnd() ) lineName = stream.readLine(); else return; email = getRightString(lineEmail); name = getRightString(lineName); addContact(email, name); } f.close();*/ } -QString AddressList::getRightString(QString in) +QString AddressList::getRightString(const QString &in) { QString out = ""; int pos = in.find('='); if (pos != -1) { out = in.mid(pos+1).stripWhiteSpace(); } return out; } 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 { QString email; QString name; }; class AddressList : public QObject { Q_OBJECT public: AddressList(); ~AddressList(); - void addContact(QString email, QString name); - bool containsEmail(QString email); - bool containsName(QString name); - QString getNameByEmail(QString email); - QString getEmailByName(QString name); + void addContact(const QString &email, const QString &name); + bool containsEmail(const QString &email); + bool containsName(const QString &name); + QString getNameByEmail(const QString &email); + QString getEmailByName(const QString &name); QList<Contact>* getContactList(); private: - int getEmailRef(QString email); - int getNameRef(QString name); - QString getRightString(QString in); + int getEmailRef(const QString &email); + int getNameRef(const QString &name); + QString getRightString(const QString &in); void read(); private: QList<Contact> addresses; QString filename; bool dirty; }; #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) item = (EmailListItem *) inboxView->firstChild(); while ((item != NULL)&&(!found)) { mailPtr = item->getMail(); if (mailPtr->id == newMail.id) { item->setMail(newMail); emit mailUpdated(item->getMail()); found = true; } item = (EmailListItem *) item->nextSibling(); } } - if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE); - + if ((!found)||(fromDisk)) { + item = new EmailListItem(inboxView, newMail, TRUE); + } if (item->getMail()->files.count()>0) { item->setPixmap(0, Resource::loadPixmap("mailit/attach")); } /*if (!newMail.downloaded) mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ mailboxView->setCurrentTab(0); } void EmailClient::allMailArrived(int count) @@ -633,25 +634,25 @@ void EmailClient::readMail() mail.rawMail = s.mid(start, stop + del.length() - start ); start = stop + del.length(); emailHandler->parse(mail.rawMail, lineShift, &mail); mail.sent = false; mail.received = false; enqueMail(mail); } } } -void EmailClient::saveMail(QString fileName, QListView *view) +void EmailClient::saveMail(const QString &fileName, QListView *view) { QFile f(fileName); Email *mail; if (! f.open(IO_WriteOnly) ) { qWarning("could not open file"); return; } item = (EmailListItem *) view->firstChild(); QTextStream t(&f); while (item != NULL) { 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: void mailSent(); void deleteItem(); void getNewMail(); void getAllNewMail(); void smtpError(int code); void popError(int code); void inboxItemSelected(); void outboxItemSelected(); void inboxItemPressed(); void inboxItemReleased(); void mailArrived(const Email &mail, bool fromDisk); void allMailArrived(int); - void saveMail(QString fileName, QListView *view); + void saveMail(const QString &fileName, QListView *view); void selectAccount(int); void editAccount(int); void updateAccounts(); void deleteAccount(int); void deleteMail(EmailListItem *mailItem, bool &inbox); void setTotalSize(int); void setMailSize(int); void setDownloadedSize(int); void moveMailFront(Email *mailPtr); void download(Email*); /* void reply(); 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) void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) { Email mail; mail.rawMail = message; mail.serverId = id; mail.size = size; mail.downloaded = complete; emit mailArrived(mail, FALSE); } -bool EmailHandler::parse(QString in, QString lineShift, Email *mail) +bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail) { QString temp, boundary; int pos; QString delimiter, header, body, mimeHeader, mimeBody; QString content, contentType, contentAttribute, id, encoding; QString fileName, storedName; int enclosureId = 0; mail->rawMail = in; mail->received = TRUE; mail->files.setAutoDelete(TRUE); @@ -501,25 +501,25 @@ int EmailHandler::encodeMime(Email *mail) fi.fileName() + "\"\r\n\r\n"; if (encodeFile(fileName, &newBody) == -1) //file not found? return -1; } newBody += "\r\n\r\n--" + boundary + "--"; mail->rawMail = newBody; return 0; } -int EmailHandler::encodeFile(QString fileName, QString *toBody) +int EmailHandler::encodeFile(const QString &fileName, QString *toBody) { char *fileData; char *dataPtr; QString temp; uint dataSize, count; QFile f(fileName); if (! f.open(IO_ReadOnly) ) { qWarning("could not open file: " + fileName); return -1; } 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 class EmailHandler : public QObject { Q_OBJECT public: EmailHandler(); void setAccount(MailAccount account); MailAccount* getAccount(){return &mailAccount;} void sendMail(QList<Email> *mailList); void getMail(); void getMailHeaders(); void getMailByList(MailList *mailList); - bool parse(QString in, QString lineShift, Email *mail); + bool parse(const QString &in, const QString &lineShift, Email *mail); bool getEnclosure(Enclosure *ePtr); int parse64base(char *src, char *dest); int encodeMime(Email *mail); - int encodeFile(QString fileName, QString *toBody); + int encodeFile(const QString &fileName, QString *toBody); void encode64base(char *src, QString *dest, int len); void cancel(); signals: void mailSent(); void smtpError(int); void popError(int); void mailArrived(const Email &, bool); void updatePopStatus(const QString &); void updateSmtpStatus(const QString &); void mailTransfered(int); 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() synchronize = FALSE; lastSync = 0; headerLimit = 0; preview = FALSE; } PopClient::~PopClient() { delete socket; delete stream; } -void PopClient::newConnection(QString target, int port) +void PopClient::newConnection(const QString &target, int port) { if (receiving) { qWarning("socket in use, connection refused"); return; } status = Init; socket->connectToHost(target, port); receiving = TRUE; //selected = FALSE; emit updateStatus("DNS lookup"); } -void PopClient::setAccount(QString popUser, QString popPasswd) +void PopClient::setAccount(const QString &popUser, const QString &popPasswd) { popUserName = popUser; popPassword = popPasswd; } void PopClient::setSynchronize(int lastCount) { synchronize = TRUE; lastSync = lastCount; } 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 @@ #include <qobject.h> #include <qtextstream.h> #include <qlist.h> #include "maillist.h" class PopClient: public QObject { Q_OBJECT public: PopClient(); ~PopClient(); - void newConnection(QString target, int port); - void setAccount(QString popUser, QString popPasswd); + void newConnection(const QString &target, int port); + void setAccount(const QString &popUser, const QString &popPasswd); void setSynchronize(int lastCount); void removeSynchronize(); void headersOnly(bool headers, int limit); void setSelectedMails(MailList *list); signals: void newMessage(const QString &, int, uint, bool); void errorOccurred(int status); void updateStatus(const QString &); void mailTransfered(int); void mailboxSize(int); 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() connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); sending = FALSE; } SmtpClient::~SmtpClient() { delete socket; delete stream; } -void SmtpClient::newConnection(QString target, int port) +void SmtpClient::newConnection(const QString &target, int port) { if (sending) { qWarning("socket in use, connection refused"); return; } status = Init; sending = TRUE; socket->connectToHost(target, port); emit updateStatus(tr("DNS lookup")); } -void SmtpClient::addMail(QString from, QString subject, QStringList to, QString body) +void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body) { RawEmail *mail = new RawEmail; mail->from = from; mail->subject = subject; mail->to = to; mail->body = body; mailList.append(mail); } 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 QString subject; QStringList to; QString body; }; class SmtpClient: public QObject { Q_OBJECT public: SmtpClient(); ~SmtpClient(); - void newConnection(QString target, int port); - void addMail(QString from, QString subject, QStringList to, QString body); + void newConnection(const QString &target, int port); + void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body); signals: void errorOccurred(int); void updateStatus(const QString &); void mailSent(); public slots: void errorHandling(int); protected slots: void connectionEstablished(); 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 @@ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "textparser.h" -TextParser::TextParser(QString in, QString lineBreak) +TextParser::TextParser(const QString &in, const QString &lineBreak) { data = in; lineSep = lineBreak; init(); createSeparators(); split(); } -TextParser::TextParser(QString in, QString lineBreak, QString sep) +TextParser::TextParser(const QString &in, const QString &lineBreak, const QString &sep) { data = in; lineSep = lineBreak; init(); separators = sep; split(); } void TextParser::init() { lineCount = 0; @@ -51,48 +51,48 @@ void TextParser::init() wordAtLine = 0; wordAtPosElm = -1; //such that nextWord equals 0 atLine = 0; atPosElm = 0; } void TextParser::createSeparators() { separators = " @#,.:;<>*/(){}|'?-+=_"; } /* Returns pos of given search criteria, -1 if not found */ -int TextParser::find(QString target, QChar sep, int pos, bool upperCase) +int TextParser::find(const QString &target, QChar sep, int pos, bool upperCase) { t_splitElm parsstr; - QString pString; - + QString pString, pTarget; + pTarget = target; int atLine = 0, atPosElm = 0; getLineReference(pos,&atLine,&atPosElm); for (int x = pos; x < totalElmCount; x++) { parsstr=splitDone[atLine].elm[atPosElm++]; if (upperCase) { pString=parsstr.str.upper(); - target=target.upper(); + pTarget=pTarget.upper(); } else { pString=parsstr.str; } - if ((pString == target) && (parsstr.separator == sep)) + if ((pString == pTarget) && (parsstr.separator == sep)) { return x; } if (atPosElm >= splitDone[atLine].elmCount) { //new Line atLine++; atPosElm = 0; } } return -1; } 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 { t_lineType lineType; QString str; //a bit redundant... t_splitElm elm[MAX_ELEMENTS]; int elmCount; }; class TextParser: public QObject { Q_OBJECT public: - TextParser(QString in, QString lineBreak); - TextParser(QString in, QString lineBreak, QString sep); - int find(QString target, QChar sep, int pos, bool upperCase); + TextParser(const QString &in, const QString &lineBreak); + TextParser(const QString &in, const QString &lineBreak, const QString &sep); + int find(const QString &target, QChar sep, int pos, bool upperCase); int elmCount(); QChar separatorAt(int pos); QChar nextSeparator(); bool hasNextSeparator(); QString wordAt(int pos); QString nextWord(); bool hasNextWord(); QString getString(int *pos, QChar stop, bool lineEnd); QString getNextLine(); bool hasNextLine(); int endLinePos(int pos); |