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

List:       kde-i18n-doc
Subject:    [PATCH] #69672 option to add vcard is missing
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2003-12-10 16:16:47
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,

I've a patch here which fixes this bug, but it introduce two new
strings. Coolo says I can commit if nobody of the translators objects.
So is it ok to commit?

Ciao,
Tobias
--=20
Can a government that shoots at reporters be democratic?
Separate politics from religion and economy!

["kab_with_vcardimpdlg.patch" (text/plain)]

Index: kaddressbook_part.cpp
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/kaddressbook_part.cpp,v
retrieving revision 1.39
diff -p -u -b -r1.39 kaddressbook_part.cpp
--- kaddressbook_part.cpp	25 Sep 2003 14:25:59 -0000	1.39
+++ kaddressbook_part.cpp	8 Dec 2003 15:38:55 -0000
@@ -123,14 +123,25 @@ void KAddressbookPart::exit()
   delete this;
 }
 
-bool KAddressbookPart::openFile()
+bool KAddressbookPart::openURL( const KURL &url )
 {
   kdDebug(5720) << "KAddressbookPart:openFile()" << endl;
 
   mCore->widget()->show();
+
+  if ( !url.isEmpty() )
+    mCore->importVCard( url );
+
+  emit setWindowCaption( url.prettyURL() );
+
   return true;
 }
 
+bool KAddressbookPart::openFile()
+{
+  return false;
+}
+
 void KAddressbookPart::guiActivateEvent( KParts::GUIActivateEvent *e )
 {
   kdDebug(5720) << "KAddressbookPart::guiActivateEvent" << endl;
Index: kaddressbook_part.h
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/kaddressbook_part.h,v
retrieving revision 1.12
diff -p -u -b -r1.12 kaddressbook_part.h
--- kaddressbook_part.h	5 May 2003 22:42:35 -0000	1.12
+++ kaddressbook_part.h	8 Dec 2003 15:38:55 -0000
@@ -53,6 +53,7 @@ class KAddressbookPart: public KParts::R
     virtual QString getNameByPhone( QString phone );
     virtual void save();
     virtual void exit();
+    virtual bool openURL( const KURL &url );
 
   protected:
     virtual bool openFile();
Index: xxport/vcard_xxport.cpp
===================================================================
RCS file: /home/kde/kdepim/kaddressbook/xxport/vcard_xxport.cpp,v
retrieving revision 1.12
diff -p -u -b -r1.12 vcard_xxport.cpp
--- xxport/vcard_xxport.cpp	14 Sep 2003 17:09:37 -0000	1.12
+++ xxport/vcard_xxport.cpp	8 Dec 2003 15:38:55 -0000
@@ -22,14 +22,19 @@
 */
 
 #include <qfile.h>
+#include <qfont.h>
+#include <qlabel.h>
+#include <qlayout.h>
 
 #include <kabc/vcardtool.h>
+#include <kdialogbase.h>
 #include <kfiledialog.h>
 #include <kio/netaccess.h>
 #include <klocale.h>
 #include <kmessagebox.h>
 #include <ktempfile.h>
 #include <kurl.h>
+#include <libkdepim/addresseeview.h>
 
 #include "xxportmanager.h"
 
@@ -52,6 +57,13 @@ extern "C"
   }
 }
 
+class VCardViewerDialog : public KDialogBase
+{
+  public:
+    VCardViewerDialog( const KABC::Addressee &addr,
+                       QWidget *parent, const char *name = 0 );
+};
+
 
 VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
   : KAB::XXPort( ab, parent, name )
@@ -158,6 +170,17 @@ KABC::AddresseeList VCardXXPort::importC
         KMessageBox::error( parentWidget(), text.arg( (*it).url() ), caption );
       }
     }
+
+    if ( !XXPortManager::importURL.isEmpty() ) { // a vcard was passed via cmd
+      KABC::AddresseeList::Iterator addrIt;
+      for ( addrIt = addrList.begin(); addrIt != addrList.end(); ++addrIt ) {
+        VCardViewerDialog dlg( *addrIt, parentWidget() );
+        if ( !dlg.exec() ) {
+          addrIt = addrList.remove( addrIt );
+          addrIt--;
+        }
+      }
+    }
   }
 
   return addrList;
@@ -184,4 +207,26 @@ bool VCardXXPort::doExport( const KURL &
   return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() );
 }
 
+// ---------- VCardViewer Dialog ---------------- //
+
+VCardViewerDialog::VCardViewerDialog( const KABC::Addressee &addr,
+                                      QWidget *parent, const char *name )
+  : KDialogBase( Plain, i18n( "Import vCard" ), Ok | Cancel, Ok,
+                 parent, name, true, true )
+{
+  QFrame *page = plainPage();
+  QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );  
+
+  QLabel *label = new QLabel( i18n( "Do you want to import this contact in your \
address book?" ), page ); +  QFont font = label->font();
+  font.setBold( true );
+  label->setFont( font );
+  layout->addWidget( label );
+
+  KPIM::AddresseeView *view = new KPIM::AddresseeView( page );
+  view->setAddressee( addr );
+  view->setVScrollBarMode( QScrollView::Auto );
+  layout->addWidget( view );
+}
+
 #include "vcard_xxport.moc"


["signature.asc" (application/pgp-signature)]

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

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