summaryrefslogtreecommitdiff
path: root/noncore/net/mail/addresspicker.cpp
authorar <ar>2004-02-21 15:27:41 (UTC)
committer ar <ar>2004-02-21 15:27:41 (UTC)
commit460258f203be746ff79e14f32a823f381b8ea513 (patch) (side-by-side diff)
tree87dddbacda3050027d343730cf021b53045e80cb /noncore/net/mail/addresspicker.cpp
parent76b70b355d2c1c32c0f74e844e0654e39db2a175 (diff)
downloadopie-460258f203be746ff79e14f32a823f381b8ea513.zip
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.gz
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.bz2
improve support for BigScreen
Diffstat (limited to 'noncore/net/mail/addresspicker.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/addresspicker.cpp120
1 files changed, 67 insertions, 53 deletions
diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp
index f4f4cea..8cdabde 100644
--- a/noncore/net/mail/addresspicker.cpp
+++ b/noncore/net/mail/addresspicker.cpp
@@ -1,20 +1,24 @@
+
+#include "composemail.h"
+
+/* OPIE */
+#include <opie2/ocontactaccess.h>
+#include <opie2/ocontact.h>
+#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qlistbox.h>
#include <qfile.h>
-#include <qpe/resource.h>
-#include <opie2/ocontactaccess.h>
-#include <opie2/ocontact.h>
-
-
+/* STD */
#include <stdlib.h>
-#include "composemail.h"
-
-AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags )
- : AddressPickerUI( parent, name, modal, flags )
+AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags )
+ : AddressPickerUI( parent, name, modal, flags )
{
okButton->setIconSet( Resource::loadPixmap( "enter" ) );
cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) );
@@ -26,75 +30,85 @@ AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFl
QString lineEmail, lineName, contactLine;
/* what name has to set here???? */
Opie::OContactAccess m_contactdb("opiemail");
-
+
QStringList mails;
QString pre,suf;
Opie::OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
- for ( it = m_list.begin(); it != m_list.end(); ++it ) {
- if ((*it).defaultEmail().length()!=0) {
+ for ( it = m_list.begin(); it != m_list.end(); ++it )
+ {
+ if ((*it).defaultEmail().length()!=0)
+ {
mails = (*it).emailList();
- if ((*it).fileAs().length()>0) {
+ if ((*it).fileAs().length()>0)
+ {
pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <";
suf = ">";
- } else {
+ }
+ else
+ {
pre = "";
suf = "";
}
QStringList::ConstIterator sit = mails.begin();
- for (;sit!=mails.end();++sit) {
+ for (;sit!=mails.end();++sit)
+ {
contactLine=pre+(*sit)+suf;
addressList->insertItem(contactLine);
- }
+ }
}
}
- if ( addressList->count() <= 0 ) {
+ if ( addressList->count() <= 0 )
+ {
#if 0
- // makes this realy sense??
- addressList->insertItem(
+ // makes this realy sense??
+ addressList->insertItem(
tr( "There are no entries in the addressbook." ) );
#endif
- addressList->setEnabled( false );
- okButton->setEnabled( false );
- } else {
-// addressList->sort();
+ addressList->setEnabled( false );
+ okButton->setEnabled( false );
+ }
+ else
+ {
+ // addressList->sort();
}
}
void AddressPicker::accept()
{
- QListBoxItem *item = addressList->firstItem();
- QString names;
-
- while ( item ) {
- if ( item->selected() )
- names += item->text() + ", ";
- item = item->next();
- }
- names.replace( names.length() - 2, 2, "" );
-
- if ( names.isEmpty() ) {
- QMessageBox::information(this, tr("Error"), tr("<p>You have to select"
- " at least one address entry.</p>"), tr("Ok"));
- return;
- }
-
- selectedNames = names;
- QDialog::accept();
+ QListBoxItem *item = addressList->firstItem();
+ QString names;
+
+ while ( item )
+ {
+ if ( item->selected() )
+ names += item->text() + ", ";
+ item = item->next();
+ }
+ names.replace( names.length() - 2, 2, "" );
+
+ if ( names.isEmpty() )
+ {
+ QMessageBox::information(this, tr("Error"), tr("<p>You have to select"
+ " at least one address entry.</p>"), tr("Ok"));
+ return;
+ }
+
+ selectedNames = names;
+ QDialog::accept();
}
QString AddressPicker::getNames()
{
- QString names = 0;
-
- AddressPicker picker(0, 0, true);
- picker.showMaximized();
- picker.show();
-
- int ret = picker.exec();
- if ( QDialog::Accepted == ret ) {
- return picker.selectedNames;
- }
-
- return 0;
+ QString names = 0;
+
+ AddressPicker picker(0, 0, true);
+
+ int ret = QPEApplication::execDialog( &picker );
+ if ( QDialog::Accepted == ret )
+ {
+ return picker.selectedNames;
+ }
+
+ return 0;
}