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

List:       kde-commits
Subject:    extragear/office/tellico
From:       Robby Stephenson <robby () periapsis ! org>
Date:       2010-01-28 4:18:30
Message-ID: 1264652310.822823.23624.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1081287 by rstephenson:

enable kaddressbook integration

 M  +4 -0      ChangeLog  
 M  +2 -0      config.h.cmake  
 M  +10 -6     src/borrowerdialog.cpp  
 M  +6 -1      src/loandialog.cpp  


--- trunk/extragear/office/tellico/ChangeLog #1081286:1081287
@@ -1,3 +1,7 @@
+2010-01-27  Robby Stephenson  <robby@periapsis.org>
+
+	* Enabled KAddressBook integration for borrowers.
+
 2010-01-15  Robby Stephenson  <robby@periapsis.org>
 
 	* Fixed bug in en_GB translation that affected file selection.
--- trunk/extragear/office/tellico/config.h.cmake #1081286:1081287
@@ -18,6 +18,8 @@
 
 #cmakedefine HAVE_EXEMPI
 
+#cmakedefine HAVE_KABC
+
 #cmakedefine HAVE_KCAL
 
 #cmakedefine HAVE_KCDDB
--- trunk/extragear/office/tellico/src/borrowerdialog.cpp #1081286:1081287
@@ -50,7 +50,7 @@
 #ifdef HAVE_KABC
 BorrowerDialog::Item::Item(QTreeWidget* parent_, const KABC::Addressee& add_)
     : QTreeWidgetItem(parent_), m_uid(add_.uid()) {
-  setData(0, Qt::DisplayRole, add_.realName());
+  setData(0, Qt::DisplayRole, add_.realName().trimmed());
   setData(0, Qt::DecorationRole, KIcon(QLatin1String("kaddressbook")));
 }
 #endif
@@ -75,7 +75,7 @@
   m_treeWidget = new QTreeWidget(mainWidget);
   topLayout->addWidget(m_treeWidget);
   m_treeWidget->setHeaderLabel(i18n("Name"));
-  connect(m_treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*)),
+  connect(m_treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
           SLOT(accept()));
   connect(m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
           SLOT(updateEdit(QTreeWidgetItem*)));
@@ -109,19 +109,23 @@
   for(KABC::AddressBook::ConstIterator it = abook->begin(), end = abook->end();
       it != end; ++it) {
     // skip people with no name
-    if((*it).realName().isEmpty()) {
+    const QString name = (*it).realName().trimmed();
+    if(name.isEmpty()) {
       continue;
     }
     Item* item = new Item(m_treeWidget, *it);
-    m_itemHash.insert((*it).realName(), item);
-    m_lineEdit->completionObject()->addItem((*it).realName());
+    m_itemHash.insert(name, item);
+    m_lineEdit->completionObject()->addItem(name);
   }
 #endif
 
   // add current borrowers, too
   Data::BorrowerList borrowers = Data::Document::self()->collection()->borrowers();
   foreach(Data::BorrowerPtr bor, borrowers) {
-    if(m_itemHash[bor->name()]) {
+    if(bor->name().isEmpty()) {
+      continue;
+    }
+    if(m_itemHash.contains(bor->name())) {
       continue; // if an item already exists with this name
     }
     Item* item = new Item(m_treeWidget, *bor);
--- trunk/extragear/office/tellico/src/loandialog.cpp #1081286:1081287
@@ -218,7 +218,12 @@
   const KABC::AddressBook* const abook = KABC::StdAddressBook::self(true);
   for(KABC::AddressBook::ConstIterator it = abook->begin(), end = abook->end();
       it != end; ++it) {
-    m_borrowerEdit->completionObject()->addItem((*it).realName());
+    // skip people with no name
+    const QString name = (*it).realName().trimmed();
+    if(name.isEmpty()) {
+      continue;
+    }
+    m_borrowerEdit->completionObject()->addItem(name);
   }
 #endif
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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