-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 24 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 174 |
2 files changed, 101 insertions, 97 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index cf2eddf..472b13e 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -791,128 +791,130 @@ void AddressbookWindow::slotSettings() AddressSettings frmSettings( this ); #if defined(Q_WS_QWS) || defined(_WS_QWS_) frmSettings.showMaximized(); #endif if ( frmSettings.exec() ) { allFields.clear(); orderedFields.clear(); slOrderedFields.clear(); initFields(); if ( abEditor ) abEditor->loadFields(); abList->refresh(); } } void AddressbookWindow::initFields() { // we really don't need the things from the configuration, anymore // only thing that is important are the important categories. So, // Call the contact functions that correspond to these old functions... QStringList xmlFields = OContact::fields(); - QStringList visibleFields = OContact::trfields(); + QStringList visibleFields = OContact::untrfields(); + // QStringList trFields = OContact::trfields(); + xmlFields.remove( "Title" ); - visibleFields.remove( tr("Name Title") ); - visibleFields.remove( tr("Notes") ); + visibleFields.remove( "Name Title" ); + visibleFields.remove( "Notes" ); int i, version; Config cfg( "AddressBook" ); QString zn; // ### Write a function to keep this from happening again... QStringList::ConstIterator it; for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { allFields.append( i + 3 ); } cfg.setGroup( "Version" ); version = cfg.readNumEntry( "version" ); i = 0; startFontSize = 1; if ( version >= ADDRESSVERSION ) { cfg.setGroup( "ImportantCategory" ); zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); while ( !zn.isNull() ) { - if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) { + if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) { slOrderedFields.clear(); break; } slOrderedFields.append( zn ); zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); } cfg.setGroup( "Font" ); startFontSize = cfg.readNumEntry( "fontSize", 1 ); } else { QString str; str = getenv("HOME"); str += "/Settings/AddressBook.conf"; QFile::remove( str ); } if ( slOrderedFields.count() > 0 ) { for( QStringList::ConstIterator it = slOrderedFields.begin(); it != slOrderedFields.end(); ++it ) { QValueList<int>::ConstIterator itVl; QStringList::ConstIterator itVis; itVl = allFields.begin(); for ( itVis = visibleFields.begin(); itVis != visibleFields.end() && itVl != allFields.end(); ++itVis, ++itVl ) { if ( *it == *itVis && itVl != allFields.end() ) { orderedFields.append( *itVl ); } } } } else { QValueList<int>::ConstIterator it; for ( it = allFields.begin(); it != allFields.end(); ++it ) orderedFields.append( *it ); slOrderedFields = visibleFields; orderedFields.remove( Qtopia::AddressUid ); orderedFields.remove( Qtopia::Title ); orderedFields.remove( Qtopia::Groups ); orderedFields.remove( Qtopia::AddressCategory ); orderedFields.remove( Qtopia::FirstName ); orderedFields.remove( Qtopia::LastName ); orderedFields.remove( Qtopia::DefaultEmail ); orderedFields.remove( Qtopia::FileAs ); orderedFields.remove( Qtopia::Notes ); orderedFields.remove( Qtopia::Gender ); - slOrderedFields.remove( tr("Name Title") ); - slOrderedFields.remove( tr("First Name") ); - slOrderedFields.remove( tr("Last Name") ); - slOrderedFields.remove( tr("File As") ); - slOrderedFields.remove( tr("Default Email") ); - slOrderedFields.remove( tr("Notes") ); - slOrderedFields.remove( tr("Gender") ); + slOrderedFields.remove( "Name Title" ); + slOrderedFields.remove( "First Name" ); + slOrderedFields.remove( "Last Name" ); + slOrderedFields.remove( "File As" ); + slOrderedFields.remove( "Default Email" ); + slOrderedFields.remove( "Notes" ); + slOrderedFields.remove( "Gender" ); } } AbLabel *AddressbookWindow::abView() { if ( !mView ) { mView = new AbLabel( this, "viewer" ); mView->init( OContact() ); connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); } return mView; } void AddressbookWindow::slotFind() { #ifndef MAKE_FOR_SHARP_ROM if ( centralWidget() == abView() ) showList(); FindDialog frmFind( "Contacts", this ); QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 12d7421..b01583f 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -84,264 +84,264 @@ void ContactEditor::init() { */ //*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) == tr( "Business Fax" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Business Fax" ) { + slChooserNames.append( tr( "Business Fax" ) ); slChooserValues.append("" ); //slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home Fax" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Home Fax" ) { + slChooserNames.append( tr( "Home Fax" ) ); slChooserValues.append("" ); //slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Business Phone" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Business Phone" ) { + slChooserNames.append( tr( "Business Phone" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home Phone" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Home Phone" ) { + slChooserNames.append( tr( "Home Phone" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } /* if ( (*it).right( 2 ) == tr( "IM" ) ) { slChooserNames.append( *it ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } */ - if ( (*it) == tr( "Business Mobile" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Business Mobile" ) { + slChooserNames.append( tr( "Business Mobile" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home Mobile" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Home Mobile" ) { + slChooserNames.append( tr( "Home Mobile" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Business WebPage" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Business WebPage" ) { + slChooserNames.append( tr( "Business WebPage" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home Web Page" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Home Web Page" ) { + slChooserNames.append( tr( "Home Web Page" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Business Pager" ) ) { - slChooserNames.append( *it ); + if ( (*it) == "Business Pager" ) { + slChooserNames.append( tr( "Business Pager" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Default Email" ) ) { - slChooserNames.append( *it ); + if ( *it == "Default Email" ) { + slChooserNames.append( tr( "Default Email" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Emails" ) ) { - slChooserNames.append( *it ); + if ( *it == "Emails" ) { + slChooserNames.append( tr( "Emails" ) ); slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; } if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) continue; - if ( *it == tr( "Name Title" ) ) { + if ( *it == "Name Title" ) { //slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "First Name" ) ) { + if ( *it == "First Name" ) { // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Middle Name" ) ) { + if ( *it == "Middle Name" ) { // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Last Name" ) ) { + if ( *it == "Last Name" ) { // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Suffix" ) ) { + if ( *it == "Suffix" ) { // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "File As" ) ) { + if ( *it == "File As" ) { // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Gender" ) ) { + if ( *it == "Gender" ) { hasGender = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Job Title" ) ) { + if ( *it == "Job Title" ) { hasTitle = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Company") || *it == tr( "Organization" ) ) { + if ( ( *it == "Company") || (*it == "Organization" ) ) { hasCompany = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Notes" ) ) { + if ( *it == "Notes" ) { hasNotes = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( *it == tr( "Groups" ) ) { + if ( *it == "Groups" ) { // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Business Street" ) ) { + if ( (*it) == "Business Street" ) { hasStreet = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home Street" ) ) { + if ( (*it) == "Home Street" ) { hasStreet = TRUE; // slDynamicEntries->remove( it ); continue; } /* if ( (*it).right( 8 ) == tr( "Street 2" ) ) { hasStreet2 = TRUE; // slDynamicEntries->remove( it ); continue; } if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { hasPOBox = TRUE; // slDynamicEntries->remove( it ); continue; } */ - if ( (*it) == tr( "Business City" ) ) { + if ( (*it) == "Business City" ) { hasCity = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Business State" ) ) { + if ( (*it) == "Business State" ) { hasState = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Business Zip" ) ) { + if ( (*it) == "Business Zip" ) { hasZip = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Business Country" ) ) { + if ( (*it) == "Business Country" ) { hasCountry = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home City" ) ) { + if ( (*it) == "Home City" ) { hasCity = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home State" ) ) { + if ( (*it) == "Home State" ) { hasState = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home Zip" ) ) { + if ( (*it) == "Home Zip" ) { hasZip = TRUE; // slDynamicEntries->remove( it ); continue; } - if ( (*it) == tr( "Home Country" ) ) { + if ( (*it) == "Home Country" ) { hasCountry = TRUE; // slDynamicEntries->remove( it ); continue; } slDynamicEntries.append( *it ); } } 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 ); @@ -1339,152 +1339,153 @@ void ContactEditor::setEntry( const OContact &entry ) { */ 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(); it != slDynamicEntries.end(); ++it, ++itLE) { - if ( *it == tr("Department") ) + if ( *it =="Department" ) (*itLE)->setText( ent.department() ); - if ( *it == tr("Company" )) + if ( *it == "Company" ) (*itLE)->setText( ent.company() ); - if ( *it == tr("Office" )) + if ( *it == "Office" ) (*itLE)->setText( ent.office() ); - if ( *it == tr("Profession" )) + if ( *it == "Profession" ) (*itLE)->setText( ent.profession() ); - if ( *it == tr("Assistant" )) + if ( *it == "Assistant" ) (*itLE)->setText( ent.assistant() ); - if ( *it == tr("Manager" )) + if ( *it == "Manager" ) (*itLE)->setText( ent.manager() ); - if ( *it == tr("Spouse" )) + if ( *it == "Spouse" ) (*itLE)->setText( ent.spouse() ); - if ( *it == tr("Birthday" )) + if ( *it == "Birthday" ) (*itLE)->setText( ent.birthday() ); - if ( *it == tr("Anniversary" )) + if ( *it == "Anniversary" ) (*itLE)->setText( ent.anniversary() ); - if ( *it == tr("Nickname" )) + if ( *it == "Nickname" ) (*itLE)->setText( ent.nickname() ); - if ( *it == tr("Children" )) + if ( *it == "Children" ) (*itLE)->setText( ent.children() ); } QStringList::Iterator itV; for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { - if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) + if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) *itV = ent.businessPhone(); /* if ( *it == "Business 2 Phone" ) *itV = ent.business2Phone(); */ - if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) + if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) *itV = ent.businessFax(); - if ( *it == tr("Business Mobile") || *it == tr("work Mobile" )) + if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) *itV = ent.businessMobile(); /* if ( *it == "Company Phone" ) *itV = ent.companyPhone(); */ - if ( *it == tr("Default Email" )) + if ( *it == "Default Email" ) *itV = ent.defaultEmail(); - if ( *it == tr("Emails" )) + if ( *it == "Emails" ) *itV = ent.emailList().join(", "); // :SX - if ( *it == tr("Home Phone" )) + if ( *it == "Home Phone" ) *itV = ent.homePhone(); /* if ( *it == "Home 2 Phone" ) *itV = ent.home2Phone(); */ - if ( *it == tr("Home Fax" )) + if ( *it == "Home Fax" ) *itV = ent.homeFax(); - if ( *it == tr("Home Mobile" )) + if ( *it == "Home Mobile" ) *itV = ent.homeMobile(); /* if ( *it == "Car Phone" ) *itV = ent.carPhone(); if ( *it == "ISDN Phone" ) *itV = ent.ISDNPhone(); if ( *it == "Other Phone" ) *itV = ent.otherPhone(); */ - if ( *it == tr("Business Pager") || *it == tr("Work Pager" )) + if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) *itV = ent.businessPager(); /* if ( *it == "Home Pager") *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" ) *itV = ent.yahooIM(); */ - if ( *it == tr("Home Web Page") ) + if ( *it == "Home Web Page" ) *itV = ent.homeWebpage(); - if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") ) + + 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() ); slotCmbChooser1Change( cmbChooserField1->currentItem() ); slotCmbChooser2Change( cmbChooserField2->currentItem() ); slotCmbChooser3Change( cmbChooserField3->currentItem() ); slotAddressTypeChange( cmbAddress->currentItem() ); } void ContactEditor::saveEntry() { if ( useFullName == TRUE ) { txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); @@ -1536,158 +1537,159 @@ void ContactEditor::saveEntry() { */ if (hasCity) { ent.setHomeCity( slHomeAddress[3] ); ent.setBusinessCity( slBusinessAddress[3] ); } if (hasState) { ent.setHomeState( slHomeAddress[4] ); ent.setBusinessState( slBusinessAddress[4] ); } if (hasZip) { ent.setHomeZip( slHomeAddress[5] ); ent.setBusinessZip( slBusinessAddress[5] ); } if (hasCountry) { ent.setHomeCountry( slHomeAddress[6] ); ent.setBusinessCountry( slBusinessAddress[6] ); } QStringList::ConstIterator it; QListIterator<QLineEdit> itLE( listValue ); for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { - if ( *it == tr("Department" )) + if ( *it == "Department" ) ent.setDepartment( (*itLE)->text() ); - if ( *it == tr("Company" )) + if ( *it == "Company" ) ent.setCompany( (*itLE)->text() ); - if ( *it == tr("Office" )) + if ( *it == "Office" ) ent.setOffice( (*itLE)->text() ); - if ( *it == tr("Profession" )) + if ( *it == "Profession" ) ent.setProfession( (*itLE)->text() ); - if ( *it == tr("Assistant" )) + if ( *it == "Assistant" ) ent.setAssistant( (*itLE)->text() ); - if ( *it == tr("Manager" )) + if ( *it == "Manager" ) ent.setManager( (*itLE)->text() ); - if ( *it == tr("Spouse" )) + if ( *it == "Spouse" ) ent.setSpouse( (*itLE)->text() ); - if ( *it == tr("Birthday" )) + if ( *it == "Birthday" ) ent.setBirthday( (*itLE)->text() ); - if ( *it == tr("Anniversary" )) + if ( *it == "Anniversary" ) ent.setAnniversary( (*itLE)->text() ); - if ( *it == tr("Nickname" )) + if ( *it == "Nickname" ) ent.setNickname( (*itLE)->text() ); - if ( *it == tr("Children" )) + if ( *it == "Children" ) ent.setChildren( (*itLE)->text() ); } QStringList::ConstIterator itV; for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { - if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) + if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) ent.setBusinessPhone( *itV ); /* if ( *it == tr("Business 2 Phone" ) ent.setBusiness2Phone( *itV ); */ - if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) + if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) ent.setBusinessFax( *itV ); - if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" )) + if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) ent.setBusinessMobile( *itV ); /* if ( *it == "Company Phone" ) ent.setCompanyPhone( *itV ); */ //if ( *it == "Default Email" ) //ent.setDefaultEmail( *itV ); - if ( *it == tr("Emails" )) { + if ( *it == "Emails" ){ QString allemail; QString defaultmail; parseEmailFrom( *itV, defaultmail, allemail ); // ent.clearEmails(); ent.setDefaultEmail( defaultmail ); ent.setEmails( allemail ); } - if ( *it == tr("Home Phone" )) + if ( *it == "Home Phone" ) ent.setHomePhone( *itV ); /* if ( *it == "Home 2 Phone" ) ent.setHome2Phone( *itV ); */ - if ( *it == tr("Home Fax" )) + if ( *it == "Home Fax" ) ent.setHomeFax( *itV ); - if ( *it == tr("Home Mobile" )) + if ( *it == "Home Mobile" ) ent.setHomeMobile( *itV ); /* if ( *it == "Car Phone" ) ent.setCarPhone( *itV ); if ( *it == "ISDN Phone" ) ent.setISDNPhone( *itV ); if ( *it == "Other Phone" ) ent.setOtherPhone( *itV ); */ - if ( *it == tr("Business Pager") || *it == tr("Work Pager") ) + if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) ent.setBusinessPager( *itV ); /* if ( *it == "Home Pager" ) ent.setHomePager( *itV ); if ( *it == "AIM IM" ) ent.setAIMIM( *itV ); if ( *it == "ICQ IM" ) ent.setICQIM( *itV ); if ( *it == "Jabber IM" ) ent.setJabberIM( *itV ); if ( *it == "MSN IM" ) ent.setMSNIM( *itV ); if ( *it == "Yahoo IM" ) ent.setYahooIM( *itV ); */ - if ( *it == tr("Home Web Page") ) + if ( *it == "Home Web Page" ) ent.setHomeWebpage( *itV ); - if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" )) + + if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) ent.setBusinessWebpage( *itV ); } int gender = cmbGender->currentItem(); ent.setGender( QString::number( gender ) ); QString str = txtNote->text(); if ( !str.isNull() ) ent.setNotes( str ); } void parseEmailFrom( const QString &txt, QString &strDefaultEmail, QString &strAll ) { int where, start; if ( txt.isEmpty() ) return; // find the first where = txt.find( ',' ); if ( where < 0 ) { |