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