summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-07-05 09:24:56 (UTC)
committer zautrix <zautrix>2004-07-05 09:24:56 (UTC)
commit5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0 (patch) (unidiff)
treef41b695d2b18bf7d7ff84d0d8b39faf15d229669
parentc2d4beeaeda44694a3e1c0b72a5808d2f518b286 (diff)
downloadkdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.zip
kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.gz
kdepimpi-5c5c1354afa5d24768ceefe5b7dd8733ff7bd5f0.tar.bz2
Removed strange handling of addresseeeditor
Diffstat (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
-rw-r--r--microkde/kdialogbase.cpp12
-rw-r--r--microkde/kdialogbase.h2
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
@@ -19,12 +19,13 @@
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qapplication.h>
25 26
26#include <kdebug.h> 27#include <kdebug.h>
27#include <klocale.h> 28#include <klocale.h>
28#include <kglobal.h> 29#include <kglobal.h>
29 30
30#include "addresseeeditorwidget.h" 31#include "addresseeeditorwidget.h"
@@ -33,37 +34,35 @@
33#include "addresseeeditordialog.h" 34#include "addresseeeditordialog.h"
34 35
35AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, 36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
36 const char *name ) 37 const char *name )
37 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), 38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
38 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, 39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
39 KDialogBase::Ok, parent, name, false ) 40 KDialogBase::Ok, parent, name, true )
40{ 41{
41#ifdef KAB_EMBEDDED
42 resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
43#endif //KAB_EMBEDDED
44 42
45 kdDebug(5720) << "AddresseeEditorDialog()" << endl;
46 43
47 QWidget *page = plainPage(); 44 QWidget *page = plainPage();
48 45
49 QVBoxLayout *layout = new QVBoxLayout( page ); 46 QVBoxLayout *layout = new QVBoxLayout( page );
50 47
51 mEditorWidget = new AddresseeEditorWidget( core, false, page ); 48 mEditorWidget = new AddresseeEditorWidget( core, false, page );
52 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), 49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
53 SLOT( widgetModified() ) ); 50 SLOT( widgetModified() ) );
54 layout->addWidget( mEditorWidget ); 51 layout->addWidget( mEditorWidget );
55 52
56 enableButton( KDialogBase::Apply, false ); 53 enableButton( KDialogBase::Apply, false );
54 if ( QApplication::desktop()->width() < 480 ) {
55 hideButtons();
56 }
57} 57}
58 58
59AddresseeEditorDialog::~AddresseeEditorDialog() 59AddresseeEditorDialog::~AddresseeEditorDialog()
60{ 60{
61 kdDebug(5720) << "~AddresseeEditorDialog()" << endl; 61 qDebug("----------------------------------------------- ");
62 62 //emit editorDestroyed( mEditorWidget->addressee().uid() );
63 emit editorDestroyed( mEditorWidget->addressee().uid() );
64} 63}
65 64
66void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) 65void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
67{ 66{
68 enableButton( KDialogBase::Apply, false ); 67 enableButton( KDialogBase::Apply, false );
69 68
@@ -89,41 +88,34 @@ void AddresseeEditorDialog::slotApply()
89 88
90 enableButton( KDialogBase::Apply, false ); 89 enableButton( KDialogBase::Apply, false );
91 90
92 KDialogBase::slotApply(); 91 KDialogBase::slotApply();
93} 92}
94 93
94void AddresseeEditorDialog:: accept ()
95{
96 slotOk();
97
98}
95void AddresseeEditorDialog::slotOk() 99void AddresseeEditorDialog::slotOk()
96{ 100{
97 slotApply(); 101 slotApply();
98 102
99 KDialogBase::slotOk(); 103 KDialogBase::slotOk();
100 104
101 // Destroy this dialog
102#ifndef KAB_EMBEDDED
103 delayedDestruct();
104#else //KAB_EMBEDDED
105 delete this;
106#endif //KAB_EMBEDDED
107} 105}
108 106
109void AddresseeEditorDialog::widgetModified() 107void AddresseeEditorDialog::widgetModified()
110{ 108{
111 enableButton( KDialogBase::Apply, true ); 109 enableButton( KDialogBase::Apply, true );
112} 110}
113 111
114void AddresseeEditorDialog::slotCancel() 112void AddresseeEditorDialog::slotCancel()
115{ 113{
116 KDialogBase::slotCancel(); 114 KDialogBase::slotCancel();
117 115
118 // Destroy this dialog
119#ifndef KAB_EMBEDDED
120 delayedDestruct();
121#else //KAB_EMBEDDED
122 delete this;
123#endif //KAB_EMBEDDED
124 116
125} 117}
126 118
127#ifndef KAB_EMBEDDED 119#ifndef KAB_EMBEDDED
128#include "addresseeeditordialog.moc" 120#include "addresseeeditordialog.moc"
129#endif //KAB_EMBEDDED 121#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
@@ -50,12 +50,13 @@ class AddresseeEditorDialog : public KDialogBase
50 void editorDestroyed( const QString& ); 50 void editorDestroyed( const QString& );
51 51
52 protected slots: 52 protected slots:
53 virtual void slotApply(); 53 virtual void slotApply();
54 virtual void slotOk(); 54 virtual void slotOk();
55 virtual void slotCancel(); 55 virtual void slotCancel();
56 virtual void accept () ;
56 void widgetModified(); 57 void widgetModified();
57 58
58 private: 59 private:
59 AddresseeEditorWidget *mEditorWidget; 60 AddresseeEditorWidget *mEditorWidget;
60}; 61};
61 62
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
1095 dialog->setMaximumSize( 640, 480 );
1096 dialog->showMaximized();
1097 1089
1098 connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1090 connect( mEditorDialog, 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 );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index b84ec22..c823f1f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -356,14 +356,14 @@ class KABCore : public QWidget
356 356
357#ifndef KAB_EMBEDDED 357#ifndef KAB_EMBEDDED
358 358
359 KCMultiDialog *mConfigureDialog; 359 KCMultiDialog *mConfigureDialog;
360 LDAPSearchDialog *mLdapSearchDialog; 360 LDAPSearchDialog *mLdapSearchDialog;
361#endif //KAB_EMBEDDED 361#endif //KAB_EMBEDDED
362 QDict<AddresseeEditorDialog> mEditorDict; 362 // QDict<AddresseeEditorDialog> mEditorDict;
363 363 AddresseeEditorDialog *mEditorDialog;
364 bool mReadWrite; 364 bool mReadWrite;
365 bool mModified; 365 bool mModified;
366 bool mIsPart; 366 bool mIsPart;
367 367
368 //US file menu 368 //US file menu
369 KAction *mActionMail; 369 KAction *mActionMail;
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index 2ea2053..c953058 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -74,12 +74,19 @@ void KDialogBase::init( const QString &caption, int buttonMask,
74 if ( buttonMask & Ok ) { 74 if ( buttonMask & Ok ) {
75 mOkButton = new QPushButton( i18n("Ok"), this ); 75 mOkButton = new QPushButton( i18n("Ok"), this );
76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); 76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) );
77 } else { 77 } else {
78 mOkButton = 0; 78 mOkButton = 0;
79 } 79 }
80 if ( buttonMask & Default ) {
81 qDebug("buttonMask & Default ");
82 mDefaultButton = new QPushButton( i18n("Default"), this );
83 connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) );
84 } else {
85 mDefaultButton = 0;
86 }
80 87
81 if ( buttonMask & Apply ) { 88 if ( buttonMask & Apply ) {
82 mApplyButton = new QPushButton( i18n("Apply"), this ); 89 mApplyButton = new QPushButton( i18n("Apply"), this );
83 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); 90 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) );
84 } else { 91 } else {
85 mApplyButton = 0; 92 mApplyButton = 0;
@@ -112,12 +119,13 @@ QTabWidget *KDialogBase::tabWidget()
112void KDialogBase::hideButtons() 119void KDialogBase::hideButtons()
113{ 120{
114 if ( mUser1Button ) mUser1Button->hide() ; 121 if ( mUser1Button ) mUser1Button->hide() ;
115 if ( mUser2Button ) mUser2Button->hide() ; 122 if ( mUser2Button ) mUser2Button->hide() ;
116 if ( mOkButton ) mOkButton->hide() ; 123 if ( mOkButton ) mOkButton->hide() ;
117 if ( mApplyButton ) mApplyButton->hide() ; 124 if ( mApplyButton ) mApplyButton->hide() ;
125 if ( mDefaultButton ) mDefaultButton->hide();
118 if ( mCancelButton ) mCancelButton->hide() ; 126 if ( mCancelButton ) mCancelButton->hide() ;
119 if ( mCloseButton ) mCloseButton->hide() ; 127 if ( mCloseButton ) mCloseButton->hide() ;
120 128
121} 129}
122void KDialogBase::initLayout() 130void KDialogBase::initLayout()
123{ 131{
@@ -133,12 +141,13 @@ void KDialogBase::initLayout()
133 mTopLayout->addLayout( buttonLayout ); 141 mTopLayout->addLayout( buttonLayout );
134 142
135 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); 143 if ( mUser1Button ) buttonLayout->addWidget( mUser1Button );
136 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); 144 if ( mUser2Button ) buttonLayout->addWidget( mUser2Button );
137 if ( mOkButton ) buttonLayout->addWidget( mOkButton ); 145 if ( mOkButton ) buttonLayout->addWidget( mOkButton );
138 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); 146 if ( mApplyButton ) buttonLayout->addWidget( mApplyButton );
147 if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton );
139 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); 148 if ( mCancelButton ) buttonLayout->addWidget( mCancelButton );
140 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); 149 if ( mCloseButton ) buttonLayout->addWidget( mCloseButton );
141} 150}
142 151
143QFrame *KDialogBase::addPage( const QString &name ) 152QFrame *KDialogBase::addPage( const QString &name )
144{ 153{
@@ -194,12 +203,15 @@ QPushButton *KDialogBase::findButton( ButtonCode id )
194 case User2: 203 case User2:
195 button = mUser2Button; 204 button = mUser2Button;
196 break; 205 break;
197 case Cancel: 206 case Cancel:
198 button = mCancelButton; 207 button = mCancelButton;
199 break; 208 break;
209 case Default:
210 button = mDefaultButton;
211 break;
200 case Close: 212 case Close:
201 button = mCloseButton; 213 button = mCloseButton;
202 break; 214 break;
203 default: 215 default:
204 break; 216 break;
205 } 217 }
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h
index 199d2fa..7b44bfb 100644
--- a/microkde/kdialogbase.h
+++ b/microkde/kdialogbase.h
@@ -102,12 +102,13 @@ class KDialogBase : public KDialog
102 102
103 /** 103 /**
104 * The Close button was pressed. This signal is only emitted if 104 * The Close button was pressed. This signal is only emitted if
105 * @ref slotClose() is not replaced. 105 * @ref slotClose() is not replaced.
106 */ 106 */
107 void closeClicked(); 107 void closeClicked();
108 void defaultClicked();
108 109
109 protected slots: 110 protected slots:
110 virtual void slotOk(); 111 virtual void slotOk();
111 virtual void slotApply(); 112 virtual void slotApply();
112 virtual void slotCancel(); 113 virtual void slotCancel();
113 virtual void slotClose(); 114 virtual void slotClose();
@@ -131,9 +132,10 @@ class KDialogBase : public KDialog
131 QPushButton *mUser1Button; 132 QPushButton *mUser1Button;
132 QPushButton *mUser2Button; 133 QPushButton *mUser2Button;
133 QPushButton *mCloseButton; 134 QPushButton *mCloseButton;
134 QPushButton *mOkButton; 135 QPushButton *mOkButton;
135 QPushButton *mApplyButton; 136 QPushButton *mApplyButton;
136 QPushButton *mCancelButton; 137 QPushButton *mCancelButton;
138 QPushButton *mDefaultButton;
137}; 139};
138 140
139#endif 141#endif