[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    Re: [Kde-pim] Attendees
From:       Mark Westcott <mark () houseoffish ! org>
Date:       2002-01-08 13:20:10
[Download RAW message or body]

> Great. I'm looking forward to apply the patch to the code.

Well here it is - it basically patches up the KOEditorViewer, so have a look 
there to see my changes.

I see your point Cornelius, about events moving between systems and therefore 
having the same contact with different uids on different systems.  I'll 
implement a fallback mechanism whereby if the uid doesnt match the name 
and/or email, it uses the email and name to find a uid rather than using the 
supplied one.

Again, a patch to libkcal to add the 'uid' field to attendees; to KAddressBook 
to add a dcop call and function to bring up the contact editor and some 
command line switches (and a small visual issue on the QLineEdits in the 
editor - i've set their cursor positions to 0 so you see the beginning of the 
contacts name not the end....); and to KOrganizer to implement hyperlinks in 
KOEditorViewer to both email the contact and bring up their information in 
KAddressBook.

Many thanks,


Mark
["kaddressbook.diff" (text/x-diff)]

? kaddressbook.diff
Index: entryeditorwidget.cpp
===================================================================
RCS file: /home/kde/kdebase/kaddressbook/entryeditorwidget.cpp,v
retrieving revision 1.26
diff -u -3 -p -r1.26 entryeditorwidget.cpp
--- entryeditorwidget.cpp	2001/12/29 16:55:45	1.26
+++ entryeditorwidget.cpp	2002/01/08 12:52:54
@@ -86,6 +86,7 @@ void ContactDialog::setupTab1()
   QPushButton *pbFullName = new QPushButton( i18n( "&Full Name..." ), tab1 );
   leFullName = new ContactLineEdit( tab1, ".AUXCONTACT-N", ce );
   leFullName->setText( curName );
+  leFullName->setCursorPosition(0);
 
   connect( ce, SIGNAL( changed() ), this, SLOT( parseName() ));
   connect( pbFullName, SIGNAL( clicked()), this, SLOT( newNameDialog()));
@@ -100,12 +101,14 @@ void ContactDialog::setupTab1()
   QLabel *lJobTitle = new QLabel( i18n( "&Job title:" ), tab1 );
   QLineEdit *leJobTitle = new ContactLineEdit( tab1, "ROLE", ce );
   lJobTitle->setBuddy( leJobTitle );
+  leJobTitle->setCursorPosition(0);
   tab1lay->addWidget( lJobTitle, 0, 3 );
   tab1lay->addWidget( leJobTitle, 0, 4 );
 
   // Second row
   QLabel *lCompany = new QLabel( i18n( "&Company:" ), tab1 );
   QLineEdit *leCompany = new ContactLineEdit( tab1, "ORG", ce );
+  leCompany->setCursorPosition(0);
   lCompany->setBuddy( leCompany );
   curCompany = leCompany->text();
   connect( ce, SIGNAL( changed() ), this, SLOT( monitorCompany() ));
@@ -145,6 +148,7 @@ void ContactDialog::setupTab1()
   cbEmail->insertItem( i18n( "Email 2" ), "X-E-mail2" );
   cbEmail->insertItem( i18n( "Email 3" ), "X-E-mail3" );
   QLineEdit *leEmail = new ContactLineEdit( tab1, "EMAIL", ce );
+  leEmail->setCursorPosition(0);
   cbEmail->setBuddy( leEmail );
   tab1lay->addWidget( cbEmail, 3, 0 );
   tab1lay->addWidget( leEmail, 3, 1 );
@@ -156,6 +160,7 @@ void ContactDialog::setupTab1()
 
   QLabel *lWebPage = new QLabel( i18n( "&Web page:" ), tab1 );
   QLineEdit *leWebPage = new ContactLineEdit( tab1, "WEBPAGE", ce );
+  leWebPage->setCursorPosition(0);
   lWebPage->setBuddy( leWebPage );
   tab1lay->addWidget( lWebPage, 3, 3 );
   tab1lay->addWidget( leWebPage, 3, 4 );
@@ -248,6 +253,7 @@ void ContactDialog::setupTab1()
 
     QCString fieldPhoneName = (iPhone[row] != -1) ? fieldPhone[iPhone[row]].ascii() \
: "X-NOTFOUND";  QLineEdit *ed = new ContactLineEdit( hGrid, fieldPhoneName, ce );
+    ed->setCursorPosition(0);
     ed->setMinimumSize( ed->sizeHint());
     cbPhone->setBuddy( ed );
     layhGrid->addWidget( ed, row ,1 );
Index: kaddressbook.cpp
===================================================================
RCS file: /home/kde/kdebase/kaddressbook/kaddressbook.cpp,v
retrieving revision 1.12
diff -u -3 -p -r1.12 kaddressbook.cpp
--- kaddressbook.cpp	2001/12/04 12:05:12	1.12
+++ kaddressbook.cpp	2002/01/08 12:52:56
@@ -256,6 +256,12 @@ void KAddressBook::addEmail( QString add
   return;
 }
 
+ASYNC KAddressBook::showContactEditor ( QString uid )
+{
+  mView->updateByUid( uid );
+  return;
+}
+
 void KAddressBook::addEntry(ContactEntry newEntry)
 {
   mView->addNewEntry(new ContactEntry(newEntry) );
Index: kaddressbook.h
===================================================================
RCS file: /home/kde/kdebase/kaddressbook/kaddressbook.h,v
retrieving revision 1.7
diff -u -3 -p -r1.7 kaddressbook.h
--- kaddressbook.h	2001/12/04 12:05:12	1.7
+++ kaddressbook.h	2002/01/08 12:52:56
@@ -47,7 +47,7 @@ class KAddressBook : public KMainWindow,
     void changeEntry( QString key, ContactEntry changeEntry);
     void removeEntry( QString key );
     void addEntry( ContactEntry newEntry );
-
+    ASYNC showContactEditor( QString uid );
     void saveCe();
     void save();
     void slotSave() { save(); }
Index: kaddressbookiface.h
===================================================================
RCS file: /home/kde/kdebase/kaddressbook/kaddressbookiface.h,v
retrieving revision 1.3
diff -u -3 -p -r1.3 kaddressbookiface.h
--- kaddressbookiface.h	2001/12/04 12:05:12	1.3
+++ kaddressbookiface.h	2002/01/08 12:52:56
@@ -10,7 +10,8 @@ class KAddressBookIface : virtual public
     K_DCOP
   k_dcop:
     virtual void addEmail( QString addr ) = 0;
-
+  
+    virtual ASYNC showContactEditor( QString uid ) = 0;
   /** Show's dialog for creation of a new contact.  Returns once a contact
    *  is created (or canceled).
    */
Index: kaddressbookview.cpp
===================================================================
RCS file: /home/kde/kdebase/kaddressbook/kaddressbookview.cpp,v
retrieving revision 1.9
diff -u -3 -p -r1.9 kaddressbookview.cpp
--- kaddressbookview.cpp	2001/12/29 16:55:45	1.9
+++ kaddressbookview.cpp	2002/01/08 12:52:57
@@ -367,6 +367,24 @@ void KAddressBookView::addEmail(const QS
   updateContact( partB, result );
 }
 
+
+void KAddressBookView::updateByUid(QString key)
+{
+ kdDebug() << "KAddressBookView::editEntry. Text of key: " << key << endl;
+ QString title = i18n( "Address Book Entry Editor" );
+ QString entryKey = key;
+ ContactEntry *ce = cel->find( key );
+ if (!ce) { // Another process deleted it(!)
+  kdDebug()<< "KAddressBookView::itemSelected Associated entry not found\n" ;
+  return;
+ }
+ PabContactDialog *cd = new PabContactDialog( title, this, 0, entryKey, ce );
+ QObject::connect( cd, SIGNAL( change( QString, ContactEntry* ) ),
+ this, SLOT( change( QString, ContactEntry* ) ));
+ cd->show();
+}
+
+
 void KAddressBookView::sendMail()
 {
   QString emailAddrs = selectedEmails();
Index: kaddressbookview.h
===================================================================
RCS file: /home/kde/kdebase/kaddressbook/kaddressbookview.h,v
retrieving revision 1.2
diff -u -3 -p -r1.2 kaddressbookview.h
--- kaddressbookview.h	2001/11/17 13:40:35	1.2
+++ kaddressbookview.h	2002/01/08 12:52:58
@@ -58,6 +58,7 @@ public:
   virtual QString selectedEmails();
   virtual void updateContact( QString addr, QString name );
   virtual void addEmail(const QString& aStr);
+  virtual void updateByUid( QString uid );
 
   bool hasSelection() const;
 signals:
Index: main.cpp
===================================================================
RCS file: /home/kde/kdebase/kaddressbook/main.cpp,v
retrieving revision 1.14
diff -u -3 -p -r1.14 main.cpp
--- main.cpp	2001/12/29 16:55:45	1.14
+++ main.cpp	2002/01/08 12:52:59
@@ -8,7 +8,7 @@
 #include <kdebug.h>
 #include <kuniqueapplication.h>
 #include <kwin.h>
-
+#include <kstartupinfo.h>
 #include "kaddressbook.h"
 
 class KAddressBookApp : public KUniqueApplication {
@@ -27,27 +27,39 @@ int KAddressBookApp::newInstance()
     // There can only be one main window
     if (KMainWindow::canBeRestored(1)) {
       mMainWin = new KAddressBook;
+      mMainWin->show();
       mMainWin->restore(1);
     }
   } else {
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
     QCString addrStr = args->getOption("addr");
-
+    QCString uidStr = args->getOption("uid");
     QString addr;
+    QString uid;
     if (!addrStr.isEmpty()) addr = QString::fromLocal8Bit(addrStr);
-
-    args->clear();
+    if (!uidStr.isEmpty()) uid = QString::fromLocal8Bit(uidStr);
 
-    if (mMainWin) {
-      kdDebug() << "AbBrowser already running." << endl;
-      KWin::setActiveWindow(mMainWin->winId());
+    
+    if (args->isSet("editor-only")) {
+      if (!mMainWin)
+        mMainWin = new KAddressBook;
+        KStartupInfo::appStarted();
+        mMainWin->hide();
     } else {
-      mMainWin = new KAddressBook;
-      mMainWin->show();
+      if (mMainWin) {
+        if (mMainWin->isVisible())
+          kdDebug() << "KAddressBook already running." << endl;
+        else
+          mMainWin->show();
+      } else {
+        mMainWin = new KAddressBook;
+        mMainWin->show();
+      }
     }
-
+    //Can not see why anyone would pass both a uid and an email address, so I'll \
leave it that two contact editors will show if they do  if (!addr.isEmpty()) \
mMainWin->addEmail(addr); +    if (!uid.isEmpty()) mMainWin->showContactEditor(uid);
   }
 
   return 0;
@@ -58,7 +70,9 @@ int KAddressBookApp::newInstance()
 static KCmdLineOptions kmoptions[] =
 {
   { "a", 0 , 0 },
-  { "addr <email>", I18N_NOOP("Update entry with given email address"), 0 },
+  { "addr <email>", I18N_NOOP("Shows contact editor with given email address"), 0 },
+  { "uid <uid>", I18N_NOOP("Shows contact editor with given uid"), 0 },
+  { "editor-only", I18N_NOOP("Launches in edtior only mode"), 0 },
   { "+[argument]", I18N_NOOP("dummy argument"), 0},
   { 0, 0, 0}
 };


["libkcal.diff" (text/x-diff)]

? diff
? libkcal.diff
Index: attendee.cpp
===================================================================
RCS file: /home/kde/kdepim/libkcal/attendee.cpp,v
retrieving revision 1.5
diff -u -3 -p -r1.5 attendee.cpp
--- attendee.cpp	2001/09/19 13:09:50	1.5
+++ attendee.cpp	2002/01/08 12:49:34
@@ -30,13 +30,14 @@
 using namespace KCal;
 
 Attendee::Attendee(const QString &name, const QString &email, bool _rsvp, Attendee::PartStat s,
-                   Attendee::Role r) :
+                   Attendee::Role r,const QString &u) :
   Person(name,email)
 {
   mFlag = TRUE;
   mRSVP = _rsvp;
   mStatus = s;
   mRole = r;
+  mUid = u;
 }
 
 #if 0
@@ -125,6 +126,16 @@ Attendee::Role Attendee::role() const
 QString Attendee::roleStr() const
 {
   return roleName(mRole);
+}
+
+void Attendee::setUid(QString uid)
+{
+mUid = uid;
+}
+
+QString Attendee::uid()
+{
+return mUid;
 }
 
 QString Attendee::roleName( Attendee::Role r )
Index: attendee.h
===================================================================
RCS file: /home/kde/kdepim/libkcal/attendee.h,v
retrieving revision 1.4
diff -u -3 -p -r1.4 attendee.h
--- attendee.h	2001/09/19 13:09:50	1.4
+++ attendee.h	2002/01/08 12:49:34
@@ -51,7 +51,7 @@ class Attendee : public Person
     */
     Attendee(const QString& name, const QString &email,
              bool rsvp=false, PartStat status=NeedsAction,
-             Role role=ReqParticipant);
+             Role role=ReqParticipant,const QString& u=QString::null);
 //    Attendee(const Attendee &);
     /** Destruct Attendee */
     virtual ~Attendee();
@@ -65,6 +65,10 @@ class Attendee : public Person
     static QString roleName( Role );
     static QStringList roleList();
 
+    /** Holds the uid of the attendee, if applicable **/
+    QString uid();
+    void setUid (QString);
+
     /** Set status. See enum for definitions of possible values */
     void setStatus(PartStat s);
     /** Return status. */
@@ -83,6 +87,7 @@ class Attendee : public Person
     bool mRSVP;
     Role mRole;
     PartStat mStatus;
+    QString mUid;
 
     // used to tell whether we have need to mail this person or not.
     bool mFlag;
Index: icalformatimpl.cpp
===================================================================
RCS file: /home/kde/kdepim/libkcal/icalformatimpl.cpp,v
retrieving revision 1.26
diff -u -3 -p -r1.26 icalformatimpl.cpp
--- icalformatimpl.cpp	2001/12/10 13:54:13	1.26
+++ icalformatimpl.cpp	2002/01/08 12:49:42
@@ -341,6 +341,7 @@ icalproperty *ICalFormatImpl::writeAtten
     icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().local8Bit()));
   }
 
+
   icalproperty_add_parameter(p,icalparameter_new_rsvp(
           attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE ));
 
@@ -389,6 +390,12 @@ icalproperty *ICalFormatImpl::writeAtten
   }
   icalproperty_add_parameter(p,icalparameter_new_role(role));
 
+  if (!attendee->uid().isEmpty()) {
+  icalparameter* icalparameter_uid = icalparameter_new_x(attendee->uid());
+  icalparameter_set_xname(icalparameter_uid,"X-UID");
+  icalproperty_add_parameter(p,icalparameter_uid);
+  }
+
   return p;
 }
 
@@ -914,6 +921,7 @@ Attendee *ICalFormatImpl::readAttendee(i
   QString email = QString::fromLocal8Bit(icalproperty_get_attendee(attendee));
 
   QString name;
+  QString uid = QString::null;
   p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER);
   if (p) {
     name = QString::fromLocal8Bit(icalparameter_get_cn(p));
@@ -977,8 +985,20 @@ Attendee *ICalFormatImpl::readAttendee(i
         break;
     }
   }
+
+  p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER);
+  uid = icalparameter_get_xvalue(p);
+  // This should be added, but there seems to be a libical bug here.
+  /*while (p) {
+   // if (icalparameter_get_xname(p) == "X-UID") {
+    uid = icalparameter_get_xvalue(p);
+    p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER);
+  } */
+
+
+
 
-  return new Attendee( name, email, rsvp, status, role );
+  return new Attendee( name, email, rsvp, status, role, uid );
 }
 
 void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)

["korganizer.diff" (text/x-diff)]

? diff
? korganizer.diff
Index: koeditordetails.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koeditordetails.cpp,v
retrieving revision 1.22
diff -u -3 -p -r1.22 koeditordetails.cpp
--- koeditordetails.cpp	2001/11/17 23:40:14	1.22
+++ koeditordetails.cpp	2002/01/08 13:04:23
@@ -32,6 +32,7 @@
 #include <klocale.h>
 #include <kiconloader.h>
 #include <kmessagebox.h>
+#include <kdebug.h>
 #ifndef KORG_NOKABC
 #include <kabc/addresseedialog.h>
 #endif
@@ -96,6 +97,9 @@ KOEditorDetails::KOEditorDetails (int sp
   connect(mNameEdit,SIGNAL(textChanged(const QString &)),
           SLOT(updateAttendeeItem()));
 
+  mUidEdit = new QLineEdit(0);
+  mUidEdit->setText("");
+
   QLabel *emailLabel = new QLabel(this);
   emailLabel->setText(i18n("Email Address:"));
   topLayout->addWidget(emailLabel,2,0);
@@ -175,7 +179,7 @@ void KOEditorDetails::openAddressBook()
 #ifndef KORG_NOKABC
   KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
   if (!a.isEmpty()) {
-    insertAttendee( new Attendee( a.realName(), a.preferredEmail() ) );
+    insertAttendee( new Attendee( a.realName(), \
a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) \
);  }
 #endif
 }
@@ -253,28 +257,27 @@ void KOEditorDetails::updateAttendeeInpu
   if (aItem) {
     fillAttendeeInput( aItem );
   } else {
-    clearAttendeeInput();    
+    clearAttendeeInput();
   }
 }
 
 void KOEditorDetails::clearAttendeeInput()
 {
   mNameEdit->setText("");
+  mUidEdit->setText("");
   mEmailEdit->setText("");
   mRoleCombo->setCurrentItem(0);
   mStatusCombo->setCurrentItem(0);
   mRsvpButton->setChecked(true);
-
   setEnabledAttendeeInput( false );
 }
 
 void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
 {
   Attendee *a = aItem->attendee();
-
   mDisableItemUpdate = true;
-
   mNameEdit->setText(a->name());
+  mUidEdit->setText(a->uid());
   mEmailEdit->setText(a->email());
   mRoleCombo->setCurrentItem(a->role());
   mStatusCombo->setCurrentItem(a->status());
@@ -307,10 +310,10 @@ void KOEditorDetails::updateAttendeeItem
   Attendee *a = aItem->attendee();
 
   a->setName( mNameEdit->text() );
+  a->setUid( mUidEdit->text() );
   a->setEmail( mEmailEdit->text() );
   a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
   a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
   a->setRSVP( mRsvpButton->isChecked() );
-
   aItem->updateItem();
 }
Index: koeditordetails.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/koeditordetails.h,v
retrieving revision 1.13
diff -u -3 -p -r1.13 koeditordetails.h
--- koeditordetails.h	2001/11/17 23:40:14	1.13
+++ koeditordetails.h	2002/01/08 13:04:23
@@ -87,6 +87,7 @@ class KOEditorDetails : public QWidget
     bool mDisableItemUpdate;
 
     QLineEdit *mNameEdit;
+    QLineEdit *mUidEdit;
     QLineEdit *mEmailEdit;
     QListView *mListView;
     QComboBox* mRoleCombo;
@@ -96,6 +97,7 @@ class KOEditorDetails : public QWidget
     QPushButton* mAddButton;
     QPushButton* mRemoveButton;
     QPushButton* mAddressBookButton;
+
 };
 
 #endif
Index: koeventviewer.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koeventviewer.cpp,v
retrieving revision 1.17
diff -u -3 -p -r1.17 koeventviewer.cpp
--- koeventviewer.cpp	2001/11/21 02:01:07	1.17
+++ koeventviewer.cpp	2002/01/08 13:04:25
@@ -20,15 +20,19 @@
 // $Id: koeventviewer.cpp,v 1.17 2001/11/21 02:01:07 cschumac Exp $
 
 #include <klocale.h>
-
+#include <kapp.h>
 #include <libkcal/event.h>
 #include <libkcal/todo.h>
-
+#include <kdebug.h>
+#include <kiconloader.h>
 #include "koeventviewer.h"
 #include "koeventviewer.moc"
-
+#include <krun.h>
+#include <dcopclient.h>
+#include <qcstring.h>
+#include "korganizer.h"
 KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
-  : QTextView(parent,name)
+  : QTextBrowser(parent,name)
 {
 }
 
@@ -36,6 +40,49 @@ KOEventViewer::~KOEventViewer()
 {
 }
 
+void KOEventViewer::setSource(const QString& n)
+{
+  kdDebug() << "KOEventViewer::setSource(): " << n << endl;
+  QString tmpStr;
+  if (n.startsWith("mailto:")) {
+    kapp->invokeMailer(n.mid(7),QString::null);
+    //emit showIncidence(n);
+    return;
+  } else if (n.startsWith("uid:")) {
+   DCOPClient *client = KApplication::kApplication()->dcopClient();
+   const QByteArray noParamData;
+   const QByteArray paramData;
+   QByteArray replyData;
+   QCString replyTypeStr;
+   #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", \
"interfaces()",  noParamData, replyTypeStr, replyData)) +   bool foundAbbrowser = \
PING_ABBROWSER; +
+   if (foundAbbrowser)
+   {
+   //KAddressbook is already running, so just DCOP to it to bring up the contact \
editor +   //client->send("kaddressbook","KAddressBookIface",
+   QDataStream arg(paramData, IO_WriteOnly);
+   arg << n.mid(6);
+   client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", \
paramData); +   return;
+   }  else {
+   /*KaddressBook is not already running.  Pass it the UID of the contact via the \
command line while starting it - its neater. +   We start it without its main \
interface*/ +    KIconLoader* iconLoader = new KIconLoader();
+    QString iconPath = iconLoader->iconPath("go",KIcon::Small);
+    KOrganizer::setStartedKAddressBook(true);
+    tmpStr = "kaddressbook --editor-only --uid ";
+    tmpStr += n.mid(6);
+    bool result = KRun::runCommand(tmpStr,"KAddressBook",iconPath);
+    return;
+   }
+  } else {
+    //QTextBrowser::setSource(n);
+  }
+}
+
+
+
 void KOEventViewer::addTag(const QString & tag,const QString & text)
 {
   int number=text.contains("\n");
@@ -148,11 +195,24 @@ void KOEventViewer::formatAttendees(Inci
     Attendee *a;
     mText.append("<ul>");
     for(a=attendees.first();a;a=attendees.next()) {
-      QString str = a->name();
-      if (!a->email().isEmpty()) str += " &lt;" + a->email() + "&gt;";
-      addTag("li",str);
+
+      mText += "<li><a href=\"uid:" + a->uid() + "\">";
+      mText += a->name();
+      mText += "</a>\n";
+      kdDebug() << "formatAttendees: uid = " << a->uid() << endl;
+
+      if (!a->email().isEmpty()) {
+      KIconLoader* iconLoader = new KIconLoader();
+      QString iconPath = iconLoader->iconPath("mail_generic",KIcon::Small);
+      if (iconPath)
+      {
+      mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
+      mText += "<IMG src=\"" + iconPath + "\">";
+      mText += "</a>\n";
+      }
+      }
     }
-    mText.append("</ul>");
+    mText.append("</li></ul>");
   }
 }
 
Index: koeventviewer.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/koeventviewer.h,v
retrieving revision 1.10
diff -u -3 -p -r1.10 koeventviewer.h
--- koeventviewer.h	2001/11/21 02:01:06	1.10
+++ koeventviewer.h	2002/01/08 13:04:25
@@ -23,18 +23,19 @@
 // Viewer widget for events.
 //
 
-#include <qtextview.h>
+#include <qtextbrowser.h>
 
 #include <libkcal/event.h>
 
 using namespace KCal;
 
-class KOEventViewer : public QTextView {
+class KOEventViewer : public QTextBrowser {
     Q_OBJECT
   public:
     KOEventViewer(QWidget *parent=0,const char *name=0);
     virtual ~KOEventViewer();
 
+    void setSource(const QString &);
     void setEvent(Event *event);
     void setTodo(Todo *event);
     
@@ -53,9 +54,11 @@ class KOEventViewer : public QTextView {
     void formatReadOnly(Incidence *event);
 
   private:
-    QTextView *mEventTextView;
+    QTextBrowser *mEventTextView;
 
-    QString mText;    
+    QString mText;
+  signals:
+    void launchaddressbook(QString uid);    
 };
 
 #endif
Index: korganizer.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer.cpp,v
retrieving revision 1.89
diff -u -3 -p -r1.89 korganizer.cpp
--- korganizer.cpp	2001/12/19 20:35:08	1.89
+++ korganizer.cpp	2002/01/08 13:04:28
@@ -138,9 +138,21 @@ KOrganizer::KOrganizer(const char *name)
   kdDebug() << "KOrganizer::KOrganizer() done" << endl;
 }
 
+bool KOrganizer::startedKAddressBook = false;
+
 KOrganizer::~KOrganizer()
 {
   kdDebug() << "~KOrganizer()" << endl;
+  
+  //close down KAddressBook if we started it
+  if (KOrganizer::startedKAddressBook == true)
+  {
+   kdDebug() << "Closing down kaddressbook" << endl;
+   DCOPClient *client = KApplication::kApplication()->dcopClient();
+   const QByteArray noParamData;
+   client->send("kaddressbook", "KAddressBookIface", "exit()",  noParamData);
+  }
+
 
   if (mTempFile) delete mTempFile;
 
Index: korganizer.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer.h,v
retrieving revision 1.39
diff -u -3 -p -r1.39 korganizer.h
--- korganizer.h	2001/12/19 20:35:08	1.39
+++ korganizer.h	2002/01/08 13:04:29
@@ -97,7 +97,7 @@ class KOrganizer : public KOrg::MainWind
 
     /** Is there a instance with this URL? */
     static KOrganizer* findInstance(const KURL &url);
-
+    static void setStartedKAddressBook(bool tmpBool) { startedKAddressBook = \
tmpBool; }  /** Open calendar file from URL */
     bool openURL(QString url);
     /** Open calendar file from URL */
@@ -119,7 +119,7 @@ class KOrganizer : public KOrg::MainWind
      *  and emit this signal which notifies all widgets which have registered 
      *  for notification to update their settings. */  
     void configChanged();
-    
+
     /** emitted when the topwidget is closing down, so that any attached
         child windows can also close. */
     void closingDown();
@@ -280,6 +280,8 @@ class KOrganizer : public KOrg::MainWind
     enum { ID_HISTORY, ID_GENERAL, ID_ACTIVE, ID_MESSAGES_IN, ID_MESSAGES_OUT };
 
     AlarmDaemonIface_stub mAlarmDaemonIface;
+
+    static bool startedKAddressBook; //whether we started KAddressBook ourselves
 
   private slots:
     void dumpText(const QString &);  // only for debugging purposes


_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic