summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp44
1 files changed, 19 insertions, 25 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8d08713..b06e1bc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -60,12 +60,13 @@
60#include "kstdaction.h" 60#include "kstdaction.h"
61#include "kaddressbookservice.h" 61#include "kaddressbookservice.h"
62#include "ldapsearchdialog.h" 62#include "ldapsearchdialog.h"
63#include "printing/printingwizard.h" 63#include "printing/printingwizard.h"
64#else // KAB_EMBEDDED 64#else // KAB_EMBEDDED
65 65
66#include <kapplication.h>
66#include "KDGanttMinimizeSplitter.h" 67#include "KDGanttMinimizeSplitter.h"
67#include "kaddressbookmain.h" 68#include "kaddressbookmain.h"
68#include "kactioncollection.h" 69#include "kactioncollection.h"
69#include <qapp.h> 70#include <qapp.h>
70#include <qmenubar.h> 71#include <qmenubar.h>
71//#include <qtoolbar.h> 72//#include <qtoolbar.h>
@@ -195,13 +196,14 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
195 connect( mDetails, SIGNAL( browse( const QString& ) ), 196 connect( mDetails, SIGNAL( browse( const QString& ) ),
196 SLOT( browse( const QString& ) ) ); 197 SLOT( browse( const QString& ) ) );
197 198
198 mAddressBookService = new KAddressBookService( this ); 199 mAddressBookService = new KAddressBookService( this );
199 200
200#endif //KAB_EMBEDDED 201#endif //KAB_EMBEDDED
201 202 mEditorDialog = 0;
203 createAddresseeEditorDialog( this );
202 setModified( false ); 204 setModified( false );
203} 205}
204 206
205KABCore::~KABCore() 207KABCore::~KABCore()
206{ 208{
207 // save(); 209 // save();
@@ -787,19 +789,19 @@ void KABCore::newContact()
787 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 789 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
788 resource = static_cast<KABC::Resource*>( res ); 790 resource = static_cast<KABC::Resource*>( res );
789 791
790 if ( resource ) { 792 if ( resource ) {
791 KABC::Addressee addr; 793 KABC::Addressee addr;
792 addr.setResource( resource ); 794 addr.setResource( resource );
793 dialog = createAddresseeEditorDialog( this ); 795 mEditorDialog->setAddressee( addr );
794 dialog->setAddressee( addr ); 796 KApplication::execDialog ( mEditorDialog );
795 797
796 } else 798 } else
797 return; 799 return;
798 800
799 mEditorDict.insert( dialog->addressee().uid(), dialog ); 801 // mEditorDict.insert( dialog->addressee().uid(), dialog );
800 802
801 dialog->show(); 803 dialog->show();
802 804
803} 805}
804 806
805void KABCore::addEmail( QString aStr ) 807void KABCore::addEmail( QString aStr )
@@ -864,23 +866,14 @@ void KABCore::editContact( const QString &uid )
864 if ( uidList.count() > 0 ) 866 if ( uidList.count() > 0 )
865 localUID = *( uidList.at( 0 ) ); 867 localUID = *( uidList.at( 0 ) );
866 } 868 }
867 869
868 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 870 KABC::Addressee addr = mAddressBook->findByUid( localUID );
869 if ( !addr.isEmpty() ) { 871 if ( !addr.isEmpty() ) {
870 AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); 872 mEditorDialog->setAddressee( addr );
871 if ( !dialog ) { 873 KApplication::execDialog ( mEditorDialog );
872 dialog = createAddresseeEditorDialog( this );
873
874 mEditorDict.insert( addr.uid(), dialog );
875
876 dialog->setAddressee( addr );
877 }
878
879 dialog->raise();
880 dialog->show();
881 } 874 }
882} 875}
883 876
884void KABCore::save() 877void KABCore::save()
885{ 878{
886 if ( !mModified ) 879 if ( !mModified )
@@ -1085,30 +1078,31 @@ void KABCore::addressBookChanged()
1085#endif //KAB_EMBEDDED 1078#endif //KAB_EMBEDDED
1086} 1079}
1087 1080
1088AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1081AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1089 const char *name ) 1082 const char *name )
1090{ 1083{
1091 AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, 1084
1085 if ( mEditorDialog == 0 ) {
1086 mEditorDialog = new AddresseeEditorDialog( this, parent,
1092 name ? name : "editorDialog" ); 1087 name ? name : "editorDialog" );
1093 1088
1094//US 1089
1095 dialog->setMaximumSize( 640, 480 ); 1090 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1096 dialog->showMaximized();
1097
1098 connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1099 SLOT( contactModified( const KABC::Addressee& ) ) ); 1091 SLOT( contactModified( const KABC::Addressee& ) ) );
1100 connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), 1092 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1101 SLOT( slotEditorDestroyed( const QString& ) ) ); 1093 // SLOT( slotEditorDestroyed( const QString& ) ) );
1094 }
1102 1095
1103 return dialog; 1096 return mEditorDialog;
1104} 1097}
1105 1098
1106void KABCore::slotEditorDestroyed( const QString &uid ) 1099void KABCore::slotEditorDestroyed( const QString &uid )
1107{ 1100{
1108 mEditorDict.remove( uid ); 1101 qDebug("KABCore::slotEditorDestroyed called. maybe a problem! ");
1102 //mEditorDict.remove( uid );
1109} 1103}
1110 1104
1111void KABCore::initGUI() 1105void KABCore::initGUI()
1112{ 1106{
1113#ifndef KAB_EMBEDDED 1107#ifndef KAB_EMBEDDED
1114 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1108 QHBoxLayout *topLayout = new QHBoxLayout( this );