summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp2
-rw-r--r--core/pim/addressbook/contacteditor.cpp12
-rw-r--r--core/pim/todo/todotable.h11
3 files changed, 14 insertions, 11 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index e11cf4c..3255269 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -484,97 +484,97 @@ 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.insertEmails( email );
cnt.setDefaultEmail( email );
cnt.setFileAs();
if ( bAbEditFirstTime ) {
abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields,
this, "editor" );
bAbEditFirstTime = FALSE;
} else {
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();
// ###### note: contacts may have been added - save here!
setCentralWidget(abList);
QCopEnvelope e(ch,m);
i=0;
for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {
QStringList sel = picker.selection(i++);
e << sel;
}
}
#endif
}
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 39bd63c..ae86ed0 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -66,256 +66,256 @@ ContactEditor::ContactEditor( const Contact &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( "" );
}
{
hasGender = FALSE;
hasTitle = FALSE;
hasCompany = FALSE;
hasNotes = FALSE;
hasStreet = FALSE;
hasStreet2 = FALSE;
hasPOBox = FALSE;
hasCity = FALSE;
hasState = FALSE;
hasZip = FALSE;
hasCountry = FALSE;
QStringList::ConstIterator it = slOrdered.begin();
for ( i = 0; it != slOrdered.end(); i++, ++it ) {
if ( (*it) == tr( "Business Fax" ) ) {
slChooserNames.append( *it );
slChooserValues.append("" );
//slDynamicEntries->remove( it );
continue;
}
-
+
if ( (*it) == tr( "Home Fax" ) ) {
slChooserNames.append( *it );
slChooserValues.append("" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Business Phone" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Home Phone" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
/*
if ( (*it).right( 2 ) == tr( "IM" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
} */
if ( (*it) == tr( "Business Mobile" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Home Mobile" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Business WebPage" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Home Web Page" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Business Pager" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( *it == tr( "Default Email" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
if ( *it == tr( "Emails" ) ) {
slChooserNames.append( *it );
slChooserValues.append( "" );
//slDynamicEntries->remove( it );
continue;
}
-
+
if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" )
continue;
if ( *it == tr( "Name Title" ) ) {
//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") || *it == tr( "Organization" ) ) {
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) == tr( "Business Street" ) ) {
hasStreet = TRUE;
// slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Home Street" ) ) {
hasStreet = TRUE;
// slDynamicEntries->remove( it );
continue;
}
/*
if ( (*it).right( 8 ) == tr( "Street 2" ) ) {
hasStreet2 = TRUE;
// slDynamicEntries->remove( it );
continue;
- }
+ }
if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) {
hasPOBox = TRUE;
// slDynamicEntries->remove( it );
continue;
} */
if ( (*it) == tr( "Business City" ) ) {
hasCity = TRUE;
// slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Business State" ) ) {
hasState = TRUE;
// slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Business Zip" ) ) {
hasZip = TRUE;
// slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Business Country" ) ) {
hasCountry = TRUE;
// slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Home City" ) ) {
hasCity = TRUE;
// slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Home State" ) ) {
hasState = TRUE;
// slDynamicEntries->remove( it );
continue;
}
if ( (*it) == tr( "Home Zip" ) ) {
hasZip = TRUE;
// slDynamicEntries->remove( it );
continue;
}
@@ -989,97 +989,97 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
cmbFileAs->setCurrentItem( index );
useFullName = TRUE;
}
void ContactEditor::loadFields() {
QStringList::ConstIterator it;
QListIterator<QLabel> lit( listName );
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() );
}
}
void ContactEditor::slotName() {
QString tmpName;
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) );
}
dlgName->showMaximized();
if ( dlgName->exec() ) {
-
+
tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
txtFullName->setText( tmpName.simplifyWhiteSpace() );
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 ) )
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 ) {
@@ -1372,97 +1372,97 @@ void ContactEditor::setEntry( const Contact &entry ) {
if ( *it == tr("Profession" ))
(*itLE)->setText( ent.profession() );
if ( *it == tr("Assistant" ))
(*itLE)->setText( ent.assistant() );
if ( *it == tr("Manager" ))
(*itLE)->setText( ent.manager() );
if ( *it == tr("Spouse" ))
(*itLE)->setText( ent.spouse() );
if ( *it == tr("Birthday" ))
(*itLE)->setText( ent.birthday() );
if ( *it == tr("Anniversary" ))
(*itLE)->setText( ent.anniversary() );
if ( *it == tr("Nickname" ))
(*itLE)->setText( ent.nickname() );
if ( *it == tr("Children" ))
(*itLE)->setText( ent.children() );
}
QStringList::Iterator itV;
for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
if ( *it == tr("Business Phone") || *it == tr("Work Phone" ))
*itV = ent.businessPhone();
/*
if ( *it == "Business 2 Phone" )
*itV = ent.business2Phone();
*/
if ( *it == tr("Business Fax") || *it == tr("Work Fax" ))
*itV = ent.businessFax();
if ( *it == tr("Business Mobile") || *it == tr("work Mobile" ))
*itV = ent.businessMobile();
/*
if ( *it == "Company Phone" )
*itV = ent.companyPhone();
*/
if ( *it == tr("Default Email" ))
*itV = ent.defaultEmail();
if ( *it == tr("Emails" ))
- *itV = ent.emails();
+ *itV = ent.emailList().join(";");
if ( *it == tr("Home Phone" ))
*itV = ent.homePhone();
/*
if ( *it == "Home 2 Phone" )
*itV = ent.home2Phone();
*/
if ( *it == tr("Home Fax" ))
*itV = ent.homeFax();
if ( *it == tr("Home Mobile" ))
*itV = ent.homeMobile();
/*
if ( *it == "Car Phone" )
*itV = ent.carPhone();
if ( *it == "ISDN Phone" )
*itV = ent.ISDNPhone();
if ( *it == "Other Phone" )
*itV = ent.otherPhone();
*/
if ( *it == tr("Business Pager") || *it == tr("Work Pager" ))
*itV = ent.businessPager();
/*
if ( *it == "Home Pager")
*itV = ent.homePager();
if ( *it == "AIM IM" )
*itV = ent.AIMIM();
if ( *it == "ICQ IM" )
*itV = ent.ICQIM();
if ( *it == "Jabber IM" )
*itV = ent.jabberIM();
if ( *it == "MSN IM" )
*itV = ent.MSNIM();
if ( *it == "Yahoo IM" )
*itV = ent.yahooIM();
*/
if ( *it == tr("Home Web Page") )
*itV = ent.homeWebpage();
if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") )
*itV = ent.businessWebpage();
@@ -1573,97 +1573,97 @@ void ContactEditor::saveEntry() {
ent.setAssistant( (*itLE)->text() );
if ( *it == tr("Manager" ))
ent.setManager( (*itLE)->text() );
if ( *it == tr("Spouse" ))
ent.setSpouse( (*itLE)->text() );
if ( *it == tr("Birthday" ))
ent.setBirthday( (*itLE)->text() );
if ( *it == tr("Anniversary" ))
ent.setAnniversary( (*itLE)->text() );
if ( *it == tr("Nickname" ))
ent.setNickname( (*itLE)->text() );
if ( *it == tr("Children" ))
ent.setChildren( (*itLE)->text() );
}
QStringList::ConstIterator itV;
for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
if ( *it == tr("Business Phone") || *it == tr("Work Phone" ))
ent.setBusinessPhone( *itV );
/*
if ( *it == tr("Business 2 Phone" )
ent.setBusiness2Phone( *itV );
*/
if ( *it == tr("Business Fax") || *it == tr("Work Fax" ))
ent.setBusinessFax( *itV );
if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" ))
ent.setBusinessMobile( *itV );
/*
if ( *it == "Company Phone" )
ent.setCompanyPhone( *itV );
*/
//if ( *it == "Default Email" )
//ent.setDefaultEmail( *itV );
if ( *it == tr("Emails" )) {
QString allemail;
QString defaultmail;
parseEmailFrom( *itV, defaultmail, allemail );
ent.setDefaultEmail( defaultmail );
- ent.setEmails( *itV );
+ ent.insertEmails( *itV );
}
if ( *it == tr("Home Phone" ))
ent.setHomePhone( *itV );
/*
if ( *it == "Home 2 Phone" )
ent.setHome2Phone( *itV );
*/
if ( *it == tr("Home Fax" ))
ent.setHomeFax( *itV );
if ( *it == tr("Home Mobile" ))
ent.setHomeMobile( *itV );
/*
if ( *it == "Car Phone" )
ent.setCarPhone( *itV );
if ( *it == "ISDN Phone" )
ent.setISDNPhone( *itV );
if ( *it == "Other Phone" )
ent.setOtherPhone( *itV );
*/
if ( *it == tr("Business Pager") || *it == tr("Work Pager") )
ent.setBusinessPager( *itV );
/*
if ( *it == "Home Pager" )
ent.setHomePager( *itV );
if ( *it == "AIM IM" )
ent.setAIMIM( *itV );
if ( *it == "ICQ IM" )
ent.setICQIM( *itV );
if ( *it == "Jabber IM" )
ent.setJabberIM( *itV );
if ( *it == "MSN IM" )
ent.setMSNIM( *itV );
if ( *it == "Yahoo IM" )
ent.setYahooIM( *itV );
*/
if ( *it == tr("Home Web Page") )
ent.setHomeWebpage( *itV );
if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" ))
ent.setBusinessWebpage( *itV );
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
index 39e00d1..7539df1 100644
--- a/core/pim/todo/todotable.h
+++ b/core/pim/todo/todotable.h
@@ -26,97 +26,97 @@
//#include <qpe/task.h>
#include <opie/todoevent.h>
#include <qtable.h>
#include <qmap.h>
#include <qguardedptr.h>
class Node;
class QComboBox;
class QTimer;
class CheckItem : public QTableItem
{
public:
CheckItem( QTable *t, const QString &sortkey );
void setChecked( bool b );
void toggle();
bool isChecked() const;
void setKey( const QString &key ) { sortKey = key; }
QString key() const;
void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
private:
bool checked;
QString sortKey;
};
class ComboItem : public QTableItem
{
public:
ComboItem( QTable *t, EditType et );
QWidget *createEditor() const;
void setContentFromEditor( QWidget *w );
void setText( const QString &s );
int alignment() const { return Qt::AlignCenter; }
QString text() const;
private:
QGuardedPtr<QComboBox> cb;
};
class TodoTextItem : public QTableItem
{
public:
- TodoTextItem( QTable *t, const QString & str )
+ TodoTextItem( QTable *t, const QString & str )
:QTableItem( t, QTableItem::Never, str ) {}
QString key () const { return Qtopia::buildSortKey( text() ); }
};
class DueTextItem : public QTableItem
{
public:
DueTextItem( QTable *t, ToDoEvent *ev );
QString key() const;
void setToDoEvent( const ToDoEvent *ev );
void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
private:
int m_off;
bool m_hasDate:1;
bool m_completed:1;
};
enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE };
namespace Opie
{
class XMLElement;
};
class TodoTable : public QTable
{
Q_OBJECT
public:
TodoTable( QWidget *parent = 0, const char * name = 0 );
void addEntry( const ToDoEvent &todo );
void clearFindRow() { currFindRow = -2; }
ToDoEvent currentEntry() const;
void replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem = false );
QStringList categories();
void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); }
bool showCompleted() const { return showComp; }
void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();}
bool showDeadline() const { return showDeadl;}
void setShowCategory( const QString &c ) { showCat = c; updateVisible(); }
@@ -147,99 +147,102 @@ signals:
void signalNotFound();
void signalWrapAround();
void showDetails( const ToDoEvent & );
protected:
void keyPressEvent( QKeyEvent *e );
private:
void updateVisible();
void viewportPaintEvent( QPaintEvent * );
void internalAddEntries( QList<ToDoEvent> &list);
inline void insertIntoTable( ToDoEvent *todo, int row );
void updateJournal( const ToDoEvent &todo, journal_action action);
void mergeJournal();
void journalFreeReplaceEntry( const ToDoEvent &todo, int row );
void journalFreeRemoveEntry( int row );
inline void realignTable( int row );
void loadFile( const QString &strFile);
private slots:
void slotClicked( int row, int col, int button, const QPoint &pos );
void slotPressed( int row, int col, int button, const QPoint &pos );
void slotCheckPriority(int row, int col );
void slotCurrentChanged(int row, int col );
void slotDoFind( const QString &findString, bool caseSensetive,
bool backwards, int category );
void slotShowMenu();
void rowHeightChanged( int row );
void slotCheckDay(); // check the day
private:
friend class TodoWindow;
QMap<CheckItem*, ToDoEvent *> todoList;
QStringList categoryList;
bool showComp;
QString showCat;
QTimer *menuTimer;
QDate mDay;
QTimer *mDayTimer; // see if the day changed
bool enablePainting;
Categories mCat;
int currFindRow;
bool showDeadl:1;
};
inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row )
{
- QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A')
- + todo->priority() )
+ int rows = numRows();
+ ++rows;
+ setNumRows( rows );
+ QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A')
+ + todo->priority() )
+ Qtopia::buildSortKey( todo->description() );
CheckItem *chk = new CheckItem( this, sortKey );
chk->setChecked( todo->isCompleted() );
ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent );
cmb->setText( QString::number( todo->priority() ) );
QString sum = todo->summary();
QTableItem *ti = new TodoTextItem( this, sum.isEmpty() ? todo->description().left(40).simplifyWhiteSpace() : sum );
ti->setReplaceable( false );
DueTextItem *due = new DueTextItem(this, todo );
setItem( row, 3, due);
-
+
setItem( row, 0, chk );
setItem( row, 1, cmb );
setItem( row, 2, ti );
todoList.insert( chk, todo );
}
inline void TodoTable::realignTable( int row )
{
QTableItem *ti1,
*ti2,
*ti3,
*ti4;
int totalRows = numRows();
for ( int curr = row; curr < totalRows - 1; curr++ ) {
// this is bad, we must take the item out and then
// set it. In the end, it behaves no worse (time wise)
// then the old way of saving the entries to file, clearing
// the table re-reading in the file and resetting the table
ti1 = item( curr + 1, 0 );
ti2 = item( curr + 1, 1 );
ti3 = item( curr + 1, 2 );
ti4 = item( curr + 1, 3 );
takeItem( ti1 );
takeItem( ti2 );
takeItem( ti3 );
takeItem( ti4 );
setItem( curr, 0, ti1 );
setItem( curr, 1, ti2 );
setItem( curr, 2, ti3 );
setItem( curr, 3, ti4 );
}
setNumRows( totalRows - 1 );
}
#endif