Fixed button related SEGV.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit d46e0e623a)
r14.0.x r14.0.13
Michele Calgaro 2 years ago
parent 1e75fe9320
commit 5d0bb57513
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -259,8 +259,8 @@ void MachBunt::createButtons()
{ {
if ( !button[BtnMenu] ) if ( !button[BtnMenu] )
button[BtnMenu] = new MachBuntButton(this, "menu", BtnMenu, text_img[0][smallButtons], text_img[1][smallButtons], smallButtons, i18n("Menu")); button[BtnMenu] = new MachBuntButton(this, "menu", BtnMenu, text_img[0][smallButtons], text_img[1][smallButtons], smallButtons, i18n("Menu"));
// if ( !button[BtnSticky] ) //if ( !button[BtnSticky] )
// button[BtnSticky] = new MachBuntButton(this, "sticky", BtnSticky, middle_img[0][smallButtons], middle_img[1][smallButtons], smallButtons, i18n("Sticky")); // button[BtnSticky] = new MachBuntButton(this, "sticky", BtnSticky, middle_img[0][smallButtons], middle_img[1][smallButtons], smallButtons, i18n("Sticky"));
if ( !button[BtnHelp] ) if ( !button[BtnHelp] )
button[BtnHelp]= new MachBuntButton(this, "help", BtnHelp, middle_img[0][smallButtons], middle_img[1][smallButtons], smallButtons, i18n("Help")); button[BtnHelp]= new MachBuntButton(this, "help", BtnHelp, middle_img[0][smallButtons], middle_img[1][smallButtons], smallButtons, i18n("Help"));
if ( !button[BtnIconify] ) if ( !button[BtnIconify] )
@ -314,9 +314,9 @@ int MachBunt::mapButton( const TQChar &c)
switch (c.latin1()) switch (c.latin1())
{ {
case 'M': case 'M':
return BtnMenu; return BtnMenu;
case 'S': //case 'S':
return BtnSticky; // return BtnSticky;
case 'H': // Help case 'H': // Help
return BtnHelp; return BtnHelp;
case 'I': // Minimize case 'I': // Minimize
@ -336,21 +336,21 @@ void MachBunt::doLayout()
delete windowLayout; delete windowLayout;
windowLayout = new TQVBoxLayout(widget(), 0, 0); windowLayout = new TQVBoxLayout(widget(), 0, 0);
titlebar = new TQSpacerItem ( 0, titleHeight, TQSizePolicy::Expanding, titlebar = new TQSpacerItem ( 0, titleHeight, TQSizePolicy::Expanding, TQSizePolicy::Fixed);
TQSizePolicy::Fixed);
TQBoxLayout *topLayout = new TQBoxLayout(windowLayout, TQBoxLayout::LeftToRight, 0, 0); TQBoxLayout *topLayout = new TQBoxLayout(windowLayout, TQBoxLayout::LeftToRight, 0, 0);
TQString leftButtons(options()->customButtonPositions() ? options()->titleButtonsLeft() : "M"); TQString leftButtons(options()->customButtonPositions() ? options()->titleButtonsLeft() : "M");
TQString rightButtons(options()->customButtonPositions() ? options()->titleButtonsRight() : "HIAX"); TQString rightButtons(options()->customButtonPositions() ? options()->titleButtonsRight() : "HIAX");
bool first_left = true; bool first_left = true;
for ( unsigned int i = 0; i <options()->titleButtonsLeft().length(); i++) for ( unsigned int i = 0; i < leftButtons.length(); i++)
{ {
int b = mapButton(leftButtons[i]); int b = mapButton(leftButtons[i]);
if ( b>=0 ){ if (b >= 0)
{
topLayout->addWidget(button[b], TQt::AlignVCenter); topLayout->addWidget(button[b], TQt::AlignVCenter);
topLayout->setStretchFactor(button[b], 0); topLayout->setStretchFactor(button[b], 0);
button[b]->setFixedSize(titleHeight, titleHeight); button[b]->setFixedSize(titleHeight, titleHeight);
if( first_left ) if( first_left )
{ {
first_left = false; first_left = false;
@ -362,7 +362,7 @@ void MachBunt::doLayout()
topLayout->addItem(titlebar); topLayout->addItem(titlebar);
MachBuntButton* last_right = NULL; MachBuntButton* last_right = NULL;
for ( unsigned int i = 0; i <options()->titleButtonsRight().length(); i++) for ( unsigned int i = 0; i < rightButtons.length(); i++)
{ {
int b = mapButton(rightButtons[i]); int b = mapButton(rightButtons[i]);
if ( b>=0 ){ if ( b>=0 ){
@ -378,7 +378,7 @@ void MachBunt::doLayout()
TQHBoxLayout * midLayout = new TQHBoxLayout(windowLayout, 0, 0); TQHBoxLayout * midLayout = new TQHBoxLayout(windowLayout, 0, 0);
midLayout->addSpacing(BORDER_LEFT); midLayout->addSpacing(BORDER_LEFT);
if( isPreview()) if( isPreview())
midLayout->addWidget(new TQLabel( i18n( "<center><b>MachBunt</b></center>" ), widget())); midLayout->addWidget(new TQLabel( i18n( "<center><b>MachBunt</b></center>" ), widget()));
else else
midLayout->addItem( new TQSpacerItem( 0, 0 )); // no widget in the middle midLayout->addItem( new TQSpacerItem( 0, 0 )); // no widget in the middle
midLayout->addSpacing(BORDER_RIGHT); midLayout->addSpacing(BORDER_RIGHT);

Loading…
Cancel
Save