24 #include "kdialogbase.h" 30 #include <tqtooltip.h> 32 #include <tqwhatsthis.h> 34 #include <tqfocusdata.h> 36 #include <tdeapplication.h> 38 #include <tdeconfig.h> 39 #include <kiconloader.h> 40 #include <tdeglobal.h> 41 #include <tdeglobalsettings.h> 42 #include <kseparator.h> 43 #include <kurllabel.h> 46 #include "kdialogbase_priv.h" 47 #include "kdialogbase_priv.moc" 51 int KDialogBaseButton::id()
56 template class TQPtrList<KDialogBaseButton>;
63 struct SButton :
public TQt
74 void resize(
bool sameWidth,
int margin,
int spacing,
int orientation );
81 TQPtrList<KDialogBaseButton> list;
85 class KDialogBase::KDialogBasePrivate {
87 KDialogBasePrivate() : bDetails(false), bFixed(false), bSettingDetails(false), detailsWidget(0) { }
92 TQWidget *detailsWidget;
95 TQString detailsButton;
100 const TQString &caption,
int buttonMask,
104 :
KDialog( parent, name, modal, (WFlags)WStyle_DialogBorder ),
105 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
106 mIsActivated(false), mShowTile(false), mMessageBoxMode(false),
107 mButtonOrientation(Qt::Horizontal), d(new KDialogBasePrivate)
115 makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
123 TQWidget *parent,
const char *name,
bool modal,
124 bool separator,
const KGuiItem &user1,
126 :
KDialog( parent, name, modal, (WFlags)WStyle_DialogBorder ),
127 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
128 mIsActivated(false), mShowTile(false), mMessageBoxMode(false),
129 mButtonOrientation(Qt::Horizontal), d(new KDialogBasePrivate)
140 if( !mJanus || !mJanus->
isValid() ) {
return; }
143 makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
151 const TQString &caption,
int buttonMask,
155 :
KDialog( parent, name, modal, f ),
156 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
157 mIsActivated(false), mShowTile(false), mMessageBoxMode(false),
158 mButtonOrientation(Qt::Horizontal), d(new KDialogBasePrivate)
169 if( !mJanus || !mJanus->
isValid() ) {
return; }
172 makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
180 TQWidget *parent,
const char *name,
bool modal,
181 bool separator,
const KGuiItem &yes,
183 :
KDialog( parent, name, modal, (WFlags)WStyle_DialogBorder ),
184 mTopLayout(0), mMainWidget(0), mUrlHelp(0), mJanus(0), mActionSep(0),
185 mIsActivated(false), mShowTile(false), mMessageBoxMode(true),
186 mButtonOrientation(Qt::Horizontal),mEscapeButton(escapeButton),
187 d(new KDialogBasePrivate)
198 makeButtonBox( buttonMask, defaultButton,
199 no.text().isEmpty() ? KStdGuiItem::no() : no,
200 yes.text().isEmpty() ? KStdGuiItem::yes() : yes );
203 KStdGuiItem::cancel() :
cancel );
223 void SButton::resize(
bool sameWidth,
int margin,
224 int spacing,
int orientation )
231 for( p = list.first(); p; p = list.next() )
233 const TQSize s( p->sizeHint() );
234 if( s.height() > h ) { h = s.height(); }
235 if( s.width() > w ) { w = s.width(); }
238 if( orientation == Qt::Horizontal )
240 for( p = list.first(); p; p = list.next() )
242 TQSize s( p->sizeHint() );
243 if( sameWidth ) { s.setWidth( w ); }
244 p->setFixedWidth( s.width() );
245 t += s.width() + spacing;
248 box->setMinimumHeight( margin*2 + h );
249 box->setMinimumWidth( margin*2 + t - spacing );
254 for( p = list.first(); p; p = list.next() )
256 TQSize s( p->sizeHint() );
258 p->setFixedSize( s );
259 t += s.height() + spacing;
261 box->setMinimumHeight( margin*2 + t - spacing );
262 box->setMinimumWidth( margin*2 + w );
269 for( p = list.first(); p; p = list.next() )
293 void KDialogBase::setupLayout()
302 if( mButtonOrientation == Qt::Horizontal )
304 mTopLayout =
new TQBoxLayout(
this, TQBoxLayout::TopToBottom,
309 mTopLayout =
new TQBoxLayout(
this, TQBoxLayout::LeftToRight,
315 mTopLayout->addWidget( mUrlHelp, 0, AlignRight );
320 mTopLayout->addWidget( mJanus, 10 );
322 else if( mMainWidget )
324 mTopLayout->addWidget( mMainWidget, 10 );
327 if ( d->detailsWidget )
329 mTopLayout->addWidget( d->detailsWidget );
334 mTopLayout->addWidget( mActionSep );
339 mTopLayout->addWidget( d->mButton.box );
347 if( mButtonOrientation != orientation )
349 mButtonOrientation = orientation;
352 mActionSep->
setOrientation( mButtonOrientation == Qt::Horizontal ?
353 TQFrame::HLine : TQFrame::VLine );
355 if( mButtonOrientation == Qt::Vertical )
360 setButtonStyle( d->mButton.style );
372 void KDialogBase::makeRelay()
376 connect( mTile, TQT_SIGNAL(pixmapChanged()), TQT_SLOT(
updateBackground()) );
383 connect( mTile, TQT_SIGNAL(pixmapChanged()), TQT_SLOT(
updateBackground()) );
384 connect( tqApp, TQT_SIGNAL(aboutToQuit()), mTile, TQT_SLOT(cleanup()) );
398 mActionSep->setFocusPolicy(TQWidget::NoFocus);
399 mActionSep->
setOrientation( mButtonOrientation == Qt::Horizontal ?
400 TQFrame::HLine : TQFrame::VLine );
409 delete mActionSep; mActionSep = 0;
422 return ( mJanus ? mJanus->
plainPage() : 0 );
432 setFixedSize( sizeHint() );
434 resize( sizeHint() );
437 TQSize KDialogBase::sizeHint()
const 439 return d->minSize.expandedTo( minimumSizeHint() ) + d->incSize;
442 TQSize KDialogBase::minimumSizeHint()
const 447 const TQSize zeroByS(0, s);
457 s2 = mUrlHelp->minimumSize() + zeroByS;
459 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
460 s1.rheight() += s2.rheight();
469 else if( mMainWidget )
471 s2 = mMainWidget->sizeHint() + zeroByS;
472 s2 = s2.expandedTo( mMainWidget->minimumSize() );
473 s2 = s2.expandedTo( mMainWidget->minimumSizeHint() );
476 s2 = TQSize( 100, 100+s );
481 s2 = TQSize( 100, 100+s );
483 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
484 s1.rheight() += s2.rheight();
486 if (d->detailsWidget && d->bDetails)
488 s2 = d->detailsWidget->sizeHint() + zeroByS;
489 s2 = s2.expandedTo( d->detailsWidget->minimumSize() );
490 s2 = s2.expandedTo( d->detailsWidget->minimumSizeHint() );
491 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
492 s1.rheight() += s2.rheight();
500 s1.rheight() += mActionSep->minimumSize().height() + s;
508 s2 = d->mButton.box->minimumSize();
509 if( mButtonOrientation == Qt::Horizontal )
511 s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
512 s1.rheight() += s2.rheight();
516 s1.rwidth() += s2.rwidth();
517 s1.rheight() = TQMAX( s1.rheight(), s2.rheight() );
533 setFixedSize( sizeHint() );
540 d->bFixed = noResize;
548 d->bFixed = noResize;
553 void KDialogBase::makeButtonBox(
int buttonMask,
ButtonCode defaultButton,
557 if( buttonMask == 0 )
563 if( buttonMask &
Cancel ) { buttonMask &= ~
Close; }
564 if( buttonMask &
Apply ) { buttonMask &= ~
Try; }
567 if( !mMessageBoxMode )
569 mEscapeButton = (buttonMask&
Cancel) ? Cancel :
Close;
572 d->mButton.box =
new TQWidget(
this );
574 d->mButton.mask = buttonMask;
575 if( d->mButton.mask &
Help )
579 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotHelp()) );
581 if( d->mButton.mask &
Default )
585 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotDefault()) );
587 if( d->mButton.mask & Details )
589 KPushButton *pb = d->mButton.append( Details, TQString() );
590 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotDetails()) );
593 if( d->mButton.mask &
User3 )
596 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotUser3()) );
598 if( d->mButton.mask &
User2 )
601 if( mMessageBoxMode )
603 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotYes()) );
607 connect( pb, TQT_SIGNAL(clicked()),
this, TQT_SLOT(
slotUser2()) );
610 if( d->mButton.mask &
User1 )
613 if( mMessageBoxMode )
615 connect( pb, TQT_SIGNAL(clicked()),
this, TQT_SLOT(
slotNo()) );
619 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotUser1()) );
622 if( d->mButton.mask &
Ok )
624 KPushButton *pb = d->mButton.append(
Ok, KStdGuiItem::ok() );
625 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotOk()) );
627 if( d->mButton.mask & Apply )
629 KPushButton *pb = d->mButton.append( Apply, KStdGuiItem::apply() );
630 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotApply()) );
631 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
applyPressed()) );
633 if( d->mButton.mask &
Try )
637 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotTry()) );
639 if( d->mButton.mask & Cancel )
641 KPushButton *pb = d->mButton.append( Cancel, KStdGuiItem::cancel() );
642 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotCancel()) );
644 if( d->mButton.mask &
Close )
647 connect( pb, TQT_SIGNAL(clicked()), TQT_SLOT(
slotClose()) );
655 setButtonFocus( pb,
true,
false );
664 void KDialogBase::setButtonStyle(
int style )
666 if( !d->mButton.box )
671 if( style < 0 || style >= ActionStyleMAX ) { style = ActionStyle0; }
672 d->mButton.style = style;
674 const unsigned int *layout;
678 static const unsigned int layoutRule[5][6] =
687 layout = layoutRule[ d->mButton.style ];
689 else if (mButtonOrientation == Qt::Horizontal)
691 static const unsigned int layoutRule[5][10] =
693 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Ok,
Apply|
Try,
Cancel|
Close},
694 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Cancel|
Close,
Apply|
Try,
Ok},
695 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Apply|
Try,
Cancel|
Close,Ok},
696 {
Ok,
Apply|
Try,
Cancel|
Close,
User3,
User2,
User1,
Stretch,
Default,
Help,
Details},
700 layout = layoutRule[ d->mButton.style ];
704 static const unsigned int layoutRule[5][10] =
706 {
Ok,
Apply|
Try,
User1,
User2,
User3,
Stretch,
Default,
Cancel|
Close,
Help,
Details},
708 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Cancel|
Close,
Apply|
Try,
Ok},
709 {
Details,
Help,
Default,
Stretch,
User3,
User2,
User1,
Apply|
Try,
Cancel|
Close,Ok},
710 {
Ok,
Apply|
Try,
Cancel|
Close,
User3,
User2,
User1,
Stretch,
Default,
Help,Details},
714 layout = layoutRule[ d->mButton.style ];
717 if( d->mButton.box->layout() )
719 delete d->mButton.box->layout();
723 if( mButtonOrientation == Qt::Horizontal )
725 lay =
new TQBoxLayout( d->mButton.box, TQBoxLayout::LeftToRight, 0,
730 lay =
new TQBoxLayout( d->mButton.box, TQBoxLayout::TopToBottom, 0,
735 TQPushButton *prevButton = 0;
736 TQPushButton *newButton;
738 for(
int i=0; i<layoutMax; ++i )
745 else if (layout[i] &
Filler)
747 if (d->mButton.mask & layout[i])
751 lay->addSpacing(newButton->sizeHint().width());
755 else if( d->mButton.mask &
Help & layout[i] )
758 lay->addWidget( newButton ); ++numButton;
760 else if( d->mButton.mask &
Default & layout[i] )
763 lay->addWidget( newButton ); ++numButton;
765 else if( d->mButton.mask &
User3 & layout[i] )
768 lay->addWidget( newButton ); ++numButton;
770 else if( d->mButton.mask &
User2 & layout[i] )
773 lay->addWidget( newButton ); ++numButton;
775 else if( d->mButton.mask &
User1 & layout[i] )
778 lay->addWidget( newButton ); ++numButton;
780 else if( d->mButton.mask &
Ok & layout[i] )
783 lay->addWidget( newButton ); ++numButton;
785 else if( d->mButton.mask &
Apply & layout[i] )
788 lay->addWidget( newButton ); ++numButton;
790 else if( d->mButton.mask &
Try & layout[i] )
793 lay->addWidget( newButton ); ++numButton;
795 else if( d->mButton.mask &
Cancel & layout[i] )
798 lay->addWidget( newButton ); ++numButton;
800 else if( d->mButton.mask &
Close & layout[i] )
803 lay->addWidget( newButton ); ++numButton;
805 else if( d->mButton.mask &
Details & layout[i] )
808 lay->addWidget( newButton ); ++numButton;
823 setTabOrder( prevButton, newButton );
825 prevButton = newButton;
828 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
834 return d->mButton.button(
id);
843 pb->setEnabled( state );
871 state ? pb->show() : pb->hide();
895 const TQString &tooltip,
896 const TQString &quickhelp )
904 const TQString whatsThis = i18n(
"" 905 "If you press the <b>OK</b> button, all changes\n" 906 "you made will be used to proceed.");
908 pb->setText( text.isEmpty() ? i18n(
"&OK") : text );
909 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
911 TQToolTip::add( pb, tooltip.isEmpty() ? i18n(
"Accept settings") : tooltip );
912 TQWhatsThis::add( pb, quickhelp.isEmpty() ? whatsThis : quickhelp );
923 const TQString &tooltip,
924 const TQString &quickhelp )
932 const TQString whatsThis = i18n(
"" 933 "When clicking <b>Apply</b>, the settings will be\n" 934 "handed over to the program, but the dialog\n" 935 "will not be closed. " 936 "Use this to try different settings. ");
938 pb->setText( text.isEmpty() ? i18n(
"&Apply") : text );
939 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
941 TQToolTip::add( pb, tooltip.isEmpty() ? i18n(
"Apply settings") : tooltip );
942 TQWhatsThis::add( pb, quickhelp.isEmpty() ? whatsThis : quickhelp );
953 const TQString& tooltip,
954 const TQString& quickhelp )
962 pb->setText( text.isEmpty() ? i18n(
"&Cancel") : text );
963 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
965 TQToolTip::add( pb, tooltip );
966 TQWhatsThis::add( pb, quickhelp );
982 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
988 if (!d->bSettingDetails && (
id ==
Details))
990 d->detailsButton = text;
998 d->mButton.resize(
false, 0,
spacingHint(), mButtonOrientation );
1009 TQToolTip::remove( pb );
1011 TQToolTip::add( pb, text );
1022 TQWhatsThis::remove( pb );
1024 TQWhatsThis::add( pb, text );
1029 void KDialogBase::setButtonFocus( TQPushButton *p,
bool isDefault,
bool isFocus )
1031 p->setDefault( isDefault );
1098 kapp->invokeHelp( mAnchor, mHelpApp );
1114 delete d->detailsWidget;
1115 d->detailsWidget = detailsWidget;
1116 if (d->detailsWidget->parentWidget() !=
this)
1117 d->detailsWidget->reparent(
this, TQPoint(0,0));
1118 d->detailsWidget->hide();
1123 if (!d->bSettingDetails)
1129 if (d->detailsButton.isEmpty())
1130 d->detailsButton = i18n(
"&Details");
1131 d->bSettingDetails =
true;
1132 d->bDetails = showDetails;
1137 if (d->detailsWidget)
1140 layout()->setEnabled(
false);
1142 d->detailsWidget->show();
1145 layout()->activate();
1146 layout()->setEnabled(
true);
1153 if (d->detailsWidget)
1155 d->detailsWidget->hide();
1158 layout()->activate();
1161 d->bSettingDetails =
false;
1218 done( mMessageBoxMode ? (
int)
Cancel : (
int)Rejected );
1250 mUrlHelp =
new KURLLabel(
this,
"url" );
1254 if( mShowTile && mTile->get() )
1256 mUrlHelp->setBackgroundPixmap(*mTile->get());
1258 mUrlHelp->setMinimumHeight( fontMetrics().height() +
marginHint() );
1259 connect(mUrlHelp,TQT_SIGNAL(leftClickedURL(
const TQString &)),
1269 delete mUrlHelp; mUrlHelp = 0;
1288 mHelpLinkText = text;
1297 const TQPixmap &pixmap )
1299 return ( mJanus ? mJanus->
addPage( itemName, header, pixmap ) : 0);
1303 const TQPixmap &pixmap )
1305 return ( mJanus ? mJanus->
addPage( items, header, pixmap ) : 0);
1310 const TQString &header,
const TQPixmap &pixmap )
1312 return ( mJanus ? mJanus->
addVBoxPage( itemName, header, pixmap) : 0);
1316 const TQString &header,
const TQPixmap &pixmap )
1318 return ( mJanus ? mJanus->
addVBoxPage( items, header, pixmap) : 0);
1323 const TQString &header,
1324 const TQPixmap &pixmap )
1326 return ( mJanus ? mJanus->
addHBoxPage( itemName, header, pixmap ) : 0);
1330 const TQString &header,
1331 const TQPixmap &pixmap )
1333 return ( mJanus ? mJanus->
addHBoxPage( items, header, pixmap ) : 0);
1338 const TQString &itemName,
1339 const TQString &header,
const TQPixmap &pixmap )
1341 return ( mJanus ? mJanus->
addGridPage( n, dir, itemName, header, pixmap) : 0);
1345 const TQStringList &items,
1346 const TQString &header,
const TQPixmap &pixmap )
1348 return ( mJanus ? mJanus->
addGridPage( n, dir, items, header, pixmap) : 0);
1361 if( mJanus || mMainWidget )
1363 printMakeMainWidgetError();
1375 if( mJanus || mMainWidget )
1377 printMakeMainWidgetError();
1390 if( mJanus || mMainWidget )
1392 printMakeMainWidgetError();
1405 if( mJanus || mMainWidget )
1407 printMakeMainWidgetError();
1411 TQGrid *
mainWidget =
new TQGrid( n, dir,
this );
1418 void KDialogBase::printMakeMainWidgetError()
1422 kdDebug() <<
"makeMainWidget: Illegal mode (wrong constructor)" <<
endl;
1424 else if( mMainWidget )
1426 kdDebug() <<
"makeMainWidget: Main widget already defined" <<
endl;
1437 mMainWidget = widget;
1442 mMainWidget = widget;
1448 if( mMainWidget != NULL )
1450 TQFocusData* fd = focusData();
1451 TQWidget* prev = fd->last();
1452 for( TQPtrListIterator<KDialogBaseButton> it( d->mButton.list );
1457 setTabOrder( prev, *it );
1472 return ( mJanus ? mJanus->
showPage(index) :
false);
1484 return ( mJanus ? mJanus->
pageIndex( widget) : -1);
1493 r.setTop(
marginHint() + (mUrlHelp ? mUrlHelp->height() : 0) );
1495 int h = (!mActionSep ? 0 : mActionSep->minimumSize().height()+
marginHint());
1496 if( d->mButton.box )
1498 r.setBottom( height() - d->mButton.box->minimumSize().height() - h );
1502 r.setBottom( height() - h );
1516 uly += mUrlHelp->minimumSize().height();
1520 lry = d->mButton.box ? d->mButton.box->minimumSize().height() : 0;
1523 lry += mActionSep->minimumSize().height() +
marginHint();
1530 int ulx, uly, lrx, lry;
1532 return TQSize(ulx+w+lrx,uly+h+lry);
1538 return ( mHelpLinkText.isNull() ? i18n(
"Get help...") : mHelpLinkText );
1559 if( e->state() == 0 )
1561 if( e->key() == Key_F1 )
1571 if( e->key() == Key_Escape )
1583 else if( e->key() == Key_F1 && e->state() == ShiftButton )
1585 TQWhatsThis::enterWhatsThisMode();
1591 else if ( e->state() == ControlButton &&
1592 (e->key() == Key_Return || e->key() == Key_Enter) )
1606 TQDialog::keyPressEvent(e);
1614 if (!ev->spontaneous())
1625 if( pb && isShown() ) {
1628 TQDialog::closeEvent( e );
1634 switch ( mEscapeButton ) {
1639 if ( mMessageBoxMode )
1645 if ( mMessageBoxMode )
1664 return ( !mTile || mTile->get() );
1672 return ( mTile ? mTile->get() : 0);
1687 if( !mTile || !mTile->get() )
1689 TQPixmap nullPixmap;
1690 setBackgroundPixmap(nullPixmap);
1691 if( d->mButton.box )
1693 d->mButton.box->setBackgroundPixmap(nullPixmap);
1694 d->mButton.box->setBackgroundMode(PaletteBackground);
1696 setBackgroundMode(PaletteBackground);
1700 const TQPixmap *pix = mTile->get();
1701 setBackgroundPixmap(*pix);
1702 if( d->mButton.box )
1704 d->mButton.box->setBackgroundPixmap(*pix);
1714 if( !mShowTile || !mTile || !mTile->get() )
1716 setBackgroundMode(PaletteBackground);
1717 if( d->mButton.box )
1719 d->mButton.box->setBackgroundMode(PaletteBackground);
1723 mUrlHelp->setBackgroundMode(PaletteBackground);
1728 const TQPixmap *pix = mTile->get();
1729 setBackgroundPixmap(*pix);
1730 if( d->mButton.box )
1732 d->mButton.box->setBackgroundPixmap(*pix);
1736 mUrlHelp->setBackgroundPixmap(*pix);
1748 const TQString& groupName )
const 1751 int scnum = TQApplication::desktop()->screenNumber(parentWidget());
1752 TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
1754 w = sizeHint().width();
1755 h = sizeHint().height();
1758 w = config.
readNumEntry( TQString::fromLatin1(
"Width %1").arg( desk.width()), w );
1759 h = config.
readNumEntry( TQString::fromLatin1(
"Height %1").arg( desk.height()), h );
1761 return TQSize( w, h );
1774 int scnum = TQApplication::desktop()->screenNumber(parentWidget());
1775 TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
1778 TQSize sizeToSave = size();
1780 config.
writeEntry( TQString::fromLatin1(
"Width %1").arg( desk.width()),
1781 TQString::number( sizeToSave.width()),
true, global);
1782 config.
writeEntry( TQString::fromLatin1(
"Height %1").arg( desk.height()),
1783 TQString::number( sizeToSave.height()),
true, global);
1787 KDialogBaseButton::KDialogBaseButton(
const KGuiItem &item,
int key,
1788 TQWidget *parent,
const char *name )
1796 KDialogBaseTile::KDialogBaseTile( TQObject *parent,
const char *name )
1797 : TQObject( parent, name ), mPixmap(0)
1802 KDialogBaseTile::~KDialogBaseTile()
1808 void KDialogBaseTile::set(
const TQPixmap *pix )
1818 mPixmap =
new TQPixmap(*pix);
1826 emit pixmapChanged();
1830 const TQPixmap *KDialogBaseTile::get()
const 1836 void KDialogBaseTile::cleanup()
1838 delete mPixmap; mPixmap = 0;
1841 void KDialogBase::virtual_hook(
int id,
void* data )
1842 { KDialog::virtual_hook(
id, data ); }
1844 #include "kdialogbase.moc"
static int marginHint()
Return the number of pixels you shall use between a dialog edge and the outermost widget(s) according...
void noClicked()
The No button was pressed.
void defaultClicked()
The Default button was pressed.
static const TQPixmap * getBackgroundTile() KDE_DEPRECATED
TQVBox * makeVBoxMainWidget()
Make a main widget.
void cancelClicked()
The Cancel button was pressed.
virtual void slotOk()
Activated when the Ok button has been clicked.
void applyClicked()
The Apply button was pressed.
virtual void applyPressed()
TQGrid * addGridPage(int n, Orientation dir, const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList, IconList or Tabbed mode.
virtual void slotDetails()
Activated when the Details button has been clicked.
void addWidgetBelowList(TQWidget *widget)
Add a widget at the bottom of the TreeList/IconList.
void apply()
Do not use this signal.
TQVBox * addVBoxPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList, IconList or Tabbed mode.
A drop-in replacement for TQLabel that displays hyperlinks.
void saveDialogSize(const TQString &groupName, bool global=false)
save the dialogs size dependant on the screen dimension either to the global or application config fi...
TQSize configDialogSize(const TQString &groupName) const
read the dialogs size from the configuration according to the screen size.
void setButtonGuiItem(ButtonCode id, const KGuiItem &item)
Sets the KGuiItem directly for the button instead of using 3 methods to set the text, tooltip and whatsthis strings.
void setButtonCancel(const KGuiItem &item=KStdGuiItem::cancel())
Sets the appearance of the Cancel button.
void tryClicked()
The Try button was pressed.
void enableButtonOK(bool state)
Enable or disable (gray out) the OK button.
void showTile(bool state)
Enable hiding of the background tile (if any).
void showButtonOK(bool state)
Hide or display the OK button.
void setEscapeButton(ButtonCode id)
Sets the button that will be activated when the Escape key is pressed.
virtual void slotHelp()
Activated when the Help button has been clicked.
void disableResize()
Convenience method.
void setButtonApply(const KGuiItem &item=KStdGuiItem::apply())
Sets the appearance of the Apply button.
void enableButton(ButtonCode id, bool state)
Enable or disable (gray out) a general action button.
TQString helpLinkText() const
Returns the help link text.
virtual void slotNo()
Activated when the Yes button has been clicked.
void setIconListAllVisible(bool state)
This function has only effect in IconList mode.
KDialogBase(TQWidget *parent=0, const char *name=0, bool modal=true, const TQString &caption=TQString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
Constructor for the standard mode where you must specify the main widget with setMainWidget() ...
Dialog with extended non-modal support and methods for KDE standard compliance.
kdbgstream kdDebug(int area=0)
TQHBox * makeHBoxMainWidget()
Make a main widget.
TQFrame * makeMainWidget()
Make a main widget.
Used internally by KDialogBase.
void user3Clicked()
The User3 button was pressed.
TQFrame * addPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList , IconList or Tabbed mode.
void cancel()
Force closing the dialog, setting its result code to the one Esc would set.
void setHelpLinkText(const TQString &text)
Sets the text that is shown as the linked text.
void unfoldTreeList(bool persist=false)
This function has only effect in TreeList mode.
TQGrid * makeGridMainWidget(int n, Orientation dir)
Make a main widget.
Standard horizontal or vertical separator.
static bool haveBackgroundTile()
Check whether the background tile is set or not.
virtual void slotApply()
Activated when the Apply button has been clicked.
void hidden()
The dialog is about to be hidden.
Show User defined button 1.
void helpClicked()
The Help button was pressed.
void user2Clicked()
The User2 button was pressed.
TQHBox * addHBoxPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList, IconList or Tabbed mode.
void setButtonOKText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) KDE_DEPRECATED
static int spacingHint()
Return the number of pixels you shall use between widgets inside a dialog according to the KDE standa...
int activePageIndex() const
Returns the index of the active page.
An abstract class for GUI data such as ToolTip and Icon.
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
void aboutToShowDetails()
The detailsWidget is about to get shown.
virtual void hideEvent(TQHideEvent *)
Emits the hidden signal.
void setButtonApplyText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) KDE_DEPRECATED
void setMainWidget(TQWidget *widget)
Sets the main user definable widget.
void setFolderIcon(const TQStringList &path, const TQPixmap &pixmap)
Sets the icon used in TreeList Mode for the given path.
void setFloat(bool do_float=true)
Turns on or off the "float" feature.
void showButtonApply(bool state)
Hide or display the Apply button.
void updateBackground()
This method is called automatically whenever the background has changed.
static void setBackgroundTile(const TQPixmap *pix)
Sets the background tile.
void helpClickedSlot(const TQString &)
Connected to help link label.
void updateGeometry()
Updates the margins and spacings.
void incInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
Show User defined button 2.
virtual void slotDefault()
Activated when the Default button has been clicked.
void setDetails(bool showDetails)
Sets the status of the Details button.
void setButtonCancelText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) KDE_DEPRECATED
void aboutToShowPage(TQWidget *page)
A page is about to be shown.
int pageIndex(TQWidget *widget) const
Returns the index of a page created with addPage(), addVBoxPage(), addHBoxPage() or addGridPage()...
TQPushButton * actionButton(ButtonCode id)
Returns the action button that corresponds to the id.
virtual void slotTry()
Activated when the Try button has been clicked.
void yesClicked()
The Yes button was pressed.
void setButtonWhatsThis(ButtonCode id, const TQString &text)
Sets the "What's this?" text of any button.
TQFrame * plainPage()
Retrieve the empty page when the predefined layout is used in Plain mode.
void enableButtonApply(bool state)
Enable or disable (gray out) the Apply button.
virtual void slotUser1()
Activated when the User1 button has been clicked.
void slotDelayedDestruct()
Deletes the dialog immediately.
void setButtonTip(ButtonCode id, const TQString &text)
Sets the tooltip text of any button.
void user1Clicked()
The User1 button was pressed.
void addButtonBelowList(const TQString &text, TQObject *recv, const char *slot)
Add a button at the bottom of the TreeList/IconList.
virtual void keyPressEvent(TQKeyEvent *e)
Maps some keys to the actions buttons.
virtual void slotCancel()
Activated when the Cancel button has been clicked.
void showButton(ButtonCode id, bool state)
Hide or display a general action button.
void setUnderline(bool on=true)
Turns on or off the underlining.
void delayedDestruct()
Destruct the Dialog delayed.
virtual void slotClose()
Activated when the Close button has been clicked.
virtual void slotYes()
Activated when the Yes button has been clicked.
TQWidget * mainWidget()
Returns the main widget if any.
void showButtonCancel(bool state)
Hide or display the Cancel button.
void setInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
virtual void slotUser3()
Activated when the User3 button has been clicked.
void setShowIconsInTreeList(bool state)
This function has only effect in TreeList mode.
virtual void setCaption(const TQString &caption)
Make a KDE compliant caption.
void okClicked()
The OK button was pressed.
void setButtonText(ButtonCode id, const TQString &text)
Sets the text of any button.
void setButtonOK(const KGuiItem &item=KStdGuiItem::ok())
Sets the appearance of the OK button.
void enableButtonSeparator(bool state)
Hide or display the a separator line drawn between the action buttons an the main widget...
void enableButtonCancel(bool state)
Enable or disable (gray out) the Cancel button.
static const TQPixmap * backgroundTile()
Returns a pointer to the background tile if there is one.
Used when specifying a default button; indicates that no button should be marked by default...
TQSize calculateSize(int w, int h) const
Calculate the size hint for the dialog.
virtual void slotUser2()
Activated when the User2 button has been clicked.
virtual void closeEvent(TQCloseEvent *e)
Detects when a dialog is being closed from the window manager controls.
void setButtonBoxOrientation(int orientation)
Sets the orientation of the button box.
void enableLinkedHelp(bool state)
Display or hide the help link area on the top of the dialog.
static TDEConfig * config()
kndbgstream & endl(kndbgstream &s)
~KDialogBase()
Destructor.
void setOrientation(int orient)
Set the orientation of the separator to orient.
void getBorderWidths(int &ulx, int &uly, int &lrx, int &lry) const KDE_DEPRECATED
int readNumEntry(const TQString &pKey, int nDefault=0) const
void layoutHintChanged()
Emitted when the margin size and/or spacing size have changed.
TQRect getContentsRect() const KDE_DEPRECATED
void setTreeListAutoResize(bool state)
This function has only effect in TreeList mode.
bool showPage(int index)
Sets the page with index to be displayed.
void setHelp(const TQString &anchor, const TQString &appname=TQString::null)
Sets the help path and topic.
void closeClicked()
The Close button was pressed.
Show User defined button 3.
void finished()
The dialog has finished.
static int buttonLayout()
void setDetailsWidget(TQWidget *detailsWidget)
Sets the widget that gets shown when "Details" is enabled.
virtual void adjustSize()
Adjust the size of the dialog to fit the contents just before TQDialog::exec() or TQDialog::show() is...
void setRootIsDecorated(bool state)
This function has only effect in TreeList mode.