summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/contacteditor.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp327
1 files changed, 164 insertions, 163 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 8acf570..534666d 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -23,2 +23,4 @@
+#include <opie2/opimcontact.h>
+
#include <qpe/categoryselect.h>
@@ -26,3 +28,2 @@
#include <qpe/qpedialog.h>
-#include <opie/ocontact.h>
#include <qpe/resource.h>
@@ -35,4 +36,4 @@
#include <qtoolbutton.h>
-#include <qlistbox.h>
-#include <qmessagebox.h>
+#include <qlistbox.h>
+#include <qmessagebox.h>
#include <qwhatsthis.h>
@@ -53,3 +54,3 @@ void parseEmailTo( const QString &strDefaultEmail,
-ContactEditor::ContactEditor( const OContact &entry,
+ContactEditor::ContactEditor( const Opie::OPimContact &entry,
QWidget *parent,
@@ -79,3 +80,3 @@ void ContactEditor::init() {
qWarning("init() START");
-
+
uint i = 0;
@@ -89,6 +90,6 @@ void ContactEditor::init() {
- trlChooserNames = OContactFields::trphonefields( false );
- slChooserNames = OContactFields::untrphonefields( false );
- slDynamicEntries = OContactFields::untrdetailsfields( false );
- trlDynamicEntries = OContactFields::trdetailsfields( false );
+ trlChooserNames = Opie::OPimContactFields::trphonefields( false );
+ slChooserNames = Opie::OPimContactFields::untrphonefields( false );
+ slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false );
+ trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false );
@@ -103,3 +104,3 @@ void ContactEditor::init() {
// use the translation map to avoid mismatches..
- QMap<int, QString> translMap = OContactFields::idToTrFields();
+ QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields();
trlDynamicEntries.remove( translMap[Qtopia::Anniversary] );
@@ -166,3 +167,3 @@ void ContactEditor::init() {
- // Chooser 1
+ // Chooser 1
cmbChooserField1 = new QComboBox( FALSE, container );
@@ -531,3 +532,3 @@ void ContactEditor::init() {
- QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
+ QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
tr( "Delete" ),
@@ -556,3 +557,3 @@ void ContactEditor::init() {
- deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
+ deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
tr( "Delete" ),
@@ -580,7 +581,7 @@ void ContactEditor::init() {
QStringList::ConstIterator it = slDynamicEntries.begin();
- QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId();
- QMap<int, QString> mapIdToStr = OContactFields::idToTrFields();
+ QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId();
+ QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields();
for (i = counter; it != slDynamicEntries.end(); i++, ++it ) {
-
- if (((*it) == "Anniversary") ||
+
+ if (((*it) == "Anniversary") ||
((*it) == "Birthday")|| ((*it) == "Gender")) continue;
@@ -646,7 +647,7 @@ void ContactEditor::init() {
- connect( txtFullName, SIGNAL(textChanged(const QString&)),
+ connect( txtFullName, SIGNAL(textChanged(const QString&)),
this, SLOT(slotFullNameChange(const QString&)) );
- connect( txtSuffix, SIGNAL(textChanged(const QString&)),
+ connect( txtSuffix, SIGNAL(textChanged(const QString&)),
this, SLOT(slotSuffixChange(const QString&)) );
- connect( txtOrganization, SIGNAL(textChanged(const QString&)),
+ connect( txtOrganization, SIGNAL(textChanged(const QString&)),
this, SLOT(slotOrganizationChange(const QString&)) );
@@ -702,3 +703,3 @@ void ContactEditor::defaultEmailChanged(int i){
-void ContactEditor::populateDefaultEmailCmb(){
+void ContactEditor::populateDefaultEmailCmb(){
@@ -707,6 +708,6 @@ void ContactEditor::populateDefaultEmailCmb(){
if ( !cmbDefaultEmail ){
- cmbDefaultEmail = new QComboBox(this);
+ cmbDefaultEmail = new QComboBox(this);
cmbDefaultEmail -> hide();
}
- cmbDefaultEmail->clear();
+ cmbDefaultEmail->clear();
cmbDefaultEmail->insertStringList( emails );
@@ -726,3 +727,3 @@ void ContactEditor::populateDefaultEmailCmb(){
}
-
+
// If the current default email is not found in the list, we choose the
@@ -743,8 +744,8 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w
- // Create and connect combobox for selecting the default email
- if ( type == "Default Email"){
+ // Create and connect combobox for selecting the default email
+ if ( type == "Default Email"){
qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition);
-
+
// More than one default-email chooser is not allowed !
- if ( ( defaultEmailChooserPosition != -1 ) &&
+ if ( ( defaultEmailChooserPosition != -1 ) &&
defaultEmailChooserPosition != widgetPos && !initializing){
@@ -755,3 +756,3 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w
QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
- if ( cmbo ){
+ if ( cmbo ){
inputStack->raiseWidget( TextField );
@@ -770,3 +771,3 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w
connect( cmbo,SIGNAL( activated(int) ),
- SLOT( defaultEmailChanged(int) ) );
+ SLOT( defaultEmailChanged(int) ) );
@@ -775,3 +776,3 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w
-
+
} else {
@@ -783,3 +784,3 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w
QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo );
- if ( cmbo ){
+ if ( cmbo ){
inputStack->raiseWidget( TextField );
@@ -803,3 +804,3 @@ void ContactEditor::chooserError( int index )
{
- qWarning("ContactEditor::chooserError( %d )", index);
+ qWarning("ContactEditor::chooserError( %d )", index);
QMessageBox::warning( this, "Chooser Error",
@@ -812,3 +813,3 @@ void ContactEditor::chooserError( int index )
// Reset the selected Chooser. Unfortunately the chooser
- // generates no signal, therfore we have to
+ // generates no signal, therfore we have to
// call the cmbChooserChange function manually..
@@ -819,3 +820,3 @@ void ContactEditor::chooserError( int index )
break;
- case 2:
+ case 2:
cmbChooserField2 -> setCurrentItem( 0 );
@@ -823,3 +824,3 @@ void ContactEditor::chooserError( int index )
break;
- case 3:
+ case 3:
cmbChooserField3 -> setCurrentItem( 0 );
@@ -827,3 +828,3 @@ void ContactEditor::chooserError( int index )
break;
- case 4:
+ case 4:
cmbChooserField4 -> setCurrentItem( 0 );
@@ -835,3 +836,3 @@ void ContactEditor::chooserError( int index )
// Called when something was changed in a textfield (shouldn't it called textchanged? (se))
-void ContactEditor::chooserChange( const QString &textChanged, int index,
+void ContactEditor::chooserChange( const QString &textChanged, int index,
QLineEdit* , int widgetPos ) {
@@ -842,3 +843,3 @@ void ContactEditor::chooserChange( const QString &textChanged, int index,
- if ( type == "Default Email"){
+ if ( type == "Default Email"){
qWarning ("??? Wozu??: %s", textChanged.latin1());
@@ -856,3 +857,3 @@ void ContactEditor::chooserChange( const QString &textChanged, int index,
}
-
+
slChooserValues[index] = textChanged;
@@ -950,3 +951,3 @@ void ContactEditor::slotCmbChooser1Change( int index ) {
if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){
-
+
txtChooserField1->setText( slChooserValues[index] );
@@ -1051,3 +1052,3 @@ void ContactEditor::slotOrganizationChange( const QString &textChanged ){
qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() );
- // Special handling for storing Companies:
+ // Special handling for storing Companies:
// If no Fullname is given, we store the Company-Name as lastname
@@ -1056,3 +1057,3 @@ void ContactEditor::slotOrganizationChange( const QString &textChanged ){
txtFullName->setText( textChanged );
-
+
}
@@ -1139,3 +1140,3 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
// A comma (",") separates the lastname from one or
- // many first names. Thus, remove the lastname from the
+ // many first names. Thus, remove the lastname from the
// String and parse the firstnames.
@@ -1156,3 +1157,3 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
allSecondNames.append( *it );
-
+
strMiddleName = allSecondNames.join(" ");
@@ -1161,3 +1162,3 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
- // No comma separator used: We use the first word as firstname, the
+ // No comma separator used: We use the first word as firstname, the
// last as second/lastname and everything in the middle as middlename
@@ -1170,6 +1171,6 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
allSecondNames.append( *it );
-
+
strMiddleName = allSecondNames.join(" ");
strLastName = *(--allNames.end());
-
+
}
@@ -1187,24 +1188,24 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
return strFirstName + " " + strLastName;
-
+
case NAME_LF:
return strLastName + ", " + strFirstName;
-
+
case NAME_LFM:
return strLastName + ", " + strFirstName + " " + strMiddleName;
-
+
case NAME_FML:
return strFirstName + " " + strMiddleName + " " + strLastName ;
-
+
case NAME_F:
return strFirstName;
-
+
case NAME_M:
return strMiddleName;
-
+
case NAME_L:
return strLastName;
-
+
case NAME_S:
return txtSuffix->text();
-
+
}
@@ -1215,3 +1216,3 @@ void ContactEditor::cleanupFields() {
QStringList::Iterator it = slChooserValues.begin();
-
+
for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
@@ -1219,3 +1220,3 @@ void ContactEditor::cleanupFields() {
}
-
+
for ( int i = 0; i < 7; i++ ) {
@@ -1224,3 +1225,3 @@ void ContactEditor::cleanupFields() {
}
-
+
QListIterator<QLineEdit> itLV( listValue );
@@ -1228,4 +1229,4 @@ void ContactEditor::cleanupFields() {
(*itLV)->setText( "" );
- }
-
+ }
+
txtFirstName->setText("");
@@ -1249,9 +1250,9 @@ void ContactEditor::cleanupFields() {
txtTmp->setText("");
-
+
}
-void ContactEditor::setEntry( const OContact &entry ) {
-
+void ContactEditor::setEntry( const Opie::OPimContact &entry ) {
+
initializing = true;
-
+
// Cleanup and activate the general Page ..
@@ -1259,5 +1260,5 @@ void ContactEditor::setEntry( const OContact &entry ) {
tabMain->setCurrentPage( 0 );
-
+
ent = entry;
-
+
emails = QStringList(ent.emailList());
@@ -1266,3 +1267,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
qDebug("default email=%s",defaultEmail.latin1());
-
+
txtFirstName->setText( ent.firstName() );
@@ -1271,3 +1272,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
txtSuffix->setText( ent.suffix() );
-
+
// QString *tmpString = new QString;
@@ -1284,14 +1285,14 @@ void ContactEditor::setEntry( const OContact &entry ) {
}
-
+
cmbFileAs->setEditText( ent.fileAs() );
-
+
// if (hasTitle)
txtJobTitle->setText( ent.jobTitle() );
-
+
// if (hasCompany)
txtOrganization->setText( ent.company() );
-
+
// if (hasNotes)
txtNote->setText( ent.notes() );
-
+
// if (hasStreet) {
@@ -1300,3 +1301,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
// }
-
+
// if (hasCity) {
@@ -1305,3 +1306,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
//}
-
+
//if (hasState) {
@@ -1310,3 +1311,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
//}
-
+
//if (hasZip) {
@@ -1315,3 +1316,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
//}
-
+
//if (hasCountry) {
@@ -1320,3 +1321,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
//}
-
+
QStringList::ConstIterator it;
@@ -1324,26 +1325,26 @@ void ContactEditor::setEntry( const OContact &entry ) {
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" ){
@@ -1352,11 +1353,11 @@ void ContactEditor::setEntry( const OContact &entry ) {
}
-
+
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" ) )
@@ -1369,3 +1370,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
*itV = ent.businessFax();
-
+
if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
@@ -1378,6 +1379,6 @@ void ContactEditor::setEntry( const OContact &entry ) {
*itV = ent.defaultEmail();
-
+
if ( *it == "Emails" )
*itV = ent.emailList().join(", "); // :SX
-
+
if ( *it == "Home Phone" )
@@ -1390,3 +1391,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
*itV = ent.homeFax();
-
+
if ( *it == "Home Mobile" )
@@ -1396,6 +1397,6 @@ void ContactEditor::setEntry( const OContact &entry ) {
*itV = ent.carPhone();
-
+
if ( *it == "ISDN Phone" )
*itV = ent.ISDNPhone();
-
+
if ( *it == "Other Phone" )
@@ -1408,15 +1409,15 @@ void ContactEditor::setEntry( const OContact &entry ) {
*itV = ent.homePager();
-
+
if ( *it == "AIM IM" )
*itV = ent.AIMIM();
-
+
if ( *it == "ICQ IM" )
*itV = ent.ICQIM();
-
+
if ( *it == "Jabber IM" )
*itV = ent.jabberIM();
-
+
if ( *it == "MSN IM" )
*itV = ent.MSNIM();
-
+
if ( *it == "Yahoo IM" )
@@ -1426,19 +1427,19 @@ void ContactEditor::setEntry( const OContact &entry ) {
*itV = ent.homeWebpage();
-
+
if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
*itV = ent.businessWebpage();
-
-
+
+
}
-
-
+
+
cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
-
+
QString gender = ent.gender();
cmbGender->setCurrentItem( gender.toInt() );
-
+
txtNote->setText( ent.notes() );
-
+
slotAddressTypeChange( cmbAddress->currentItem() );
-
+
// Get combo-settings from contact and set preset..
@@ -1455,5 +1456,5 @@ void ContactEditor::setEntry( const OContact &entry ) {
slotAddressTypeChange( cmbAddress->currentItem() );
-
+
updateDatePicker();
-
+
initializing = false;
@@ -1468,3 +1469,3 @@ void ContactEditor::updateDatePicker()
birthdayButton->setText( tr ("Unknown") );
-
+
if ( !ent.anniversary().isNull() ){
@@ -1474,3 +1475,3 @@ void ContactEditor::updateDatePicker()
anniversaryButton->setText( tr ("Unknown") );
-
+
}
@@ -1478,6 +1479,6 @@ void ContactEditor::updateDatePicker()
void ContactEditor::saveEntry() {
-
+
// Store current combo into contact
contactfields.saveToRecord( ent );
-
+
txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
@@ -1486,3 +1487,3 @@ void ContactEditor::saveEntry() {
// txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
-
+
ent.setFirstName( txtFirstName->text() );
@@ -1491,17 +1492,17 @@ void ContactEditor::saveEntry() {
ent.setSuffix( txtSuffix->text() );
-
+
ent.setFileAs( cmbFileAs->currentText() );
-
+
ent.setCategories( cmbCat->currentCategories() );
-
-
+
+
//if (hasTitle)
ent.setJobTitle( txtJobTitle->text() );
-
+
//if (hasCompany)
ent.setCompany( txtOrganization->text() );
-
+
// if (hasNotes)
ent.setNotes( txtNote->text() );
-
+
//if (hasStreet) {
@@ -1510,3 +1511,3 @@ void ContactEditor::saveEntry() {
// }
-
+
// if (hasCity) {
@@ -1515,3 +1516,3 @@ void ContactEditor::saveEntry() {
// }
-
+
// if (hasState) {
@@ -1520,3 +1521,3 @@ void ContactEditor::saveEntry() {
// }
-
+
// if (hasZip) {
@@ -1525,3 +1526,3 @@ void ContactEditor::saveEntry() {
// }
-
+
// if (hasCountry) {
@@ -1530,3 +1531,3 @@ void ContactEditor::saveEntry() {
// }
-
+
QStringList::ConstIterator it;
@@ -1534,45 +1535,45 @@ void ContactEditor::saveEntry() {
for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
-
+
if ( *it == "Department" )
ent.setDepartment( (*itLE)->text() );
-
+
if ( *it == "Company" )
ent.setCompany( (*itLE)->text() );
-
+
if ( *it == "Office" )
ent.setOffice( (*itLE)->text() );
-
+
if ( *it == "Profession" )
ent.setProfession( (*itLE)->text() );
-
+
if ( *it == "Assistant" )
ent.setAssistant( (*itLE)->text() );
-
+
if ( *it == "Manager" )
ent.setManager( (*itLE)->text() );
-
+
if ( *it == "Spouse" )
ent.setSpouse( (*itLE)->text() );
-
+
if ( *it == "Nickname" )
ent.setNickname( (*itLE)->text() );
-
+
if ( *it == "Children" )
ent.setChildren( (*itLE)->text() );
-
+
}
-
-
+
+
QStringList::ConstIterator itV;
for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
-
+
if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
ent.setBusinessPhone( *itV );
-
+
if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
ent.setBusinessFax( *itV );
-
+
if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
ent.setBusinessMobile( *itV );
-
+
if ( *it == "Emails" ){
@@ -1588,30 +1589,30 @@ void ContactEditor::saveEntry() {
}
-
+
if ( *it == "Default Email")
ent.setDefaultEmail( defaultEmail /* *itV */ );
-
+
if ( *it == "Home Phone" )
ent.setHomePhone( *itV );
-
+
if ( *it == "Home Fax" )
ent.setHomeFax( *itV );
-
+
if ( *it == "Home Mobile" )
ent.setHomeMobile( *itV );
-
+
if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
ent.setBusinessPager( *itV );
-
+
if ( *it == "Home Web Page" )
ent.setHomeWebpage( *itV );
-
+
if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
ent.setBusinessWebpage( *itV );
-
-
+
+
}
-
+
int gender = cmbGender->currentItem();
ent.setGender( QString::number( gender ) );
-
+
QString str = txtNote->text();
@@ -1619,3 +1620,3 @@ void ContactEditor::saveEntry() {
ent.setNotes( str );
-
+
}
@@ -1700,3 +1701,3 @@ void ContactEditor::setPersonalView( bool personal )
m_personalView = personal;
-
+
// Currently disbled due to the fact that
@@ -1704,3 +1705,3 @@ void ContactEditor::setPersonalView( bool personal )
return;
-
+
if ( personal ){
@@ -1708,6 +1709,6 @@ void ContactEditor::setPersonalView( bool personal )
labCat->hide();
-
+
} else{
cmbCat->show();
- labCat->show();
+ labCat->show();
}