summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-07-03 16:54:31 (UTC)
committer zautrix <zautrix>2004-07-03 16:54:31 (UTC)
commit6c035951faeaea6d7651e5fd028c7fd2a674cdfc (patch) (side-by-side diff)
treef55c6dd1f4457a5c3d387e6511d596438988955e /libkdepim
parent1da48d95d970233f0d1ea9a7fba5c98cfcf24798 (diff)
downloadkdepimpi-6c035951faeaea6d7651e5fd028c7fd2a674cdfc.zip
kdepimpi-6c035951faeaea6d7651e5fd028c7fd2a674cdfc.tar.gz
kdepimpi-6c035951faeaea6d7651e5fd028c7fd2a674cdfc.tar.bz2
Added connection to KM when clicking on email
Diffstat (limited to 'libkdepim') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/addresseeview.cpp18
-rw-r--r--libkdepim/addresseeview.h2
-rw-r--r--libkdepim/kincidenceformatter.cpp6
3 files changed, 22 insertions, 4 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index deafd34..70fc57c 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -14,100 +14,116 @@
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kabc/address.h>
#include <kabc/addressee.h>
#include <kabc/phonenumber.h>
#include <kglobal.h>
//US#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
//US #include <kstringhandler.h>
#include <qscrollview.h>
#include <qregexp.h>
#include <qfile.h>
#include <qapplication.h>
#include "addresseeview.h"
+
+#ifndef DESKTOP_VERSION
+#include <qtopia/qcopenvelope_qws.h>
+#endif
+
+
+
using namespace KPIM;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
//US : KTextBrowser( parent, name )
: QTextBrowser( parent, name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
//setHScrollBarMode( QScrollView::AlwaysOff );
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
}
+void AddresseeView::setSource(const QString& n)
+{
+ //qDebug("********AddresseeView::setSource %s", n.mid(7).latin1());
+#ifndef DESKTOP_VERSION
+ QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)");
+ e << n.mid(7);
+#endif
+}
void AddresseeView::setAddressee( const KABC::Addressee& addr )
{
mAddressee = addr;
// clear view
setText( QString::null );
if ( mAddressee.isEmpty() )
return;
QString name = ( mAddressee.formattedName().isEmpty() ?
mAddressee.assembledName() : mAddressee.formattedName() );
QString dynamicPart;
KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
KABC::PhoneNumber::List::ConstIterator phoneIt;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
.arg( (*phoneIt).number() );
}
QStringList emails = mAddressee.emails();
QStringList::ConstIterator emailIt;
QString type = i18n( "Email" );
for ( emailIt = emails.begin(); emailIt != emails.end(); ++emailIt ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
- "<td align=\"left\"><a href=\"mailto:%2\">%3</a></td></tr>" )
+ "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
.arg( type )
+ .arg( name )
.arg( *emailIt )
.arg( *emailIt );
type = i18n( "Other" );
}
if ( !mAddressee.url().url().isEmpty() ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Homepage" ) )
//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) );
.arg( mAddressee.url().url() );
//qDebug("AddresseeView::setAddressee has to be verified.");
}
KABC::Address::List addresses = mAddressee.addresses();
KABC::Address::List::ConstIterator addrIt;
for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
if ( true /*(*addrIt).label().isEmpty()*/ ) {
QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
//qDebug("adresss %s ",formattedAddress.latin1() );
formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
//qDebug("AddresseeView::setAddressee has to be verified.");
diff --git a/libkdepim/addresseeview.h b/libkdepim/addresseeview.h
index 598ef0d..1865fc4 100644
--- a/libkdepim/addresseeview.h
+++ b/libkdepim/addresseeview.h
@@ -20,41 +20,41 @@
*/
#ifndef KPIM_ADDRESSEEVIEW_H
#define KPIM_ADDRESSEEVIEW_H
#include <kabc/addressee.h>
//US #include <ktextbrowser.h>
#include <qtextbrowser.h>
namespace KPIM {
//US class AddresseeView : public KTextBrowser
class AddresseeView : public QTextBrowser
{
public:
AddresseeView( QWidget *parent = 0, const char *name = 0 );
/**
Sets the addressee object. The addressee is displayed immediately.
@param addr The addressee object.
*/
void setAddressee( const KABC::Addressee& addr );
-
+ void setSource(const QString& n);
/**
Returns the current addressee object.
*/
KABC::Addressee addressee() const;
private:
KABC::Addressee mAddressee;
QString mText;
void addTag(const QString & tag,const QString & text);
class AddresseeViewPrivate;
AddresseeViewPrivate *d;
};
}
#endif
diff --git a/libkdepim/kincidenceformatter.cpp b/libkdepim/kincidenceformatter.cpp
index 4815519..2f41409 100644
--- a/libkdepim/kincidenceformatter.cpp
+++ b/libkdepim/kincidenceformatter.cpp
@@ -227,76 +227,78 @@ void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
void KIncidenceFormatter::formatAttendees(Incidence *event)
{
QPtrList<Attendee> attendees = event->attendees();
if (attendees.count()) {
QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
addTag("h3",i18n("Organizer"));
mText.append("<ul><li>");
-#ifndef KORG_NOKABC
+#if 0
+ //ndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(event->organizer());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText.append(event->organizer());
}
#else
mText.append(event->organizer());
#endif
if (iconPath) {
mText += " <a href=\"mailto:" + event->organizer() + "\">";
mText += "<IMG src=\"" + iconPath + "\">";
mText += "</a>\n";
}
mText.append("</li></ul>");
addTag("h3",i18n("Attendees"));
Attendee *a;
mText.append("<ul>");
for(a=attendees.first();a;a=attendees.next()) {
-#ifndef KORG_NOKABC
+#if 0
+//ndef KORG_NOKABC
if (a->name().isEmpty()) {
addressList = add_book->findByEmail(a->email());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText += "<li>";
mText.append(a->email());
mText += "\n";
}
} else {
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
}
#else
//qDebug("nokabc ");
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";