summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/addresspicker.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp
index 7857870..c6dec35 100644
--- a/noncore/net/mail/addresspicker.cpp
+++ b/noncore/net/mail/addresspicker.cpp
@@ -1,92 +1,92 @@
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#include <opie/ocontactaccess.h> 8#include <opie/ocontactaccess.h>
9#include <opie/ocontact.h> 9#include <opie/ocontact.h>
10 10
11 11
12#include <stdlib.h> 12#include <stdlib.h>
13 13
14#include "composemail.h" 14#include "composemail.h"
15 15
16AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags ) 16AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags )
17 : AddressPickerUI( parent, name, modal, flags ) 17 : AddressPickerUI( parent, name, modal, flags )
18{ 18{
19 okButton->setIconSet( Resource::loadPixmap( "enter" ) ); 19 okButton->setIconSet( Resource::loadPixmap( "enter" ) );
20 cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) ); 20 cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) );
21 21
22 connect(okButton, SIGNAL(clicked()), SLOT(accept())); 22 connect(okButton, SIGNAL(clicked()), SLOT(accept()));
23 connect(cancelButton, SIGNAL(clicked()), SLOT(close())); 23 connect(cancelButton, SIGNAL(clicked()), SLOT(close()));
24 OContactAccess::List::Iterator it; 24 OContactAccess::List::Iterator it;
25 25
26 QString lineEmail, lineName, contactLine; 26 QString lineEmail, lineName, contactLine;
27 /* what name has to set here???? */ 27 /* what name has to set here???? */
28 OContactAccess m_contactdb("addressbook"); 28 OContactAccess m_contactdb("opiemail");
29 QStringList mails; 29 QStringList mails;
30 QString pre,suf; 30 QString pre,suf;
31 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); 31 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
32 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 32 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
33 if ((*it).defaultEmail().length()!=0) { 33 if ((*it).defaultEmail().length()!=0) {
34 mails = (*it).emailList(); 34 mails = (*it).emailList();
35 if ((*it).fileAs().length()>0) { 35 if ((*it).fileAs().length()>0) {
36 pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <"; 36 pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <";
37 suf = ">"; 37 suf = ">";
38 } else { 38 } else {
39 pre = ""; 39 pre = "";
40 suf = ""; 40 suf = "";
41 } 41 }
42 QStringList::ConstIterator sit = mails.begin(); 42 QStringList::ConstIterator sit = mails.begin();
43 for (;sit!=mails.end();++sit) { 43 for (;sit!=mails.end();++sit) {
44 contactLine=pre+(*sit)+suf; 44 contactLine=pre+(*sit)+suf;
45 addressList->insertItem(contactLine); 45 addressList->insertItem(contactLine);
46 } 46 }
47 } 47 }
48 } 48 }
49 if ( addressList->count() <= 0 ) { 49 if ( addressList->count() <= 0 ) {
50#if 0 50#if 0
51 // makes this realy sense?? 51 // makes this realy sense??
52 addressList->insertItem( 52 addressList->insertItem(
53 tr( "There are no entries in the addressbook." ) ); 53 tr( "There are no entries in the addressbook." ) );
54#endif 54#endif
55 addressList->setEnabled( false ); 55 addressList->setEnabled( false );
56 okButton->setEnabled( false ); 56 okButton->setEnabled( false );
57 } else { 57 } else {
58// addressList->sort(); 58// addressList->sort();
59 } 59 }
60} 60}
61 61
62void AddressPicker::accept() 62void AddressPicker::accept()
63{ 63{
64 QListBoxItem *item = addressList->firstItem(); 64 QListBoxItem *item = addressList->firstItem();
65 QString names; 65 QString names;
66 66
67 while ( item ) { 67 while ( item ) {
68 if ( item->selected() ) 68 if ( item->selected() )
69 names += item->text() + ", "; 69 names += item->text() + ", ";
70 item = item->next(); 70 item = item->next();
71 } 71 }
72 names.replace( names.length() - 2, 2, "" ); 72 names.replace( names.length() - 2, 2, "" );
73 73
74 if ( names.isEmpty() ) { 74 if ( names.isEmpty() ) {
75 QMessageBox::information(this, tr("Error"), tr("<p>You have to select" 75 QMessageBox::information(this, tr("Error"), tr("<p>You have to select"
76 " at least one address entry.</p>"), tr("Ok")); 76 " at least one address entry.</p>"), tr("Ok"));
77 return; 77 return;
78 } 78 }
79 79
80 selectedNames = names; 80 selectedNames = names;
81 QDialog::accept(); 81 QDialog::accept();
82} 82}
83 83
84QString AddressPicker::getNames() 84QString AddressPicker::getNames()
85{ 85{
86 QString names = 0; 86 QString names = 0;
87 87
88 AddressPicker picker(0, 0, true); 88 AddressPicker picker(0, 0, true);
89 picker.showMaximized(); 89 picker.showMaximized();
90 picker.show(); 90 picker.show();
91 91
92 int ret = picker.exec(); 92 int ret = picker.exec();