summaryrefslogtreecommitdiff
authoreilers <eilers>2002-12-27 12:25:08 (UTC)
committer eilers <eilers>2002-12-27 12:25:08 (UTC)
commit36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9 (patch) (side-by-side diff)
tree82c1e5d1763f7f3afbc9b02f48894f2ca24ef764
parenteea5575187d95968ad76b49e4334e1165952163c (diff)
downloadopie-36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9.zip
opie-36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9.tar.gz
opie-36c8b8ffff2c8a7a454aa1b8afbe96bd9b1535f9.tar.bz2
Children and nickname was not shown .. fixed !
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 254cff7..1b83308 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -2,143 +2,164 @@
* Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
* Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de)
*
* This file is an add-on for the OPIE Palmtop Environment
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in the pacakaging
* of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* This is a rewrite of the abeditor.h file, modified to provide a more
* intuitive interface to TrollTech's original Address Book editor. This
* is made to operate exactly in interface with the exception of name.
*
*/
#include "contacteditor.h"
#include "addresspicker.h"
#include "ocontactfields.h"
#include <qpe/categoryselect.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
#include <qpe/timeconversion.h>
#include <opie/ocontact.h>
#include <qpe/resource.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qscrollview.h>
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <qmainwindow.h>
#include <qvaluelist.h>
#include <qpopupmenu.h>
#include <qlistbox.h>
#include <qhbox.h>
#include <qaction.h>
#include <qiconset.h>
+#include <assert.h>
+
static inline bool containsAlphaNum( const QString &str );
static inline bool constainsWhiteSpace( const QString &str );
// helper functions, convert our comma delimited list to proper
// file format...
void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
QString &strAll );
// helper convert from file format to comma delimited...
void parseEmailTo( const QString &strDefaultEmail,
const QString &strOtherEmail, QString &strBack );
ContactEditor::ContactEditor( const OContact &entry,
QWidget *parent,
const char *name,
WFlags fl )
: QDialog( parent, name, TRUE, fl ),
m_personalView ( false )
{
init();
setEntry( entry );
cmbDefaultEmail = 0;
defaultEmailChooserPosition = -1;
}
ContactEditor::~ContactEditor() {
}
void ContactEditor::init() {
useFullName = true;
uint i = 0;
QStringList trlChooserNames;
for (i = 0; i <= 6; i++) {
slHomeAddress.append( "" );
slBusinessAddress.append( "" );
}
trlChooserNames = OContactFields::trphonefields( false );
slChooserNames = OContactFields::untrphonefields( false );
slDynamicEntries = OContactFields::untrdetailsfields( false );
trlDynamicEntries = OContactFields::trdetailsfields( false );
+
+ // Ok, we have to remove elements from the list of dynamic entries
+ // which are now stored in special (not dynamic) widgets..
+ // Otherwise we will get problems with field assignments! (se)
+ slDynamicEntries.remove("Anniversary");
+ slDynamicEntries.remove("Birthday");
+ slDynamicEntries.remove("Gender");
+
+ // The same with translated fields.. But I will
+ // use the translation map to avoid mismatches..
+ QMap<int, QString> translMap = OContactFields::idToTrFields();
+ trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
+ trlDynamicEntries.remove( translMap[Qtopia::Birthday] );
+ trlDynamicEntries.remove( translMap[Qtopia::Gender] );
+
+ // Last Check to be sure..
+ assert( slDynamicEntries.count() == trlDynamicEntries.count() );
+ assert( slChooserNames.count() == trlChooserNames.count() );
+
for (i = 0; i < slChooserNames.count(); i++)
slChooserValues.append("");
QVBoxLayout *vb = new QVBoxLayout( this );
tabMain = new QTabWidget( this );
vb->addWidget( tabMain );
QWidget *tabViewport = new QWidget ( tabMain );
vb = new QVBoxLayout( tabViewport );
svGeneral = new QScrollView( tabViewport );
vb->addWidget( svGeneral, 0, 0 );
svGeneral->setResizePolicy( QScrollView::AutoOneFit );
svGeneral->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( svGeneral->viewport() );
svGeneral->addChild( container );
QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
gl->setResizeMode( QLayout::FreeResize );
btnFullName = new QPushButton( tr( "Full Name..." ), container );
gl->addWidget( btnFullName, 0, 0 );
txtFullName = new QLineEdit( container );
gl->addWidget( txtFullName, 0, 1 );
QLabel *l = new QLabel( tr( "Job Title" ), container );
gl->addWidget( l, 1, 0 );
txtJobTitle = new QLineEdit( container );
gl->addWidget( txtJobTitle, 1, 1 );
l = new QLabel( tr( "Organization" ), container );
gl->addWidget( l, 2, 0 );
txtOrganization = new QLineEdit( container );
gl->addWidget( txtOrganization, 2, 1 );
cmbChooserField1 = new QComboBox( FALSE, container );
cmbChooserField1->setMaximumWidth( 90 );
gl->addWidget( cmbChooserField1, 3, 0 );
txtChooserField1 = new QLineEdit( container );
gl->addWidget( txtChooserField1, 3, 1 );
cmbChooserField2 = new QComboBox( FALSE, container );
cmbChooserField2->setMaximumWidth( 90 );
gl->addWidget( cmbChooserField2, 4, 0 );
@@ -1131,119 +1152,124 @@ void ContactEditor::setEntry( const OContact &entry ) {
txtLastName->setText( ent.lastName() );
txtSuffix->setText( ent.suffix() );
QString *tmpString = new QString;
*tmpString = ent.firstName() + " " + ent.middleName() +
+ " " + ent.lastName() + " " + ent.suffix();
txtFullName->setText( tmpString->simplifyWhiteSpace() );
cmbFileAs->setEditText( ent.fileAs() );
// if (hasTitle)
txtJobTitle->setText( ent.jobTitle() );
// if (hasCompany)
txtOrganization->setText( ent.company() );
// if (hasNotes)
txtNote->setText( ent.notes() );
// if (hasStreet) {
slHomeAddress[0] = ent.homeStreet();
slBusinessAddress[0] = ent.businessStreet();
// }
// if (hasCity) {
slHomeAddress[3] = ent.homeCity();
slBusinessAddress[3] = ent.businessCity();
//}
//if (hasState) {
slHomeAddress[4] = ent.homeState();
slBusinessAddress[4] = ent.businessState();
//}
//if (hasZip) {
slHomeAddress[5] = ent.homeZip();
slBusinessAddress[5] = ent.businessZip();
//}
//if (hasCountry) {
slHomeAddress[6] = ent.homeCountry();
slBusinessAddress[6] = ent.businessCountry();
//}
QStringList::ConstIterator it;
QListIterator<QLineEdit> itLE( listValue );
for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
+
+ qWarning(" Filling dynamic Field: %s", (*it).latin1() );
+
if ( *it == "Department" )
(*itLE)->setText( ent.department() );
if ( *it == "Company" )
(*itLE)->setText( ent.company() );
if ( *it == "Office" )
(*itLE)->setText( ent.office() );
if ( *it == "Profession" )
(*itLE)->setText( ent.profession() );
if ( *it == "Assistant" )
(*itLE)->setText( ent.assistant() );
if ( *it == "Manager" )
(*itLE)->setText( ent.manager() );
if ( *it == "Spouse" )
(*itLE)->setText( ent.spouse() );
- if ( *it == "Nickname" )
+ if ( *it == "Nickname" ){
+ qWarning("**** Nichname: %s", ent.nickname().latin1() );
(*itLE)->setText( ent.nickname() );
+ }
if ( *it == "Children" )
(*itLE)->setText( ent.children() );
}
QStringList::Iterator itV;
for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
*itV = ent.businessPhone();
/*
if ( *it == "Business 2 Phone" )
*itV = ent.business2Phone();
*/
if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
*itV = ent.businessFax();
if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
*itV = ent.businessMobile();
/*
if ( *it == "Company Phone" )
*itV = ent.companyPhone();
*/
if ( *it == "Default Email" )
*itV = ent.defaultEmail();
if ( *it == "Emails" )
*itV = ent.emailList().join(", "); // :SX
if ( *it == "Home Phone" )
*itV = ent.homePhone();
/*
if ( *it == "Home 2 Phone" )
*itV = ent.home2Phone();
*/
if ( *it == "Home Fax" )
*itV = ent.homeFax();
if ( *it == "Home Mobile" )
*itV = ent.homeMobile();
/*
if ( *it == "Car Phone" )
*itV = ent.carPhone();
if ( *it == "ISDN Phone" )
*itV = ent.ISDNPhone();