-rw-r--r-- | microkde/kdialogbase.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 801094a..f453331 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -1,127 +1,129 @@ | |||
1 | #include <qtabwidget.h> | 1 | #include <qtabwidget.h> |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qframe.h> | 4 | #include <qframe.h> |
5 | 5 | ||
6 | 6 | ||
7 | #include "klocale.h" | 7 | #include "klocale.h" |
8 | #include "kdebug.h" | 8 | #include "kdebug.h" |
9 | 9 | ||
10 | #include "kdialogbase.h" | 10 | #include "kdialogbase.h" |
11 | 11 | ||
12 | KDialogBase::KDialogBase() | 12 | KDialogBase::KDialogBase() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, | 16 | KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, |
17 | const QString &caption, | 17 | const QString &caption, |
18 | int buttonMask, ButtonCode defaultButton, | 18 | int buttonMask, ButtonCode defaultButton, |
19 | bool separator, | 19 | bool separator, |
20 | const QString &user1, | 20 | const QString &user1, |
21 | const QString &user2, | 21 | const QString &user2, |
22 | const QString &user3) : | 22 | const QString &user3) : |
23 | KDialog( parent, name, modal ) | 23 | KDialog( parent, name, modal ) |
24 | { | 24 | { |
25 | init( caption, buttonMask, user1, user2 ); | 25 | init( caption, buttonMask, user1, user2 ); |
26 | if (findButton( defaultButton ) ) { | 26 | if (findButton( defaultButton ) ) { |
27 | (findButton( defaultButton ) )->setFocus(); | 27 | (findButton( defaultButton ) )->setFocus(); |
28 | (findButton( defaultButton ) )->setDefault( true ); | 28 | (findButton( defaultButton ) )->setDefault( true ); |
29 | } | 29 | } |
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | KDialogBase::KDialogBase( int dialogFace, const QString &caption, | 33 | KDialogBase::KDialogBase( int dialogFace, const QString &caption, |
34 | int buttonMask, ButtonCode defaultButton, | 34 | int buttonMask, ButtonCode defaultButton, |
35 | QWidget *parent, const char *name, bool modal, | 35 | QWidget *parent, const char *name, bool modal, |
36 | bool separator, | 36 | bool separator, |
37 | const QString &user1, | 37 | const QString &user1, |
38 | const QString &user2, | 38 | const QString &user2, |
39 | const QString &user3) : | 39 | const QString &user3) : |
40 | KDialog( parent, name, modal ) | 40 | KDialog( parent, name, modal ) |
41 | { | 41 | { |
42 | init( caption, buttonMask, user1, user2 ); | 42 | init( caption, buttonMask, user1, user2 ); |
43 | if (findButton( defaultButton ) ) | 43 | if (findButton( defaultButton ) ) { |
44 | (findButton( defaultButton ) )->setFocus(); | 44 | (findButton( defaultButton ) )->setFocus(); |
45 | (findButton( defaultButton ) )->setDefault( true ); | ||
46 | } | ||
45 | 47 | ||
46 | } | 48 | } |
47 | 49 | ||
48 | KDialogBase::~KDialogBase() | 50 | KDialogBase::~KDialogBase() |
49 | { | 51 | { |
50 | } | 52 | } |
51 | 53 | ||
52 | void KDialogBase::init( const QString &caption, int buttonMask, | 54 | void KDialogBase::init( const QString &caption, int buttonMask, |
53 | const QString &user1 ,const QString &user2 ) | 55 | const QString &user1 ,const QString &user2 ) |
54 | { | 56 | { |
55 | mMainWidget = 0; | 57 | mMainWidget = 0; |
56 | mTabWidget = 0; | 58 | mTabWidget = 0; |
57 | mPlainPage = 0; | 59 | mPlainPage = 0; |
58 | mTopLayout = 0; | 60 | mTopLayout = 0; |
59 | if ( !caption.isEmpty() ) { | 61 | if ( !caption.isEmpty() ) { |
60 | setCaption( caption ); | 62 | setCaption( caption ); |
61 | } | 63 | } |
62 | 64 | ||
63 | if ( buttonMask & User1 ) { | 65 | if ( buttonMask & User1 ) { |
64 | mUser1Button = new QPushButton( user1, this ); | 66 | mUser1Button = new QPushButton( user1, this ); |
65 | connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); | 67 | connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); |
66 | } else { | 68 | } else { |
67 | mUser1Button = 0; | 69 | mUser1Button = 0; |
68 | } | 70 | } |
69 | if ( buttonMask & User2 ) { | 71 | if ( buttonMask & User2 ) { |
70 | mUser2Button = new QPushButton( user2, this ); | 72 | mUser2Button = new QPushButton( user2, this ); |
71 | connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); | 73 | connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); |
72 | } else { | 74 | } else { |
73 | mUser2Button = 0; | 75 | mUser2Button = 0; |
74 | } | 76 | } |
75 | 77 | ||
76 | if ( buttonMask & Ok ) { | 78 | if ( buttonMask & Ok ) { |
77 | mOkButton = new QPushButton( i18n("Ok"), this ); | 79 | mOkButton = new QPushButton( i18n("Ok"), this ); |
78 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); | 80 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); |
79 | mOkButton->setDefault( true ); | 81 | //mOkButton->setDefault( true ); |
80 | } else { | 82 | } else { |
81 | mOkButton = 0; | 83 | mOkButton = 0; |
82 | } | 84 | } |
83 | if ( buttonMask & Default ) { | 85 | if ( buttonMask & Default ) { |
84 | mDefaultButton = new QPushButton( i18n("Default"), this ); | 86 | mDefaultButton = new QPushButton( i18n("Default"), this ); |
85 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); | 87 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); |
86 | } else { | 88 | } else { |
87 | mDefaultButton = 0; | 89 | mDefaultButton = 0; |
88 | } | 90 | } |
89 | 91 | ||
90 | if ( buttonMask & Apply ) { | 92 | if ( buttonMask & Apply ) { |
91 | mApplyButton = new QPushButton( i18n("Apply"), this ); | 93 | mApplyButton = new QPushButton( i18n("Apply"), this ); |
92 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); | 94 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); |
93 | } else { | 95 | } else { |
94 | mApplyButton = 0; | 96 | mApplyButton = 0; |
95 | } | 97 | } |
96 | 98 | ||
97 | if ( buttonMask & Cancel ) { | 99 | if ( buttonMask & Cancel ) { |
98 | mCancelButton = new QPushButton( i18n("Cancel"), this ); | 100 | mCancelButton = new QPushButton( i18n("Cancel"), this ); |
99 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); | 101 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); |
100 | } else { | 102 | } else { |
101 | mCancelButton = 0; | 103 | mCancelButton = 0; |
102 | } | 104 | } |
103 | 105 | ||
104 | if ( buttonMask & Close ) { | 106 | if ( buttonMask & Close ) { |
105 | mCloseButton = new QPushButton( i18n("Close"), this ); | 107 | mCloseButton = new QPushButton( i18n("Close"), this ); |
106 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); | 108 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); |
107 | } else { | 109 | } else { |
108 | mCloseButton = 0; | 110 | mCloseButton = 0; |
109 | } | 111 | } |
110 | } | 112 | } |
111 | 113 | ||
112 | QTabWidget *KDialogBase::tabWidget() | 114 | QTabWidget *KDialogBase::tabWidget() |
113 | { | 115 | { |
114 | if ( !mTabWidget ) { | 116 | if ( !mTabWidget ) { |
115 | mTabWidget = new QTabWidget( this ); | 117 | mTabWidget = new QTabWidget( this ); |
116 | setMainWidget( mTabWidget ); | 118 | setMainWidget( mTabWidget ); |
117 | } | 119 | } |
118 | return mTabWidget; | 120 | return mTabWidget; |
119 | } | 121 | } |
120 | 122 | ||
121 | void KDialogBase::hideButtons() | 123 | void KDialogBase::hideButtons() |
122 | { | 124 | { |
123 | if ( mUser1Button ) mUser1Button->hide() ; | 125 | if ( mUser1Button ) mUser1Button->hide() ; |
124 | if ( mUser2Button ) mUser2Button->hide() ; | 126 | if ( mUser2Button ) mUser2Button->hide() ; |
125 | if ( mOkButton ) mOkButton->hide() ; | 127 | if ( mOkButton ) mOkButton->hide() ; |
126 | if ( mApplyButton ) mApplyButton->hide() ; | 128 | if ( mApplyButton ) mApplyButton->hide() ; |
127 | if ( mDefaultButton ) mDefaultButton->hide(); | 129 | if ( mDefaultButton ) mDefaultButton->hide(); |