[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/pim/mailody/src
From: Tom Albers <toma () kde ! org>
Date: 2009-10-17 17:54:07
Message-ID: 1255802047.920906.2750.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1036744 by toma:
Remove most of the code, now the API has been changed so I can pass a Addressee to \
the dialog in creation mode.
M +5 -41 contactcreation.cpp
M +0 -11 contactcreation.h
--- trunk/extragear/pim/mailody/src/contactcreation.cpp #1036743:1036744
@@ -22,6 +22,7 @@
#include <akonadi/collection.h>
#include <akonadi/contact/contacteditordialog.h>
+#include <akonadi/contact/contacteditor.h>
#include <akonadi/item.h>
#include <akonadi/itemcreatejob.h>
#include <akonadi/itemdeletejob.h>
@@ -32,7 +33,7 @@
ContactCreation::ContactCreation( QWidget* parent, const QString& address,
Akonadi::Collection collection )
- : QObject( parent ), m_parent( parent )
+ : QObject( parent )
{
QString email, name;
bool ok = KPIMUtils::extractEmailAddressAndName( address, email, name );
@@ -46,46 +47,9 @@
addressee.setNameFromString( name );
addressee.setEmails( QStringList( email ) );
- Akonadi::Item item( -1 );
- item.setMimeType( "text/directory" );
- item.setPayload<KABC::Addressee>( addressee );
-
- Akonadi::ItemCreateJob* job = new Akonadi::ItemCreateJob( item, collection );
- connect( job, SIGNAL( result( KJob* ) ),
- SLOT( slotAddContactCompleted( KJob* ) ) );
-}
-
-void ContactCreation::slotAddContactCompleted( KJob* job )
-{
- kDebug();
- if ( job->error() ) {
- kDebug() << "Initial creation failed" << job->errorString();
- return;
- }
-
- Akonadi::ItemCreateJob* createJob =
- static_cast<Akonadi::ItemCreateJob*>( job );
-
- m_item = createJob->item();
-
- QTimer::singleShot( 1000 /* some delay */, this, SLOT( slotShowDialog() ) );
-}
-
-void ContactCreation::slotShowDialog()
-{
- kDebug();
Akonadi::ContactEditorDialog* dlg =
- new Akonadi::ContactEditorDialog( Akonadi::ContactEditorDialog::EditMode,
- m_parent );
- dlg->setContact( m_item );
+ new Akonadi::ContactEditorDialog( Akonadi::ContactEditorDialog::CreateMode,
+ parent );
+ dlg->editor()->setContactTemplate( addressee );
dlg->show();
- connect( dlg, SIGNAL( cancelClicked() ), SLOT( slotCancelClicked() ) );
}
-
-void ContactCreation::slotCancelClicked()
-{
- kDebug();
- new Akonadi::ItemDeleteJob( m_item );
-}
-
-#include "contactcreation.moc"
--- trunk/extragear/pim/mailody/src/contactcreation.h #1036743:1036744
@@ -34,20 +34,9 @@
class ContactCreation : public QObject
{
- Q_OBJECT
-
public:
ContactCreation( QWidget* parent, const QString& address,
Akonadi::Collection );
-
-private slots:
- void slotAddContactCompleted( KJob* job );
- void slotShowDialog();
- void slotCancelClicked();
-
-private:
- Akonadi::Item m_item;
- QWidget* m_parent;
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic