-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 16 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 255 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 4 |
3 files changed, 261 insertions, 14 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index e8fa37c..5a8038b 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -1,64 +1,68 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qt 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 ** packaging 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #define QTOPIA_INTERNAL_FD #include "contacteditor.h" #include "ablabel.h" #include "abtable.h" #include "addresssettings.h" #include "addressbook.h" #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/contact.h> + +#ifndef MAKE_FOR_SHARP_ROM #include <qpe/finddialog.h> +#endif + #include <qpe/global.h> #include <qpe/resource.h> #include <qpe/ir.h> #include <qpe/qpemessagebox.h> #include <qpe/qcopenvelope_qws.h> #include <qaction.h> #include <qdialog.h> #include <qdir.h> #include <qfile.h> #include <qimage.h> #include <qlayout.h> #include <qpe/qpemenubar.h> #include <qmessagebox.h> #include <qpixmap.h> #include <qpopupmenu.h> #include <qpe/qpetoolbar.h> #include <qstringlist.h> #include <qtoolbutton.h> #include <qwhatsthis.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <qdatetime.h> static QString addressbookOldXMLFilename() { QString filename = QPEApplication::documentDir() + "addressbook.xml"; @@ -100,70 +104,72 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, bar->setHorizontalStretchable( TRUE ); QPEMenuBar *mbList = new QPEMenuBar( bar ); mbList->setMargin( 0 ); QPopupMenu *edit = new QPopupMenu( this ); mbList->insertItem( tr( "Contact" ), edit ); listTools = new QPEToolBar( this, "list operations" ); QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); actionNew = a; connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); a->addTo( edit ); a->addTo( listTools ); a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); actionEdit = a; connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); a->addTo( edit ); a->addTo( listTools ); a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); actionTrash = a; connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); a->addTo( edit ); a->addTo( listTools ); +#ifndef MAKE_FOR_SHARP_ROM a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); actionFind = a; connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); a->addTo( edit ); a->addTo( listTools ); +#endif a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), QString::null, 0, this, 0 ); //a->setEnabled( FALSE ); we got support for it now :) zecke actionMail = a; connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); a->addTo( edit ); a->addTo( listTools ); if ( Ir::supported() ) { a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); actionBeam = a; connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); a->addTo( edit ); a->addTo( listTools ); } edit->insertSeparator(); a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); actionPersonal = a; connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); a->addTo( edit ); a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); a->addTo( edit ); @@ -481,74 +487,78 @@ void AddressbookWindow::editPersonal() me = Contact::readVCard( filename )[0]; if (bAbEditFirstTime) { abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, this, "editor" ); // don't create a new editor every time bAbEditFirstTime = FALSE; } else abEditor->setEntry( me ); abEditor->setCaption(tr("Edit My Personal Details")); abEditor->showMaximized(); // fix the foxus... abEditor->setNameFocus(); if ( abEditor->exec() ) { setFocus(); Contact new_personal = abEditor->entry(); QString fname = addressbookPersonalVCardName(); Contact::writeVCard( fname, new_personal ); abView()->init(new_personal); abView()->sync(); } abEditor->setCaption( tr("Edit Address") ); } void AddressbookWindow::slotPersonalView() { if (!actionPersonal->isOn()) { // we just turned it off setCaption( tr("Contacts") ); actionNew->setEnabled(TRUE); actionTrash->setEnabled(TRUE); +#ifndef MAKE_FOR_SHARP_ROM actionFind->setEnabled(TRUE); +#endif slotUpdateToolbar(); // maybe some of the above could be moved there showList(); return; } // XXX need to disable some QActions. actionNew->setEnabled(FALSE); actionTrash->setEnabled(FALSE); +#ifndef MAKE_FOR_SHARP_ROM actionFind->setEnabled(FALSE); +#endif actionMail->setEnabled(FALSE); setCaption( tr("Contacts - My Personal Details") ); QString filename = addressbookPersonalVCardName(); Contact me; if (QFile::exists(filename)) me = Contact::readVCard( filename )[0]; abView()->init( me ); abView()->sync(); abList->hide(); setCentralWidget( abView() ); mView->show(); mView->setFocus(); } void AddressbookWindow::editEntry( EntryMode entryMode ) { Contact entry; if ( bAbEditFirstTime ) { abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, this, "editor" ); bAbEditFirstTime = FALSE; if ( entryMode == EditEntry ) abEditor->setEntry( abList->currentEntry() ); } // other things may chane the caption. abEditor->setCaption( tr("Edit Address") ); #if defined(Q_WS_QWS) || defined(_WS_QWS_) abEditor->showMaximized(); #endif @@ -747,74 +757,80 @@ void AddressbookWindow::initFields() 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") ); } } AbLabel *AddressbookWindow::abView() { if ( !mView ) { mView = new AbLabel( this, "viewer" ); mView->init( Contact() ); 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()) ); QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); + frmFind.exec(); + if ( abList->numSelections() ) abList->clearSelection(); + abList->clearFindRow(); +#endif } void AddressbookWindow::slotSetCategory( int c ) { if ( c <= 0 ) return; for ( unsigned int i = 1; i < catMenu->count(); i++ ) catMenu->setItemChecked( i, c == (int)i ); if ( c == 1 ) { abList->setShowCategory( QString::null ); setCaption( tr("Contacts") + " - " + tr ( "All" ) ); } else if ( c == (int)catMenu->count() ) { abList->setShowCategory( tr( "Unfiled" ) ); setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) ); } else { QString cat = abList->categories()[c - 2]; abList->setShowCategory( cat ); setCaption( tr("Contacts") + " - " + cat ); } } void AddressbookWindow::populateCategories() { catMenu->clear(); int id, rememberId; id = 1; catMenu->insertItem( tr( "All" ), id++ ); QStringList categories = abList->categories(); categories.append( tr( "Unfiled" ) ); for ( QStringList::Iterator it = categories.begin(); diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 6edab2c..cbcd11f 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -254,327 +254,548 @@ void ContactEditor::init() { hasZip = TRUE; // slDynamicEntries->remove( it ); continue; } if ( (*it).right( 7 ) == tr( "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 ); QWidget *container = new QWidget( svGeneral->viewport() ); svGeneral->addChild( container ); - QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 3 ); + 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( 100 ); + cmbChooserField1->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField1, 3, 0 ); txtChooserField1 = new QLineEdit( container ); gl->addWidget( txtChooserField1, 3, 1 ); cmbChooserField2 = new QComboBox( FALSE, container ); - cmbChooserField2->setMaximumWidth( 100 ); + cmbChooserField2->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField2, 4, 0 ); txtChooserField2 = new QLineEdit( container ); gl->addWidget( txtChooserField2, 4, 1 ); cmbChooserField3 = new QComboBox( FALSE, container ); - cmbChooserField3->setMaximumWidth( 100 ); + cmbChooserField3->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField3, 5, 0 ); txtChooserField3 = new QLineEdit( container ); gl->addWidget( txtChooserField3, 5, 1 ); l = new QLabel( tr( "File As" ), container ); gl->addWidget( l, 6, 0 ); cmbFileAs = new QComboBox( TRUE, container ); gl->addWidget( cmbFileAs, 6, 1 ); l = new QLabel( tr( "Category" ), container ); gl->addWidget( l, 7, 0 ); cmbCat = new CategorySelect( container ); gl->addWidget( cmbCat, 7, 1 ); btnNote = new QPushButton( tr( "Notes..." ), container ); gl->addWidget( btnNote, 8, 1 ); tabMain->insertTab( tabViewport, tr( "General" ) ); tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svAddress = new QScrollView( tabViewport ); vb->addWidget( svAddress, 0, 0 ); svAddress->setResizePolicy( QScrollView::AutoOneFit ); svAddress->setFrameStyle( QFrame::NoFrame ); container = new QWidget( svAddress->viewport() ); svAddress->addChild( container ); - gl = new QGridLayout( container, 5, 3, 2, 3 ); + gl = new QGridLayout( container, 6, 3, 2, 4 ); cmbAddress = new QComboBox( FALSE, container ); cmbAddress->insertItem( tr( "Business" ) ); cmbAddress->insertItem( tr( "Home" ) ); gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); l = new QLabel( tr( "Address" ), container ); gl->addWidget( l, 1, 0 ); txtAddress = new QLineEdit( container ); gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); /* l = new QLabel( tr( "Address 2" ), container ); gl->addWidget( l, 2, 0 ); txtAddress2 = new QLineEdit( container ); gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); l = new QLabel( tr( "P.O. Box" ), container ); gl->addWidget( l, 3, 0 ); txtPOBox = new QLineEdit( container ); gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); */ l = new QLabel( tr( "City" ), container ); gl->addWidget( l, 2, 0 ); txtCity = new QLineEdit( container ); gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); l = new QLabel( tr( "State" ), container ); gl->addWidget( l, 3, 0 ); txtState = new QLineEdit( container ); gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); l = new QLabel( tr( "Zip Code" ), container ); gl->addWidget( l, 4, 0 ); txtZip = new QLineEdit( container ); gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); l = new QLabel( tr( "Country" ), container ); gl->addWidget( l, 5, 0 ); cmbCountry = new QComboBox( TRUE, container ); cmbCountry->insertItem( tr( "" ) ); - cmbCountry->insertItem( tr( "United States" ) ); - cmbCountry->insertItem( tr( "United Kingdom" ) ); - cmbCountry->insertItem( tr( "Japan" ) ); - cmbCountry->insertItem( tr( "France" ) ); - cmbCountry->insertItem( tr( "Germany" ) ); - cmbCountry->insertItem( tr( "Norway" ) ); - cmbCountry->insertItem( tr( "Canada" ) ); - + cmbCountry->insertItem( tr ( "United States" ) ); + cmbCountry->insertItem( tr ( "United Kingdom" ) ); + cmbCountry->insertItem( tr ( "Afganistan" ) ); + cmbCountry->insertItem( tr ( "Albania" ) ); + cmbCountry->insertItem( tr ( "Algeria" ) ); + cmbCountry->insertItem( tr ( "American Samoa" ) ); + cmbCountry->insertItem( tr ( "Andorra" ) ); + cmbCountry->insertItem( tr ( "Angola" ) ); + cmbCountry->insertItem( tr ( "Anguilla" ) ); + cmbCountry->insertItem( tr ( "Antartica" ) ); + cmbCountry->insertItem( tr ( "Argentina" ) ); + cmbCountry->insertItem( tr ( "Armania" ) ); + cmbCountry->insertItem( tr ( "Aruba" ) ); + cmbCountry->insertItem( tr ( "Australia" ) ); + cmbCountry->insertItem( tr ( "Austria" ) ); + cmbCountry->insertItem( tr ( "Azerbaijan" ) ); + cmbCountry->insertItem( tr ( "Bahamas" ) ); + cmbCountry->insertItem( tr ( "Bahrain" ) ); + cmbCountry->insertItem( tr ( "Bangladesh" ) ); + cmbCountry->insertItem( tr ( "Barbados" ) ); + cmbCountry->insertItem( tr ( "Belarus" ) ); + cmbCountry->insertItem( tr ( "Belgium" ) ); + cmbCountry->insertItem( tr ( "Belize" ) ); + cmbCountry->insertItem( tr ( "Benin" ) ); + cmbCountry->insertItem( tr ( "Bermuda" ) ); + cmbCountry->insertItem( tr ( "Bhutan" ) ); + cmbCountry->insertItem( tr ( "Boliva" ) ); + cmbCountry->insertItem( tr ( "Botswana" ) ); + cmbCountry->insertItem( tr ( "Bouvet Island" ) ); + cmbCountry->insertItem( tr ( "Brazil" ) ); + cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); + cmbCountry->insertItem( tr ( "Bulgaria" ) ); + cmbCountry->insertItem( tr ( "Burkina Faso" ) ); + cmbCountry->insertItem( tr ( "Burundi" ) ); + cmbCountry->insertItem( tr ( "Cambodia" ) ); + cmbCountry->insertItem( tr ( "Camaroon" ) ); + cmbCountry->insertItem( tr ( "Canada" ) ); + cmbCountry->insertItem( tr ( "Cape Verde" ) ); + cmbCountry->insertItem( tr ( "Cayman Islands" ) ); + cmbCountry->insertItem( tr ( "Chad" ) ); + cmbCountry->insertItem( tr ( "Chile" ) ); + cmbCountry->insertItem( tr ( "China" ) ); + cmbCountry->insertItem( tr ( "Christmas Island" ) ); + cmbCountry->insertItem( tr ( "Colombia" ) ); + cmbCountry->insertItem( tr ( "Comoros" ) ); + cmbCountry->insertItem( tr ( "Congo" ) ); + cmbCountry->insertItem( tr ( "Cook Island" ) ); + cmbCountry->insertItem( tr ( "Costa Rica" ) ); + cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); + cmbCountry->insertItem( tr ( "Croatia" ) ); + cmbCountry->insertItem( tr ( "Cuba" ) ); + cmbCountry->insertItem( tr ( "Cyprus" ) ); + cmbCountry->insertItem( tr ( "Czech Republic" ) ); + cmbCountry->insertItem( tr ( "Denmark" ) ); + cmbCountry->insertItem( tr ( "Djibouti" ) ); + cmbCountry->insertItem( tr ( "Dominica" ) ); + cmbCountry->insertItem( tr ( "Dominican Republic" ) ); + cmbCountry->insertItem( tr ( "East Timor" ) ); + cmbCountry->insertItem( tr ( "Ecuador" ) ); + cmbCountry->insertItem( tr ( "Egypt" ) ); + cmbCountry->insertItem( tr ( "El Salvador" ) ); + cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); + cmbCountry->insertItem( tr ( "Eritrea" ) ); + cmbCountry->insertItem( tr ( "Estonia" ) ); + cmbCountry->insertItem( tr ( "Ethiopia" ) ); + cmbCountry->insertItem( tr ( "Falkland Islands" ) ); + cmbCountry->insertItem( tr ( "Faroe Islands" ) ); + cmbCountry->insertItem( tr ( "Fiji" ) ); + cmbCountry->insertItem( tr ( "Finland" ) ); + cmbCountry->insertItem( tr ( "France" ) ); + cmbCountry->insertItem( tr ( "French Guiana" ) ); + cmbCountry->insertItem( tr ( "French Polynesia" ) ); + cmbCountry->insertItem( tr ( "Gabon" ) ); + cmbCountry->insertItem( tr ( "Gambia" ) ); + cmbCountry->insertItem( tr ( "Georgia" ) ); + cmbCountry->insertItem( tr ( "Germany" ) ); + cmbCountry->insertItem( tr ( "Gahna" ) ); + cmbCountry->insertItem( tr ( "Gibraltar" ) ); + cmbCountry->insertItem( tr ( "Greece" ) ); + cmbCountry->insertItem( tr ( "Greenland" ) ); + cmbCountry->insertItem( tr ( "Grenada" ) ); + cmbCountry->insertItem( tr ( "Guadelupe" ) ); + cmbCountry->insertItem( tr ( "Guam" ) ); + cmbCountry->insertItem( tr ( "Guatemala" ) ); + cmbCountry->insertItem( tr ( "Guinea" ) ); + cmbCountry->insertItem( tr ( "Guinea-bissau" ) ); + cmbCountry->insertItem( tr ( "Guyana" ) ); + cmbCountry->insertItem( tr ( "Haiti" ) ); + cmbCountry->insertItem( tr ( "Holy See" ) ); + cmbCountry->insertItem( tr ( "Honduras" ) ); + cmbCountry->insertItem( tr ( "Hong Kong" ) ); + cmbCountry->insertItem( tr ( "Hungary" ) ); + cmbCountry->insertItem( tr ( "Iceland" ) ); + cmbCountry->insertItem( tr ( "India" ) ); + cmbCountry->insertItem( tr ( "Indonesia" ) ); + cmbCountry->insertItem( tr ( "Ireland" ) ); + cmbCountry->insertItem( tr ( "Israel" ) ); + cmbCountry->insertItem( tr ( "Italy" ) ); + cmbCountry->insertItem( tr ( "Jamacia" ) ); + cmbCountry->insertItem( tr ( "Japan" ) ); + cmbCountry->insertItem( tr ( "Jordan" ) ); + cmbCountry->insertItem( tr ( "Kazakhstan" ) ); + cmbCountry->insertItem( tr ( "Kenya" ) ); + cmbCountry->insertItem( tr ( "Kribati" ) ); + cmbCountry->insertItem( tr ( "Korea" ) ); + cmbCountry->insertItem( tr ( "Kuait" ) ); + cmbCountry->insertItem( tr ( "Kyrgyztan" ) ); + cmbCountry->insertItem( tr ( "Laos" ) ); + cmbCountry->insertItem( tr ( "Latvia" ) ); + cmbCountry->insertItem( tr ( "Lebanon" ) ); + cmbCountry->insertItem( tr ( "Lesotho" ) ); + cmbCountry->insertItem( tr ( "Liberia" ) ); + cmbCountry->insertItem( tr ( "Liechtenstein" ) ); + cmbCountry->insertItem( tr ( "Lithuania" ) ); + cmbCountry->insertItem( tr ( "Luxembourg" ) ); + cmbCountry->insertItem( tr ( "Macau" ) ); + cmbCountry->insertItem( tr ( "Macedonia" ) ); + cmbCountry->insertItem( tr ( "Madagascar" ) ); + cmbCountry->insertItem( tr ( "Malawi" ) ); + cmbCountry->insertItem( tr ( "Malaysia" ) ); + cmbCountry->insertItem( tr ( "Maldives" ) ); + cmbCountry->insertItem( tr ( "Mali" ) ); + cmbCountry->insertItem( tr ( "Malta" ) ); + cmbCountry->insertItem( tr ( "Martinique" ) ); + cmbCountry->insertItem( tr ( "Mauritania" ) ); + cmbCountry->insertItem( tr ( "Mauritius" ) ); + cmbCountry->insertItem( tr ( "Mayotte" ) ); + cmbCountry->insertItem( tr ( "Mexico" ) ); + cmbCountry->insertItem( tr ( "Micronesia" ) ); + cmbCountry->insertItem( tr ( "Moldova" ) ); + cmbCountry->insertItem( tr ( "Monaco" ) ); + cmbCountry->insertItem( tr ( "Mongolia" ) ); + cmbCountry->insertItem( tr ( "Montserrat" ) ); + cmbCountry->insertItem( tr ( "Morocco" ) ); + cmbCountry->insertItem( tr ( "Mozambique" ) ); + cmbCountry->insertItem( tr ( "Myanmar" ) ); + cmbCountry->insertItem( tr ( "Namibia" ) ); + cmbCountry->insertItem( tr ( "Nauru" ) ); + cmbCountry->insertItem( tr ( "Nepal" ) ); + cmbCountry->insertItem( tr ( "Netherlands" ) ); + cmbCountry->insertItem( tr ( "New Caledonia" ) ); + cmbCountry->insertItem( tr ( "New Zealand" ) ); + cmbCountry->insertItem( tr ( "Nicaragua" ) ); + cmbCountry->insertItem( tr ( "Niger" ) ); + cmbCountry->insertItem( tr ( "Nigeria" ) ); + cmbCountry->insertItem( tr ( "Niue" ) ); + cmbCountry->insertItem( tr ( "Norway" ) ); + cmbCountry->insertItem( tr ( "Oman" ) ); + cmbCountry->insertItem( tr ( "Pakistan" ) ); + cmbCountry->insertItem( tr ( "Palau" ) ); + cmbCountry->insertItem( tr ( "Palestinian Territory" ) ); + cmbCountry->insertItem( tr ( "Panama" ) ); + cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); + cmbCountry->insertItem( tr ( "Paraguay" ) ); + cmbCountry->insertItem( tr ( "Peru" ) ); + cmbCountry->insertItem( tr ( "Philippines" ) ); + cmbCountry->insertItem( tr ( "Pitcairn" ) ); + cmbCountry->insertItem( tr ( "Poland" ) ); + cmbCountry->insertItem( tr ( "Portugal" ) ); + cmbCountry->insertItem( tr ( "Puerto Rico" ) ); + cmbCountry->insertItem( tr ( "Qatar" ) ); + cmbCountry->insertItem( tr ( "Reunion" ) ); + cmbCountry->insertItem( tr ( "Romania" ) ); + cmbCountry->insertItem( tr ( "Russia" ) ); + cmbCountry->insertItem( tr ( "Rwanda" ) ); + cmbCountry->insertItem( tr ( "Saint Lucia" ) ); + cmbCountry->insertItem( tr ( "Samoa" ) ); + cmbCountry->insertItem( tr ( "San Marino" ) ); + cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); + cmbCountry->insertItem( tr ( "Senegal" ) ); + cmbCountry->insertItem( tr ( "Seychelles" ) ); + cmbCountry->insertItem( tr ( "Sierra Leone" ) ); + cmbCountry->insertItem( tr ( "Singapore" ) ); + cmbCountry->insertItem( tr ( "Slovakia" ) ); + cmbCountry->insertItem( tr ( "Slovenia" ) ); + cmbCountry->insertItem( tr ( "Solomon Islands" ) ); + cmbCountry->insertItem( tr ( "Somalia" ) ); + cmbCountry->insertItem( tr ( "South Africa" ) ); + cmbCountry->insertItem( tr ( "Spain" ) ); + cmbCountry->insertItem( tr ( "Sri Lanka" ) ); + cmbCountry->insertItem( tr ( "St. Helena" ) ); + cmbCountry->insertItem( tr ( "Sudan" ) ); + cmbCountry->insertItem( tr ( "Suriname" ) ); + cmbCountry->insertItem( tr ( "Swaziland" ) ); + cmbCountry->insertItem( tr ( "Sweden" ) ); + cmbCountry->insertItem( tr ( "Switzerland" ) ); + cmbCountry->insertItem( tr ( "Taiwan" ) ); + cmbCountry->insertItem( tr ( "Tajikistan" ) ); + cmbCountry->insertItem( tr ( "Tanzania" ) ); + cmbCountry->insertItem( tr ( "Thailand" ) ); + cmbCountry->insertItem( tr ( "Togo" ) ); + cmbCountry->insertItem( tr ( "Tokelau" ) ); + cmbCountry->insertItem( tr ( "Tonga" ) ); + cmbCountry->insertItem( tr ( "Tunisia" ) ); + cmbCountry->insertItem( tr ( "Turkey" ) ); + cmbCountry->insertItem( tr ( "Turkmenistan" ) ); + cmbCountry->insertItem( tr ( "Tuvalu" ) ); + cmbCountry->insertItem( tr ( "Uganda" ) ); + cmbCountry->insertItem( tr ( "Ukraine" ) ); + cmbCountry->insertItem( tr ( "Uruguay" ) ); + cmbCountry->insertItem( tr ( "Uzbekistan" ) ); + cmbCountry->insertItem( tr ( "Vanuatu" ) ); + cmbCountry->insertItem( tr ( "Venezuela" ) ); + cmbCountry->insertItem( tr ( "Viet Nam" ) ); + cmbCountry->insertItem( tr ( "Virgin Islands" ) ); + cmbCountry->insertItem( tr ( "Western Sahara" ) ); + cmbCountry->insertItem( tr ( "Yemen" ) ); + cmbCountry->insertItem( tr ( "Yugoslavia" ) ); + cmbCountry->insertItem( tr ( "Zambia" ) ); + cmbCountry->insertItem( tr ( "Zimbabwe" ) ); + + cmbCountry->setMaximumWidth( 135 ); + gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); + cmbChooserField4 = new QComboBox( FALSE, container ); + cmbChooserField4->setMaximumWidth( 90 ); + gl->addWidget( cmbChooserField4, 6, 0 ); + txtChooserField4 = new QLineEdit( container ); + gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); tabMain->insertTab( tabViewport, tr( "Address" ) ); tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svDetails = new QScrollView( tabViewport ); vb->addWidget( svDetails, 0, 0 ); svDetails->setResizePolicy( QScrollView::AutoOneFit ); svDetails->setFrameStyle( QFrame::NoFrame ); container = new QWidget( svDetails->viewport() ); svDetails->addChild( container ); - gl = new QGridLayout( container, 1, 2, 2, 3 ); + gl = new QGridLayout( container, 1, 2, 2, 4 ); QStringList::ConstIterator it = slDynamicEntries->begin(); for (i = 0; it != slDynamicEntries->end(); i++, ++it) { l = new QLabel( *it, container ); listName.append( l ); gl->addWidget( l, i, 0 ); QLineEdit *e = new QLineEdit( container ); listValue.append( e ); gl->addWidget( e, i, 1); } l = new QLabel( tr("Gender"), container ); gl->addWidget( l, slDynamicEntries->count(), 0 ); cmbGender = new QComboBox( container ); cmbGender->insertItem( "", 0 ); cmbGender->insertItem( tr("Male"), 1); cmbGender->insertItem( tr("Female"), 2); gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); tabMain->insertTab( tabViewport, tr( "Details" ) ); dlgNote = new QDialog( this, "Note Dialog", TRUE ); dlgNote->setCaption( tr("Enter Note") ); QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); txtNote = new QMultiLineEdit( dlgNote ); vbNote->addWidget( txtNote ); connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); dlgName = new QDialog( this, "Name Dialog", TRUE ); dlgName->setCaption( tr("Edit Name") ); gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); l = new QLabel( tr("First Name"), dlgName ); gl->addWidget( l, 0, 0 ); txtFirstName = new QLineEdit( dlgName ); gl->addWidget( txtFirstName, 0, 1 ); l = new QLabel( tr("Middle Name"), dlgName ); gl->addWidget( l, 1, 0 ); txtMiddleName = new QLineEdit( dlgName ); gl->addWidget( txtMiddleName, 1, 1 ); l = new QLabel( tr("Last Name"), dlgName ); gl->addWidget( l, 2, 0 ); txtLastName = new QLineEdit( dlgName ); gl->addWidget( txtLastName, 2, 1 ); l = new QLabel( tr("Suffix"), dlgName ); gl->addWidget( l, 3, 0 ); txtSuffix = new QLineEdit( dlgName ); gl->addWidget( txtSuffix, 3, 1 ); cmbChooserField1->insertStringList( *slChooserNames ); cmbChooserField2->insertStringList( *slChooserNames ); cmbChooserField3->insertStringList( *slChooserNames ); + cmbChooserField4->insertStringList( *slChooserNames ); cmbChooserField1->setCurrentItem( 0 ); cmbChooserField2->setCurrentItem( 1 ); cmbChooserField3->setCurrentItem( 2 ); connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); + connect( txtChooserField4, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser4Change(const QString &)) ); connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); + connect( cmbChooserField4, SIGNAL(activated(int)), this, SLOT(slotCmbChooser4Change(int)) ); connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); new QPEDialogListener(this); } void ContactEditor::initMap() { /* // since the fields and the XML fields exist, create a map // between them... Config cfg1( "AddressBook" ); Config cfg2( "AddressBook" ); QString strCfg1, strCfg2; int i; // This stuff better exist... cfg1.setGroup( "AddressFields" ); o cfg2.setGroup( "XMLFields" ); i = 0; strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), QString::null ); while ( !strCfg1.isNull() && !strCfg2.isNull() ) { mapField.insert( strCfg1, strCfg2 ); strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), QString::null ); } */ } void ContactEditor::slotChooser1Change( const QString &textChanged ) { int index = cmbChooserField1->currentItem(); (*slChooserValues)[index] = textChanged; } void ContactEditor::slotChooser2Change( const QString &textChanged ) { int index = cmbChooserField2->currentItem(); (*slChooserValues)[index] = textChanged; } void ContactEditor::slotChooser3Change( const QString &textChanged ) { int index = cmbChooserField3->currentItem(); (*slChooserValues)[index] = textChanged; } +void ContactEditor::slotChooser4Change( const QString &textChanged ) { + + int index = cmbChooserField4->currentItem(); + + (*slChooserValues)[index] = textChanged; + +} + void ContactEditor::slotAddressChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { (*slBusinessAddress)[0] = textChanged; } else { (*slHomeAddress)[0] = textChanged; } } void ContactEditor::slotAddress2Change( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { (*slBusinessAddress)[1] = textChanged; } else { (*slHomeAddress)[1] = textChanged; } } void ContactEditor::slotPOBoxChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { (*slBusinessAddress)[2] = textChanged; } else { (*slHomeAddress)[2] = textChanged; } } void ContactEditor::slotCityChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { (*slBusinessAddress)[3] = textChanged; } else { @@ -599,64 +820,70 @@ void ContactEditor::slotZipChange( const QString &textChanged ) { } else { (*slHomeAddress)[5] = textChanged; } } void ContactEditor::slotCountryChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { (*slBusinessAddress)[6] = textChanged; } else { (*slHomeAddress)[6] = textChanged; } } void ContactEditor::slotCmbChooser1Change( int index ) { txtChooserField1->setText( (*slChooserValues)[index] ); } void ContactEditor::slotCmbChooser2Change( int index ) { txtChooserField2->setText( (*slChooserValues)[index] ); } void ContactEditor::slotCmbChooser3Change( int index ) { txtChooserField3->setText( (*slChooserValues)[index] ); } +void ContactEditor::slotCmbChooser4Change( int index ) { + + txtChooserField4->setText( (*slChooserValues)[index] ); + +} + void ContactEditor::slotAddressTypeChange( int index ) { if ( index == 0 ) { txtAddress->setText( (*slBusinessAddress)[0] ); //txtAddress2->setText( (*slBusinessAddress)[1] ); //txtPOBox->setText( (*slBusinessAddress)[2] ); txtCity->setText( (*slBusinessAddress)[3] ); txtState->setText( (*slBusinessAddress)[4] ); txtZip->setText( (*slBusinessAddress)[5] ); QLineEdit *txtTmp = cmbCountry->lineEdit(); txtTmp->setText( (*slBusinessAddress)[6] ); } else { txtAddress->setText( (*slHomeAddress)[0] ); //txtAddress2->setText( (*slHomeAddress)[1] ); //txtPOBox->setText( (*slHomeAddress)[2] ); txtCity->setText( (*slHomeAddress)[3] ); txtState->setText( (*slHomeAddress)[4] ); txtZip->setText( (*slHomeAddress)[5] ); QLineEdit *txtTmp = cmbCountry->lineEdit(); txtTmp->setText( (*slHomeAddress)[6] ); } } void ContactEditor::slotFullNameChange( const QString &textChanged ) { int index = cmbFileAs->currentItem(); diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index a799672..a58a860 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -54,105 +54,109 @@ class ContactEditor : public QDialog { public: ContactEditor( const Contact &entry, const QValueList<int> *newOrderedValues, QStringList *slNewOrdered, QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); ~ContactEditor(); void loadFields(); void setNameFocus(); Contact entry() const { return ent; } public slots: void slotNote(); void slotName(); void setEntry(const Contact &entry); protected slots: void accept(); private: void init(); void initMap(); void saveEntry(); bool isEmpty(); void cleanupFields(); QString parseName( QString fullName, int type ); private slots: void slotChooser1Change( const QString &textChanged ); void slotChooser2Change( const QString &textChanged ); void slotChooser3Change( const QString &textChanged ); + void slotChooser4Change( const QString &textChanged ); void slotCmbChooser1Change( int index ); void slotCmbChooser2Change( int index ); void slotCmbChooser3Change( int index ); + void slotCmbChooser4Change( int index ); void slotAddressTypeChange( int index ); void slotAddressChange( const QString &textChanged ); void slotAddress2Change( const QString &textChanged ); void slotPOBoxChange( const QString &textChanged ); void slotCityChange( const QString &textChanged ); void slotStateChange( const QString &textChanged ); void slotZipChange( const QString &textChanged ); void slotCountryChange( const QString &textChanged ); void slotFullNameChange( const QString &textChanged ); private: bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry; Contact ent; QDialog *dlgNote; QDialog *dlgName; QList<QLineEdit> listValue; QList<QLabel> listName; const QValueList<int> *orderedValues; QStringList *slOrdered; QStringList *slDynamicEntries; QStringList *slHomeAddress; QStringList *slBusinessAddress; QStringList *slChooserNames; QStringList *slChooserValues; QMultiLineEdit *txtNote; QLabel *lblNote; //QLineEdit *txtTitle; QLineEdit *txtFirstName; QLineEdit *txtMiddleName; QLineEdit *txtLastName; QLineEdit *txtSuffix; QTabWidget *tabMain; QScrollView *svGeneral; QPushButton *btnFullName; QPushButton *btnNote; QLineEdit *txtFullName; QLineEdit *txtJobTitle; QLineEdit *txtOrganization; QLineEdit *txtChooserField1; QLineEdit *txtChooserField2; QLineEdit *txtChooserField3; + QLineEdit *txtChooserField4; QComboBox *cmbChooserField1; QComboBox *cmbChooserField2; QComboBox *cmbChooserField3; + QComboBox *cmbChooserField4; QComboBox *cmbFileAs; CategorySelect *cmbCat; QScrollView *svAddress; QLineEdit *txtAddress; //QLineEdit *txtAddress2; //QLineEdit *txtPOBox; QLineEdit *txtCity; QLineEdit *txtState; QLineEdit *txtZip; QComboBox *cmbAddress; QComboBox *cmbCountry; QScrollView *svDetails; QComboBox *cmbGender; }; #endif |