summaryrefslogtreecommitdiff
path: root/library/backend
Side-by-side diff
Diffstat (limited to 'library/backend') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/contact.h4
-rw-r--r--library/backend/timeconversion.cpp15
2 files changed, 14 insertions, 5 deletions
diff --git a/library/backend/contact.h b/library/backend/contact.h
index 4999430..2294986 100644
--- a/library/backend/contact.h
+++ b/library/backend/contact.h
@@ -182,58 +182,58 @@ public:
// other
QString notes() const { return find( Qtopia::Notes ); }
QString groups() const { return find( Qtopia::Groups ); }
QStringList groupList() const;
// // custom
// const QString &customField( const QString &key )
// { return find( Custom- + key ); }
static QStringList fields();
static QStringList trfields();
QString toRichText() const;
QMap<int, QString> toMap() const;
QString field( int key ) const { return find( key ); }
// journaling...
void saveJournal( journal_action action, const QString &key = QString::null );
void save( QString &buf ) const;
void setUid( int i )
{ Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); }
+ void setEmails( const QString &v );
+ QString emails() const { return find( Qtopia::Emails ); }
private:
friend class AbEditor;
friend class AbTable;
friend class AddressBookAccessPrivate;
friend class XMLIO;
QString emailSeparator() const { return " "; }
// the emails should be seperated by a comma
- void setEmails( const QString &v );
- QString emails() const { return find( Qtopia::Emails ); }
void insert( int key, const QString &value );
void replace( int key, const QString &value );
QString find( int key ) const;
QString displayAddress( const QString &street,
const QString &city,
const QString &state,
const QString &zip,
const QString &country ) const;
Qtopia::UidGen &uidGen() { return sUidGen; }
static Qtopia::UidGen sUidGen;
QMap<int, QString> mMap;
ContactPrivate *d;
};
// these methods are inlined to keep binary compatability with Qtopia 1.5
inline void Contact::insertEmail( const QString &v )
{
//qDebug("insertEmail %s", v.latin1());
QString e = v.simplifyWhiteSpace();
QString def = defaultEmail();
diff --git a/library/backend/timeconversion.cpp b/library/backend/timeconversion.cpp
index 3c25922..df7b0d5 100644
--- a/library/backend/timeconversion.cpp
+++ b/library/backend/timeconversion.cpp
@@ -4,57 +4,66 @@
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qglobal.h>
#include <qtopia/timeconversion.h>
#include <qregexp.h>
#include <stdlib.h>
QString TimeConversion::toString( const QDate &d )
{
- QString r = QString::number( d.day() ) + "." +
+ QString empty;
+ if ( d.isNull() )
+ return empty;
+
+ QString r = QString::number( d.day() ) + "." +
QString::number( d.month() ) + "." +
QString::number( d.year() );
- //qDebug("TimeConversion::toString %s", r.latin1());
- return r;
+ //qDebug("TimeConversion::toString %s", r.latin1());
+
+ return r;
}
QDate TimeConversion::fromString( const QString &datestr )
{
+ QDate empty;
+ if ( datestr.isEmpty() )
+ return empty;
+
int monthPos = datestr.find('.');
int yearPos = datestr.find('.', monthPos+1 );
if ( monthPos == -1 || yearPos == -1 ) {
qDebug("fromString didn't find . in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, yearPos );
return QDate();
}
int d = datestr.left( monthPos ).toInt();
int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt();
int y = datestr.mid( yearPos+1 ).toInt();
QDate date ( y,m,d );
//qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, yearPos);
return date;
}
time_t TimeConversion::toUTC( const QDateTime& dt )
{
time_t tmp;
struct tm *lt;
#if defined(_OS_WIN32) || defined (Q_OS_WIN32) || defined (Q_OS_WIN64)
_tzset();
#else
tzset();
#endif