summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO11
-rw-r--r--core/pim/addressbook/addressbook.cpp9
-rw-r--r--core/pim/addressbook/configdlg_base.ui6
-rw-r--r--core/pim/addressbook/contacteditor.cpp153
-rw-r--r--core/pim/addressbook/contacteditor.h16
5 files changed, 154 insertions, 41 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index 96134f4..100a6fd 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -6,20 +6,20 @@ Urgent:
Important:
-- Personal contact editor: Disable categories
- Name order selected in "contacteditor" not used in list view.
-- contacteditor: Birthday, annyversary, ... : Use Dateselector
- Overview window cleanup needed..
- Cursor keys should work in detail-view (ablabel)
-- "What's this" should be added
+ -> Ablabel should be removed and Abtable should be increased with
+ different views (as started by darwin zins)..
- Store last settings of combo-boxes
- Finishing of new View functions (List, Phonebook...)
- The names of the countries are sorted by there english names, only..
Even if they are translated.. :S
- Reload if contacts were changed externally
+- "What's this" should be added
Less important:
- The picker (alphabetical sort widget) should be
@@ -28,9 +28,9 @@ Less important:
memory footprint and to make everything more easy !
(abtable should store Iterator for selected Category)
Should be Fixed (not absolute sure, need further validation):
-- "Nonenglish" translation bug has to be fixed.
+
Fixed:
- Syncing: abtable not reloaded after sync.
- Find widget should be replaced by something like
@@ -40,4 +40,7 @@ Fixed:
- Advanced handling of cursor keys (search..)
- Mail-Icon is missing
- Use opie-mail insted of qt-mail if possible.
- Font menu is invisible using german translation
+- Personal contact editor: Disable categories
+- "Nonenglish" translation bug has to be fixed.
+- contacteditor: Birthday, annyversary, ... : Use Dateselector
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 39d8321..108e66d 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -93,9 +93,9 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
useRegExp = cfg.readBoolEntry( "useRegExp" );
caseSensitive = cfg.readBoolEntry( "caseSensitive" );
doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" );
cfg.setGroup("Mail");
- m_useQtMail = cfg.readBoolEntry( "useQtMail" );
+ m_useQtMail = cfg.readBoolEntry( "useQtMail", true );
m_useOpieMail=cfg.readBoolEntry( "useOpieMail" );
initFields();
@@ -672,14 +672,18 @@ void AddressbookWindow::editPersonal()
OContact me;
if (QFile::exists(filename))
me = OContact::readVCard( filename )[0];
if (bAbEditFirstTime) {
+ qWarning("Editing personal data");
abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields,
this, "editor" );
// don't create a new editor every time
bAbEditFirstTime = FALSE;
- } else
+ } else{
abEditor->setEntry( me );
+ }
+
+ abEditor->setPersonalView( true );
abEditor->setCaption(tr("Edit My Personal Details"));
abEditor->showMaximized();
@@ -693,8 +697,9 @@ void AddressbookWindow::editPersonal()
abView()->init(new_personal);
abView()->sync();
}
abEditor->setCaption( tr("Edit Address") );
+ abEditor->setPersonalView( false );
}
void AddressbookWindow::slotPersonalView()
{
diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui
index d3ea12e..a6fcffa 100644
--- a/core/pim/addressbook/configdlg_base.ui
+++ b/core/pim/addressbook/configdlg_base.ui
@@ -11,10 +11,10 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>217</width>
- <height>287</height>
+ <width>244</width>
+ <height>298</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
@@ -328,8 +328,10 @@ is provided free !</string>
<tabstop>configDlg_base</tabstop>
<tabstop>m_useWildCard</tabstop>
<tabstop>m_useCaseSensitive</tabstop>
<tabstop>m_signalWrapAround</tabstop>
+ <tabstop>m_useQtMail</tabstop>
+ <tabstop>m_useOpieMail</tabstop>
<tabstop>buttonOk</tabstop>
<tabstop>buttonCancel</tabstop>
</tabstops>
</UI>
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index e7f2ebd..a59a927 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -23,8 +23,9 @@
#include <qpe/categoryselect.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
+#include <qpe/timeconversion.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qtabwidget.h>
@@ -35,8 +36,9 @@
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <qmainwindow.h>
#include <qvaluelist.h>
+#include <qpopupmenu.h>
static inline bool containsAlphaNum( const QString &str );
static inline bool constainsWhiteSpace( const QString &str );
@@ -56,9 +58,10 @@ ContactEditor::ContactEditor( const OContact &entry,
const char *name,
WFlags fl )
: QDialog( parent, name, TRUE, fl ),
orderedValues( newOrderedValues ),
- slOrdered( *slNewOrdered )
+ slOrdered( *slNewOrdered ),
+ m_personalView ( false )
{
init();
initMap();
@@ -205,9 +208,18 @@ void ContactEditor::init() {
//slDynamicEntries->remove( it );
continue;
}
- if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" )
+ if ( *it == "Name Title" ||
+ *it == "First Name" ||
+ *it == "Middle Name" ||
+ *it == "Last Name" ||
+ *it == "File As" ||
+ *it == "Default Email" ||
+ *it == "Emails" ||
+ *it == "Groups" ||
+ *it == "Anniversary" ||
+ *it == "Birthday" )
continue;
if ( *it == "Name Title" ) {
//slDynamicEntries->remove( it );
@@ -401,13 +413,23 @@ void ContactEditor::init() {
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 );
+ labCat = new QLabel( tr( "Category" ), container );
+ gl->addWidget( labCat, 7, 0 );
cmbCat = new CategorySelect( container );
gl->addWidget( cmbCat, 7, 1 );
+ // We don't need categories for the personal view
+ if ( m_personalView ){
+ qWarning("Disable Category..");
+ labCat->hide();
+ cmbCat->hide();
+ } else {
+ labCat->show();
+ cmbCat->show();
+ }
+
btnNote = new QPushButton( tr( "Notes..." ), container );
gl->addWidget( btnNote, 8, 1 );
tabMain->insertTab( tabViewport, tr( "General" ) );
@@ -706,11 +728,58 @@ void ContactEditor::init() {
svDetails->addChild( container );
gl = new QGridLayout( container, 1, 2, 2, 4 );
+ int counter = 0;
+
+ // Birthday
+ l = new QLabel( tr("Birthday"), container );
+ gl->addWidget( l, counter, 0 );
+
+ QPopupMenu* m1 = new QPopupMenu( container );
+ birthdayPicker = new DateBookMonth( m1, 0, TRUE );
+ m1->insertItem( birthdayPicker );
+
+ birthdayButton= new QToolButton( container, "buttonStart" );
+ birthdayButton->setPopup( m1 );
+ birthdayButton->setPopupDelay(0);
+ gl->addWidget( birthdayButton, counter , 1 );
+ connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( slotBirthdayDateChanged( int, int, int ) ) );
+
+ ++counter;
+
+ // Anniversary
+ l = new QLabel( tr("Anniversary"), container );
+ gl->addWidget( l, counter, 0 );
+
+ m1 = new QPopupMenu( container );
+ anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
+ m1->insertItem( anniversaryPicker );
+
+ anniversaryButton= new QToolButton( container, "buttonStart" );
+ anniversaryButton->setPopup( m1 );
+ anniversaryButton->setPopupDelay(0);
+ gl->addWidget( anniversaryButton, counter , 1 );
+ connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) );
+
+ ++counter;
+
+ // Gender
+ l = new QLabel( tr("Gender"), container );
+ gl->addWidget( l, counter, 0 );
+ cmbGender = new QComboBox( container );
+ cmbGender->insertItem( "", 0 );
+ cmbGender->insertItem( tr("Male"), 1);
+ cmbGender->insertItem( tr("Female"), 2);
+ gl->addWidget( cmbGender, counter, 1 );
+
+ ++counter;
+
// Create Labels and lineedit fields for every dynamic entry
QStringList::ConstIterator it = slDynamicEntries.begin();
- for (i = 0; it != slDynamicEntries.end(); i++, ++it) {
+ for (i = counter; it != slDynamicEntries.end(); i++, ++it) {
l = new QLabel( QString::null , container );
listName.append( l );
gl->addWidget( l, i, 0 );
QLineEdit *e = new QLineEdit( container );
@@ -719,15 +788,8 @@ void ContactEditor::init() {
}
// Fill labels with names..
loadFields();
- 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 );
@@ -1008,8 +1070,9 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
useFullName = TRUE;
}
+// Loads the detail fields
void ContactEditor::loadFields() {
QStringList::ConstIterator it;
QListIterator<QLabel> lit( listName );
@@ -1035,20 +1098,29 @@ void ContactEditor::loadFields() {
if ( *it == "Spouse" )
(*lit)->setText( tr( "Spouse" ) );
- if ( *it == "Birthday" )
- (*lit)->setText( tr( "Birthday" ) );
-
- if ( *it == "Anniversary" )
- (*lit)->setText( tr( "Anniversary" ) );
-
if ( *it == "Nickname" )
(*lit)->setText( tr( "Nickname" ) );
if ( *it == "Children" )
(*lit)->setText( tr( "Children" ) );
}
+ // Set DatePicker
+ qWarning ("**Info: %s", ent.birthday().latin1() );
+ if ( !ent.birthday().isEmpty() ){
+ birthdayButton->setText( ent.birthday() );
+ birthdayPicker->setDate( TimeConversion::fromString ( ent.birthday() ) );
+ } else
+ birthdayButton->setText( tr ("Unknown") );
+
+ qWarning ("**Info: %s", ent.anniversary().latin1() );
+ if ( !ent.anniversary().isEmpty() ){
+ anniversaryButton->setText( ent.anniversary() );
+ anniversaryPicker->setDate( TimeConversion::fromString ( ent.birthday() ) );
+ } else
+ anniversaryButton->setText( tr ("Unknown") );
+
}
void ContactEditor::accept() {
@@ -1428,14 +1500,8 @@ void ContactEditor::setEntry( const OContact &entry ) {
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" )
@@ -1517,8 +1583,9 @@ void ContactEditor::setEntry( const OContact &entry ) {
}
+
cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
QString gender = ent.gender();
cmbGender->setCurrentItem( gender.toInt() );
@@ -1530,8 +1597,10 @@ void ContactEditor::setEntry( const OContact &entry ) {
slotCmbChooser3Change( cmbChooserField3->currentItem() );
slotAddressTypeChange( cmbAddress->currentItem() );
+ loadFields();
+
}
void ContactEditor::saveEntry() {
@@ -1626,14 +1695,8 @@ void ContactEditor::saveEntry() {
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" )
@@ -1805,4 +1868,34 @@ static inline bool constainsWhiteSpace( const QString &str )
return TRUE;
return FALSE;
}
+void ContactEditor::setPersonalView( bool personal )
+{
+ m_personalView = personal;
+ if ( personal ){
+ cmbCat->hide();
+ labCat->hide();
+ } else{
+ cmbCat->show();
+ labCat->show();
+
+ }
+}
+
+void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
+{
+ QDate date;
+ date.setYMD( year, month, day );
+ QString dateString = TimeString::numberDateString( date );
+ anniversaryButton->setText( dateString );
+ ent.setAnniversary ( dateString );
+}
+
+void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
+{
+ QDate date;
+ date.setYMD( year, month, day );
+ QString dateString = TimeString::numberDateString( date );
+ birthdayButton->setText( dateString );
+ ent.setBirthday ( dateString );
+}
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index 8ed8553..40ce864 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -22,8 +22,10 @@
#define CONTACTEDITOR_H
#include <opie/ocontact.h>
+#include <qpe/datebookmonth.h>
+
#include <qdialog.h>
#include <qlist.h>
#include <qmap.h>
#include <qstringlist.h>
@@ -60,8 +62,9 @@ class ContactEditor : public QDialog {
WFlags fl = 0 );
~ContactEditor();
void loadFields();
void setNameFocus();
+ void setPersonalView( bool personal = true );
OContact entry() const { return ent; }
public slots:
void slotNote();
@@ -77,9 +80,8 @@ class ContactEditor : public QDialog {
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 );
@@ -96,8 +98,10 @@ class ContactEditor : public QDialog {
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);
private:
bool useFullName, hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry;
@@ -111,8 +115,10 @@ class ContactEditor : public QDialog {
const QValueList<int> *orderedValues;
QStringList slOrdered;
QStringList slDynamicEntries;
+ bool m_personalView;
+
QStringList slHomeAddress;
QStringList slBusinessAddress;
QStringList slChooserNames;
QStringList slChooserValues;
@@ -142,8 +148,9 @@ class ContactEditor : public QDialog {
QComboBox *cmbChooserField3;
QComboBox *cmbChooserField4;
QComboBox *cmbFileAs;
CategorySelect *cmbCat;
+ QLabel *labCat;
QScrollView *svAddress;
QLineEdit *txtAddress;
//QLineEdit *txtAddress2;
@@ -155,8 +162,11 @@ class ContactEditor : public QDialog {
QComboBox *cmbCountry;
QScrollView *svDetails;
QComboBox *cmbGender;
-
-};
+ DateBookMonth* birthdayPicker;
+ QToolButton* birthdayButton;
+ DateBookMonth* anniversaryPicker;
+ QToolButton* anniversaryButton;
+ };
#endif