author | groucho <groucho> | 2003-04-14 08:22:55 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-14 08:22:55 (UTC) |
commit | 4624a73cd100f860371fb01facea442737e9336e (patch) (unidiff) | |
tree | ae06cfd24013ca39816a5ca035605988f4033dcd /noncore/unsupported/mailit/addresslist.cpp | |
parent | 6d737040698a9c7ebc6492ba4234b64bf4db6c0b (diff) | |
download | opie-4624a73cd100f860371fb01facea442737e9336e.zip opie-4624a73cd100f860371fb01facea442737e9336e.tar.gz opie-4624a73cd100f860371fb01facea442737e9336e.tar.bz2 |
- Buttonlayout changed in attach dialog
- Removed file access for address list (reduces size)
- Added header size sping box for accounts
- mailit shows an icon in the message list if attachments are present
- Added translations in pro file
- Removed resource.* references in header files, uses qpe/resource.h instead
Diffstat (limited to 'noncore/unsupported/mailit/addresslist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/addresslist.cpp | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp index 43e3830..9fe558a 100644 --- a/noncore/unsupported/mailit/addresslist.cpp +++ b/noncore/unsupported/mailit/addresslist.cpp | |||
@@ -15,35 +15,33 @@ | |||
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 <qfile.h> | 20 | #include <qfile.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #include <opie/ocontactaccess.h> | 22 | #include <opie/ocontactaccess.h> |
23 | #include <opie/ocontact.h> | 23 | #include <opie/ocontact.h> |
24 | 24 | ||
25 | #include "addresslist.h" | 25 | #include "addresslist.h" |
26 | 26 | ||
27 | AddressList::AddressList(QString file) | 27 | AddressList::AddressList() |
28 | { | 28 | { |
29 | addresses.setAutoDelete(TRUE); | 29 | addresses.setAutoDelete(TRUE); |
30 | filename = file; | ||
31 | read(); | 30 | read(); |
32 | dirty = FALSE; | 31 | dirty = FALSE; |
33 | } | 32 | } |
34 | 33 | ||
35 | AddressList::~AddressList() | 34 | AddressList::~AddressList() |
36 | { | 35 | { |
37 | write(); | ||
38 | addresses.clear(); | 36 | addresses.clear(); |
39 | } | 37 | } |
40 | 38 | ||
41 | void AddressList::addContact(QString email, QString name) | 39 | void AddressList::addContact(QString email, QString name) |
42 | { | 40 | { |
43 | //skip if not a valid email address, | 41 | //skip if not a valid email address, |
44 | if (email.find( '@') == -1) | 42 | if (email.find( '@') == -1) |
45 | return; | 43 | return; |
46 | 44 | ||
47 | if ( ! containsEmail(email) ) { | 45 | if ( ! containsEmail(email) ) { |
48 | Contact *in = new Contact; | 46 | Contact *in = new Contact; |
49 | in->email = email; | 47 | in->email = email; |
@@ -111,25 +109,24 @@ int AddressList::getNameRef(QString name) | |||
111 | return -1; | 109 | return -1; |
112 | } | 110 | } |
113 | 111 | ||
114 | QList<Contact>* AddressList::getContactList() | 112 | QList<Contact>* AddressList::getContactList() |
115 | { | 113 | { |
116 | return &addresses; | 114 | return &addresses; |
117 | } | 115 | } |
118 | 116 | ||
119 | void AddressList::read() | 117 | void AddressList::read() |
120 | { | 118 | { |
121 | OContactAccess::List::Iterator it; | 119 | OContactAccess::List::Iterator it; |
122 | 120 | ||
123 | //QFile f(filename); | ||
124 | QString lineEmail, lineName, email, name; | 121 | QString lineEmail, lineName, email, name; |
125 | OContactAccess m_contactdb("mailit"); | 122 | OContactAccess m_contactdb("mailit"); |
126 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); | 123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); |
127 | //OContact* oc; | 124 | //OContact* oc; |
128 | 125 | ||
129 | for ( it = m_list.begin(); it != m_list.end(); ++it ) | 126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) |
130 | { | 127 | { |
131 | //oc=(OContact*) it; | 128 | //oc=(OContact*) it; |
132 | if ((*it).defaultEmail().length()!=0) | 129 | if ((*it).defaultEmail().length()!=0) |
133 | addContact((*it).defaultEmail(),(*it).fullName()); | 130 | addContact((*it).defaultEmail(),(*it).fullName()); |
134 | } | 131 | } |
135 | 132 | ||
@@ -153,29 +150,12 @@ void AddressList::read() | |||
153 | 150 | ||
154 | QString AddressList::getRightString(QString in) | 151 | QString AddressList::getRightString(QString in) |
155 | { | 152 | { |
156 | QString out = ""; | 153 | QString out = ""; |
157 | 154 | ||
158 | int pos = in.find('='); | 155 | int pos = in.find('='); |
159 | if (pos != -1) { | 156 | if (pos != -1) { |
160 | out = in.mid(pos+1).stripWhiteSpace(); | 157 | out = in.mid(pos+1).stripWhiteSpace(); |
161 | } | 158 | } |
162 | return out; | 159 | return out; |
163 | } | 160 | } |
164 | 161 | ||
165 | void AddressList::write() | ||
166 | { | ||
167 | if ( (addresses.count() == 0) || (!dirty) ) | ||
168 | return; | ||
169 | |||
170 | QFile f(filename); | ||
171 | if (! f.open(IO_WriteOnly) ) | ||
172 | return; | ||
173 | |||
174 | QTextStream stream(&f); | ||
175 | Contact *ptr; | ||
176 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { | ||
177 | stream << "email = " + ptr->email + "\n"; | ||
178 | stream << "name = " + ptr->name + "\n"; | ||
179 | } | ||
180 | f.close(); | ||
181 | } | ||