Version: (using KDE KDE 3.4.0) Installed from: SuSE RPMs HI, it would be very cool, to have an integration of Kaddressbook and Digikam. I really like the labeling function in digikam. I would like to associate a people's label with an adressbook entry.
SVN commit 427514 by toma: This add your AddressBook to the context menu of the tags. This way you can easily add one of your friends as a new tag. FEATURE: 101606 M +1 -1 Makefile.am M +52 -7 tagfolderview.cpp M +6 -3 tagfolderview.h --- branches/digikam/0.8-experimental/digikam/digikam/Makefile.am #427513:427514 @@ -49,7 +49,7 @@ upgradedb_sqlite2tosqlite3.cpp jpegreader.cpp -libdigikam_la_LIBADD = $(LIB_KIO) $(LIB_SQLITE3) \ +libdigikam_la_LIBADD = $(LIB_KIO) $(LIB_SQLITE3) $(LIB_KABC) \ $(LIBKEXIF_LIBS) $(LIBKIPI_LIBS) $(LIB_KUTILS) \ $(top_builddir)/digikam/sqlite/libsqlite.la \ $(top_builddir)/digikam/libs/histogram/libhistogram.la \ --- branches/digikam/0.8-experimental/digikam/digikam/tagfolderview.cpp #427513:427514 @@ -24,6 +24,7 @@ #include <klocale.h> #include <kdebug.h> +#include <kabc/stdaddressbook.h> #include <kiconloader.h> #include <kapplication.h> #include <kmessagebox.h> @@ -109,7 +110,8 @@ class TagFolderViewPriv { public: - AlbumManager *albumMan; + AlbumManager *albumMan; + QPopupMenu *ABCMenu; }; //----------------------------------------------------------------------------- @@ -259,7 +261,10 @@ void TagFolderView::slotContextMenu(QListViewItem *item, const QPoint &, int) { QPopupMenu popmenu(this); - + d->ABCMenu = new QPopupMenu; + connect( d->ABCMenu, SIGNAL( aboutToShow() ), + SLOT( slotABCContextMenu() ) ); + TagFolderViewItem *tag = dynamic_cast<TagFolderViewItem*>(item); popmenu.insertItem(SmallIcon("tag"), i18n("New Tag..."), 10); @@ -269,7 +274,11 @@ popmenu.insertItem(SmallIcon("edittrash"), i18n("Delete Tag"), 12); } - switch(popmenu.exec((QCursor::pos()))) + popmenu.insertItem( i18n("Create Tag from AddressBook"), d->ABCMenu); + + + int choice = popmenu.exec((QCursor::pos())); + switch( choice ) { case 10: { @@ -289,17 +298,50 @@ default: break; } + + if ( choice > 12 ) + { + tagNew( tag, d->ABCMenu->text( choice ), "tag-people" ); + } + + delete d->ABCMenu; + d->ABCMenu = 0; } +void TagFolderView::slotABCContextMenu() +{ + d->ABCMenu->clear(); + + int counter = 12; + KABC::AddressBook* ab = KABC::StdAddressBook::self(); + KABC::AddressBook::Iterator it; + for ( it = ab->begin(); it != ab->end(); ++it ) + { + KABC::Addressee addr = (*it); + QString name = addr.formattedName(); + if ( !name.isNull() ) + d->ABCMenu->insertItem( name, ++counter ); + } + + if (counter == 12) + { + d->ABCMenu->insertItem( i18n("No AddressBook Entries Found"), ++counter ); + d->ABCMenu->setItemEnabled( counter, false ); + } +} + void TagFolderView::tagNew() { TagFolderViewItem *item = dynamic_cast<TagFolderViewItem*>(selectedItem()); tagNew(item); } -void TagFolderView::tagNew(TagFolderViewItem *item) +void TagFolderView::tagNew( TagFolderViewItem *item, + const QString& _title, + const QString& _icon ) { - QString title, icon; + QString title = _title; + QString icon = _icon; TAlbum *parent; if(!item) @@ -307,8 +349,11 @@ else parent = item->getTag(); - if(!TagCreateDlg::tagCreate(parent, title, icon)) - return; + if (title.isNull()) + { + if(!TagCreateDlg::tagCreate(parent, title, icon)) + return; + } QString errMsg; if(!d->albumMan->createTAlbum(parent, title, icon, errMsg)) --- branches/digikam/0.8-experimental/digikam/digikam/tagfolderview.h #427513:427514 @@ -57,11 +57,14 @@ void slotAlbumsCleared(); void slotAlbumIconChanged(Album* album); void slotContextMenu(QListViewItem*, const QPoint&, int); - + void slotABCContextMenu(); + private: - void tagNew(TagFolderViewItem *item); - void tagEdit(TagFolderViewItem *item); + void tagNew(TagFolderViewItem *item, + const QString& _title=QString(), + const QString& _icon=QString() ); + void tagEdit(TagFolderViewItem *item); void tagDelete(TagFolderViewItem *item); TagFolderViewPriv *d;
*** Bug 111600 has been marked as a duplicate of this bug. ***
I have so many contacts in my kaddressbook that only people whose name begins with letters A-K are shown. The rest of the menu is outside my screen. And this function only seems to add the contacts name on the tag list. I wish there would be more interaction, for example an option to send picture to people on it by email.