-rw-r--r-- | noncore/net/mailit/addresslist.cpp | 16 | ||||
-rw-r--r-- | noncore/net/mailit/addresslist.h | 6 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addresslist.cpp | 16 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addresslist.h | 6 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 4 |
6 files changed, 26 insertions, 26 deletions
diff --git a/noncore/net/mailit/addresslist.cpp b/noncore/net/mailit/addresslist.cpp index 18d14bc..f2b027c 100644 --- a/noncore/net/mailit/addresslist.cpp +++ b/noncore/net/mailit/addresslist.cpp | |||
@@ -1,161 +1,161 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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() | 27 | AddressList::AddressList() |
28 | { | 28 | { |
29 | addresses.setAutoDelete(TRUE); | 29 | addresses.setAutoDelete(TRUE); |
30 | read(); | 30 | read(); |
31 | dirty = FALSE; | 31 | dirty = FALSE; |
32 | } | 32 | } |
33 | 33 | ||
34 | AddressList::~AddressList() | 34 | AddressList::~AddressList() |
35 | { | 35 | { |
36 | addresses.clear(); | 36 | addresses.clear(); |
37 | } | 37 | } |
38 | 38 | ||
39 | void AddressList::addContact(const QString &email, const 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) ) { |
46 | Contact *in = new Contact; | 46 | AContact *in = new AContact; |
47 | in->email = email; | 47 | in->email = email; |
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(const 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(const 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(const 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 | AContact *ptr = addresses.at(pos); |
69 | return ptr->name; | 69 | return ptr->name; |
70 | } | 70 | } |
71 | 71 | ||
72 | return NULL; | 72 | return QString::null; |
73 | } | 73 | } |
74 | 74 | ||
75 | QString AddressList::getEmailByName(const 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 | AContact *ptr = addresses.at(pos); |
80 | return ptr->email; | 80 | return ptr->email; |
81 | } | 81 | } |
82 | 82 | ||
83 | return NULL; | 83 | return QString::null; |
84 | } | 84 | } |
85 | 85 | ||
86 | int AddressList::getEmailRef(const QString &email) | 86 | int AddressList::getEmailRef(const QString &email) |
87 | { | 87 | { |
88 | int pos = 0; | 88 | int pos = 0; |
89 | Contact *ptr; | 89 | AContact *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(const QString &name) | 99 | int AddressList::getNameRef(const QString &name) |
100 | { | 100 | { |
101 | int pos = 0; | 101 | int pos = 0; |
102 | Contact *ptr; | 102 | AContact *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) |
106 | return pos; | 106 | return pos; |
107 | pos++; | 107 | pos++; |
108 | } | 108 | } |
109 | return -1; | 109 | return -1; |
110 | } | 110 | } |
111 | 111 | ||
112 | QList<Contact>* AddressList::getContactList() | 112 | QList<AContact>* AddressList::getContactList() |
113 | { | 113 | { |
114 | return &addresses; | 114 | return &addresses; |
115 | } | 115 | } |
116 | 116 | ||
117 | void AddressList::read() | 117 | void AddressList::read() |
118 | { | 118 | { |
119 | OContactAccess::List::Iterator it; | 119 | OContactAccess::List::Iterator it; |
120 | 120 | ||
121 | QString lineEmail, lineName, email, name; | 121 | QString lineEmail, lineName, email, name; |
122 | OContactAccess m_contactdb("mailit"); | 122 | OContactAccess m_contactdb("mailit"); |
123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); | 123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); |
124 | //OContact* oc;(*it).defaultEmail() | 124 | //OContact* oc;(*it).defaultEmail() |
125 | 125 | ||
126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) | 126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) |
127 | { | 127 | { |
128 | //oc=(OContact*) it; | 128 | //oc=(OContact*) it; |
129 | if ((*it).defaultEmail().length()!=0) | 129 | if ((*it).defaultEmail().length()!=0) |
130 | addContact((*it).defaultEmail(),(*it).fileAs()); | 130 | addContact((*it).defaultEmail(),(*it).fileAs()); |
131 | } | 131 | } |
132 | 132 | ||
133 | /*if (! f.open(IO_ReadOnly) ) | 133 | /*if (! f.open(IO_ReadOnly) ) |
134 | return; | 134 | return; |
135 | 135 | ||
136 | QTextStream stream(&f); | 136 | QTextStream stream(&f); |
137 | 137 | ||
138 | while (! stream.atEnd() ) { | 138 | while (! stream.atEnd() ) { |
139 | lineEmail = stream.readLine(); | 139 | lineEmail = stream.readLine(); |
140 | if (! stream.atEnd() ) | 140 | if (! stream.atEnd() ) |
141 | lineName = stream.readLine(); | 141 | lineName = stream.readLine(); |
142 | else return; | 142 | else return; |
143 | 143 | ||
144 | email = getRightString(lineEmail); | 144 | email = getRightString(lineEmail); |
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(const 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(); |
158 | } | 158 | } |
159 | return out; | 159 | return out; |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/noncore/net/mailit/addresslist.h b/noncore/net/mailit/addresslist.h index b46d467..763b6d4 100644 --- a/noncore/net/mailit/addresslist.h +++ b/noncore/net/mailit/addresslist.h | |||
@@ -1,58 +1,58 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 | #ifndef ADDRESSLIST_H | 20 | #ifndef ADDRESSLIST_H |
21 | #define ADDRESSLIST_H | 21 | #define ADDRESSLIST_H |
22 | 22 | ||
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | 25 | ||
26 | struct Contact | 26 | struct AContact |
27 | { | 27 | { |
28 | QString email; | 28 | QString email; |
29 | QString name; | 29 | QString name; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | class AddressList : public QObject | 32 | 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(const QString &email, const QString &name); | 39 | void addContact(const QString &email, const QString &name); |
40 | bool containsEmail(const QString &email); | 40 | bool containsEmail(const QString &email); |
41 | bool containsName(const QString &name); | 41 | bool containsName(const QString &name); |
42 | QString getNameByEmail(const QString &email); | 42 | QString getNameByEmail(const QString &email); |
43 | QString getEmailByName(const QString &name); | 43 | QString getEmailByName(const QString &name); |
44 | QList<Contact>* getContactList(); | 44 | QList<AContact>* getContactList(); |
45 | 45 | ||
46 | private: | 46 | private: |
47 | int getEmailRef(const QString &email); | 47 | int getEmailRef(const QString &email); |
48 | int getNameRef(const QString &name); | 48 | int getNameRef(const QString &name); |
49 | QString getRightString(const 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<AContact> addresses; |
54 | QString filename; | 54 | QString filename; |
55 | bool dirty; | 55 | bool dirty; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index c75494e..0298cb3 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -1,141 +1,141 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qwhatsthis.h> | 21 | #include <qwhatsthis.h> |
22 | #include "writemail.h" | 22 | #include "writemail.h" |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) | 25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) |
26 | { | 26 | { |
27 | showingAddressList = FALSE; | 27 | showingAddressList = FALSE; |
28 | init(); | 28 | init(); |
29 | 29 | ||
30 | addAtt = new AddAtt(0, "Add Attachments"); | 30 | addAtt = new AddAtt(0, "Add Attachments"); |
31 | } | 31 | } |
32 | 32 | ||
33 | WriteMail::~WriteMail() | 33 | WriteMail::~WriteMail() |
34 | { | 34 | { |
35 | delete addAtt; | 35 | delete addAtt; |
36 | } | 36 | } |
37 | 37 | ||
38 | void WriteMail::setAddressList(AddressList *list) | 38 | void WriteMail::setAddressList(AddressList *list) |
39 | { | 39 | { |
40 | Contact *cPtr; | 40 | AContact *cPtr; |
41 | 41 | ||
42 | addressList = list; | 42 | addressList = list; |
43 | 43 | ||
44 | addressView->clear(); | 44 | addressView->clear(); |
45 | QList<Contact> *cListPtr = addressList->getContactList(); | 45 | QList<AContact> *cListPtr = addressList->getContactList(); |
46 | QListViewItem *item; | 46 | QListViewItem *item; |
47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { | 47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { |
48 | item = new QListViewItem(addressView, cPtr->name, cPtr->email); | 48 | item = new QListViewItem(addressView, cPtr->name, cPtr->email); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | void WriteMail::init() | 52 | void WriteMail::init() |
53 | { | 53 | { |
54 | setToolBarsMovable(FALSE); | 54 | setToolBarsMovable(FALSE); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | bar->setHorizontalStretchable( TRUE ); | 57 | bar->setHorizontalStretchable( TRUE ); |
58 | 58 | ||
59 | menu = new QMenuBar( bar ); | 59 | menu = new QMenuBar( bar ); |
60 | 60 | ||
61 | mailMenu = new QPopupMenu(menu); | 61 | mailMenu = new QPopupMenu(menu); |
62 | menu->insertItem( tr( "&Mail" ), mailMenu); | 62 | menu->insertItem( tr( "&Mail" ), mailMenu); |
63 | addMenu = new QPopupMenu(menu); | 63 | addMenu = new QPopupMenu(menu); |
64 | menu->insertItem( tr( "&Add" ), addMenu); | 64 | menu->insertItem( tr( "&Add" ), addMenu); |
65 | 65 | ||
66 | bar = new QToolBar(this); | 66 | bar = new QToolBar(this); |
67 | attachButton = new QAction(tr("Attachment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); | 67 | attachButton = new QAction(tr("Attachment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); |
68 | attachButton->addTo(bar); | 68 | attachButton->addTo(bar); |
69 | attachButton->addTo(addMenu); | 69 | attachButton->addTo(addMenu); |
70 | connect( attachButton, SIGNAL( activated() ), this, SLOT( attachFile() ) ); | 70 | connect( attachButton, SIGNAL( activated() ), this, SLOT( attachFile() ) ); |
71 | attachButton->setWhatsThis(tr("Click here to attach files to your mail")); | 71 | attachButton->setWhatsThis(tr("Click here to attach files to your mail")); |
72 | 72 | ||
73 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); | 73 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); |
74 | confirmButton->addTo(bar); | 74 | confirmButton->addTo(bar); |
75 | confirmButton->addTo(mailMenu); | 75 | confirmButton->addTo(mailMenu); |
76 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); | 76 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); |
77 | confirmButton->setWhatsThis(tr("This button puts your mail in the send queue")); | 77 | confirmButton->setWhatsThis(tr("This button puts your mail in the send queue")); |
78 | 78 | ||
79 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 79 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
80 | newButton->addTo(mailMenu); | 80 | newButton->addTo(mailMenu); |
81 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); | 81 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); |
82 | newButton->setWhatsThis(tr("Click here to create a new mail")); | 82 | newButton->setWhatsThis(tr("Click here to create a new mail")); |
83 | 83 | ||
84 | widget = new QWidget(this, "widget"); | 84 | widget = new QWidget(this, "widget"); |
85 | grid = new QGridLayout( widget ); | 85 | grid = new QGridLayout( widget ); |
86 | 86 | ||
87 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); | 87 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); |
88 | recipientsBox->insertItem( tr( "To:" ) ); | 88 | recipientsBox->insertItem( tr( "To:" ) ); |
89 | recipientsBox->insertItem( tr( "CC:" ) ); | 89 | recipientsBox->insertItem( tr( "CC:" ) ); |
90 | recipientsBox->setCurrentItem(0); | 90 | recipientsBox->setCurrentItem(0); |
91 | grid->addWidget( recipientsBox, 0, 0 ); | 91 | grid->addWidget( recipientsBox, 0, 0 ); |
92 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); | 92 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); |
93 | 93 | ||
94 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 94 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
95 | subjetLabel->setText( tr( "Subject:" ) ); | 95 | subjetLabel->setText( tr( "Subject:" ) ); |
96 | 96 | ||
97 | grid->addWidget( subjetLabel, 1, 0 ); | 97 | grid->addWidget( subjetLabel, 1, 0 ); |
98 | 98 | ||
99 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); | 99 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); |
100 | ToolButton13_2->setText( tr( "..." ) ); | 100 | ToolButton13_2->setText( tr( "..." ) ); |
101 | grid->addWidget( ToolButton13_2, 1, 2 ); | 101 | grid->addWidget( ToolButton13_2, 1, 2 ); |
102 | 102 | ||
103 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 103 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
104 | grid->addWidget( subjectInput, 1, 1 ); | 104 | grid->addWidget( subjectInput, 1, 1 ); |
105 | QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); | 105 | QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); |
106 | 106 | ||
107 | toInput = new QLineEdit( widget, "toInput" ); | 107 | toInput = new QLineEdit( widget, "toInput" ); |
108 | grid->addWidget( toInput, 0, 1 ); | 108 | grid->addWidget( toInput, 0, 1 ); |
109 | QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); | 109 | QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); |
110 | 110 | ||
111 | ccInput = new QLineEdit( widget, "ccInput" ); | 111 | ccInput = new QLineEdit( widget, "ccInput" ); |
112 | ccInput->hide(); | 112 | ccInput->hide(); |
113 | grid->addWidget( ccInput, 0, 1 ); | 113 | grid->addWidget( ccInput, 0, 1 ); |
114 | QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); | 114 | QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); |
115 | 115 | ||
116 | addressButton = new QToolButton( widget, "addressButton" ); | 116 | addressButton = new QToolButton( widget, "addressButton" ); |
117 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 117 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
118 | addressButton->setToggleButton(TRUE); | 118 | addressButton->setToggleButton(TRUE); |
119 | grid->addWidget( addressButton, 0, 2 ); | 119 | grid->addWidget( addressButton, 0, 2 ); |
120 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 120 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
121 | QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); | 121 | QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); |
122 | 122 | ||
123 | emailInput = new QMultiLineEdit( widget, "emailInput" ); | 123 | emailInput = new QMultiLineEdit( widget, "emailInput" ); |
124 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 124 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
125 | QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); | 125 | QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); |
126 | 126 | ||
127 | addressView = new QListView( widget, "addressView"); | 127 | addressView = new QListView( widget, "addressView"); |
128 | addressView->addColumn("Name"); | 128 | addressView->addColumn("Name"); |
129 | addressView->addColumn("EMail"); | 129 | addressView->addColumn("EMail"); |
130 | addressView->setAllColumnsShowFocus(TRUE); | 130 | addressView->setAllColumnsShowFocus(TRUE); |
131 | addressView->setMultiSelection(TRUE); | 131 | addressView->setMultiSelection(TRUE); |
132 | addressView->hide(); | 132 | addressView->hide(); |
133 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 133 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
134 | QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); | 134 | QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); |
135 | 135 | ||
136 | okButton = new QToolButton(bar, "ok"); | 136 | okButton = new QToolButton(bar, "ok"); |
137 | okButton->setPixmap( Resource::loadPixmap("enter") ); | 137 | okButton->setPixmap( Resource::loadPixmap("enter") ); |
138 | okButton->hide(); | 138 | okButton->hide(); |
139 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); | 139 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); |
140 | QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); | 140 | QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); |
141 | 141 | ||
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp index 18d14bc..f2b027c 100644 --- a/noncore/unsupported/mailit/addresslist.cpp +++ b/noncore/unsupported/mailit/addresslist.cpp | |||
@@ -1,161 +1,161 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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() | 27 | AddressList::AddressList() |
28 | { | 28 | { |
29 | addresses.setAutoDelete(TRUE); | 29 | addresses.setAutoDelete(TRUE); |
30 | read(); | 30 | read(); |
31 | dirty = FALSE; | 31 | dirty = FALSE; |
32 | } | 32 | } |
33 | 33 | ||
34 | AddressList::~AddressList() | 34 | AddressList::~AddressList() |
35 | { | 35 | { |
36 | addresses.clear(); | 36 | addresses.clear(); |
37 | } | 37 | } |
38 | 38 | ||
39 | void AddressList::addContact(const QString &email, const 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) ) { |
46 | Contact *in = new Contact; | 46 | AContact *in = new AContact; |
47 | in->email = email; | 47 | in->email = email; |
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(const 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(const 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(const 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 | AContact *ptr = addresses.at(pos); |
69 | return ptr->name; | 69 | return ptr->name; |
70 | } | 70 | } |
71 | 71 | ||
72 | return NULL; | 72 | return QString::null; |
73 | } | 73 | } |
74 | 74 | ||
75 | QString AddressList::getEmailByName(const 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 | AContact *ptr = addresses.at(pos); |
80 | return ptr->email; | 80 | return ptr->email; |
81 | } | 81 | } |
82 | 82 | ||
83 | return NULL; | 83 | return QString::null; |
84 | } | 84 | } |
85 | 85 | ||
86 | int AddressList::getEmailRef(const QString &email) | 86 | int AddressList::getEmailRef(const QString &email) |
87 | { | 87 | { |
88 | int pos = 0; | 88 | int pos = 0; |
89 | Contact *ptr; | 89 | AContact *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(const QString &name) | 99 | int AddressList::getNameRef(const QString &name) |
100 | { | 100 | { |
101 | int pos = 0; | 101 | int pos = 0; |
102 | Contact *ptr; | 102 | AContact *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) |
106 | return pos; | 106 | return pos; |
107 | pos++; | 107 | pos++; |
108 | } | 108 | } |
109 | return -1; | 109 | return -1; |
110 | } | 110 | } |
111 | 111 | ||
112 | QList<Contact>* AddressList::getContactList() | 112 | QList<AContact>* AddressList::getContactList() |
113 | { | 113 | { |
114 | return &addresses; | 114 | return &addresses; |
115 | } | 115 | } |
116 | 116 | ||
117 | void AddressList::read() | 117 | void AddressList::read() |
118 | { | 118 | { |
119 | OContactAccess::List::Iterator it; | 119 | OContactAccess::List::Iterator it; |
120 | 120 | ||
121 | QString lineEmail, lineName, email, name; | 121 | QString lineEmail, lineName, email, name; |
122 | OContactAccess m_contactdb("mailit"); | 122 | OContactAccess m_contactdb("mailit"); |
123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); | 123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); |
124 | //OContact* oc;(*it).defaultEmail() | 124 | //OContact* oc;(*it).defaultEmail() |
125 | 125 | ||
126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) | 126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) |
127 | { | 127 | { |
128 | //oc=(OContact*) it; | 128 | //oc=(OContact*) it; |
129 | if ((*it).defaultEmail().length()!=0) | 129 | if ((*it).defaultEmail().length()!=0) |
130 | addContact((*it).defaultEmail(),(*it).fileAs()); | 130 | addContact((*it).defaultEmail(),(*it).fileAs()); |
131 | } | 131 | } |
132 | 132 | ||
133 | /*if (! f.open(IO_ReadOnly) ) | 133 | /*if (! f.open(IO_ReadOnly) ) |
134 | return; | 134 | return; |
135 | 135 | ||
136 | QTextStream stream(&f); | 136 | QTextStream stream(&f); |
137 | 137 | ||
138 | while (! stream.atEnd() ) { | 138 | while (! stream.atEnd() ) { |
139 | lineEmail = stream.readLine(); | 139 | lineEmail = stream.readLine(); |
140 | if (! stream.atEnd() ) | 140 | if (! stream.atEnd() ) |
141 | lineName = stream.readLine(); | 141 | lineName = stream.readLine(); |
142 | else return; | 142 | else return; |
143 | 143 | ||
144 | email = getRightString(lineEmail); | 144 | email = getRightString(lineEmail); |
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(const 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(); |
158 | } | 158 | } |
159 | return out; | 159 | return out; |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/noncore/unsupported/mailit/addresslist.h b/noncore/unsupported/mailit/addresslist.h index b46d467..763b6d4 100644 --- a/noncore/unsupported/mailit/addresslist.h +++ b/noncore/unsupported/mailit/addresslist.h | |||
@@ -1,58 +1,58 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 | #ifndef ADDRESSLIST_H | 20 | #ifndef ADDRESSLIST_H |
21 | #define ADDRESSLIST_H | 21 | #define ADDRESSLIST_H |
22 | 22 | ||
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | 25 | ||
26 | struct Contact | 26 | struct AContact |
27 | { | 27 | { |
28 | QString email; | 28 | QString email; |
29 | QString name; | 29 | QString name; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | class AddressList : public QObject | 32 | 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(const QString &email, const QString &name); | 39 | void addContact(const QString &email, const QString &name); |
40 | bool containsEmail(const QString &email); | 40 | bool containsEmail(const QString &email); |
41 | bool containsName(const QString &name); | 41 | bool containsName(const QString &name); |
42 | QString getNameByEmail(const QString &email); | 42 | QString getNameByEmail(const QString &email); |
43 | QString getEmailByName(const QString &name); | 43 | QString getEmailByName(const QString &name); |
44 | QList<Contact>* getContactList(); | 44 | QList<AContact>* getContactList(); |
45 | 45 | ||
46 | private: | 46 | private: |
47 | int getEmailRef(const QString &email); | 47 | int getEmailRef(const QString &email); |
48 | int getNameRef(const QString &name); | 48 | int getNameRef(const QString &name); |
49 | QString getRightString(const 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<AContact> addresses; |
54 | QString filename; | 54 | QString filename; |
55 | bool dirty; | 55 | bool dirty; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index c75494e..0298cb3 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp | |||
@@ -1,141 +1,141 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qwhatsthis.h> | 21 | #include <qwhatsthis.h> |
22 | #include "writemail.h" | 22 | #include "writemail.h" |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) | 25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) |
26 | { | 26 | { |
27 | showingAddressList = FALSE; | 27 | showingAddressList = FALSE; |
28 | init(); | 28 | init(); |
29 | 29 | ||
30 | addAtt = new AddAtt(0, "Add Attachments"); | 30 | addAtt = new AddAtt(0, "Add Attachments"); |
31 | } | 31 | } |
32 | 32 | ||
33 | WriteMail::~WriteMail() | 33 | WriteMail::~WriteMail() |
34 | { | 34 | { |
35 | delete addAtt; | 35 | delete addAtt; |
36 | } | 36 | } |
37 | 37 | ||
38 | void WriteMail::setAddressList(AddressList *list) | 38 | void WriteMail::setAddressList(AddressList *list) |
39 | { | 39 | { |
40 | Contact *cPtr; | 40 | AContact *cPtr; |
41 | 41 | ||
42 | addressList = list; | 42 | addressList = list; |
43 | 43 | ||
44 | addressView->clear(); | 44 | addressView->clear(); |
45 | QList<Contact> *cListPtr = addressList->getContactList(); | 45 | QList<AContact> *cListPtr = addressList->getContactList(); |
46 | QListViewItem *item; | 46 | QListViewItem *item; |
47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { | 47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { |
48 | item = new QListViewItem(addressView, cPtr->name, cPtr->email); | 48 | item = new QListViewItem(addressView, cPtr->name, cPtr->email); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | void WriteMail::init() | 52 | void WriteMail::init() |
53 | { | 53 | { |
54 | setToolBarsMovable(FALSE); | 54 | setToolBarsMovable(FALSE); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | bar->setHorizontalStretchable( TRUE ); | 57 | bar->setHorizontalStretchable( TRUE ); |
58 | 58 | ||
59 | menu = new QMenuBar( bar ); | 59 | menu = new QMenuBar( bar ); |
60 | 60 | ||
61 | mailMenu = new QPopupMenu(menu); | 61 | mailMenu = new QPopupMenu(menu); |
62 | menu->insertItem( tr( "&Mail" ), mailMenu); | 62 | menu->insertItem( tr( "&Mail" ), mailMenu); |
63 | addMenu = new QPopupMenu(menu); | 63 | addMenu = new QPopupMenu(menu); |
64 | menu->insertItem( tr( "&Add" ), addMenu); | 64 | menu->insertItem( tr( "&Add" ), addMenu); |
65 | 65 | ||
66 | bar = new QToolBar(this); | 66 | bar = new QToolBar(this); |
67 | attachButton = new QAction(tr("Attachment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); | 67 | attachButton = new QAction(tr("Attachment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); |
68 | attachButton->addTo(bar); | 68 | attachButton->addTo(bar); |
69 | attachButton->addTo(addMenu); | 69 | attachButton->addTo(addMenu); |
70 | connect( attachButton, SIGNAL( activated() ), this, SLOT( attachFile() ) ); | 70 | connect( attachButton, SIGNAL( activated() ), this, SLOT( attachFile() ) ); |
71 | attachButton->setWhatsThis(tr("Click here to attach files to your mail")); | 71 | attachButton->setWhatsThis(tr("Click here to attach files to your mail")); |
72 | 72 | ||
73 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); | 73 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); |
74 | confirmButton->addTo(bar); | 74 | confirmButton->addTo(bar); |
75 | confirmButton->addTo(mailMenu); | 75 | confirmButton->addTo(mailMenu); |
76 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); | 76 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); |
77 | confirmButton->setWhatsThis(tr("This button puts your mail in the send queue")); | 77 | confirmButton->setWhatsThis(tr("This button puts your mail in the send queue")); |
78 | 78 | ||
79 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 79 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
80 | newButton->addTo(mailMenu); | 80 | newButton->addTo(mailMenu); |
81 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); | 81 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); |
82 | newButton->setWhatsThis(tr("Click here to create a new mail")); | 82 | newButton->setWhatsThis(tr("Click here to create a new mail")); |
83 | 83 | ||
84 | widget = new QWidget(this, "widget"); | 84 | widget = new QWidget(this, "widget"); |
85 | grid = new QGridLayout( widget ); | 85 | grid = new QGridLayout( widget ); |
86 | 86 | ||
87 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); | 87 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); |
88 | recipientsBox->insertItem( tr( "To:" ) ); | 88 | recipientsBox->insertItem( tr( "To:" ) ); |
89 | recipientsBox->insertItem( tr( "CC:" ) ); | 89 | recipientsBox->insertItem( tr( "CC:" ) ); |
90 | recipientsBox->setCurrentItem(0); | 90 | recipientsBox->setCurrentItem(0); |
91 | grid->addWidget( recipientsBox, 0, 0 ); | 91 | grid->addWidget( recipientsBox, 0, 0 ); |
92 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); | 92 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); |
93 | 93 | ||
94 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 94 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
95 | subjetLabel->setText( tr( "Subject:" ) ); | 95 | subjetLabel->setText( tr( "Subject:" ) ); |
96 | 96 | ||
97 | grid->addWidget( subjetLabel, 1, 0 ); | 97 | grid->addWidget( subjetLabel, 1, 0 ); |
98 | 98 | ||
99 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); | 99 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); |
100 | ToolButton13_2->setText( tr( "..." ) ); | 100 | ToolButton13_2->setText( tr( "..." ) ); |
101 | grid->addWidget( ToolButton13_2, 1, 2 ); | 101 | grid->addWidget( ToolButton13_2, 1, 2 ); |
102 | 102 | ||
103 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 103 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
104 | grid->addWidget( subjectInput, 1, 1 ); | 104 | grid->addWidget( subjectInput, 1, 1 ); |
105 | QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); | 105 | QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); |
106 | 106 | ||
107 | toInput = new QLineEdit( widget, "toInput" ); | 107 | toInput = new QLineEdit( widget, "toInput" ); |
108 | grid->addWidget( toInput, 0, 1 ); | 108 | grid->addWidget( toInput, 0, 1 ); |
109 | QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); | 109 | QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); |
110 | 110 | ||
111 | ccInput = new QLineEdit( widget, "ccInput" ); | 111 | ccInput = new QLineEdit( widget, "ccInput" ); |
112 | ccInput->hide(); | 112 | ccInput->hide(); |
113 | grid->addWidget( ccInput, 0, 1 ); | 113 | grid->addWidget( ccInput, 0, 1 ); |
114 | QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); | 114 | QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); |
115 | 115 | ||
116 | addressButton = new QToolButton( widget, "addressButton" ); | 116 | addressButton = new QToolButton( widget, "addressButton" ); |
117 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 117 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
118 | addressButton->setToggleButton(TRUE); | 118 | addressButton->setToggleButton(TRUE); |
119 | grid->addWidget( addressButton, 0, 2 ); | 119 | grid->addWidget( addressButton, 0, 2 ); |
120 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 120 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
121 | QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); | 121 | QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); |
122 | 122 | ||
123 | emailInput = new QMultiLineEdit( widget, "emailInput" ); | 123 | emailInput = new QMultiLineEdit( widget, "emailInput" ); |
124 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 124 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
125 | QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); | 125 | QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); |
126 | 126 | ||
127 | addressView = new QListView( widget, "addressView"); | 127 | addressView = new QListView( widget, "addressView"); |
128 | addressView->addColumn("Name"); | 128 | addressView->addColumn("Name"); |
129 | addressView->addColumn("EMail"); | 129 | addressView->addColumn("EMail"); |
130 | addressView->setAllColumnsShowFocus(TRUE); | 130 | addressView->setAllColumnsShowFocus(TRUE); |
131 | addressView->setMultiSelection(TRUE); | 131 | addressView->setMultiSelection(TRUE); |
132 | addressView->hide(); | 132 | addressView->hide(); |
133 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 133 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
134 | QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); | 134 | QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); |
135 | 135 | ||
136 | okButton = new QToolButton(bar, "ok"); | 136 | okButton = new QToolButton(bar, "ok"); |
137 | okButton->setPixmap( Resource::loadPixmap("enter") ); | 137 | okButton->setPixmap( Resource::loadPixmap("enter") ); |
138 | okButton->hide(); | 138 | okButton->hide(); |
139 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); | 139 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); |
140 | QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); | 140 | QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); |
141 | 141 | ||