Diffstat (limited to 'noncore/net/mailit/addresslist.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mailit/addresslist.cpp | 16 |
1 files changed, 8 insertions, 8 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() 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) ) { @@ -48,58 +48,58 @@ void AddressList::addContact(QString email, QString name) 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) @@ -145,13 +145,13 @@ void AddressList::read() 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(); |