summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/addresslist.cpp16
-rw-r--r--noncore/net/mailit/addresslist.h6
-rw-r--r--noncore/net/mailit/writemail.cpp4
-rw-r--r--noncore/unsupported/mailit/addresslist.cpp16
-rw-r--r--noncore/unsupported/mailit/addresslist.h6
-rw-r--r--noncore/unsupported/mailit/writemail.cpp4
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,160 +1,160 @@
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
27AddressList::AddressList() 27AddressList::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
34AddressList::~AddressList() 34AddressList::~AddressList()
35{ 35{
36 addresses.clear(); 36 addresses.clear();
37} 37}
38 38
39void AddressList::addContact(const QString &email, const QString &name) 39void 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
54bool AddressList::containsEmail(const QString &email) 54bool AddressList::containsEmail(const QString &email)
55{ 55{
56 return ( getEmailRef(email) != -1 ); 56 return ( getEmailRef(email) != -1 );
57} 57}
58 58
59bool AddressList::containsName(const QString &name) 59bool AddressList::containsName(const QString &name)
60{ 60{
61 return ( getNameRef(name) != -1 ); 61 return ( getNameRef(name) != -1 );
62} 62}
63 63
64QString AddressList::getNameByEmail(const QString &email) 64QString 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
75QString AddressList::getEmailByName(const QString &name) 75QString 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
86int AddressList::getEmailRef(const QString &email) 86int 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
99int AddressList::getNameRef(const QString &name) 99int 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
112QList<Contact>* AddressList::getContactList() 112QList<AContact>* AddressList::getContactList()
113{ 113{
114 return &addresses; 114 return &addresses;
115} 115}
116 116
117void AddressList::read() 117void 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
151QString AddressList::getRightString(const QString &in) 151QString 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}
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
26struct Contact 26struct AContact
27{ 27{
28 QString email; 28 QString email;
29 QString name; 29 QString name;
30}; 30};
31 31
32class AddressList : public QObject 32class AddressList : public QObject
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
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
46private: 46private:
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
52private: 52private:
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,93 +1,93 @@
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
25WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) 25WriteMail::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
33WriteMail::~WriteMail() 33WriteMail::~WriteMail()
34{ 34{
35 delete addAtt; 35 delete addAtt;
36} 36}
37 37
38void WriteMail::setAddressList(AddressList *list) 38void 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
52void WriteMail::init() 52void 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
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,160 +1,160 @@
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
27AddressList::AddressList() 27AddressList::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
34AddressList::~AddressList() 34AddressList::~AddressList()
35{ 35{
36 addresses.clear(); 36 addresses.clear();
37} 37}
38 38
39void AddressList::addContact(const QString &email, const QString &name) 39void 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
54bool AddressList::containsEmail(const QString &email) 54bool AddressList::containsEmail(const QString &email)
55{ 55{
56 return ( getEmailRef(email) != -1 ); 56 return ( getEmailRef(email) != -1 );
57} 57}
58 58
59bool AddressList::containsName(const QString &name) 59bool AddressList::containsName(const QString &name)
60{ 60{
61 return ( getNameRef(name) != -1 ); 61 return ( getNameRef(name) != -1 );
62} 62}
63 63
64QString AddressList::getNameByEmail(const QString &email) 64QString 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
75QString AddressList::getEmailByName(const QString &name) 75QString 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
86int AddressList::getEmailRef(const QString &email) 86int 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
99int AddressList::getNameRef(const QString &name) 99int 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
112QList<Contact>* AddressList::getContactList() 112QList<AContact>* AddressList::getContactList()
113{ 113{
114 return &addresses; 114 return &addresses;
115} 115}
116 116
117void AddressList::read() 117void 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
151QString AddressList::getRightString(const QString &in) 151QString 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}
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
26struct Contact 26struct AContact
27{ 27{
28 QString email; 28 QString email;
29 QString name; 29 QString name;
30}; 30};
31 31
32class AddressList : public QObject 32class AddressList : public QObject
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
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
46private: 46private:
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
52private: 52private:
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,93 +1,93 @@
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
25WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) 25WriteMail::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
33WriteMail::~WriteMail() 33WriteMail::~WriteMail()
34{ 34{
35 delete addAtt; 35 delete addAtt;
36} 36}
37 37
38void WriteMail::setAddressList(AddressList *list) 38void 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
52void WriteMail::init() 52void 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