author | simon <simon> | 2002-04-30 06:26:17 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 06:26:17 (UTC) |
commit | f521dd69afdd07f46e41299846880289b727514b (patch) (side-by-side diff) | |
tree | 1e9fe07ead05cf0ddfbf34438f4e2d85c1e87380 | |
parent | 702c4b745d42d9ad5fdcede0a40d85ea1b0577a6 (diff) | |
download | opie-f521dd69afdd07f46e41299846880289b727514b.zip opie-f521dd69afdd07f46e41299846880289b727514b.tar.gz opie-f521dd69afdd07f46e41299846880289b727514b.tar.bz2 |
- no default arguments in method implementations
- don't return void in non-void functions
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index adea1a1..e74da87 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -1,153 +1,153 @@ /* * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> * * 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 <qpe/categoryselect.h> #include <qpe/qpeapplication.h> #include <qpe/qpedialog.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> 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 Contact &entry, const QValueList<int> *newOrderedValues, QStringList *slNewOrdered, - QWidget *parent = 0, - const char *name = 0, - WFlags fl = 0 ) + QWidget *parent, + const char *name, + WFlags fl ) : QDialog( parent, name, TRUE, fl ), orderedValues( newOrderedValues ), slOrdered( slNewOrdered ) { init(); initMap(); setEntry( entry ); qDebug("finish"); } ContactEditor::~ContactEditor() { } void ContactEditor::init() { useFullName = TRUE; int i = 0; slHomeAddress = new QStringList; slBusinessAddress = new QStringList; slChooserNames = new QStringList; slChooserValues = new QStringList; slDynamicEntries = new QStringList; //*slDynamicEntries = *slOrdered; for (i = 0; i <= 6; i++) { slHomeAddress->append( "" ); slBusinessAddress->append( "" ); } { hasGender = FALSE; hasTitle = FALSE; hasCompany = FALSE; hasNotes = FALSE; hasStreet = FALSE; hasStreet2 = FALSE; hasPOBox = FALSE; hasCity = FALSE; hasState = FALSE; hasZip = FALSE; hasCountry = FALSE; QStringList::ConstIterator it = slOrdered->begin(); for ( i = 0; it != slOrdered->end(); i++, ++it ) { if ( (*it).right( 3 ) == tr( "Fax" ) ) { slChooserNames->append( *it ); slChooserValues->append( tr( "" ) ); //slDynamicEntries->remove( it ); continue; } if ( (*it).right( 5 ) == tr( "Phone" ) ) { slChooserNames->append( *it ); slChooserValues->append( "" ); //slDynamicEntries->remove( it ); continue; } if ( (*it).right( 2 ) == tr( "IM" ) ) { slChooserNames->append( *it ); slChooserValues->append( "" ); //slDynamicEntries->remove( it ); continue; } if ( (*it).right( 6 ) == tr( "Mobile" ) ) { slChooserNames->append( *it ); slChooserValues->append( "" ); //slDynamicEntries->remove( it ); continue; } if ( (*it).right( 4 ) == tr( "Page" ) ) { slChooserNames->append( *it ); slChooserValues->append( "" ); //slDynamicEntries->remove( it ); continue; } if ( (*it).right( 5 ) == tr( "Pager" ) ) { slChooserNames->append( *it ); slChooserValues->append( "" ); //slDynamicEntries->remove( it ); continue; } if ( *it == tr( "Default Email" ) ) { slChooserNames->append( *it ); slChooserValues->append( "" ); //slDynamicEntries->remove( it ); @@ -1032,192 +1032,193 @@ QString ContactEditor::parseName( const QString fullName, int type ) { default: spPos = simplifiedName.find( ' ', 0, TRUE ); strTitle = simplifiedName.left( spPos ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); strSuffix = simplifiedName.mid( spPos2 + 1 ); break; } } else { simplifiedName.replace( commapos, 1, " " ); simplifiedName = simplifiedName.simplifyWhiteSpace(); switch (spCount) { case 0: return simplifiedName; case 1: spPos = simplifiedName.find( ' ', 0, TRUE ); strLastName = simplifiedName.left( spPos ); strFirstName = simplifiedName.mid( spPos + 1 ); break; case 2: spPos = simplifiedName.find( ' ', 0, TRUE ); strLastName = simplifiedName.left( spPos ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); strMiddleName = simplifiedName.mid( spPos2 + 1 ); break; case 3: spPos = simplifiedName.find( ' ', 0, TRUE ); strLastName = simplifiedName.left( spPos ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); strSuffix = simplifiedName.mid( spPos + 1 ); break; case 4: spPos = simplifiedName.find( ' ', 0, TRUE ); strLastName = simplifiedName.left( spPos ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); strSuffix = simplifiedName.mid( spPos2 + 1 ); break; default: spPos = simplifiedName.find( ' ', 0, TRUE ); strLastName = simplifiedName.left( spPos ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); strSuffix = simplifiedName.mid( spPos2 + 1 ); break; } } switch (type) { case NAME_FL: return strFirstName + " " + strLastName; case NAME_LF: return strLastName + ", " + strFirstName; case NAME_LFM: return strLastName + ", " + strFirstName + " " + strMiddleName; case NAME_FMLS: return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; case NAME_F: return strFirstName; case NAME_M: return strMiddleName; case NAME_L: return strLastName; case NAME_S: return strSuffix; } + return QString::null; } void ContactEditor::cleanupFields() { QStringList::Iterator it = slChooserValues->begin(); for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { (*it) = ""; } for ( int i = 0; i < 7; i++ ) { (*slHomeAddress)[i] = ""; (*slBusinessAddress)[i] = ""; } QStringList::ConstIterator cit; QListIterator<QLineEdit> itLE( listValue ); for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { (*itLE)->setText( "" ); } txtFirstName->setText(""); txtMiddleName->setText(""); txtLastName->setText(""); txtSuffix->setText(""); txtNote->setText(""); txtFullName->setText(""); txtJobTitle->setText(""); txtOrganization->setText(""); txtChooserField1->setText(""); txtChooserField2->setText(""); txtChooserField3->setText(""); txtAddress->setText(""); //txtAddress2->setText(""); txtCity->setText(""); //txtPOBox->setText(""); txtState->setText(""); txtZip->setText(""); QLineEdit *txtTmp = cmbCountry->lineEdit(); txtTmp->setText(""); txtTmp = cmbFileAs->lineEdit(); txtTmp->setText(""); } void ContactEditor::setEntry( const Contact &entry ) { cleanupFields(); ent = entry; useFullName = FALSE; txtFirstName->setText( ent.firstName() ); txtMiddleName->setText( ent.middleName() ); 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 (hasStreet2) { (*slHomeAddress)[1] = ent.homeStreet2(); (*slBusinessAddress)[1] = ent.businessStreet2(); } if (hasPOBox) { (*slHomeAddress)[2] = ent.homePOBox(); (*slBusinessAddress)[2] = ent.businessPOBox(); } */ if (hasCity) { (*slHomeAddress)[3] = ent.homeCity(); (*slBusinessAddress)[3] = ent.businessCity(); } if (hasState) { (*slHomeAddress)[4] = ent.homeState(); |