author | zautrix <zautrix> | 2004-07-05 09:24:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-05 09:24:56 (UTC) |
commit | 5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0 (patch) (side-by-side diff) | |
tree | f41b695d2b18bf7d7ff84d0d8b39faf15d229669 | |
parent | c2d4beeaeda44694a3e1c0b72a5808d2f518b286 (diff) | |
download | kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.zip kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.gz kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.bz2 |
Removed strange handling of addresseeeditor
-rw-r--r-- | kaddressbook/addresseeeditordialog.cpp | 32 | ||||
-rw-r--r-- | kaddressbook/addresseeeditordialog.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 42 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 4 | ||||
-rw-r--r-- | microkde/kdialogbase.cpp | 12 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 2 |
6 files changed, 47 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 @@ -24,2 +24,3 @@ #include <qlayout.h> +#include <qapplication.h> @@ -38,9 +39,5 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, 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; @@ -56,2 +53,5 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, enableButton( KDialogBase::Apply, false ); + if ( QApplication::desktop()->width() < 480 ) { + hideButtons(); + } } @@ -60,5 +60,4 @@ AddresseeEditorDialog::~AddresseeEditorDialog() { - kdDebug(5720) << "~AddresseeEditorDialog()" << endl; - - emit editorDestroyed( mEditorWidget->addressee().uid() ); + qDebug("----------------------------------------------- "); + //emit editorDestroyed( mEditorWidget->addressee().uid() ); } @@ -94,2 +93,7 @@ void AddresseeEditorDialog::slotApply() +void AddresseeEditorDialog:: accept () +{ + slotOk(); + +} void AddresseeEditorDialog::slotOk() @@ -100,8 +104,2 @@ void AddresseeEditorDialog::slotOk() - // Destroy this dialog -#ifndef KAB_EMBEDDED - delayedDestruct(); -#else //KAB_EMBEDDED - delete this; -#endif //KAB_EMBEDDED } @@ -117,8 +115,2 @@ void AddresseeEditorDialog::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 @@ -55,2 +55,3 @@ class AddresseeEditorDialog : public KDialogBase 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 @@ -65,2 +65,3 @@ +#include <kapplication.h> #include "KDGanttMinimizeSplitter.h" @@ -200,3 +201,4 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const #endif //KAB_EMBEDDED - + mEditorDialog = 0; + createAddresseeEditorDialog( this ); setModified( false ); @@ -792,4 +794,4 @@ void KABCore::newContact() addr.setResource( resource ); - dialog = createAddresseeEditorDialog( this ); - dialog->setAddressee( addr ); + mEditorDialog->setAddressee( addr ); + KApplication::execDialog ( mEditorDialog ); @@ -798,3 +800,3 @@ void KABCore::newContact() - mEditorDict.insert( dialog->addressee().uid(), dialog ); + // mEditorDict.insert( dialog->addressee().uid(), dialog ); @@ -869,13 +871,4 @@ void KABCore::editContact( const QString &uid ) 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 ); } @@ -1090,15 +1083,15 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, { - 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; } @@ -1107,3 +1100,4 @@ 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 @@ -361,4 +361,4 @@ class KABCore : public QWidget #endif //KAB_EMBEDDED - QDict<AddresseeEditorDialog> mEditorDict; - + // QDict<AddresseeEditorDialog> mEditorDict; + AddresseeEditorDialog *mEditorDialog; bool mReadWrite; diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 2ea2053..c953058 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp @@ -79,2 +79,9 @@ void KDialogBase::init( const QString &caption, int buttonMask, } + if ( buttonMask & Default ) { + qDebug("buttonMask & Default "); + mDefaultButton = new QPushButton( i18n("Default"), this ); + connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); + } else { + mDefaultButton = 0; + } @@ -117,2 +124,3 @@ void KDialogBase::hideButtons() if ( mApplyButton ) mApplyButton->hide() ; + if ( mDefaultButton ) mDefaultButton->hide(); if ( mCancelButton ) mCancelButton->hide() ; @@ -138,2 +146,3 @@ void KDialogBase::initLayout() if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); + if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); @@ -199,2 +208,5 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) break; + case Default: + button = mDefaultButton; + break; case Close: diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 199d2fa..7b44bfb 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h @@ -107,2 +107,3 @@ class KDialogBase : public KDialog void closeClicked(); + void defaultClicked(); @@ -136,2 +137,3 @@ class KDialogBase : public KDialog QPushButton *mCancelButton; + QPushButton *mDefaultButton; }; |