[Kde-pim] branches/work/kdepim-3.5.5+/kaddressbook

Friedrich W. H. Kossebau kossebau at kde.org
Tue Feb 6 14:14:47 GMT 2007


SVN commit 630826 by kossebau:

Make KAddressbook use Khalkhi.

So substituting:
 Old                               | New
-----------------------------------+-------------------------
 KPIM::AddresseeView               | Khalkhi::CardView
                                   |
 all hardcoded actions             | Khalkhi services
 (browse, email, ...)              | 
 hardcoded IM status system        |
 (KIMProxy)                        |
 
CCMAIL:kde-pim at kde.org



 M  +5 -0      branches/work/kdepim-3.5.5+/kaddressbook/Makefile.am  
 M  +33 -43    branches/work/kdepim-3.5.5+/kaddressbook/kabcore.cpp  
 M  +13 -30    branches/work/kdepim-3.5.5+/kaddressbook/kabcore.h  
 M  +11 -7     branches/work/kdepim-3.5.5+/kaddressbook/kaddressbook_part.rc  
 M  +11 -7     branches/work/kdepim-3.5.5+/kaddressbook/kaddressbookui.rc  


--- branches/work/kdepim-3.5.5+/kaddressbook/Makefile.am #630825:630826
@@ -12,6 +12,10 @@
           -I$(top_builddir)/kaddressbook/common \
           -I$(top_srcdir) \
           -I$(top_buildir)/kaddressbook/editors \
+          -I$(top_srcdir)/libkhalkhi/core \
+          -I$(top_srcdir)/libkhalkhi/gui \
+          -I$(top_srcdir)/libkhalkhi/gui/cards \
+          -I$(top_srcdir)/libkhalkhi/gui/actions \
           -I$(top_srcdir)/akregator/src \
           $(all_includes)
 
@@ -45,6 +49,7 @@
 libkaddressbook_la_LIBADD = $(top_builddir)/kaddressbook/printing/libprinter.la \
                             $(top_builddir)/kaddressbook/interfaces/libkabinterfaces.la \
                             $(top_builddir)/libkdepim/libkdepim.la \
+                            $(top_builddir)/libkhalkhi/gui/libkhalkhigui.la \
                             $(top_builddir)/libkcal/libkcal.la \
                             -lkabc_file $(LIB_KABC) $(LIB_KHTML) \
                             $(top_builddir)/kaddressbook/common/libkabcommon.la \
--- branches/work/kdepim-3.5.5+/kaddressbook/kabcore.cpp #630825:630826
@@ -1,6 +1,7 @@
 /*
     This file is part of KAddressbook.
     Copyright (c) 2003 - 2004 Tobias Koenig <tokoe at kde.org>
+    Copyright (c) 2007 Friedrich W. H. Kossebau <kossebau at kde.org>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -59,10 +60,11 @@
 #include <kstdguiitem.h>
 #include <kxmlguiclient.h>
 #include <ktoolbar.h>
-#include <libkdepim/addresseeview.h>
 #include <libkdepim/categoryeditdialog.h>
 #include <libkdepim/categoryselectdialog.h>
 
+#include <services.h>
+
 #include "addresseeutil.h"
 #include "addresseeeditordialog.h"
 #include "extensionmanager.h"
@@ -162,9 +164,6 @@
   connect( mXXPortManager, SIGNAL( modified() ),
            SLOT( setModified() ) );
 
-  connect( mDetails, SIGNAL( highlightedMessage( const QString& ) ),
-           SLOT( detailsHighlighted( const QString& ) ) );
-
   connect( mIncSearchWidget, SIGNAL( scrollUp() ),
            mViewManager, SLOT( scrollUp() ) );
   connect( mIncSearchWidget, SIGNAL( scrollDown() ),
@@ -182,7 +181,7 @@
 
   KAcceleratorManager::manage( mWidget );
 
-  mKIMProxy = ::KIMProxy::instance( kapp->dcopClient() );
+  connect( Khalkhi::Services::self(), SIGNAL(changed()), SLOT(onKhalkhiChange()) );
 }
 
 KABCore::~KABCore()
@@ -191,7 +190,6 @@
 
   mAddressBook = 0;
   KABC::StdAddressBook::close();
-  mKIMProxy = 0;
 }
 
 void KABCore::restoreSettings()
@@ -309,6 +307,8 @@
                     "michel at klaralvdalens-datakonsult.se" );
   about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup" ),
                     "hansen at kde.org" );
+  about->addAuthor( "Friedrich W. H. Kossebau", I18N_NOOP("ხალხი properties & services framework"),
+                    "kossebau at kde.org" );
 
   return about;
 }
@@ -326,8 +326,8 @@
 void KABCore::setContactSelected( const QString &uid )
 {
   KABC::Addressee addr = mAddressBook->findByUid( uid );
-  if ( !mDetails->isHidden() )
-    mDetails->setAddressee( addr );
+  if ( !mCardView->isHidden() )
+    mCardView->setPerson( addr );
 
   mExtensionManager->setSelectionChanged();
 
@@ -346,22 +346,21 @@
   mActionDelete->setEnabled( selected );
   mActionEditAddressee->setEnabled( selected );
   mActionStoreAddresseeIn->setEnabled( selected );
-  mActionMail->setEnabled( selected );
   mActionMailVCard->setEnabled( selected );
-  mActionChat->setEnabled( selected && mKIMProxy && mKIMProxy->initialize() );
   mActionWhoAmI->setEnabled( selected );
   mActionCategories->setEnabled( selected );
   mActionMerge->setEnabled( selected );
-}
 
-void KABCore::sendMail()
-{
-  sendMail( mViewManager->selectedEmails().join( ", " ) );
-}
+  KABC::Addressee::List addrList = mViewManager->selectedAddressees();
 
-void KABCore::sendMail( const QString& email )
-{
-  kapp->invokeMailer( email, "" );
+  if( addrList.count() > 1 )
+      mListAllPropertiesServicesXMLGUIFiller.setPersonList( addrList );
+  else
+      mAllPropertiesServicesXMLGUIFiller.setPerson( addr );
+
+
+//       ContactServicesMenuFiller.set( contact );
+//       ContactServicesMenuFiller.fillGUIClient( "file_contactactionlist", mCore->guiClient() );
 }
 
 void KABCore::mailVCard()
@@ -376,18 +375,7 @@
   KABTools::mailVCards( uids, mAddressBook );
 }
 
-void KABCore::startChat()
-{
-  QStringList uids = mViewManager->selectedUids();
-  if ( !uids.isEmpty() )
-    mKIMProxy->chatWithContact( uids.first() );
-}
 
-void KABCore::browse( const QString& url )
-{
-  kapp->invokeBrowser( url );
-}
-
 void KABCore::selectAllContacts()
 {
   mViewManager->setSelected( QString::null, true );
@@ -882,6 +870,7 @@
            this, SLOT( configurationChanged() ) );
 
   dlg.addModule( "kabconfig.desktop" );
+  dlg.addModule( "kcmkhalkhi.desktop" );
   dlg.addModule( "kabldapconfig.desktop" );
   dlg.addModule( "kabcustomfields.desktop" );
 
@@ -903,7 +892,7 @@
   wizard.exec();
 }
 
-void KABCore::detailsHighlighted( const QString &msg )
+void KABCore::showActionText( const QString &msg )
 {
   if ( mStatusBar ) {
     if ( !mStatusBar->hasItem( 2 ) )
@@ -1029,12 +1018,11 @@
   mDetailsLayout->addWidget( mDetailsPage );
 
   QHBoxLayout *detailsPageLayout = new QHBoxLayout( mDetailsPage, 0, 0 );
-  mDetails = new KPIM::AddresseeView( mDetailsPage );
-  detailsPageLayout->addWidget( mDetails );
+  mCardView = new Khalkhi::CardView( mDetailsPage );
+  detailsPageLayout->addWidget( mCardView );
+  connect( mCardView, SIGNAL(actionHighlighted( const QString& )),
+           SLOT( showActionText( const QString& ) ) );
 
-  connect( mDetails, SIGNAL( addressClicked( const QString&) ),
-           this, SLOT( showContactsAddress( const QString& ) ) );
-
   mViewManager = new ViewManager( this, mExtensionBarSplitter );
   mViewManager->setFilterSelectionWidget( mFilterSelectionWidget );
 
@@ -1070,10 +1058,7 @@
   KAction *action;
 
   // file menu
-  mActionMail = new KAction( i18n( "&Send Email to Contact..." ), "mail_send", 0,
-                             this, SLOT( sendMail() ), actionCollection(), "file_mail" );
   action = KStdAction::print( this, SLOT( print() ), actionCollection() );
-  mActionMail->setWhatsThis( i18n( "Send a mail to all selected contacts." ) );
   action->setWhatsThis( i18n( "Print a special number of contacts." ) );
 
   mActionSave = KStdAction::save( this,
@@ -1089,11 +1074,6 @@
                                   actionCollection(), "file_mail_vcard" );
   mActionMailVCard->setWhatsThis( i18n( "Send a mail with the selected contact as attachment." ) );
 
-  mActionChat = new KAction( i18n("Chat &With..."), 0,
-                                  this, SLOT( startChat() ),
-                                  actionCollection(), "file_chat" );
-  mActionChat->setWhatsThis( i18n( "Start a chat with the selected contact." ) );
-
   mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
                                       this, SLOT( editContact() ),
                                       actionCollection(), "file_properties" );
@@ -1169,6 +1149,10 @@
   clearLocation->setWhatsThis( i18n( "Clear Search Bar<p>"
 				     "Clears the content of the quick search bar." ) );
 
+
+  mAllPropertiesServicesXMLGUIFiller.setGUIClient( guiClient(), "file_allpropertiesactionlist" );
+  mListAllPropertiesServicesXMLGUIFiller.setGUIClient( guiClient(), "file_allpropertiesactionlist" );
+
   clipboardDataChanged();
 }
 
@@ -1340,6 +1324,12 @@
   return doneSomething;
 }
 
+void KABCore::onKhalkhiChange()
+{
+  mCardView->updateView();
+  mAllPropertiesServicesXMLGUIFiller.update();
+}
+
 #ifdef KDEPIM_NEW_DISTRLISTS
 KPIM::DistributionList::List KABCore::distributionLists() const
 {
--- branches/work/kdepim-3.5.5+/kaddressbook/kabcore.h #630825:630826
@@ -1,6 +1,7 @@
 /*
     This file is part of KAddressbook.
     Copyright (c) 2003 Tobias Koenig <tokoe at kde.org>
+    Copyright (c) 2007 Friedrich W. H. Kossebau <kossebau at kde.org>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -25,6 +26,10 @@
 #define KABCORE_H
 
 #include <kabc/field.h>
+#include <cards/cardview.h>
+#include <allpropertiesglobalactionservicexmlguifiller.h>
+#include <listallpropertiesglobalactionservicexmlguifiller.h>
+#include <actionservicemenufiller.h>
 
 #include <qdict.h>
 #include <qwidget.h>
@@ -38,7 +43,6 @@
 }
 
 namespace KPIM {
-class AddresseeView;
 class CategoryEditDialog;
 class CategorySelectDialog;
 }
@@ -156,33 +160,10 @@
      */
     void setContactSelected( const QString &uid );
 
-    /**
-      Opens the preferred mail composer with all selected contacts as
-      arguments.
-     */
-    void sendMail();
-
-    /**
-      Opens the preferred mail composer with the given contacts as
-      arguments.
-     */
-    void sendMail( const QString& email );
-
-
     void mailVCard();
     void mailVCard(const QStringList& uids);
 
     /**
-     * Start an Instant Messaging chat with the selected contacts
-     */
-    void startChat();
-
-    /**
-      Starts the preferred web browser with the given URL as argument.
-     */
-    void browse( const QString& url );
-
-    /**
       Select all contacts in the view.
      */
     void selectAllContacts();
@@ -334,7 +315,7 @@
      */
     void print();
 
-    void detailsHighlighted( const QString& );
+    void showActionText( const QString& );
 
     void showContactsAddress( const QString &uid );
 
@@ -365,6 +346,8 @@
     void slotClearSearchBar();
     void slotContactsUpdated();
 
+    void onKhalkhiChange();
+
   private:
     void initGUI();
     void createJumpButtonBar();
@@ -387,7 +370,7 @@
     JumpButtonBar *mJumpButtonBar;
     FilterSelectionWidget *mFilterSelectionWidget;
     IncSearchWidget *mIncSearchWidget;
-    KPIM::AddresseeView *mDetails;
+    Khalkhi::CardView *mCardView;
     KPIM::CategorySelectDialog *mCategorySelectDialog;
     KPIM::CategoryEditDialog *mCategoryEditDialog;
     QWidget *mDetailsPage;
@@ -412,9 +395,7 @@
     KAction *mActionEditAddressee;
     KAction *mActionStoreAddresseeIn;
     KAction *mActionMerge;
-    KAction *mActionMail;
     KAction *mActionMailVCard;
-    KAction *mActionChat;
     KAction *mActionSave;
     KAction *mActionDeleteView;
     KAction *mActionWhoAmI;
@@ -422,13 +403,15 @@
     KToggleAction *mActionJumpBar;
     KToggleAction *mActionDetails;
 
+    Khalkhi::AllPropertiesGlobalActionServiceXMLGUIFiller mAllPropertiesServicesXMLGUIFiller;
+    Khalkhi::ActionServiceMenuFiller mPersonServicesMenuFiller;
+    Khalkhi::ListAllPropertiesGlobalActionServiceXMLGUIFiller mListAllPropertiesServicesXMLGUIFiller;
+
     KCommandHistory *mCommandHistory;
 
     KAddressBookService *mAddressBookService;
 
     KAB::SearchManager *mSearchManager;
-    // KIMProxy provides access to up to date instant messaging presence data
-    ::KIMProxy *mKIMProxy;
 
     class KABCorePrivate;
     KABCorePrivate *d;
--- branches/work/kdepim-3.5.5+/kaddressbook/kaddressbook_part.rc #630825:630826
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="kaddressbook" version="16">
+<kpartgui name="kaddressbook" version="17">
 
   <MenuBar>
     <Menu name="file" noMerge="1"><text>&File</text>
@@ -13,10 +13,11 @@
       </Menu>
       <Separator/>
       <Action name="file_print"/>
-      <Action name="file_mail"/>
       <Action name="file_mail_vcard"/>
-      <Action name="file_chat"/>
       <Separator/>
+      <ActionList name="file_allpropertiesactionlist" />
+      <ActionList name="file_contactactionlist" />
+      <Separator/>
       <Action name="file_quit"/>
     </Menu>
 
@@ -68,14 +69,17 @@
   </MenuBar>
 
   <Menu name="RMBPopup">
-    <Action name="file_properties"/>
     <Action name="file_new_contact"/>
+    <Separator/>
     <Action name="edit_delete"/>
+    <Separator/>
     <Action name="edit_store_in"/>
+    <Action name="file_mail_vcard"/>
     <Separator/>
-    <Action name="file_mail"/>
-    <Action name="file_mail_vcard"/>
-    <Action name="file_chat"/>
+    <ActionList name="file_allpropertiesactionlist" />
+    <ActionList name="file_contactactionlist" />
+    <Separator/>
+    <Action name="file_properties"/>
   </Menu>
 
   <ToolBar name="mainToolBar" noMerge="1"><text>Main Toolbar</text>
--- branches/work/kdepim-3.5.5+/kaddressbook/kaddressbookui.rc #630825:630826
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="kaddressbook" version="16">
+<kpartgui name="kaddressbook" version="17">
 
   <MenuBar>
     <Menu name="file" noMerge="1"><text>&File</text>
@@ -13,10 +13,11 @@
       </Menu>
       <Separator/>
       <Action name="file_print"/>
-      <Action name="file_mail"/>
       <Action name="file_mail_vcard"/>
-      <Action name="file_chat"/>
       <Separator/>
+      <ActionList name="file_allpropertiesactionlist" />
+      <ActionList name="file_contactactionlist" />
+      <Separator/>
       <Action name="file_quit"/>
     </Menu>
 
@@ -71,14 +72,17 @@
   </MenuBar>
 
   <Menu name="RMBPopup">
-    <Action name="file_properties"/>
     <Action name="file_new_contact"/>
+    <Separator/>
     <Action name="edit_delete"/>
+    <Separator/>
     <Action name="edit_store_in"/>
+    <Action name="file_mail_vcard"/>
     <Separator/>
-    <Action name="file_mail"/>
-    <Action name="file_mail_vcard"/>
-    <Action name="file_chat"/>
+    <ActionList name="file_allpropertiesactionlist" />
+    <ActionList name="file_contactactionlist" />
+    <Separator/>
+    <Action name="file_properties"/>
   </Menu>
 
   <ToolBar name="mainToolBar" noMerge="1"><text>Main Toolbar</text>
_______________________________________________
kde-pim mailing list
kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/


More information about the kde-pim mailing list