summaryrefslogtreecommitdiff
authorzecke <zecke>2002-05-21 14:21:25 (UTC)
committer zecke <zecke>2002-05-21 14:21:25 (UTC)
commit3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663 (patch) (side-by-side diff)
tree59f3648e8a0848457f879058b1064017b9feca66
parent54955c2fd698b2a1cf3ba8a79f2612013c8eb2f0 (diff)
downloadopie-3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663.zip
opie-3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663.tar.gz
opie-3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663.tar.bz2
usbaility updates
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp21
-rw-r--r--core/pim/addressbook/contacteditor.cpp348
-rw-r--r--core/pim/addressbook/contacteditor.h18
3 files changed, 208 insertions, 179 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index beb953a..8229212 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -169,106 +169,106 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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 );
// Create Views
// This is safe to call without checking to see if it exists...
// not to mention it also does the necessary stuff for the
// journaling...
QString str = addressbookXMLFilename();
if ( str.isNull() ) {
QMessageBox::warning( this, tr("Out of Space"),
tr("There is not enough space to create\n"
"neccessary startup files.\n"
"\nFree up some space before\nentering data!")
);
}
listContainer = new QWidget( this );
-
+
QVBoxLayout *vb = new QVBoxLayout( listContainer );
-
+
abList = new AbTable( &orderedFields, listContainer, "table" );
vb->addWidget(abList);
abList->setHScrollBarMode( QScrollView::AlwaysOff );
connect( abList, SIGNAL( empty( bool ) ),
this, SLOT( listIsEmpty( bool ) ) );
connect( abList, SIGNAL( details() ),
this, SLOT( slotListView() ) );
connect( abList, SIGNAL(currentChanged(int,int)),
this, SLOT(slotUpdateToolbar()) );
mView = 0;
abList->load( addressbookXMLFilename() );
if ( QFile::exists(addressbookOldXMLFilename()) ) {
abList->load( addressbookOldXMLFilename() );
QFile::remove(addressbookOldXMLFilename());
}
pLabel = new LetterPicker( listContainer );
connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
vb->addWidget(pLabel);
catMenu = new QPopupMenu( this );
catMenu->setCheckable( TRUE );
connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) );
populateCategories();
mbList->insertItem( tr("View"), catMenu );
setCentralWidget( listContainer );
fontMenu = new QPopupMenu(this);
fontMenu->setCheckable( true );
connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
fontMenu->insertItem(tr( "Small" ), 0);
fontMenu->insertItem(tr( "Normal" ), 1);
fontMenu->insertItem(tr( "Large" ), 2);
defaultFont = new QFont( abList->font() );
slotSetFont(startFontSize);
-
+
mbList->insertItem( tr("Font"), fontMenu);
setCentralWidget(listContainer);
// qDebug("adressbook contrsuction: t=%d", t.elapsed() );
}
void AddressbookWindow::slotSetFont( int size ) {
if (size > 2 || size < 0)
size = 1;
startFontSize = size;
QFont *currentFont;
-
+
switch (size) {
case 0:
fontMenu->setItemChecked(0, true);
fontMenu->setItemChecked(1, false);
fontMenu->setItemChecked(2, false);
abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
currentFont = new QFont (abList->font());
abList->resizeRows(currentFont->pixelSize() + 7);
break;
case 1:
fontMenu->setItemChecked(0, false);
fontMenu->setItemChecked(1, true);
fontMenu->setItemChecked(2, false);
abList->setFont( *defaultFont );
currentFont = new QFont (abList->font());
abList->resizeRows(currentFont->pixelSize() + 7);
break;
case 2:
fontMenu->setItemChecked(0, false);
fontMenu->setItemChecked(1, false);
fontMenu->setItemChecked(2, true);
abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
currentFont = new QFont (abList->font());
abList->resizeRows(currentFont->pixelSize() + 7);
@@ -450,81 +450,81 @@ void AddressbookWindow::beamDone( Ir *ir )
static void parseName( const QString& name, QString *first, QString *middle,
QString * last )
{
int comma = name.find ( "," );
QString rest;
if ( comma > 0 ) {
*last = name.left( comma );
comma++;
while ( comma < int(name.length()) && name[comma] == ' ' )
comma++;
rest = name.mid( comma );
} else {
int space = name.findRev( ' ' );
*last = name.mid( space+1 );
rest = name.left( space );
}
int space = rest.find( ' ' );
if ( space <= 0 ) {
*first = rest;
} else {
*first = rest.left( space );
*middle = rest.mid( space+1 );
}
-
+
}
void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
{
if (msg == "editPersonal()") {
editPersonal();
} else if (msg == "editPersonalAndClose()") {
editPersonal();
close();
} else if ( msg == "addContact(QString,QString)" ) {
QDataStream stream(data,IO_ReadOnly);
QString name, email;
stream >> name >> email;
Contact cnt;
QString fn, mn, ln;
parseName( name, &fn, &mn, &ln );
// qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
cnt.setFirstName( fn );
cnt.setMiddleName( mn );
cnt.setLastName( ln );
cnt.setEmails( email );
cnt.setDefaultEmail( email );
cnt.setFileAs();
if ( bAbEditFirstTime ) {
abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields,
this, "editor" );
bAbEditFirstTime = FALSE;
} else {
- abEditor->setEntry( cnt );
+ abEditor->setEntry( cnt );
}
abView()->init( cnt );
editEntry( NewEntry );
}
#if 0
else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
QDataStream stream(data,IO_ReadOnly);
QCString ch,m;
QStringList types;
stream >> ch >> m >> types;
AddressPicker picker(abList,this,0,TRUE);
picker.showMaximized();
picker.setChoiceNames(types);
int i=0;
for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
QStringList sel;
stream >> sel;
picker.setSelection(i++,sel);
}
picker.showMaximized();
picker.exec();
@@ -773,49 +773,49 @@ void AddressbookWindow::initFields()
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") ) ) {
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 )
@@ -838,86 +838,87 @@ void AddressbookWindow::initFields()
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::slotSetLetter( char c ) {
abList->setShowByLetter( c );
}
void AddressbookWindow::populateCategories()
{
catMenu->clear();
int id,
rememberId;
id = 1;
+ rememberId = 0;
catMenu->insertItem( tr( "All" ), id++ );
QStringList categories = abList->categories();
categories.append( tr( "Unfiled" ) );
for ( QStringList::Iterator it = categories.begin();
it != categories.end(); ++it ) {
catMenu->insertItem( *it, id );
if ( *it == abList->showCategory() )
rememberId = id;
++id;
}
if ( abList->showCategory().isEmpty() )
slotSetCategory( 1 );
else
slotSetCategory( rememberId );
}
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index e74da87..fa60f98 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -36,262 +36,262 @@
#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,
const char *name,
WFlags fl )
: QDialog( parent, name, TRUE, fl ),
orderedValues( newOrderedValues ),
- slOrdered( slNewOrdered )
+ slOrdered( *slNewOrdered )
{
-
+
init();
initMap();
setEntry( entry );
qDebug("finish");
}
ContactEditor::~ContactEditor() {
}
void ContactEditor::init() {
useFullName = TRUE;
int i = 0;
-
+/** SHut up and stop leaking
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( "" );
+ 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 ) {
+
+ 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( "" ) );
+ slChooserNames.append( *it );
+ slChooserValues.append("" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it).right( 5 ) == tr( "Phone" ) ) {
- slChooserNames->append( *it );
- slChooserValues->append( "" );
+ slChooserNames.append( *it );
+ slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it).right( 2 ) == tr( "IM" ) ) {
- slChooserNames->append( *it );
- slChooserValues->append( "" );
+ slChooserNames.append( *it );
+ slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it).right( 6 ) == tr( "Mobile" ) ) {
- slChooserNames->append( *it );
- slChooserValues->append( "" );
+ slChooserNames.append( *it );
+ slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it).right( 4 ) == tr( "Page" ) ) {
- slChooserNames->append( *it );
- slChooserValues->append( "" );
+ slChooserNames.append( *it );
+ slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it).right( 5 ) == tr( "Pager" ) ) {
- slChooserNames->append( *it );
- slChooserValues->append( "" );
+ slChooserNames.append( *it );
+ slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( *it == tr( "Default Email" ) ) {
- slChooserNames->append( *it );
- slChooserValues->append( "" );
+ slChooserNames.append( *it );
+ slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( *it == tr( "Emails" ) ) {
- slChooserNames->append( *it );
- slChooserValues->append( "" );
+ slChooserNames.append( *it );
+ slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( *it == tr( "Name Title" ) ) {
//slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "First Name" ) ) {
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Middle Name" ) ) {
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Last Name" ) ) {
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Suffix" ) ) {
// slDynamicEntries->remove( it );
continue;
}
if ( *it == tr( "File As" ) ) {
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Gender" ) ) {
hasGender = TRUE;
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Job Title" ) ) {
hasTitle = TRUE;
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Company" ) ) {
hasCompany = TRUE;
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Notes" ) ) {
hasNotes = TRUE;
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == tr( "Groups" ) ) {
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( (*it).right( 6 ) == tr( "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).right( 4 ) == tr( "City" ) ) {
hasCity = TRUE;
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( (*it).right( 5 ) == tr( "State" ) ) {
hasState = TRUE;
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( (*it).right( 3 ) == tr( "Zip" ) ) {
hasZip = TRUE;
// slDynamicEntries->remove( it );
continue;
}
-
+
if ( (*it).right( 7 ) == tr( "Country" ) ) {
hasCountry = TRUE;
// slDynamicEntries->remove( it );
continue;
}
- slDynamicEntries->append( *it );
+ 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, 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 );
@@ -325,63 +325,63 @@ void ContactEditor::init() {
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, 6, 3, 2, 4 );
+ gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem
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 );
+ 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 );
@@ -586,346 +586,374 @@ void ContactEditor::init() {
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 );
+
+ QSpacerItem *space = new QSpacerItem(1,1,
+ QSizePolicy::Maximum,
+ QSizePolicy::MinimumExpanding );
+ gl->addItem( space, 7, 0 );
+
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, 4 );
- QStringList::ConstIterator it = slDynamicEntries->begin();
- for (i = 0; it != slDynamicEntries->end(); i++, ++it) {
+ 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 );
+ 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 );
-
+ 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 );
+ gl = new QGridLayout( dlgName, 5, 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 );
+ space = new QSpacerItem(1,1,
+ QSizePolicy::Maximum,
+ QSizePolicy::MinimumExpanding );
+ gl->addItem( space, 4, 0 );
- cmbChooserField1->insertStringList( *slChooserNames );
- cmbChooserField2->insertStringList( *slChooserNames );
- cmbChooserField3->insertStringList( *slChooserNames );
- cmbChooserField4->insertStringList( *slChooserNames );
+ 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)) );
+
+ 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;
+ slChooserValues[index] = textChanged;
}
void ContactEditor::slotChooser2Change( const QString &textChanged ) {
int index = cmbChooserField2->currentItem();
- (*slChooserValues)[index] = textChanged;
+ slChooserValues[index] = textChanged;
}
void ContactEditor::slotChooser3Change( const QString &textChanged ) {
int index = cmbChooserField3->currentItem();
- (*slChooserValues)[index] = textChanged;
+ slChooserValues[index] = textChanged;
}
void ContactEditor::slotChooser4Change( const QString &textChanged ) {
int index = cmbChooserField4->currentItem();
- (*slChooserValues)[index] = textChanged;
+ slChooserValues[index] = textChanged;
}
void ContactEditor::slotAddressChange( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
- (*slBusinessAddress)[0] = textChanged;
+ slBusinessAddress[0] = textChanged;
} else {
- (*slHomeAddress)[0] = textChanged;
+ slHomeAddress[0] = textChanged;
}
}
void ContactEditor::slotAddress2Change( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
- (*slBusinessAddress)[1] = textChanged;
+ slBusinessAddress[1] = textChanged;
} else {
- (*slHomeAddress)[1] = textChanged;
+ slHomeAddress[1] = textChanged;
}
}
void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
- (*slBusinessAddress)[2] = textChanged;
+ slBusinessAddress[2] = textChanged;
} else {
- (*slHomeAddress)[2] = textChanged;
+ slHomeAddress[2] = textChanged;
}
}
void ContactEditor::slotCityChange( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
- (*slBusinessAddress)[3] = textChanged;
+ slBusinessAddress[3] = textChanged;
} else {
- (*slHomeAddress)[3] = textChanged;
+ slHomeAddress[3] = textChanged;
}
}
void ContactEditor::slotStateChange( const QString &textChanged ) {
-
+
if ( cmbAddress->currentItem() == 0 ) {
- (*slBusinessAddress)[4] = textChanged;
+ slBusinessAddress[4] = textChanged;
} else {
- (*slHomeAddress)[4] = textChanged;
+ slHomeAddress[4] = textChanged;
}
}
void ContactEditor::slotZipChange( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
- (*slBusinessAddress)[5] = textChanged;
+ slBusinessAddress[5] = textChanged;
} else {
- (*slHomeAddress)[5] = textChanged;
+ slHomeAddress[5] = textChanged;
}
}
void ContactEditor::slotCountryChange( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
- (*slBusinessAddress)[6] = textChanged;
+ slBusinessAddress[6] = textChanged;
} else {
- (*slHomeAddress)[6] = textChanged;
+ slHomeAddress[6] = textChanged;
}
}
void ContactEditor::slotCmbChooser1Change( int index ) {
- txtChooserField1->setText( (*slChooserValues)[index] );
-
+ txtChooserField1->setText( slChooserValues[index] );
+ txtChooserField1->setFocus();
}
void ContactEditor::slotCmbChooser2Change( int index ) {
- txtChooserField2->setText( (*slChooserValues)[index] );
-
+ txtChooserField2->setText( slChooserValues[index] );
+ txtChooserField2->setFocus();
}
void ContactEditor::slotCmbChooser3Change( int index ) {
- txtChooserField3->setText( (*slChooserValues)[index] );
+ txtChooserField3->setText( slChooserValues[index] );
+ txtChooserField3->setFocus();
}
void ContactEditor::slotCmbChooser4Change( int index ) {
- txtChooserField4->setText( (*slChooserValues)[index] );
+ txtChooserField4->setText( slChooserValues[index] );
+ txtChooserField4->setFocus();
}
void ContactEditor::slotAddressTypeChange( int index ) {
if ( index == 0 ) {
- txtAddress->setText( (*slBusinessAddress)[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] );
+ txtCity->setText( slBusinessAddress[3] );
+ txtState->setText( slBusinessAddress[4] );
+ txtZip->setText( slBusinessAddress[5] );
QLineEdit *txtTmp = cmbCountry->lineEdit();
- txtTmp->setText( (*slBusinessAddress)[6] );
+ txtTmp->setText( slBusinessAddress[6] );
} else {
- txtAddress->setText( (*slHomeAddress)[0] );
+ txtAddress->setText( slHomeAddress[0] );
//txtAddress2->setText( (*slHomeAddress)[1] );
//txtPOBox->setText( (*slHomeAddress)[2] );
- txtCity->setText( (*slHomeAddress)[3] );
- txtState->setText( (*slHomeAddress)[4] );
- txtZip->setText( (*slHomeAddress)[5] );
+ txtCity->setText( slHomeAddress[3] );
+ txtState->setText( slHomeAddress[4] );
+ txtZip->setText( slHomeAddress[5] );
QLineEdit *txtTmp = cmbCountry->lineEdit();
- txtTmp->setText( (*slHomeAddress)[6] );
+ txtTmp->setText( slHomeAddress[6] );
}
}
void ContactEditor::slotFullNameChange( const QString &textChanged ) {
int index = cmbFileAs->currentItem();
cmbFileAs->clear();
cmbFileAs->insertItem( parseName( textChanged, 0 ) );
cmbFileAs->insertItem( parseName( textChanged, 1 ) );
cmbFileAs->insertItem( parseName( textChanged, 2 ) );
cmbFileAs->insertItem( parseName( textChanged, 3 ) );
cmbFileAs->setCurrentItem( index );
useFullName = TRUE;
-}
+}
void ContactEditor::loadFields() {
QStringList::ConstIterator it;
QListIterator<QLabel> lit( listName );
- for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) {
+ for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) {
(*lit)->setText( *it );
}
}
void ContactEditor::accept() {
if ( isEmpty() ) {
cleanupFields();
reject();
} else {
saveEntry();
cleanupFields();
QDialog::accept();
}
}
void ContactEditor::slotNote() {
dlgNote->showMaximized();
if ( !dlgNote->exec() ) {
txtNote->setText( ent.notes() );
}
}
@@ -938,78 +966,78 @@ void ContactEditor::slotName() {
txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
}
dlgName->showMaximized();
if ( dlgName->exec() ) {
txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() );
slotFullNameChange( txtFullName->text() );
useFullName = FALSE;
}
}
void ContactEditor::setNameFocus() {
txtFullName->setFocus();
}
bool ContactEditor::isEmpty() {
// Test and see if the record should be saved.
// More strict than the original qtopia, needs name or fileas to save
QString t = txtFullName->text();
- if ( !t.isEmpty() && containsAlphaNum( t ) )
+ if ( !t.isEmpty() && containsAlphaNum( t ) )
return false;
-
+
t = cmbFileAs->currentText();
if ( !t.isEmpty() && containsAlphaNum( t ) )
return false;
return true;
}
QString ContactEditor::parseName( const QString fullName, int type ) {
QString simplifiedName( fullName.simplifyWhiteSpace() );
QString strFirstName;
QString strMiddleName;
QString strLastName;
QString strSuffix;
QString strTitle;
int commapos;
int spCount;
int spPos;
int spPos2;
-
+
commapos = simplifiedName.find( ',', 0, TRUE);
spCount = simplifiedName.contains( ' ', TRUE );
if ( commapos == -1 ) {
-
+
switch (spCount) {
case 0:
return simplifiedName;
case 1:
spPos = simplifiedName.find( ' ', 0, TRUE );
strFirstName = simplifiedName.left( spPos );
strLastName = simplifiedName.mid( spPos + 1 );
break;
case 2:
spPos = simplifiedName.find( ' ', 0, TRUE );
strFirstName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
strLastName = simplifiedName.mid( spPos2 + 1 );
break;
case 3:
spPos = simplifiedName.find( ' ', 0, TRUE );
strFirstName = simplifiedName.left( spPos );
spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
@@ -1023,49 +1051,49 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
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;
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 );
@@ -1077,225 +1105,225 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
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 ) {
+ 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] = "";
+ slHomeAddress[i] = "";
+ slBusinessAddress[i] = "";
}
QStringList::ConstIterator cit;
QListIterator<QLineEdit> itLE( listValue );
- for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) {
+ 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() +
+ *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)
+ if (hasCompany)
txtOrganization->setText( ent.company() );
if (hasNotes)
txtNote->setText( ent.notes() );
if (hasStreet) {
- (*slHomeAddress)[0] = ent.homeStreet();
- (*slBusinessAddress)[0] = ent.businessStreet();
+ 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();
+ slHomeAddress[3] = ent.homeCity();
+ slBusinessAddress[3] = ent.businessCity();
}
if (hasState) {
- (*slHomeAddress)[4] = ent.homeState();
- (*slBusinessAddress)[4] = ent.businessState();
+ slHomeAddress[4] = ent.homeState();
+ slBusinessAddress[4] = ent.businessState();
}
if (hasZip) {
- (*slHomeAddress)[5] = ent.homeZip();
- (*slBusinessAddress)[5] = ent.businessZip();
+ slHomeAddress[5] = ent.homeZip();
+ slBusinessAddress[5] = ent.businessZip();
}
if (hasCountry) {
- (*slHomeAddress)[6] = ent.homeCountry();
- (*slBusinessAddress)[6] = ent.businessCountry();
+ slHomeAddress[6] = ent.homeCountry();
+ slBusinessAddress[6] = ent.businessCountry();
}
QStringList::ConstIterator it;
QListIterator<QLineEdit> itLE( listValue );
- for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) {
+ for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) {
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 == "Birthday" )
(*itLE)->setText( ent.birthday() );
if ( *it == "Anniversary" )
(*itLE)->setText( ent.anniversary() );
if ( *it == "Nickname" )
(*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 ) {
+ 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.emails();
if ( *it == "Home Phone" )
*itV = ent.homePhone();
@@ -1325,174 +1353,174 @@ void ContactEditor::setEntry( const Contact &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" )
*itV = ent.yahooIM();
*/
if ( *it == "Home Web Page" )
*itV = ent.homeWebpage();
if ( *it == "Business Web Page" || *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 ) );
txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
-
+
useFullName = FALSE;
}
- /*if ( ent.firstName() != txtFirstName->text() ||
+ /*if ( ent.firstName() != txtFirstName->text() ||
ent.lastName != txtLastName->text() ||
ent.middleName != txtMiddleName->text() ) {
*/
ent.setFirstName( txtFirstName->text() );
ent.setLastName( txtLastName->text() );
ent.setMiddleName( txtMiddleName->text() );
ent.setSuffix( txtSuffix->text() );
//}
ent.setFileAs( cmbFileAs->currentText() );
-
+
ent.setCategories( cmbCat->currentCategories() );
if (hasTitle)
ent.setJobTitle( txtJobTitle->text() );
- if (hasCompany)
+ if (hasCompany)
ent.setCompany( txtOrganization->text() );
if (hasNotes)
ent.setNotes( txtNote->text() );
if (hasStreet) {
- ent.setHomeStreet( (*slHomeAddress)[0] );
- ent.setBusinessStreet( (*slBusinessAddress)[0] );
+ ent.setHomeStreet( slHomeAddress[0] );
+ ent.setBusinessStreet( slBusinessAddress[0] );
}
/*
if (hasStreet2) {
ent.setHomeStreet2( (*slHomeAddress)[1] );
ent.setBusinessStreet2( (*slBusinessAddress)[1] );
}
if (hasPOBox) {
ent.setHomePOBox( (*slHomeAddress)[2] );
ent.setBusinessPOBox( (*slBusinessAddress)[2] );
}
*/
if (hasCity) {
- ent.setHomeCity( (*slHomeAddress)[3] );
- ent.setBusinessCity( (*slBusinessAddress)[3] );
+ ent.setHomeCity( slHomeAddress[3] );
+ ent.setBusinessCity( slBusinessAddress[3] );
}
if (hasState) {
- ent.setHomeState( (*slHomeAddress)[4] );
- ent.setBusinessState( (*slBusinessAddress)[4] );
+ ent.setHomeState( slHomeAddress[4] );
+ ent.setBusinessState( slBusinessAddress[4] );
}
if (hasZip) {
- ent.setHomeZip( (*slHomeAddress)[5] );
- ent.setBusinessZip( (*slBusinessAddress)[5] );
+ ent.setHomeZip( slHomeAddress[5] );
+ ent.setBusinessZip( slBusinessAddress[5] );
}
-
+
if (hasCountry) {
- ent.setHomeCountry( (*slHomeAddress)[6] );
- ent.setBusinessCountry( (*slBusinessAddress)[6] );
+ ent.setHomeCountry( slHomeAddress[6] );
+ ent.setBusinessCountry( slBusinessAddress[6] );
}
QStringList::ConstIterator it;
QListIterator<QLineEdit> itLE( listValue );
- for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) {
+ for ( it = slDynamicEntries.begin(); 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 == "Birthday" )
ent.setBirthday( (*itLE)->text() );
if ( *it == "Anniversary" )
ent.setAnniversary( (*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 ) {
+ 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 2 Phone" )
ent.setBusiness2Phone( *itV );
*/
if ( *it == "Business Fax" || *it == "Work Fax" )
ent.setBusinessFax( *itV );
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 == "Emails" ) {
QString allemail;
QString defaultmail;
parseEmailFrom( *itV, defaultmail, allemail );
ent.setDefaultEmail( defaultmail );
@@ -1527,49 +1555,49 @@ void ContactEditor::saveEntry() {
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 == "Home Web Page" )
ent.setHomeWebpage( *itV );
if ( *it == "Business Web Page" || *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 ) {
strDefaultEmail = txt;
strAll = txt;
} else {
strDefaultEmail = txt.left( where ).stripWhiteSpace();
strAll = strDefaultEmail;
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index a58a860..4f3b56e 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -29,134 +29,134 @@
#include <qstringlist.h>
const int NAME_LF = 0;
const int NAME_LFM = 1;
const int NAME_FL = 2;
const int NAME_FMLS = 3;
const int NAME_F = 4;
const int NAME_M = 5;
const int NAME_L = 6;
const int NAME_S = 7;
class QScrollView;
class QTabWidget;
class QMultiLineEdit;
class QLineEdit;
class QComboBox;
class QPushButton;
class CategorySelect;
class QLabel;
class ContactEditor : public QDialog {
Q_OBJECT
-
+
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 slOrdered;
+ QStringList slDynamicEntries;
- QStringList *slHomeAddress;
- QStringList *slBusinessAddress;
- QStringList *slChooserNames;
- QStringList *slChooserValues;
+ 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