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 @@ -21,8 +21,9 @@ without including the source code for Qt in the source distribution. */ #include <qlayout.h> +#include <qapplication.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> @@ -35,15 +36,11 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, const char *name ) : 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(); QVBoxLayout *layout = new QVBoxLayout( page ); @@ -53,15 +50,17 @@ AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, SLOT( widgetModified() ) ); layout->addWidget( mEditorWidget ); 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() ); } void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) { @@ -91,20 +90,19 @@ void AddresseeEditorDialog::slotApply() KDialogBase::slotApply(); } +void AddresseeEditorDialog:: accept () +{ + slotOk(); + +} void AddresseeEditorDialog::slotOk() { slotApply(); KDialogBase::slotOk(); - // Destroy this dialog -#ifndef KAB_EMBEDDED - delayedDestruct(); -#else //KAB_EMBEDDED - delete this; -#endif //KAB_EMBEDDED } void AddresseeEditorDialog::widgetModified() { @@ -114,14 +112,8 @@ void AddresseeEditorDialog::widgetModified() void AddresseeEditorDialog::slotCancel() { KDialogBase::slotCancel(); - // Destroy this dialog -#ifndef KAB_EMBEDDED - delayedDestruct(); -#else //KAB_EMBEDDED - delete this; -#endif //KAB_EMBEDDED } #ifndef KAB_EMBEDDED diff --git a/kaddressbook/addresseeeditordialog.h b/kaddressbook/addresseeeditordialog.h index 1a00d3a..a1521e2 100644 --- a/kaddressbook/addresseeeditordialog.h +++ b/kaddressbook/addresseeeditordialog.h @@ -52,8 +52,9 @@ class AddresseeEditorDialog : public KDialogBase protected slots: virtual void slotApply(); virtual void slotOk(); virtual void slotCancel(); + virtual void accept () ; void widgetModified(); private: AddresseeEditorWidget *mEditorWidget; diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 8d08713..b06e1bc 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -62,8 +62,9 @@ #include "ldapsearchdialog.h" #include "printing/printingwizard.h" #else // KAB_EMBEDDED +#include <kapplication.h> #include "KDGanttMinimizeSplitter.h" #include "kaddressbookmain.h" #include "kactioncollection.h" #include <qapp.h> @@ -197,9 +198,10 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const mAddressBookService = new KAddressBookService( this ); #endif //KAB_EMBEDDED - + mEditorDialog = 0; + createAddresseeEditorDialog( this ); setModified( false ); } KABCore::~KABCore() @@ -789,15 +791,15 @@ void KABCore::newContact() if ( resource ) { 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(); } @@ -866,19 +868,10 @@ 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 ); } } void KABCore::save() @@ -1087,26 +1080,27 @@ void KABCore::addressBookChanged() 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 ); } void KABCore::initGUI() { diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index b84ec22..c823f1f 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -358,10 +358,10 @@ class KABCore : public QWidget KCMultiDialog *mConfigureDialog; LDAPSearchDialog *mLdapSearchDialog; #endif //KAB_EMBEDDED - QDict<AddresseeEditorDialog> mEditorDict; - + // QDict<AddresseeEditorDialog> mEditorDict; + AddresseeEditorDialog *mEditorDialog; bool mReadWrite; bool mModified; bool mIsPart; diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 2ea2053..c953058 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp @@ -76,8 +76,15 @@ void KDialogBase::init( const QString &caption, int buttonMask, connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); } else { mOkButton = 0; } + if ( buttonMask & Default ) { + qDebug("buttonMask & Default "); + mDefaultButton = new QPushButton( i18n("Default"), this ); + connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); + } else { + mDefaultButton = 0; + } if ( buttonMask & Apply ) { mApplyButton = new QPushButton( i18n("Apply"), this ); connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); @@ -114,8 +121,9 @@ void KDialogBase::hideButtons() if ( mUser1Button ) mUser1Button->hide() ; if ( mUser2Button ) mUser2Button->hide() ; if ( mOkButton ) mOkButton->hide() ; if ( mApplyButton ) mApplyButton->hide() ; + if ( mDefaultButton ) mDefaultButton->hide(); if ( mCancelButton ) mCancelButton->hide() ; if ( mCloseButton ) mCloseButton->hide() ; } @@ -135,8 +143,9 @@ void KDialogBase::initLayout() if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); if ( mOkButton ) buttonLayout->addWidget( mOkButton ); if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); + if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); } @@ -196,8 +205,11 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) break; case Cancel: button = mCancelButton; break; + case Default: + button = mDefaultButton; + break; case Close: button = mCloseButton; break; default: diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 199d2fa..7b44bfb 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h @@ -104,8 +104,9 @@ class KDialogBase : public KDialog * The Close button was pressed. This signal is only emitted if * @ref slotClose() is not replaced. */ void closeClicked(); + void defaultClicked(); protected slots: virtual void slotOk(); virtual void slotApply(); @@ -133,7 +134,8 @@ class KDialogBase : public KDialog QPushButton *mCloseButton; QPushButton *mOkButton; QPushButton *mApplyButton; QPushButton *mCancelButton; + QPushButton *mDefaultButton; }; #endif |