summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Knauß <knauss@kolabsys.com>2014-05-15 12:29:12 (GMT)
committerSandro Knauß <knauss@kolabsys.com>2014-05-15 12:29:12 (GMT)
commite180af6d57394557281a0c8b3b503199c0220954 (patch)
treea40a049db5d5ba3025dc204bd5fa820141a0d952
parent5c36749406fa97838216d9a82a3184e041ff22ea (diff)
downloadlibcalendaring-e180af6d57394557281a0c8b3b503199c0220954.tar.gz
Activation complete kpimutils/email to have email validation
* removing #if 0 * replacing kDebug -> qDebug * adding dummy for i18n
-rw-r--r--kpimutils/email.cpp38
-rw-r--r--kpimutils/email.h7
2 files changed, 22 insertions, 23 deletions
diff --git a/kpimutils/email.cpp b/kpimutils/email.cpp
index 5b088a3..9a63705 100644
--- a/kpimutils/email.cpp
+++ b/kpimutils/email.cpp
@@ -28,7 +28,7 @@
#include <kmime/kmime_util.h>
-// #include <kdebug.h>
+#include <QDebug>
// #include <klocale.h>
// #include <kurl.h>
@@ -40,7 +40,12 @@
// static const KCatalogLoader loader( "libkpimutils" );
using namespace KPIMUtils;
-#if 0
+
+const char* i18n(const char* str)
+{
+ return str;
+}
+
//-----------------------------------------------------------------------------
QStringList KPIMUtils::splitAddressList( const QString &aStr )
{
@@ -120,7 +125,7 @@ KPIMUtils::EmailParseResult splitAddressInternal( const QByteArray address,
QByteArray &comment,
bool allowMultipleAddresses )
{
- // kDebug() << "address";
+ // qDebug() << "address";
displayName = "";
addrSpec = "";
comment = "";
@@ -275,9 +280,9 @@ KPIMUtils::EmailParseResult splitAddressInternal( const QByteArray address,
}
}
/*
- kDebug() << "display-name : \"" << displayName << "\"";
- kDebug() << "comment : \"" << comment << "\"";
- kDebug() << "addr-spec : \"" << addrSpec << "\"";
+ qDebug() << "display-name : \"" << displayName << "\"";
+ qDebug() << "comment : \"" << comment << "\"";
+ qDebug() << "addr-spec : \"" << addrSpec << "\"";
*/
return AddressOk;
}
@@ -658,7 +663,7 @@ QByteArray KPIMUtils::extractEmailAddress( const QByteArray &address )
if ( result != AddressOk ) {
addrSpec = QByteArray();
if ( result != AddressEmpty ) {
- kDebug()
+ qDebug()
<< "Input:" << address << "\nError:"
<< emailParseResultToString( result );
}
@@ -683,7 +688,7 @@ QByteArray KPIMUtils::firstEmailAddress( const QByteArray &addresses )
if ( result != AddressOk ) {
addrSpec = QByteArray();
if ( result != AddressEmpty ) {
- kDebug()
+ qDebug()
<< "Input: aStr\nError:"
<< emailParseResultToString( result );
}
@@ -697,7 +702,7 @@ QString KPIMUtils::firstEmailAddress( const QString &addresses )
{
return QString::fromUtf8( firstEmailAddress( addresses.toUtf8() ) );
}
-#endif
+
//-----------------------------------------------------------------------------
bool KPIMUtils::extractEmailAddressAndName( const QString &aStr,
QString &mail, QString &name )
@@ -891,7 +896,7 @@ bool KPIMUtils::extractEmailAddressAndName( const QString &aStr,
return ! ( name.isEmpty() || mail.isEmpty() );
}
-#if 0
+
//-----------------------------------------------------------------------------
bool KPIMUtils::compareEmail( const QString &email1, const QString &email2,
bool matchName )
@@ -962,7 +967,7 @@ QString KPIMUtils::toIdn( const QString &addrSpec )
//-----------------------------------------------------------------------------
QString KPIMUtils::normalizeAddressesAndDecodeIdn( const QString &str )
{
- // kDebug() << str;
+ // qDebug() << str;
if ( str.isEmpty() ) {
return str;
}
@@ -990,7 +995,7 @@ QString KPIMUtils::normalizeAddressesAndDecodeIdn( const QString &str )
}
}
/*
- kDebug() << "normalizedAddressList: \""
+ qDebug() << "normalizedAddressList: \""
<< normalizedAddressList.join( ", " )
<< "\"";
*/
@@ -1000,7 +1005,7 @@ QString KPIMUtils::normalizeAddressesAndDecodeIdn( const QString &str )
//-----------------------------------------------------------------------------
QString KPIMUtils::normalizeAddressesAndEncodeIdn( const QString &str )
{
- //kDebug() << str;
+ //qDebug() << str;
if ( str.isEmpty() ) {
return str;
}
@@ -1025,13 +1030,13 @@ QString KPIMUtils::normalizeAddressesAndEncodeIdn( const QString &str )
}
/*
- kDebug() << "normalizedAddressList: \""
+ qDebug() << "normalizedAddressList: \""
<< normalizedAddressList.join( ", " )
<< "\"";
*/
return normalizedAddressList.join( ", " );
}
-#endif
+
//-----------------------------------------------------------------------------
// Escapes unescaped doublequotes in str.
static QString escapeQuotes( const QString &str )
@@ -1077,7 +1082,7 @@ QString KPIMUtils::quoteNameIfNecessary( const QString &str )
return quoted;
}
-#if 0
+
KUrl KPIMUtils::encodeMailtoUrl( const QString &mailbox )
{
const QByteArray encodedPath = KMime::encodeRFC2047String( mailbox, "utf-8" );
@@ -1092,4 +1097,3 @@ QString KPIMUtils::decodeMailtoUrl( const KUrl &mailtoUrl )
Q_ASSERT( mailtoUrl.protocol().toLower() == "mailto" );
return KMime::decodeRFC2047String( mailtoUrl.path().toUtf8() );
}
-#endif \ No newline at end of file
diff --git a/kpimutils/email.h b/kpimutils/email.h
index 742e8c1..9c090cb 100644
--- a/kpimutils/email.h
+++ b/kpimutils/email.h
@@ -40,7 +40,6 @@
#include "kpimutils_export.h"
namespace KPIMUtils {
-#if 0
/**
@defgroup emailvalidation Email Validation Functions
@@ -268,7 +267,6 @@ namespace KPIMUtils {
*/
KPIMUTILS_EXPORT
QString firstEmailAddress( const QString & addresses );
-#endif
/**
Return email address and name from string.
Examples:
@@ -290,7 +288,6 @@ namespace KPIMUtils {
KPIMUTILS_EXPORT
bool extractEmailAddressAndName( const QString &aStr, QString &mail,
QString &name );
-#if 0
/**
Compare two email addresses. If matchName is false, it just checks
the email address, and returns true if this matches. If matchName
@@ -369,7 +366,6 @@ namespace KPIMUtils {
QString normalizeAddressesAndEncodeIdn( const QString &str );
/** @} */
-#endif
/** @ingroup emailextraction
Add quote characters around the given string if it contains a
@@ -380,7 +376,7 @@ namespace KPIMUtils {
*/
KPIMUTILS_EXPORT
QString quoteNameIfNecessary( const QString &str );
-#if 0
+
/**
* Creates a valid mailto: URL from the given mailbox.
* @param mailbox The mailbox, which means the display name and the address specification, for
@@ -399,7 +395,6 @@ namespace KPIMUtils {
*/
KPIMUTILS_EXPORT
QString decodeMailtoUrl( const KUrl &mailtoUrl );
-#endif
} // namespace