-rw-r--r-- | noncore/unsupported/mail2/addresspicker.cpp | 1 | ||||
-rw-r--r-- | noncore/unsupported/mail2/bend/opie-mailapplet.control | 4 | ||||
-rw-r--r-- | noncore/unsupported/mail2/opie-mail2.control | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/noncore/unsupported/mail2/addresspicker.cpp b/noncore/unsupported/mail2/addresspicker.cpp index 7f32725..a97b33f 100644 --- a/noncore/unsupported/mail2/addresspicker.cpp +++ b/noncore/unsupported/mail2/addresspicker.cpp | |||
@@ -1,117 +1,118 @@ | |||
1 | #include <qpushbutton.h> | 1 | #include <qpushbutton.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <qlistbox.h> | 4 | #include <qlistbox.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | 6 | ||
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | 8 | ||
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | 10 | ||
11 | #include "addresspicker.h" | 11 | #include "addresspicker.h" |
12 | 12 | ||
13 | AddressPicker::AddressPicker(QWidget *parent, const char *name, bool modal, | 13 | AddressPicker::AddressPicker(QWidget *parent, const char *name, bool modal, |
14 | WFlags fl) : AddressPickerBase(parent, name, modal, fl) | 14 | WFlags fl) : AddressPickerBase(parent, name, modal, fl) |
15 | { | 15 | { |
16 | okButton->setIconSet(Resource::loadPixmap("enter")); | 16 | okButton->setIconSet(Resource::loadPixmap("enter")); |
17 | cancelButton->setIconSet(Resource::loadPixmap("editdelete")); | 17 | cancelButton->setIconSet(Resource::loadPixmap("editdelete")); |
18 | 18 | ||
19 | connect(okButton, SIGNAL(clicked()), SLOT(accept())); | 19 | connect(okButton, SIGNAL(clicked()), SLOT(accept())); |
20 | connect(cancelButton, SIGNAL(clicked()), SLOT(close())); | 20 | connect(cancelButton, SIGNAL(clicked()), SLOT(close())); |
21 | 21 | ||
22 | QFile f((QString) getenv("HOME") + "/Applications/" | 22 | QFile f((QString) getenv("HOME") + "/Applications/" |
23 | + "addressbook/addressbook.xml"); | 23 | + "addressbook/addressbook.xml"); |
24 | 24 | ||
25 | if (f.open(IO_ReadOnly)) { | 25 | if (f.open(IO_ReadOnly)) { |
26 | QTextStream stream(&f); | 26 | QTextStream stream(&f); |
27 | stream.setEncoding( QTextStream::UnicodeUTF8 ); | ||
27 | QString content; | 28 | QString content; |
28 | while (!f.atEnd()) content += stream.readLine() + "\n"; | 29 | while (!f.atEnd()) content += stream.readLine() + "\n"; |
29 | QStringList lines = QStringList::split(QRegExp("\\n"), content); | 30 | QStringList lines = QStringList::split(QRegExp("\\n"), content); |
30 | QStringList::Iterator it; | 31 | QStringList::Iterator it; |
31 | for (it = lines.begin(); it != lines.end(); it++) { | 32 | for (it = lines.begin(); it != lines.end(); it++) { |
32 | if ((*it).find(QRegExp("^<Contact.*")) != -1) { | 33 | if ((*it).find(QRegExp("^<Contact.*")) != -1) { |
33 | int pos = (*it).find("FirstName=\""); | 34 | int pos = (*it).find("FirstName=\""); |
34 | QString fname; | 35 | QString fname; |
35 | if (pos != -1) { | 36 | if (pos != -1) { |
36 | int i = 1; | 37 | int i = 1; |
37 | QChar c; | 38 | QChar c; |
38 | while (c != '"') { | 39 | while (c != '"') { |
39 | c = (*it)[pos + 10 + i]; | 40 | c = (*it)[pos + 10 + i]; |
40 | if (c != '"') fname += c; | 41 | if (c != '"') fname += c; |
41 | i++; | 42 | i++; |
42 | } | 43 | } |
43 | } | 44 | } |
44 | pos = (*it).find("LastName=\""); | 45 | pos = (*it).find("LastName=\""); |
45 | QString lname; | 46 | QString lname; |
46 | if (pos != -1) { | 47 | if (pos != -1) { |
47 | int i = 1; | 48 | int i = 1; |
48 | QChar c; | 49 | QChar c; |
49 | while (c != '"') { | 50 | while (c != '"') { |
50 | c = (*it)[pos + 9 + i]; | 51 | c = (*it)[pos + 9 + i]; |
51 | if (c != '"') lname += c; | 52 | if (c != '"') lname += c; |
52 | i++; | 53 | i++; |
53 | } | 54 | } |
54 | } | 55 | } |
55 | pos = (*it).find("DefaultEmail=\""); | 56 | pos = (*it).find("DefaultEmail=\""); |
56 | QString email; | 57 | QString email; |
57 | if (pos != -1) { | 58 | if (pos != -1) { |
58 | int i = 1; | 59 | int i = 1; |
59 | QChar c; | 60 | QChar c; |
60 | while (c != '"') { | 61 | while (c != '"') { |
61 | c = (*it)[pos + 13 + i]; | 62 | c = (*it)[pos + 13 + i]; |
62 | if (c != '"') email += c; | 63 | if (c != '"') email += c; |
63 | i++; | 64 | i++; |
64 | } | 65 | } |
65 | } | 66 | } |
66 | QString tname, temail; | 67 | QString tname, temail; |
67 | if (!fname.isEmpty()) tname += fname; | 68 | if (!fname.isEmpty()) tname += fname; |
68 | if (!lname.isEmpty()) tname += fname.isEmpty() ? lname : (" " + lname); | 69 | if (!lname.isEmpty()) tname += fname.isEmpty() ? lname : (" " + lname); |
69 | if (!email.isEmpty()) temail += tname.isEmpty() ? email : (" <" + email + ">"); | 70 | if (!email.isEmpty()) temail += tname.isEmpty() ? email : (" <" + email + ">"); |
70 | if (!email.isEmpty()) addressList->insertItem(tname + temail); | 71 | if (!email.isEmpty()) addressList->insertItem(tname + temail); |
71 | } | 72 | } |
72 | } | 73 | } |
73 | } | 74 | } |
74 | if (addressList->count() <= 0) { | 75 | if (addressList->count() <= 0) { |
75 | addressList->insertItem(tr("There are no entries in the addressbook.")); | 76 | addressList->insertItem(tr("There are no entries in the addressbook.")); |
76 | addressList->setEnabled(false); | 77 | addressList->setEnabled(false); |
77 | okButton->setEnabled(false); | 78 | okButton->setEnabled(false); |
78 | } | 79 | } |
79 | } | 80 | } |
80 | 81 | ||
81 | void AddressPicker::accept() | 82 | void AddressPicker::accept() |
82 | { | 83 | { |
83 | QListBoxItem *item = addressList->firstItem(); | 84 | QListBoxItem *item = addressList->firstItem(); |
84 | QString names; | 85 | QString names; |
85 | 86 | ||
86 | while (item) { | 87 | while (item) { |
87 | if (item->selected()) | 88 | if (item->selected()) |
88 | names += item->text() + ", "; | 89 | names += item->text() + ", "; |
89 | item = item->next(); | 90 | item = item->next(); |
90 | } | 91 | } |
91 | names.replace(names.length() - 2, 2, ""); | 92 | names.replace(names.length() - 2, 2, ""); |
92 | 93 | ||
93 | if (names.isEmpty()) { | 94 | if (names.isEmpty()) { |
94 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select" | 95 | QMessageBox::information(this, tr("Error"), tr("<p>You have to select" |
95 | " at least one address entry.</p>"), tr("Ok")); | 96 | " at least one address entry.</p>"), tr("Ok")); |
96 | return; | 97 | return; |
97 | } | 98 | } |
98 | 99 | ||
99 | selectedNames = names; | 100 | selectedNames = names; |
100 | QDialog::accept(); | 101 | QDialog::accept(); |
101 | } | 102 | } |
102 | 103 | ||
103 | QString AddressPicker::getNames() | 104 | QString AddressPicker::getNames() |
104 | { | 105 | { |
105 | QString names = 0; | 106 | QString names = 0; |
106 | 107 | ||
107 | AddressPicker picker(0, 0, true); | 108 | AddressPicker picker(0, 0, true); |
108 | picker.showMaximized(); | 109 | picker.showMaximized(); |
109 | picker.show(); | 110 | picker.show(); |
110 | 111 | ||
111 | int ret = picker.exec(); | 112 | int ret = picker.exec(); |
112 | if (QDialog::Accepted == ret) { | 113 | if (QDialog::Accepted == ret) { |
113 | return picker.selectedNames; | 114 | return picker.selectedNames; |
114 | } | 115 | } |
115 | return 0; | 116 | return 0; |
116 | } | 117 | } |
117 | 118 | ||
diff --git a/noncore/unsupported/mail2/bend/opie-mailapplet.control b/noncore/unsupported/mail2/bend/opie-mailapplet.control index e5d3c6e..d618643 100644 --- a/noncore/unsupported/mail2/bend/opie-mailapplet.control +++ b/noncore/unsupported/mail2/bend/opie-mailapplet.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-mailapplet | 1 | Package: opie-mailapplet |
2 | Files: plugins/applets/libbend.so* | 2 | Files: plugins/applets/libbend.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Constantin Bergemann <cbergemann@lisa.de> | 5 | Maintainer: Constantin Bergemann <cbergemann@lisa.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.0.9-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal libopie1 opie-mail2 | 8 | Depends: task-opie-minimal, libopie1, opie-mail2 |
9 | Description: A Biff-Like mailchecker | 9 | Description: A Biff-Like mailchecker |
10 | License: LGPL | 10 | License: LGPL |
diff --git a/noncore/unsupported/mail2/opie-mail2.control b/noncore/unsupported/mail2/opie-mail2.control index 7f8aeb6..976dc0b 100644 --- a/noncore/unsupported/mail2/opie-mail2.control +++ b/noncore/unsupported/mail2/opie-mail2.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-mail2 | 1 | Package: opie-mail2 |
2 | Files: bin/mail $OPIEDIR/lib/libmail.so* apps/1Pim/mail.desktop pics/mail/*.png sounds/mail/*.wav | 2 | Files: bin/mail $OPIEDIR/lib/libmail.so* apps/1Pim/mail.desktop pics/mail/*.png sounds/mail/*.wav |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Constantin Bergemann <cbergemann@lisa.de> | 5 | Maintainer: Constantin Bergemann <cbergemann@lisa.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.0.9-$SUB_VERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libopie1 | 8 | Depends: task-opie-minimal, libopie1 |
9 | Description: An IMAP mail client | 9 | Description: An IMAP mail client |
10 | License: LGPL | 10 | License: LGPL |