summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/addresseeeditordialog.cpp32
-rw-r--r--kaddressbook/addresseeeditordialog.h1
-rw-r--r--kaddressbook/kabcore.cpp42
-rw-r--r--kaddressbook/kabcore.h4
4 files changed, 33 insertions, 46 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index 102138e..790f148 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -23,4 +23,5 @@
#include <qlayout.h>
+#include <qapplication.h>
#include <kdebug.h>
@@ -37,11 +38,7 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
: KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
- KDialogBase::Ok, parent, name, false )
+ KDialogBase::Ok, parent, name, true )
{
-#ifdef KAB_EMBEDDED
- resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
-#endif //KAB_EMBEDDED
- kdDebug(5720) << "AddresseeEditorDialog()" << endl;
QWidget *page = plainPage();
@@ -55,11 +52,13 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
enableButton( KDialogBase::Apply, false );
+ if ( QApplication::desktop()->width() < 480 ) {
+ hideButtons();
+ }
}
AddresseeEditorDialog::~AddresseeEditorDialog()
{
- kdDebug(5720) << "~AddresseeEditorDialog()" << endl;
-
- emit editorDestroyed( mEditorWidget->addressee().uid() );
+ qDebug("----------------------------------------------- ");
+ //emit editorDestroyed( mEditorWidget->addressee().uid() );
}
@@ -93,4 +92,9 @@ void AddresseeEditorDialog::slotApply()
}
+void AddresseeEditorDialog:: accept ()
+{
+ slotOk();
+
+}
void AddresseeEditorDialog::slotOk()
{
@@ -99,10 +103,4 @@ void AddresseeEditorDialog::slotOk()
KDialogBase::slotOk();
- // Destroy this dialog
-#ifndef KAB_EMBEDDED
- delayedDestruct();
-#else //KAB_EMBEDDED
- delete this;
-#endif //KAB_EMBEDDED
}
@@ -116,10 +114,4 @@ void AddresseeEditorDialog::slotCancel()
KDialogBase::slotCancel();
- // Destroy this dialog
-#ifndef KAB_EMBEDDED
- delayedDestruct();
-#else //KAB_EMBEDDED
- delete this;
-#endif //KAB_EMBEDDED
}
diff --git a/kaddressbook/addresseeeditordialog.h b/kaddressbook/addresseeeditordialog.h
index 1a00d3a..a1521e2 100644
--- a/kaddressbook/addresseeeditordialog.h
+++ b/kaddressbook/addresseeeditordialog.h
@@ -54,4 +54,5 @@ class AddresseeEditorDialog : public KDialogBase
virtual void slotOk();
virtual void slotCancel();
+ virtual void accept () ;
void widgetModified();
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8d08713..b06e1bc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -64,4 +64,5 @@
#else // KAB_EMBEDDED
+#include <kapplication.h>
#include "KDGanttMinimizeSplitter.h"
#include "kaddressbookmain.h"
@@ -199,5 +200,6 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
#endif //KAB_EMBEDDED
-
+ mEditorDialog = 0;
+ createAddresseeEditorDialog( this );
setModified( false );
}
@@ -791,11 +793,11 @@ void KABCore::newContact()
KABC::Addressee addr;
addr.setResource( resource );
- dialog = createAddresseeEditorDialog( this );
- dialog->setAddressee( addr );
+ mEditorDialog->setAddressee( addr );
+ KApplication::execDialog ( mEditorDialog );
} else
return;
- mEditorDict.insert( dialog->addressee().uid(), dialog );
+ // mEditorDict.insert( dialog->addressee().uid(), dialog );
dialog->show();
@@ -868,15 +870,6 @@ void KABCore::editContact( const QString &uid )
KABC::Addressee addr = mAddressBook->findByUid( localUID );
if ( !addr.isEmpty() ) {
- AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() );
- if ( !dialog ) {
- dialog = createAddresseeEditorDialog( this );
-
- mEditorDict.insert( addr.uid(), dialog );
-
- dialog->setAddressee( addr );
- }
-
- dialog->raise();
- dialog->show();
+ mEditorDialog->setAddressee( addr );
+ KApplication::execDialog ( mEditorDialog );
}
}
@@ -1089,22 +1082,23 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
const char *name )
{
- AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent,
+
+ if ( mEditorDialog == 0 ) {
+ mEditorDialog = new AddresseeEditorDialog( this, parent,
name ? name : "editorDialog" );
-//US
- dialog->setMaximumSize( 640, 480 );
- dialog->showMaximized();
- connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
+ connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
SLOT( contactModified( const KABC::Addressee& ) ) );
- connect( dialog, SIGNAL( editorDestroyed( const QString& ) ),
- SLOT( slotEditorDestroyed( const QString& ) ) );
+ //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
+ // SLOT( slotEditorDestroyed( const QString& ) ) );
+ }
- return dialog;
+ return mEditorDialog;
}
void KABCore::slotEditorDestroyed( const QString &uid )
{
- mEditorDict.remove( uid );
+ qDebug("KABCore::slotEditorDestroyed called. maybe a problem! ");
+ //mEditorDict.remove( uid );
}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index b84ec22..c823f1f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -360,6 +360,6 @@ class KABCore : public QWidget
LDAPSearchDialog *mLdapSearchDialog;
#endif //KAB_EMBEDDED
- QDict<AddresseeEditorDialog> mEditorDict;
-
+ // QDict<AddresseeEditorDialog> mEditorDict;
+ AddresseeEditorDialog *mEditorDialog;
bool mReadWrite;
bool mModified;