summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp61
-rw-r--r--core/pim/addressbook/contacteditor.h4
-rw-r--r--core/pim/addressbook/ocontactfields.cpp4
3 files changed, 44 insertions, 25 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 5a7bf1a..7338eeb 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -35,50 +35,50 @@
#include <qtabwidget.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qscrollview.h>
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <qmainwindow.h>
#include <qvaluelist.h>
#include <qpopupmenu.h>
#include <qlistbox.h>
#include <qhbox.h>
#include <qaction.h>
#include <qiconset.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 );
+//void parseEmailTo( const QString &strDefaultEmail,
+// const QString &strOtherEmail, QString &strBack );
ContactEditor::ContactEditor( const OContact &entry,
QWidget *parent,
const char *name,
WFlags fl )
: QDialog( parent, name, TRUE, fl ),
m_personalView ( false )
{
init();
setEntry( entry );
}
ContactEditor::~ContactEditor() {
}
void ContactEditor::init() {
useFullName = true;
uint i = 0;
QStringList trlChooserNames;
@@ -600,78 +600,92 @@ void ContactEditor::init() {
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);
setPersonalView ( m_personalView );
}
-void ContactEditor::slotChooser1Change( const QString &textChanged ) {
-
+void ContactEditor::defaultEmailChanged(int i){
+ qDebug("defaultEmailChanged");
int index = cmbChooserField1->currentItem();
-
- slChooserValues[index] = textChanged;
+ slChooserValues[index] = cmbDefaultEmail->text(i);
}
-void ContactEditor::slotChooser2Change( const QString &textChanged ) {
+void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) {
+
+ if (slChooserNames[index] == "Default Email"){
+ delete cmbDefaultEmail;
+ cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
+ cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
+ cmbDefaultEmail->insertStringList(ent.emailList());
+ connect(cmbDefaultEmail,SIGNAL(activated(int)),
+ SLOT(defaultEmailChanged(int)));
+ QString demail = ent.defaultEmail();
+ for ( int i = 0; i < cmbDefaultEmail->count(); i++)
+ if ( cmbDefaultEmail->text( i ) == demail )
+ cmbDefaultEmail->setCurrentItem( i );
+
+ cmbDefaultEmail->show();
+ }
- int index = cmbChooserField2->currentItem();
slChooserValues[index] = textChanged;
}
-void ContactEditor::slotChooser3Change( const QString &textChanged ) {
+void ContactEditor::slotChooser1Change( const QString &textChanged ) {
+ chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1);
+}
- int index = cmbChooserField3->currentItem();
+void ContactEditor::slotChooser2Change( const QString &textChanged ) {
+ chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2);
- slChooserValues[index] = textChanged;
+}
+void ContactEditor::slotChooser3Change( const QString &textChanged ) {
+ chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3);
}
void ContactEditor::slotChooser4Change( const QString &textChanged ) {
-
- int index = cmbChooserField4->currentItem();
-
- slChooserValues[index] = textChanged;
-
+ chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4);
}
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;
@@ -1350,56 +1364,59 @@ void ContactEditor::saveEntry() {
ent.setSpouse( (*itLE)->text() );
if ( *it == "Nickname" )
ent.setNickname( (*itLE)->text() );
if ( *it == "Children" )
ent.setChildren( (*itLE)->text() );
}
QStringList::ConstIterator itV;
for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
ent.setBusinessPhone( *itV );
if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
ent.setBusinessFax( *itV );
if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
ent.setBusinessMobile( *itV );
if ( *it == "Emails" ){
- QString allemail;
- QString defaultmail;
- parseEmailFrom( *itV, defaultmail, allemail );
- // ent.clearEmails();
- ent.setDefaultEmail( defaultmail );
- ent.setEmails( allemail );
+ QString allemail;
+ QString defaultmail;
+ parseEmailFrom( *itV, defaultmail, allemail );
+ // ent.clearEmails();
+// ent.setDefaultEmail( defaultmail );
+ ent.setEmails( allemail );
}
+ if ( *it == "Default Email")
+ ent.setDefaultEmail( *itV );
+
if ( *it == "Home Phone" )
ent.setHomePhone( *itV );
if ( *it == "Home Fax" )
ent.setHomeFax( *itV );
if ( *it == "Home Mobile" )
ent.setHomeMobile( *itV );
if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
ent.setBusinessPager( *itV );
if ( *it == "Home Web Page" )
ent.setHomeWebpage( *itV );
if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
ent.setBusinessWebpage( *itV );
}
int gender = cmbGender->currentItem();
ent.setGender( QString::number( gender ) );
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index 250b831..d4b7f27 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -79,94 +79,96 @@ class ContactEditor : public QDialog {
void updateDatePicker();
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 );
void slotAnniversaryDateChanged( int year, int month, int day);
void slotBirthdayDateChanged( int year, int month, int day);
void slotRemoveBirthday();
void slotRemoveAnniversary();
+ void defaultEmailChanged(int);
private:
+ void chooserChange( const QString&, int , QLineEdit* );
bool useFullName;
- // bool hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry;
OContact ent;
QDialog *dlgNote;
QDialog *dlgName;
QList<QLineEdit> listValue;
QList<QLabel> listName;
QStringList slDynamicEntries;
QStringList trlDynamicEntries;
bool m_personalView;
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 *cmbDefaultEmail;
QComboBox *cmbFileAs;
CategorySelect *cmbCat;
QLabel *labCat;
QScrollView *svAddress;
QLineEdit *txtAddress;
//QLineEdit *txtAddress2;
//QLineEdit *txtPOBox;
QLineEdit *txtCity;
QLineEdit *txtState;
QLineEdit *txtZip;
QComboBox *cmbAddress;
QComboBox *cmbCountry;
QScrollView *svDetails;
QComboBox *cmbGender;
DateBookMonth* birthdayPicker;
QToolButton* birthdayButton;
DateBookMonth* anniversaryPicker;
QToolButton* anniversaryButton;
};
#endif
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp
index df57efa..7823a9c 100644
--- a/core/pim/addressbook/ocontactfields.cpp
+++ b/core/pim/addressbook/ocontactfields.cpp
@@ -21,49 +21,49 @@ QStringList OContactFields::untrdetailsfields( bool sorted )
list.append( "Manager" );
list.append( "Spouse" );
list.append( "Gender" );
list.append( "Birthday" );
list.append( "Anniversary" );
list.append( "Nickname" );
list.append( "Children" );
if (sorted) list.sort();
return list;
}
/*!
\internal
Returns a translated list of phone field names for a contact.
*/
QStringList OContactFields::trphonefields( bool sorted )
{
QStringList list;
list.append( QObject::tr( "Business Phone" ) );
list.append( QObject::tr( "Business Fax" ) );
list.append( QObject::tr( "Business Mobile" ) );
- // list.append( QObject::tr( "Default Email" ) );
+ list.append( QObject::tr( "Default Email" ) );
list.append( QObject::tr( "Emails" ) );
list.append( QObject::tr( "Home Phone" ) );
list.append( QObject::tr( "Home Fax" ) );
list.append( QObject::tr( "Home Mobile" ) );
if (sorted) list.sort();
return list;
}
/*!
\internal
Returns a translated list of details field names for a contact.
*/
QStringList OContactFields::trdetailsfields( bool sorted )
{
QStringList list;
list.append( QObject::tr( "Office" ) );
list.append( QObject::tr( "Profession" ) );
list.append( QObject::tr( "Assistant" ) );
list.append( QObject::tr( "Manager" ) );
@@ -117,49 +117,49 @@ QStringList OContactFields::trfields( bool sorted )
list.append( QObject::tr( "Home Web Page" ) );
list += trdetailsfields( sorted );
list.append( QObject::tr( "Notes" ) );
list.append( QObject::tr( "Groups" ) );
if (sorted) list.sort();
return list;
}
/*!
\internal
Returns a list of phone field names for a contact.
*/
QStringList OContactFields::untrphonefields( bool sorted )
{
QStringList list;
list.append( "Business Phone" );
list.append( "Business Fax" );
list.append( "Business Mobile" );
- // list.append( "Default Email" );
+ list.append( "Default Email" );
list.append( "Emails" );
list.append( "Home Phone" );
list.append( "Home Fax" );
list.append( "Home Mobile" );
if (sorted) list.sort();
return list;
}
/*!
\internal
Returns an untranslated list of field names for a contact.
*/
QStringList OContactFields::untrfields( bool sorted )
{
QStringList list;
list.append( "Name Title" );
list.append( "First Name" );
list.append( "Middle Name" );
list.append( "Last Name" );
list.append( "Suffix" );