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

List:       kde-commits
Subject:    playground/office/kraft/src
From:       Klaas Freitag <klaas () freisturz ! de>
Date:       2012-07-14 19:57:15
Message-ID: 20120714195716.01E39AC7A9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1305680 by freitag:

Added a button to document editor to select the addressee from an addressbook.


 M  +1 -0      CMakeLists.txt  
 M  +0 -1      akonadiaddressselector.cpp  
 A             akonadiaddressselectordialog.cpp   [License: GPL (v2+)]
 A             akonadiaddressselectordialog.h   [License: GPL (v2+)]
 M  +4 -1      docheader.ui  
 M  +1 -6      kraftdocheaderedit.cpp  
 M  +2 -2      kraftdocheaderedit.h  
 M  +14 -3     kraftview.cpp  
 M  +1 -0      kraftview.h  


--- trunk/playground/office/kraft/src/CMakeLists.txt #1305679:1305680
@@ -146,6 +146,7 @@
     external/ktreeviewsearchline.cpp
     addressprovider.cpp
     akonadiaddressselector.cpp
+    akonadiaddressselectordialog.cpp
     models/globalcontactmodel.cpp
     quicksearchwidget.cpp
 )
--- trunk/playground/office/kraft/src/akonadiaddressselector.cpp #1305679:1305680
@@ -55,7 +55,6 @@
   QStringList mimeTypes;
   mimeTypes << KABC::Addressee::mimeType() << KABC::ContactGroup::mimeType();
   const QStringList collectionMimeTypes = collection.contentMimeTypes();
-  kDebug() << "tokoe: collectionMimeTypes:" << collectionMimeTypes;
   foreach ( const QString &mimeType, mimeTypes ) {
     if ( collectionMimeTypes.contains( mimeType ) ) {
       return false;
--- trunk/playground/office/kraft/src/docheader.ui #1305679:1305680
@@ -200,8 +200,11 @@
        </item>
        <item>
         <widget class="QPushButton" name="pb_pickAddressee">
+         <property name="toolTip">
+          <string>Select an addressee from the address books.</string>
+         </property>
          <property name="text">
-          <string>pick...</string>
+          <string>select...</string>
          </property>
         </widget>
        </item>
--- trunk/playground/office/kraft/src/kraftdocheaderedit.cpp #1305679:1305680
@@ -54,13 +54,8 @@
   connect( mDocHeaderEdit->m_whiteboardEdit, SIGNAL( textChanged() ),
     SLOT( slotModified() ) );
 
-  connect( mDocHeaderEdit->pb_pickAddressee, SIGNAL(clicked()), \
SLOT(slotPickAddressee())); +  connect( mDocHeaderEdit->pb_pickAddressee, \
SIGNAL(clicked()), SIGNAL(pickAddressee()));  
   setTitle( i18n( "Document Header" ) );
   setColor( "#9af0ff" );
 }
-
-void KraftDocHeaderEdit::slotPickAddressee()
-{
-    kDebug() << "*** Picking Address from Addressbooks.";
-}
--- trunk/playground/office/kraft/src/kraftdocheaderedit.h #1305679:1305680
@@ -29,8 +29,8 @@
   // FIXME: Remove access to internal widgets
   Ui::DocHeaderEdit *docHeaderEdit() { return mDocHeaderEdit; }
 
-protected slots:
-  void slotPickAddressee();
+signals:
+  void pickAddressee();
 
 private:
   Ui::DocHeaderEdit *mDocHeaderEdit;
--- trunk/playground/office/kraft/src/kraftview.cpp #1305679:1305680
@@ -79,6 +79,7 @@
 #include "importitemdialog.h"
 #include "addressprovider.h"
 #include "doclocaledialog.h"
+#include "akonadiaddressselectordialog.h"
 
 #define NO_TAX   0
 #define RED_TAX  1
@@ -304,6 +305,7 @@
              this, SLOT( slotLanguageSettings() ) );
     connect( edit, SIGNAL( modified() ),
               this, SLOT( slotModifiedHeader() ) );
+    connect( edit, SIGNAL(pickAddressee()), this, SLOT(slotPickAddressee()) );
 }
 
 void KraftView::setupPositions()
@@ -371,6 +373,15 @@
     mModified = false;
 }
 
+void KraftView::slotPickAddressee()
+{
+    AkonadiAddressSelectorDialog dialog(this);
+
+    if( dialog.exec() ) {
+        slotNewAddress( dialog.addressee() );
+    }
+}
+
 void KraftView::slotAddresseeFound( const QString& uid, const KABC::Addressee& \
contact )  {
   kDebug() << "Addressee Found with uid " << uid;
@@ -810,6 +821,7 @@
   const QString currAddress = m_headerEdit->m_postAddressEdit->toPlainText();
 
   bool replace = true;
+  m_headerEdit->m_labName->setText( contact.realName() );
 
   if( currAddress.isEmpty() ) {
     replace = true;
@@ -817,7 +829,8 @@
     // non empty and current different from new address
     // need to ask first if we overwrite
     if( interactive ) {
-      if( KMessageBox::questionYesNo( this, i18n("The address label is not empty. Do \
you really want to replace it?"), +        if( KMessageBox::questionYesNo( this, \
i18n("The address label is not empty and different from the selected one.<br/>" +     \
"Do you really want to replace it with the text shown \
                below?<pre>%1</pre>").arg(newAddress),
                                      i18n("Address Overwrite") ) == KMessageBox::No \
) replace = false;  } else {
       // this happens when the document is loaded and the address arrives from \
addressbook @@ -829,8 +842,6 @@
   }
 
   if( replace ) {
-    m_headerEdit->m_labName->setText( contact.realName() );
-
     mContactUid = contact.uid();
 
     m_headerEdit->m_postAddressEdit->setText( newAddress );
--- trunk/playground/office/kraft/src/kraftview.h #1305679:1305680
@@ -148,6 +148,7 @@
 
   void slotDocTypeChanged( const QString& );
   void slotLanguageSettings();
+  void slotPickAddressee();
   void slotAddresseeFound( const QString&, const KABC::Addressee& );
   void slotTaxComboChanged( int );
 


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

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