• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
kdialogbase.cpp
1 /*
2  * This file is part of the KDE Libraries
3  * Copyright (C) 1999-2001 Mirko Boehm (mirko@kde.org) and
4  * Espen Sand (espen@kde.org)
5  * Holger Freyther <freyther@kde.org>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  */
23 
24 #include "kdialogbase.h"
25 #include <stdlib.h>
26 
27 #include <tqgrid.h>
28 #include <tqhbox.h>
29 #include <tqlayout.h>
30 #include <tqtooltip.h>
31 #include <tqvbox.h>
32 #include <tqwhatsthis.h>
33 #include <tqtimer.h>
34 #include <tqfocusdata.h>
35 
36 #include <tdeapplication.h>
37 #include <tdelocale.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>
44 #include <kdebug.h>
45 
46 #include "kdialogbase_priv.h"
47 #include "kdialogbase_priv.moc"
48 
49 KDialogBaseTile *KDialogBase::mTile = 0;
50 
51 int KDialogBaseButton::id()
52 {
53  return mKey;
54 }
55 
56 template class TQPtrList<KDialogBaseButton>;
57 
61 namespace
62 {
63 struct SButton : public TQt
64 {
65  SButton()
66  {
67  box = 0;
68  mask = 0;
69  style = 0;
70  }
71 
72  KPushButton *append( int key, const KGuiItem &item );
73 
74  void resize( bool sameWidth, int margin, int spacing, int orientation );
75 
76  KPushButton *button( int key );
77 
78  TQWidget *box;
79  int mask;
80  int style;
81  TQPtrList<KDialogBaseButton> list;
82 };
83 }// namespace
84 
85 class KDialogBase::KDialogBasePrivate {
86 public:
87  KDialogBasePrivate() : bDetails(false), bFixed(false), bSettingDetails(false), detailsWidget(0) { }
88 
89  bool bDetails;
90  bool bFixed;
91  bool bSettingDetails;
92  TQWidget *detailsWidget;
93  TQSize incSize;
94  TQSize minSize;
95  TQString detailsButton;
96  SButton mButton;
97 };
98 
99 KDialogBase::KDialogBase( TQWidget *parent, const char *name, bool modal,
100  const TQString &caption, int buttonMask,
101  ButtonCode defaultButton, bool separator,
102  const KGuiItem &user1, const KGuiItem &user2,
103  const KGuiItem &user3 )
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(TQt::Horizontal), d(new KDialogBasePrivate)
108 {
109  setCaption( caption );
110 
111  makeRelay();
112  connect( this, TQ_SIGNAL(layoutHintChanged()), TQ_SLOT(updateGeometry()) );
113 
114  enableButtonSeparator( separator );
115  makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
116 
117  mIsActivated = true;
118  setupLayout();
119 }
120 
121 KDialogBase::KDialogBase( int dialogFace, const TQString &caption,
122  int buttonMask, ButtonCode defaultButton,
123  TQWidget *parent, const char *name, bool modal,
124  bool separator, const KGuiItem &user1,
125  const KGuiItem &user2, const KGuiItem &user3 )
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(TQt::Horizontal), d(new KDialogBasePrivate)
130 {
131  setCaption( caption );
132 
133  makeRelay();
134  connect( this, TQ_SIGNAL(layoutHintChanged()), TQ_SLOT(updateGeometry()) );
135 
136  mJanus = new KJanusWidget( this, "janus", dialogFace );
137  connect(mJanus, TQ_SIGNAL(aboutToShowPage(TQWidget *)),
138  this, TQ_SIGNAL(aboutToShowPage(TQWidget *)));
139 
140  if( !mJanus || !mJanus->isValid() ) { return; }
141 
142  enableButtonSeparator( separator );
143  makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
144 
145  mIsActivated = true;
146  setupLayout();
147 }
148 
149 KDialogBase::KDialogBase( KDialogBase::DialogType dialogFace, WFlags f, TQWidget *parent, const char *name,
150  bool modal,
151  const TQString &caption, int buttonMask,
152  ButtonCode defaultButton, bool separator,
153  const KGuiItem &user1, const KGuiItem &user2,
154  const KGuiItem &user3 )
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(TQt::Horizontal), d(new KDialogBasePrivate)
159 {
160  setCaption( caption );
161 
162  makeRelay();
163  connect( this, TQ_SIGNAL(layoutHintChanged()), TQ_SLOT(updateGeometry()) );
164 
165  mJanus = new KJanusWidget( this, "janus", dialogFace );
166  connect(mJanus, TQ_SIGNAL(aboutToShowPage(TQWidget *)),
167  this, TQ_SIGNAL(aboutToShowPage(TQWidget *)));
168 
169  if( !mJanus || !mJanus->isValid() ) { return; }
170 
171  enableButtonSeparator( separator );
172  makeButtonBox( buttonMask, defaultButton, user1, user2, user3 );
173 
174  mIsActivated = true;
175  setupLayout();
176 }
177 
178 KDialogBase::KDialogBase( const TQString &caption, int buttonMask,
179  ButtonCode defaultButton, ButtonCode escapeButton,
180  TQWidget *parent, const char *name, bool modal,
181  bool separator, const KGuiItem &yes,
182  const KGuiItem &no, const KGuiItem &cancel )
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(TQt::Horizontal),mEscapeButton(escapeButton),
187  d(new KDialogBasePrivate)
188 {
189  setCaption( caption );
190 
191  makeRelay();
192  connect( this, TQ_SIGNAL(layoutHintChanged()), TQ_SLOT(updateGeometry()) );
193 
194  enableButtonSeparator( separator );
195 
196  buttonMask &= Details|Yes|No|Cancel;
197 
198  makeButtonBox( buttonMask, defaultButton,
199  no.text().isEmpty() ? KStdGuiItem::no() : no,
200  yes.text().isEmpty() ? KStdGuiItem::yes() : yes );
201 
202  setButtonCancel( cancel.text().isEmpty() ?
203  KStdGuiItem::cancel() : cancel );
204 
205  mIsActivated = true;
206  setupLayout();
207 }
208 
209 
210 
211 KDialogBase::~KDialogBase()
212 {
213  delete d;
214 }
215 
216 KPushButton *SButton::append( int key, const KGuiItem &item )
217 {
218  KDialogBaseButton *p = new KDialogBaseButton( item, key, box );
219  list.append( p );
220  return p;
221 }
222 
223 void SButton::resize( bool sameWidth, int margin,
224  int spacing, int orientation )
225 {
226  KDialogBaseButton *p;
227  int h = 0;
228  int w = 0;
229  int t = 0;
230 
231  for( p = list.first(); p; p = list.next() )
232  {
233  const TQSize s( p->sizeHint() );
234  if( s.height() > h ) { h = s.height(); }
235  if( s.width() > w ) { w = s.width(); }
236  }
237 
238  if( orientation == TQt::Horizontal )
239  {
240  for( p = list.first(); p; p = list.next() )
241  {
242  TQSize s( p->sizeHint() );
243  if( sameWidth ) { s.setWidth( w ); }
244  p->setFixedWidth( s.width() );
245  t += s.width() + spacing;
246  }
247 
248  box->setMinimumHeight( margin*2 + h );
249  box->setMinimumWidth( margin*2 + t - spacing );
250  }
251  else
252  {
253  // sameWidth has no effect here
254  for( p = list.first(); p; p = list.next() )
255  {
256  TQSize s( p->sizeHint() );
257  s.setWidth( w );
258  p->setFixedSize( s );
259  t += s.height() + spacing;
260  }
261  box->setMinimumHeight( margin*2 + t - spacing );
262  box->setMinimumWidth( margin*2 + w );
263  }
264 }
265 
266 KPushButton *SButton::button( int key )
267 {
268  KDialogBaseButton *p;
269  for( p = list.first(); p; p = list.next() )
270  {
271  if( p->id() == key )
272  {
273  return p;
274  }
275  }
276  return 0;
277 }
278 
279 void
280 KDialogBase::delayedDestruct()
281 {
282  if (isVisible())
283  hide();
284  TQTimer::singleShot( 0, this, TQ_SLOT(slotDelayedDestruct()));
285 }
286 
287 void
288 KDialogBase::slotDelayedDestruct()
289 {
290  delete this;
291 }
292 
293 void KDialogBase::setupLayout()
294 {
295  if( mTopLayout )
296  {
297  delete mTopLayout;
298  }
299  // mTopLayout = new TQVBoxLayout( this, marginHint(), spacingHint() );
300 
301 
302  if( mButtonOrientation == TQt::Horizontal )
303  {
304  mTopLayout = new TQBoxLayout( this, TQBoxLayout::TopToBottom,
305  marginHint(), spacingHint() );
306  }
307  else
308  {
309  mTopLayout = new TQBoxLayout( this, TQBoxLayout::LeftToRight,
310  marginHint(), spacingHint() );
311  }
312 
313  if( mUrlHelp )
314  {
315  mTopLayout->addWidget( mUrlHelp, 0, AlignRight );
316  }
317 
318  if( mJanus )
319  {
320  mTopLayout->addWidget( mJanus, 10 );
321  }
322  else if( mMainWidget )
323  {
324  mTopLayout->addWidget( mMainWidget, 10 );
325  }
326 
327  if ( d->detailsWidget )
328  {
329  mTopLayout->addWidget( d->detailsWidget );
330  }
331 
332  if( mActionSep )
333  {
334  mTopLayout->addWidget( mActionSep );
335  }
336 
337  if( d->mButton.box )
338  {
339  mTopLayout->addWidget( d->mButton.box );
340  }
341 }
342 
343 
344 
345 void KDialogBase::setButtonBoxOrientation( int orientation )
346 {
347  if( mButtonOrientation != orientation )
348  {
349  mButtonOrientation = orientation;
350  if( mActionSep )
351  {
352  mActionSep->setOrientation( mButtonOrientation == TQt::Horizontal ?
353  TQFrame::HLine : TQFrame::VLine );
354  }
355  if( mButtonOrientation == TQt::Vertical )
356  {
357  enableLinkedHelp(false); // 2000-06-18 Espen: No support for this yet.
358  }
359  setupLayout();
360  setButtonStyle( d->mButton.style );
361  }
362 }
363 
364 
365 void KDialogBase::setEscapeButton( ButtonCode id )
366 {
367  mEscapeButton = id;
368 }
369 
370 
371 
372 void KDialogBase::makeRelay()
373 {
374  if( mTile )
375  {
376  connect( mTile, TQ_SIGNAL(pixmapChanged()), TQ_SLOT(updateBackground()) );
377  return;
378  }
379 
380  mTile = new KDialogBaseTile;
381  if( mTile )
382  {
383  connect( mTile, TQ_SIGNAL(pixmapChanged()), TQ_SLOT(updateBackground()) );
384  connect( tqApp, TQ_SIGNAL(aboutToQuit()), mTile, TQ_SLOT(cleanup()) );
385  }
386 }
387 
388 
389 void KDialogBase::enableButtonSeparator( bool state )
390 {
391  if( state )
392  {
393  if( mActionSep )
394  {
395  return;
396  }
397  mActionSep = new KSeparator( this );
398  mActionSep->setFocusPolicy(TQWidget::NoFocus);
399  mActionSep->setOrientation( mButtonOrientation == TQt::Horizontal ?
400  TQFrame::HLine : TQFrame::VLine );
401  mActionSep->show();
402  }
403  else
404  {
405  if( !mActionSep )
406  {
407  return;
408  }
409  delete mActionSep; mActionSep = 0;
410  }
411 
412  if( mIsActivated )
413  {
414  setupLayout();
415  }
416 }
417 
418 
419 
420 TQFrame *KDialogBase::plainPage()
421 {
422  return ( mJanus ? mJanus->plainPage() : 0 );
423 }
424 
425 
426 
427 void KDialogBase::adjustSize()
428 {
429 // if (layout())
430 // layout()->activate();
431  if( d->bFixed )
432  setFixedSize( sizeHint() );
433  else
434  resize( sizeHint() );
435 }
436 
437 TQSize KDialogBase::sizeHint() const
438 {
439  return d->minSize.expandedTo( minimumSizeHint() ) + d->incSize;
440 }
441 
442 TQSize KDialogBase::minimumSizeHint() const
443 {
444  const int m = marginHint();
445  const int s = spacingHint();
446 
447  const TQSize zeroByS(0, s);
448 
449  TQSize s1(0,0);
450  TQSize s2(0,0);
451 
452  //
453  // Url help area
454  //
455  if( mUrlHelp )
456  {
457  s2 = mUrlHelp->minimumSize() + zeroByS;
458  }
459  s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
460  s1.rheight() += s2.rheight();
461 
462  //
463  // User widget
464  //
465  if( mJanus )
466  {
467  s2 = mJanus->minimumSizeHint() + zeroByS;
468  }
469  else if( mMainWidget )
470  {
471  s2 = mMainWidget->sizeHint() + zeroByS;
472  s2 = s2.expandedTo( mMainWidget->minimumSize() );
473  s2 = s2.expandedTo( mMainWidget->minimumSizeHint() );
474  if( s2.isEmpty() )
475  {
476  s2 = TQSize( 100, 100+s );
477  }
478  }
479  else
480  {
481  s2 = TQSize( 100, 100+s );
482  }
483  s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
484  s1.rheight() += s2.rheight();
485 
486  if (d->detailsWidget && d->bDetails)
487  {
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();
493  }
494 
495  //
496  // Button separator
497  //
498  if( mActionSep )
499  {
500  s1.rheight() += mActionSep->minimumSize().height() + s;
501  }
502 
503  //
504  // The button box
505  //
506  if( d->mButton.box )
507  {
508  s2 = d->mButton.box->minimumSize();
509  if( mButtonOrientation == TQt::Horizontal )
510  {
511  s1.rwidth() = TQMAX( s1.rwidth(), s2.rwidth() );
512  s1.rheight() += s2.rheight();
513  }
514  else
515  {
516  s1.rwidth() += s2.rwidth();
517  s1.rheight() = TQMAX( s1.rheight(), s2.rheight() );
518  }
519  }
520 
521  //
522  // Outer margings
523  //
524  s1.rheight() += 2*m;
525  s1.rwidth() += 2*m;
526 
527  return s1;
528 }
529 
530 
531 void KDialogBase::disableResize()
532 {
533  setFixedSize( sizeHint() );
534 }
535 
536 
537 void KDialogBase::setInitialSize( const TQSize &s, bool noResize )
538 {
539  d->minSize = s;
540  d->bFixed = noResize;
541  adjustSize();
542 }
543 
544 
545 void KDialogBase::incInitialSize( const TQSize &s, bool noResize )
546 {
547  d->incSize = s;
548  d->bFixed = noResize;
549  adjustSize();
550 }
551 
552 
553 void KDialogBase::makeButtonBox( int buttonMask, ButtonCode defaultButton,
554  const KGuiItem &user1, const KGuiItem &user2,
555  const KGuiItem &user3 )
556 {
557  if( buttonMask == 0 )
558  {
559  d->mButton.box = 0;
560  return; // When we want no button box
561  }
562 
563  if( buttonMask & Cancel ) { buttonMask &= ~Close; }
564  if( buttonMask & Apply ) { buttonMask &= ~Try; }
565  if( buttonMask & Details ) { buttonMask &= ~Default; }
566 
567  if( !mMessageBoxMode )
568  {
569  mEscapeButton = (buttonMask&Cancel) ? Cancel : Close;
570  }
571 
572  d->mButton.box = new TQWidget( this );
573 
574  d->mButton.mask = buttonMask;
575  if( d->mButton.mask & Help )
576  {
577  KPushButton *pb = d->mButton.append( Help, KStdGuiItem::help() );
578 
579  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotHelp()) );
580  }
581  if( d->mButton.mask & Default )
582  {
583  KPushButton *pb = d->mButton.append( Default, KStdGuiItem::defaults() );
584 
585  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotDefault()) );
586  }
587  if( d->mButton.mask & Details )
588  {
589  KPushButton *pb = d->mButton.append( Details, TQString() );
590  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotDetails()) );
591  setDetails(false);
592  }
593  if( d->mButton.mask & User3 )
594  {
595  KPushButton *pb = d->mButton.append( User3, user3 );
596  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotUser3()) );
597  }
598  if( d->mButton.mask & User2 )
599  {
600  KPushButton *pb = d->mButton.append( User2, user2 );
601  if( mMessageBoxMode )
602  {
603  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotYes()) );
604  }
605  else
606  {
607  connect( pb, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotUser2()) );
608  }
609  }
610  if( d->mButton.mask & User1 )
611  {
612  KPushButton *pb = d->mButton.append( User1, user1 );
613  if( mMessageBoxMode )
614  {
615  connect( pb, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotNo()) );
616  }
617  else
618  {
619  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotUser1()) );
620  }
621  }
622  if( d->mButton.mask & Ok )
623  {
624  KPushButton *pb = d->mButton.append( Ok, KStdGuiItem::ok() );
625  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotOk()) );
626  }
627  if( d->mButton.mask & Apply )
628  {
629  KPushButton *pb = d->mButton.append( Apply, KStdGuiItem::apply() );
630  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotApply()) );
631  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(applyPressed()) );
632  }
633  if( d->mButton.mask & Try )
634  {
635  KPushButton *pb = d->mButton.append( Try,
636  i18n( "&Try" ) );
637  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotTry()) );
638  }
639  if( d->mButton.mask & Cancel )
640  {
641  KPushButton *pb = d->mButton.append( Cancel, KStdGuiItem::cancel() );
642  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotCancel()) );
643  }
644  if( d->mButton.mask & Close )
645  {
646  KPushButton *pb = d->mButton.append( Close, KStdGuiItem::close() );
647  connect( pb, TQ_SIGNAL(clicked()), TQ_SLOT(slotClose()) );
648  }
649 
650  if( defaultButton != NoDefault )
651  {
652  TQPushButton *pb = actionButton( defaultButton );
653  if( pb )
654  {
655  setButtonFocus( pb, true, false );
656  }
657  }
658 
659  setButtonStyle( TDEGlobalSettings::buttonLayout() );
660 }
661 
662 
663 
664 void KDialogBase::setButtonStyle( int style )
665 {
666  if( !d->mButton.box )
667  {
668  return;
669  }
670 
671  if( style < 0 || style >= ActionStyleMAX ) { style = ActionStyle0; }
672  d->mButton.style = style;
673 
674  const unsigned int *layout;
675  int layoutMax = 0;
676  if (mMessageBoxMode)
677  {
678  static const unsigned int layoutRule[5][6] =
679  {
680  {Details,Stretch,User2|Stretch,User1|Stretch,Cancel|Stretch, Details|Filler},
681  {Details,Stretch,User2|Stretch,User1|Stretch,Cancel|Stretch, Details|Filler},
682  {Details,Stretch,User2|Stretch,User1|Stretch,Cancel|Stretch, Details|Filler},
683  {Details|Filler,Stretch,Cancel|Stretch,User2|Stretch,User1|Stretch,Details},
684  {Details|Filler,Stretch,Cancel|Stretch,User2|Stretch,User1|Stretch,Details}
685  };
686  layoutMax = 6;
687  layout = layoutRule[ d->mButton.style ];
688  }
689  else if (mButtonOrientation == TQt::Horizontal)
690  {
691  static const unsigned int layoutRule[5][10] =
692  {
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},
697  {Ok,Cancel|Close,Apply|Try,User3,User2,User1,Stretch,Default,Help,Details}
698  };
699  layoutMax = 10;
700  layout = layoutRule[ d->mButton.style ];
701  }
702  else
703  {
704  static const unsigned int layoutRule[5][10] =
705  {
706  {Ok,Apply|Try,User1,User2,User3,Stretch,Default,Cancel|Close,Help, Details},
707  //{Ok,Apply|Try,Cancel|Close,User1,User2,User3,Stretch, Default,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},
711  {Ok,Cancel|Close,Apply|Try,User3,User2,User1,Stretch,Default,Help,Details}
712  };
713  layoutMax = 10;
714  layout = layoutRule[ d->mButton.style ];
715  }
716 
717  if( d->mButton.box->layout() )
718  {
719  delete d->mButton.box->layout();
720  }
721 
722  TQBoxLayout *lay;
723  if( mButtonOrientation == TQt::Horizontal )
724  {
725  lay = new TQBoxLayout( d->mButton.box, TQBoxLayout::LeftToRight, 0,
726  spacingHint());
727  }
728  else
729  {
730  lay = new TQBoxLayout( d->mButton.box, TQBoxLayout::TopToBottom, 0,
731  spacingHint());
732  }
733 
734  int numButton = 0;
735  TQPushButton *prevButton = 0;
736  TQPushButton *newButton;
737 
738  for( int i=0; i<layoutMax; ++i )
739  {
740  if(((ButtonCode) layout[i]) == Stretch) // Unconditional Stretch
741  {
742  lay->addStretch(1);
743  continue;
744  }
745  else if (layout[i] & Filler) // Conditional space
746  {
747  if (d->mButton.mask & layout[i])
748  {
749  newButton = actionButton( (ButtonCode) (layout[i] & ~(Stretch | Filler)));
750  if (newButton)
751  lay->addSpacing(newButton->sizeHint().width());
752  }
753  continue;
754  }
755  else if( d->mButton.mask & Help & layout[i] )
756  {
757  newButton = actionButton( Help );
758  lay->addWidget( newButton ); ++numButton;
759  }
760  else if( d->mButton.mask & Default & layout[i] )
761  {
762  newButton = actionButton( Default );
763  lay->addWidget( newButton ); ++numButton;
764  }
765  else if( d->mButton.mask & User3 & layout[i] )
766  {
767  newButton = actionButton( User3 );
768  lay->addWidget( newButton ); ++numButton;
769  }
770  else if( d->mButton.mask & User2 & layout[i] )
771  {
772  newButton = actionButton( User2 );
773  lay->addWidget( newButton ); ++numButton;
774  }
775  else if( d->mButton.mask & User1 & layout[i] )
776  {
777  newButton = actionButton( User1 );
778  lay->addWidget( newButton ); ++numButton;
779  }
780  else if( d->mButton.mask & Ok & layout[i] )
781  {
782  newButton = actionButton( Ok );
783  lay->addWidget( newButton ); ++numButton;
784  }
785  else if( d->mButton.mask & Apply & layout[i] )
786  {
787  newButton = actionButton( Apply );
788  lay->addWidget( newButton ); ++numButton;
789  }
790  else if( d->mButton.mask & Try & layout[i] )
791  {
792  newButton = actionButton( Try );
793  lay->addWidget( newButton ); ++numButton;
794  }
795  else if( d->mButton.mask & Cancel & layout[i] )
796  {
797  newButton = actionButton( Cancel );
798  lay->addWidget( newButton ); ++numButton;
799  }
800  else if( d->mButton.mask & Close & layout[i] )
801  {
802  newButton = actionButton( Close );
803  lay->addWidget( newButton ); ++numButton;
804  }
805  else if( d->mButton.mask & Details & layout[i] )
806  {
807  newButton = actionButton( Details );
808  lay->addWidget( newButton ); ++numButton;
809  }
810  else
811  {
812  continue;
813  }
814 
815  // Add conditional stretch (Only added if a button was added)
816  if(layout[i] & Stretch)
817  {
818  lay->addStretch(1);
819  }
820 
821  if( prevButton )
822  {
823  setTabOrder( prevButton, newButton );
824  }
825  prevButton = newButton;
826  }
827 
828  d->mButton.resize( false, 0, spacingHint(), mButtonOrientation );
829 }
830 
831 
832 TQPushButton *KDialogBase::actionButton( ButtonCode id )
833 {
834  return d->mButton.button(id);
835 }
836 
837 
838 void KDialogBase::enableButton( ButtonCode id, bool state )
839 {
840  TQPushButton *pb = actionButton( id );
841  if( pb )
842  {
843  pb->setEnabled( state );
844  }
845 }
846 
847 
848 void KDialogBase::enableButtonOK( bool state )
849 {
850  enableButton( Ok, state );
851 }
852 
853 
854 void KDialogBase::enableButtonApply( bool state )
855 {
856  enableButton( Apply, state );
857 }
858 
859 
860 void KDialogBase::enableButtonCancel( bool state )
861 {
862  enableButton( Cancel, state );
863 }
864 
865 
866 void KDialogBase::showButton( ButtonCode id, bool state )
867 {
868  TQPushButton *pb = actionButton( id );
869  if( pb )
870  {
871  state ? pb->show() : pb->hide();
872  }
873 }
874 
875 
876 void KDialogBase::showButtonOK( bool state )
877 {
878  showButton( Ok, state );
879 }
880 
881 
882 void KDialogBase::showButtonApply( bool state )
883 {
884  showButton( Apply, state );
885 }
886 
887 
888 void KDialogBase::showButtonCancel( bool state )
889 {
890  showButton( Cancel, state );
891 }
892 
893 
894 void KDialogBase::setButtonOKText( const TQString &text,
895  const TQString &tooltip,
896  const TQString &quickhelp )
897 {
898  TQPushButton *pb = actionButton( Ok );
899  if( !pb )
900  {
901  return;
902  }
903 
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.");
907 
908  pb->setText( text.isEmpty() ? i18n("&OK") : text );
909  d->mButton.resize( false, 0, spacingHint(), mButtonOrientation );
910 
911  TQToolTip::add( pb, tooltip.isEmpty() ? i18n("Accept settings") : tooltip );
912  TQWhatsThis::add( pb, quickhelp.isEmpty() ? whatsThis : quickhelp );
913 }
914 
915 
916 void KDialogBase::setButtonOK( const KGuiItem &item /* = KStdGuiItem::ok() */ )
917 {
918  setButtonGuiItem( Ok, item );
919 }
920 
921 
922 void KDialogBase::setButtonApplyText( const TQString &text,
923  const TQString &tooltip,
924  const TQString &quickhelp )
925 {
926  TQPushButton *pb = actionButton( Apply );
927  if( !pb )
928  {
929  return;
930  }
931 
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. ");
937 
938  pb->setText( text.isEmpty() ? i18n("&Apply") : text );
939  d->mButton.resize( false, 0, spacingHint(), mButtonOrientation );
940 
941  TQToolTip::add( pb, tooltip.isEmpty() ? i18n("Apply settings") : tooltip );
942  TQWhatsThis::add( pb, quickhelp.isEmpty() ? whatsThis : quickhelp );
943 }
944 
945 
946 void KDialogBase::setButtonApply( const KGuiItem &item /* = KStdGuiItem::apply() */ )
947 {
948  setButtonGuiItem( Apply, item );
949 }
950 
951 
952 void KDialogBase::setButtonCancelText( const TQString& text,
953  const TQString& tooltip,
954  const TQString& quickhelp )
955 {
956  TQPushButton *pb = actionButton( Cancel );
957  if( !pb )
958  {
959  return;
960  }
961 
962  pb->setText( text.isEmpty() ? i18n("&Cancel") : text );
963  d->mButton.resize( false, 0, spacingHint(), mButtonOrientation );
964 
965  TQToolTip::add( pb, tooltip );
966  TQWhatsThis::add( pb, quickhelp );
967 }
968 
969 
970 void KDialogBase::setButtonCancel( const KGuiItem &item /* = KStdGuiItem::cancel() */ )
971 {
972  setButtonGuiItem( Cancel, item );
973 }
974 
975 void KDialogBase::setButtonGuiItem( ButtonCode id, const KGuiItem &item )
976 {
977  KPushButton *pb = static_cast<KPushButton *>( actionButton( id ) );
978  if( !pb )
979  return;
980 
981  pb->setGuiItem( item );
982  d->mButton.resize( false, 0, spacingHint(), mButtonOrientation );
983 }
984 
985 
986 void KDialogBase::setButtonText( ButtonCode id, const TQString &text )
987 {
988  if (!d->bSettingDetails && (id == Details))
989  {
990  d->detailsButton = text;
991  setDetails(d->bDetails);
992  return;
993  }
994  TQPushButton *pb = actionButton( id );
995  if( pb )
996  {
997  pb->setText( text );
998  d->mButton.resize( false, 0, spacingHint(), mButtonOrientation );
999  }
1000 }
1001 
1002 
1003 void KDialogBase::setButtonTip( ButtonCode id, const TQString &text )
1004 {
1005  TQPushButton *pb = actionButton( id );
1006  if( pb )
1007  {
1008  if (text.isEmpty())
1009  TQToolTip::remove( pb );
1010  else
1011  TQToolTip::add( pb, text );
1012  }
1013 }
1014 
1015 
1016 void KDialogBase::setButtonWhatsThis( ButtonCode id, const TQString &text )
1017 {
1018  TQPushButton *pb = actionButton( id );
1019  if( pb )
1020  {
1021  if (text.isEmpty())
1022  TQWhatsThis::remove( pb );
1023  else
1024  TQWhatsThis::add( pb, text );
1025  }
1026 }
1027 
1028 
1029 void KDialogBase::setButtonFocus( TQPushButton *p,bool isDefault, bool isFocus )
1030 {
1031  p->setDefault( isDefault );
1032  if( isFocus )
1033  p->setFocus();
1034 }
1035 
1036 
1037 void KDialogBase::setTreeListAutoResize( bool state )
1038 {
1039  if( mJanus )
1040  {
1041  mJanus->setTreeListAutoResize( state );
1042  }
1043 }
1044 
1045 void KDialogBase::setShowIconsInTreeList(bool state)
1046 {
1047  if( mJanus )
1048  {
1049  mJanus->setShowIconsInTreeList( state );
1050  }
1051 }
1052 
1053 void KDialogBase::setRootIsDecorated( bool state )
1054 {
1055  if( mJanus )
1056  {
1057  mJanus->setRootIsDecorated( state );
1058  }
1059 }
1060 
1061 void KDialogBase::unfoldTreeList( bool persist )
1062 {
1063  if( mJanus )
1064  mJanus->unfoldTreeList( persist );
1065 }
1066 
1067 void KDialogBase::addWidgetBelowList( TQWidget * widget )
1068 {
1069  if( mJanus )
1070  mJanus->addWidgetBelowList( widget );
1071 }
1072 
1073 void KDialogBase::addButtonBelowList( const TQString & text, TQObject * recv, const char * slot )
1074 {
1075  if( mJanus )
1076  mJanus->addButtonBelowList( text, recv, slot );
1077 }
1078 
1079 void KDialogBase::addButtonBelowList( const KGuiItem & item, TQObject * recv, const char * slot )
1080 {
1081  if( mJanus )
1082  mJanus->addButtonBelowList( item, recv, slot );
1083 }
1084 
1085 void KDialogBase::setIconListAllVisible( bool state )
1086 {
1087  if( mJanus )
1088  {
1089  mJanus->setIconListAllVisible( state );
1090  }
1091 }
1092 
1093 
1094 void KDialogBase::slotHelp()
1095 {
1096  emit helpClicked();
1097  if ( kapp ) // may be null when used inside designer
1098  kapp->invokeHelp( mAnchor, mHelpApp );
1099 }
1100 
1101 
1102 void KDialogBase::slotDefault()
1103 {
1104  emit defaultClicked();
1105 }
1106 
1107 void KDialogBase::slotDetails()
1108 {
1109  setDetails(!d->bDetails);
1110 }
1111 
1112 void KDialogBase::setDetailsWidget(TQWidget *detailsWidget)
1113 {
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();
1119  if( mIsActivated )
1120  {
1121  setupLayout();
1122  }
1123  if (!d->bSettingDetails)
1124  setDetails(d->bDetails);
1125 }
1126 
1127 void KDialogBase::setDetails(bool showDetails)
1128 {
1129  if (d->detailsButton.isEmpty())
1130  d->detailsButton = i18n("&Details");
1131  d->bSettingDetails = true;
1132  d->bDetails = showDetails;
1133  if (d->bDetails)
1134  {
1135  emit aboutToShowDetails();
1136  setButtonText(Details, d->detailsButton+ " <<");
1137  if (d->detailsWidget)
1138  {
1139  if (layout())
1140  layout()->setEnabled(false);
1141  adjustSize();
1142  d->detailsWidget->show();
1143  if (layout())
1144  {
1145  layout()->activate();
1146  layout()->setEnabled(true);
1147  }
1148  }
1149  }
1150  else
1151  {
1152  setButtonText(Details, d->detailsButton+" >>");
1153  if (d->detailsWidget)
1154  {
1155  d->detailsWidget->hide();
1156  }
1157  if (layout())
1158  layout()->activate();
1159  adjustSize();
1160  }
1161  d->bSettingDetails = false;
1162 }
1163 
1164 void KDialogBase::slotOk()
1165 {
1166  emit okClicked();
1167  accept();
1168 }
1169 
1170 
1171 void KDialogBase::slotApply()
1172 {
1173  emit applyClicked();
1174 }
1175 
1176 
1177 void KDialogBase::slotTry()
1178 {
1179  emit tryClicked();
1180 }
1181 
1182 
1183 void KDialogBase::slotUser3()
1184 {
1185  emit user3Clicked();
1186 }
1187 
1188 
1189 void KDialogBase::slotUser2()
1190 {
1191  emit user2Clicked();
1192 }
1193 
1194 
1195 void KDialogBase::slotUser1()
1196 {
1197  emit user1Clicked();
1198 }
1199 
1200 
1201 void KDialogBase::slotYes()
1202 {
1203  emit yesClicked();
1204  done( Yes );
1205 }
1206 
1207 
1208 void KDialogBase::slotNo()
1209 {
1210  emit noClicked();
1211  done( No );
1212 }
1213 
1214 
1215 void KDialogBase::slotCancel()
1216 {
1217  emit cancelClicked();
1218  done( mMessageBoxMode ? (int)Cancel : (int)Rejected );
1219 }
1220 
1221 
1222 void KDialogBase::slotClose()
1223 {
1224  emit closeClicked();
1225  reject();
1226 }
1227 
1228 
1229 void KDialogBase::helpClickedSlot( const TQString & )
1230 {
1231  slotHelp();
1232 }
1233 
1234 
1235 void KDialogBase::applyPressed()
1236 {
1237  emit apply();
1238 }
1239 
1240 
1241 void KDialogBase::enableLinkedHelp( bool state )
1242 {
1243  if( state )
1244  {
1245  if( mUrlHelp )
1246  {
1247  return;
1248  }
1249 
1250  mUrlHelp = new KURLLabel( this, "url" );
1251  mUrlHelp->setText( helpLinkText() );
1252  mUrlHelp->setFloat(true);
1253  mUrlHelp->setUnderline(true);
1254  if( mShowTile && mTile->get() )
1255  {
1256  mUrlHelp->setBackgroundPixmap(*mTile->get());
1257  }
1258  mUrlHelp->setMinimumHeight( fontMetrics().height() + marginHint() );
1259  connect(mUrlHelp,TQ_SIGNAL(leftClickedURL(const TQString &)),
1260  TQ_SLOT(helpClickedSlot(const TQString &)));
1261  mUrlHelp->show();
1262  }
1263  else
1264  {
1265  if( !mUrlHelp )
1266  {
1267  return;
1268  }
1269  delete mUrlHelp; mUrlHelp = 0;
1270  }
1271 
1272  if( mIsActivated )
1273  {
1274  setupLayout();
1275  }
1276 }
1277 
1278 
1279 void KDialogBase::setHelp( const TQString &anchor, const TQString &appname )
1280 {
1281  mAnchor = anchor;
1282  mHelpApp = appname;
1283 }
1284 
1285 
1286 void KDialogBase::setHelpLinkText( const TQString &text )
1287 {
1288  mHelpLinkText = text;
1289  if( mUrlHelp )
1290  {
1291  mUrlHelp->setText( helpLinkText() );
1292  }
1293 }
1294 
1295 
1296 TQFrame *KDialogBase::addPage( const TQString &itemName, const TQString &header,
1297  const TQPixmap &pixmap )
1298 {
1299  return ( mJanus ? mJanus->addPage( itemName, header, pixmap ) : 0);
1300 }
1301 
1302 TQFrame *KDialogBase::addPage( const TQStringList &items, const TQString &header,
1303  const TQPixmap &pixmap )
1304 {
1305  return ( mJanus ? mJanus->addPage( items, header, pixmap ) : 0);
1306 }
1307 
1308 
1309 TQVBox *KDialogBase::addVBoxPage( const TQString &itemName,
1310  const TQString &header, const TQPixmap &pixmap )
1311 {
1312  return ( mJanus ? mJanus->addVBoxPage( itemName, header, pixmap) : 0);
1313 }
1314 
1315 TQVBox *KDialogBase::addVBoxPage( const TQStringList &items,
1316  const TQString &header, const TQPixmap &pixmap )
1317 {
1318  return ( mJanus ? mJanus->addVBoxPage( items, header, pixmap) : 0);
1319 }
1320 
1321 
1322 TQHBox *KDialogBase::addHBoxPage( const TQString &itemName,
1323  const TQString &header,
1324  const TQPixmap &pixmap )
1325 {
1326  return ( mJanus ? mJanus->addHBoxPage( itemName, header, pixmap ) : 0);
1327 }
1328 
1329 TQHBox *KDialogBase::addHBoxPage( const TQStringList &items,
1330  const TQString &header,
1331  const TQPixmap &pixmap )
1332 {
1333  return ( mJanus ? mJanus->addHBoxPage( items, header, pixmap ) : 0);
1334 }
1335 
1336 
1337 TQGrid *KDialogBase::addGridPage( int n, Orientation dir,
1338  const TQString &itemName,
1339  const TQString &header, const TQPixmap &pixmap )
1340 {
1341  return ( mJanus ? mJanus->addGridPage( n, dir, itemName, header, pixmap) : 0);
1342 }
1343 
1344 TQGrid *KDialogBase::addGridPage( int n, Orientation dir,
1345  const TQStringList &items,
1346  const TQString &header, const TQPixmap &pixmap )
1347 {
1348  return ( mJanus ? mJanus->addGridPage( n, dir, items, header, pixmap) : 0);
1349 }
1350 
1351 void KDialogBase::setFolderIcon(const TQStringList &path, const TQPixmap &pixmap)
1352 {
1353  if (!mJanus)
1354  return;
1355 
1356  mJanus->setFolderIcon(path,pixmap);
1357 }
1358 
1359 TQFrame *KDialogBase::makeMainWidget()
1360 {
1361  if( mJanus || mMainWidget )
1362  {
1363  printMakeMainWidgetError();
1364  return 0;
1365  }
1366 
1367  TQFrame *mainWidget = new TQFrame( this );
1368  setMainWidget( mainWidget );
1369  return mainWidget;
1370 }
1371 
1372 
1373 TQVBox *KDialogBase::makeVBoxMainWidget()
1374 {
1375  if( mJanus || mMainWidget )
1376  {
1377  printMakeMainWidgetError();
1378  return 0;
1379  }
1380 
1381  TQVBox *mainWidget = new TQVBox( this );
1382  mainWidget->setSpacing( spacingHint() );
1383  setMainWidget( mainWidget );
1384  return mainWidget;
1385 }
1386 
1387 
1388 TQHBox *KDialogBase::makeHBoxMainWidget()
1389 {
1390  if( mJanus || mMainWidget )
1391  {
1392  printMakeMainWidgetError();
1393  return 0;
1394  }
1395 
1396  TQHBox *mainWidget = new TQHBox( this );
1397  mainWidget->setSpacing( spacingHint() );
1398  setMainWidget( mainWidget );
1399  return mainWidget;
1400 }
1401 
1402 
1403 TQGrid *KDialogBase::makeGridMainWidget( int n, Orientation dir )
1404 {
1405  if( mJanus || mMainWidget )
1406  {
1407  printMakeMainWidgetError();
1408  return 0;
1409  }
1410 
1411  TQGrid *mainWidget = new TQGrid( n, dir, this );
1412  mainWidget->setSpacing( spacingHint() );
1413  setMainWidget( mainWidget );
1414  return mainWidget;
1415 }
1416 
1417 
1418 void KDialogBase::printMakeMainWidgetError()
1419 {
1420  if( mJanus )
1421  {
1422  kdDebug() << "makeMainWidget: Illegal mode (wrong constructor)" << endl;
1423  }
1424  else if( mMainWidget )
1425  {
1426  kdDebug() << "makeMainWidget: Main widget already defined" << endl;
1427  }
1428 }
1429 
1430 
1431 void KDialogBase::setMainWidget( TQWidget *widget )
1432 {
1433  if( mJanus )
1434  {
1435  if( mJanus->setSwallowedWidget(widget) )
1436  {
1437  mMainWidget = widget;
1438  }
1439  }
1440  else
1441  {
1442  mMainWidget = widget;
1443  if( mIsActivated )
1444  {
1445  setupLayout();
1446  }
1447  }
1448  if( mMainWidget != NULL )
1449  {
1450  TQFocusData* fd = focusData();
1451  TQWidget* prev = fd->last();
1452  for( TQPtrListIterator<KDialogBaseButton> it( d->mButton.list );
1453  it != NULL;
1454  ++it )
1455  {
1456  if( prev != *it )
1457  setTabOrder( prev, *it );
1458  prev = *it;
1459  }
1460  }
1461 }
1462 
1463 
1464 TQWidget *KDialogBase::mainWidget()
1465 {
1466  return mMainWidget;
1467 }
1468 
1469 
1470 bool KDialogBase::showPage( int index )
1471 {
1472  return ( mJanus ? mJanus->showPage(index) : false);
1473 }
1474 
1475 
1476 int KDialogBase::activePageIndex() const
1477 {
1478  return ( mJanus ? mJanus->activePageIndex() : -1);
1479 }
1480 
1481 
1482 int KDialogBase::pageIndex( TQWidget *widget ) const
1483 {
1484  return ( mJanus ? mJanus->pageIndex( widget) : -1);
1485 }
1486 
1487 
1488 // Deprecated
1489 TQRect KDialogBase::getContentsRect() const
1490 {
1491  TQRect r;
1492  r.setLeft( marginHint() );
1493  r.setTop( marginHint() + (mUrlHelp ? mUrlHelp->height() : 0) );
1494  r.setRight( width() - marginHint() );
1495  int h = (!mActionSep ? 0 : mActionSep->minimumSize().height()+marginHint());
1496  if( d->mButton.box )
1497  {
1498  r.setBottom( height() - d->mButton.box->minimumSize().height() - h );
1499  }
1500  else
1501  {
1502  r.setBottom( height() - h );
1503  }
1504 
1505  return r;
1506 }
1507 
1508 
1509 // Deprecated
1510 void KDialogBase::getBorderWidths(int& ulx, int& uly, int& lrx, int& lry) const
1511 {
1512  ulx = marginHint();
1513  uly = marginHint();
1514  if( mUrlHelp )
1515  {
1516  uly += mUrlHelp->minimumSize().height();
1517  }
1518 
1519  lrx = marginHint();
1520  lry = d->mButton.box ? d->mButton.box->minimumSize().height() : 0;
1521  if( mActionSep )
1522  {
1523  lry += mActionSep->minimumSize().height() + marginHint();
1524  }
1525 }
1526 
1527 
1528 TQSize KDialogBase::calculateSize(int w, int h) const
1529 {
1530  int ulx, uly, lrx, lry;
1531  getBorderWidths(ulx, uly, lrx, lry);
1532  return TQSize(ulx+w+lrx,uly+h+lry);
1533 }
1534 
1535 
1536 TQString KDialogBase::helpLinkText() const
1537 {
1538  return ( mHelpLinkText.isNull() ? i18n("Get help...") : mHelpLinkText );
1539 }
1540 
1541 
1542 void KDialogBase::updateGeometry()
1543 {
1544  if( mTopLayout )
1545  {
1546  mTopLayout->setMargin( marginHint() );
1547  mTopLayout->setSpacing(spacingHint() );
1548  }
1549 }
1550 
1551 
1552 
1553 void KDialogBase::keyPressEvent( TQKeyEvent *e )
1554 {
1555  //
1556  // Reimplemented from KDialog to remove the default behavior
1557  // and to add F1 (help) sensitivity and some animation.
1558  //
1559  if( e->state() == 0 )
1560  {
1561  if( e->key() == Key_F1 )
1562  {
1563  TQPushButton *pb = actionButton( Help );
1564  if( pb )
1565  {
1566  pb->animateClick();
1567  e->accept();
1568  return;
1569  }
1570  }
1571  if( e->key() == Key_Escape )
1572  {
1573  TQPushButton *pb = actionButton( mEscapeButton );
1574  if( pb )
1575  {
1576  pb->animateClick();
1577  e->accept();
1578  return;
1579  }
1580 
1581  }
1582  }
1583  else if( e->key() == Key_F1 && e->state() == ShiftButton )
1584  {
1585  TQWhatsThis::enterWhatsThisMode();
1586  e->accept();
1587  return;
1588  }
1589 
1590  // accept the dialog when Ctrl-Return is pressed
1591  else if ( e->state() == ControlButton &&
1592  (e->key() == Key_Return || e->key() == Key_Enter) )
1593  {
1594  TQPushButton *pb = actionButton( Ok );
1595  if ( pb )
1596  {
1597  pb->animateClick();
1598  e->accept();
1599  return;
1600  }
1601  }
1602 
1603  //
1604  // Do the default action instead. Note KDialog::keyPressEvent is bypassed
1605  //
1606  TQDialog::keyPressEvent(e);
1607 }
1608 
1609 
1610 
1611 void KDialogBase::hideEvent( TQHideEvent *ev )
1612 {
1613  emit hidden();
1614  if (!ev->spontaneous())
1615  {
1616  emit finished();
1617  }
1618 }
1619 
1620 
1621 
1622 void KDialogBase::closeEvent( TQCloseEvent *e )
1623 {
1624  TQPushButton *pb = actionButton( mEscapeButton );
1625  if( pb && isShown() ) {
1626  pb->animateClick();
1627  } else {
1628  TQDialog::closeEvent( e );
1629  }
1630 }
1631 
1632 void KDialogBase::cancel()
1633 {
1634  switch ( mEscapeButton ) {
1635  case Ok:
1636  slotOk();
1637  break;
1638  case User1: // == No
1639  if ( mMessageBoxMode )
1640  slotNo();
1641  else
1642  slotUser1();
1643  break;
1644  case User2: // == Yes
1645  if ( mMessageBoxMode )
1646  slotYes();
1647  else
1648  slotUser2();
1649  break;
1650  case User3:
1651  slotUser3();
1652  break;
1653  case Close:
1654  slotClose();
1655  break;
1656  case Cancel:
1657  default:
1658  slotCancel();
1659  }
1660 }
1661 
1662 bool KDialogBase::haveBackgroundTile()
1663 {
1664  return ( !mTile || mTile->get() );
1665 }
1666 
1667 // Deprecated. For compatibility only.
1668 const TQPixmap *KDialogBase::getBackgroundTile() { return backgroundTile(); }
1669 
1670 const TQPixmap *KDialogBase::backgroundTile()
1671 {
1672  return ( mTile ? mTile->get() : 0);
1673 }
1674 
1675 
1676 void KDialogBase::setBackgroundTile( const TQPixmap *pix )
1677 {
1678  if( mTile )
1679  {
1680  mTile->set( pix );
1681  }
1682 }
1683 
1684 
1685 void KDialogBase::updateBackground()
1686 {
1687  if( !mTile || !mTile->get() )
1688  {
1689  TQPixmap nullPixmap;
1690  setBackgroundPixmap(nullPixmap);
1691  if( d->mButton.box )
1692  {
1693  d->mButton.box->setBackgroundPixmap(nullPixmap);
1694  d->mButton.box->setBackgroundMode(PaletteBackground);
1695  }
1696  setBackgroundMode(PaletteBackground);
1697  }
1698  else
1699  {
1700  const TQPixmap *pix = mTile->get();
1701  setBackgroundPixmap(*pix);
1702  if( d->mButton.box )
1703  {
1704  d->mButton.box->setBackgroundPixmap(*pix);
1705  }
1706  showTile( mShowTile );
1707  }
1708 }
1709 
1710 
1711 void KDialogBase::showTile( bool state )
1712 {
1713  mShowTile = state;
1714  if( !mShowTile || !mTile || !mTile->get() )
1715  {
1716  setBackgroundMode(PaletteBackground);
1717  if( d->mButton.box )
1718  {
1719  d->mButton.box->setBackgroundMode(PaletteBackground);
1720  }
1721  if( mUrlHelp )
1722  {
1723  mUrlHelp->setBackgroundMode(PaletteBackground);
1724  }
1725  }
1726  else
1727  {
1728  const TQPixmap *pix = mTile->get();
1729  setBackgroundPixmap(*pix);
1730  if( d->mButton.box )
1731  {
1732  d->mButton.box->setBackgroundPixmap(*pix);
1733  }
1734  if( mUrlHelp )
1735  {
1736  mUrlHelp->setBackgroundPixmap(*pix);
1737  }
1738  }
1739 }
1740 
1741 TQSize KDialogBase::configDialogSize( const TQString& groupName ) const
1742 {
1743  return configDialogSize( *TDEGlobal::config(), groupName );
1744 }
1745 
1746 
1747 TQSize KDialogBase::configDialogSize( TDEConfig& config,
1748  const TQString& groupName ) const
1749 {
1750  int w, h;
1751  int scnum = TQApplication::desktop()->screenNumber(parentWidget());
1752  TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
1753 
1754  w = sizeHint().width();
1755  h = sizeHint().height();
1756 
1757  TDEConfigGroupSaver cs(&config, groupName);
1758  w = config.readNumEntry( TQString::fromLatin1("Width %1").arg( desk.width()), w );
1759  h = config.readNumEntry( TQString::fromLatin1("Height %1").arg( desk.height()), h );
1760 
1761  return TQSize( w, h );
1762 }
1763 
1764 
1765 void KDialogBase::saveDialogSize( const TQString& groupName, bool global )
1766 {
1767  saveDialogSize( *TDEGlobal::config(), groupName, global );
1768 }
1769 
1770 
1771 void KDialogBase::saveDialogSize( TDEConfig& config, const TQString& groupName,
1772  bool global ) const
1773 {
1774  int scnum = TQApplication::desktop()->screenNumber(parentWidget());
1775  TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
1776 
1777  TDEConfigGroupSaver cs(&config, groupName);
1778  TQSize sizeToSave = size();
1779 
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);
1784 }
1785 
1786 
1787 KDialogBaseButton::KDialogBaseButton( const KGuiItem &item, int key,
1788  TQWidget *parent, const char *name )
1789  : KPushButton( item, parent, name ), mKey(key)
1790 {
1791 }
1792 
1793 
1794 
1795 
1796 KDialogBaseTile::KDialogBaseTile( TQObject *parent, const char *name )
1797  : TQObject( parent, name ), mPixmap(0)
1798 {
1799 }
1800 
1801 
1802 KDialogBaseTile::~KDialogBaseTile()
1803 {
1804  cleanup();
1805 }
1806 
1807 
1808 void KDialogBaseTile::set( const TQPixmap *pix )
1809 {
1810  if( !pix )
1811  {
1812  cleanup();
1813  }
1814  else
1815  {
1816  if( !mPixmap )
1817  {
1818  mPixmap = new TQPixmap(*pix);
1819  }
1820  else
1821  {
1822  *mPixmap = *pix;
1823  }
1824  }
1825 
1826  emit pixmapChanged();
1827 }
1828 
1829 
1830 const TQPixmap *KDialogBaseTile::get() const
1831 {
1832  return mPixmap;
1833 }
1834 
1835 
1836 void KDialogBaseTile::cleanup()
1837 {
1838  delete mPixmap; mPixmap = 0;
1839 }
1840 
1841 void KDialogBase::virtual_hook( int id, void* data )
1842 { KDialog::virtual_hook( id, data ); }
1843 
1844 #include "kdialogbase.moc"
KDialogBaseButton
Used internally by KDialogBase.
Definition: kdialogbase_priv.h:32
KDialogBaseTile
Used internally by KDialogBase.
Definition: kdialogbase_priv.h:49
KDialogBase::enableButtonCancel
void enableButtonCancel(bool state)
Enable or disable (gray out) the Cancel button.
Definition: kdialogbase.cpp:860
KDialogBase::slotCancel
virtual void slotCancel()
Activated when the Cancel button has been clicked.
Definition: kdialogbase.cpp:1215
KDialogBase::setButtonOK
void setButtonOK(const KGuiItem &item=KStdGuiItem::ok())
Sets the appearance of the OK button.
Definition: kdialogbase.cpp:916
KDialogBase::enableButton
void enableButton(ButtonCode id, bool state)
Enable or disable (gray out) a general action button.
Definition: kdialogbase.cpp:838
KDialogBase::mainWidget
TQWidget * mainWidget()
Returns the main widget if any.
Definition: kdialogbase.cpp:1464
KDialogBase::showPage
bool showPage(int index)
Sets the page with index to be displayed.
Definition: kdialogbase.cpp:1470
KDialogBase::setButtonCancel
void setButtonCancel(const KGuiItem &item=KStdGuiItem::cancel())
Sets the appearance of the Cancel button.
Definition: kdialogbase.cpp:970
KDialogBase::helpClicked
void helpClicked()
The Help button was pressed.
KDialogBase::cancelClicked
void cancelClicked()
The Cancel button was pressed.
KDialogBase::slotApply
virtual void slotApply()
Activated when the Apply button has been clicked.
Definition: kdialogbase.cpp:1171
KDialogBase::closeEvent
virtual void closeEvent(TQCloseEvent *e)
Detects when a dialog is being closed from the window manager controls.
Definition: kdialogbase.cpp:1622
KDialogBase::setButtonGuiItem
void setButtonGuiItem(ButtonCode id, const KGuiItem &item)
Sets the KGuiItem directly for the button instead of using 3 methods to set the text,...
Definition: kdialogbase.cpp:975
KDialogBase::slotYes
virtual void slotYes()
Activated when the Yes button has been clicked.
Definition: kdialogbase.cpp:1201
KDialogBase::addVBoxPage
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.
Definition: kdialogbase.cpp:1309
KDialogBase::showButton
void showButton(ButtonCode id, bool state)
Hide or display a general action button.
Definition: kdialogbase.cpp:866
KDialogBase::setButtonTip
void setButtonTip(ButtonCode id, const TQString &text)
Sets the tooltip text of any button.
Definition: kdialogbase.cpp:1003
KDialogBase::apply
void apply()
Do not use this signal.
KDialogBase::unfoldTreeList
void unfoldTreeList(bool persist=false)
This function has only effect in TreeList mode.
Definition: kdialogbase.cpp:1061
KDialogBase::setMainWidget
void setMainWidget(TQWidget *widget)
Sets the main user definable widget.
Definition: kdialogbase.cpp:1431
KDialogBase::configDialogSize
TQSize configDialogSize(const TQString &groupName) const
read the dialogs size from the configuration according to the screen size.
Definition: kdialogbase.cpp:1741
KDialogBase::enableButtonSeparator
void enableButtonSeparator(bool state)
Hide or display the a separator line drawn between the action buttons an the main widget.
Definition: kdialogbase.cpp:389
KDialogBase::aboutToShowDetails
void aboutToShowDetails()
The detailsWidget is about to get shown.
KDialogBase::addWidgetBelowList
void addWidgetBelowList(TQWidget *widget)
Add a widget at the bottom of the TreeList/IconList.
Definition: kdialogbase.cpp:1067
KDialogBase::showButtonApply
void showButtonApply(bool state)
Hide or display the Apply button.
Definition: kdialogbase.cpp:882
KDialogBase::setButtonApplyText
void setButtonApplyText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) TDE_DEPRECATED
Definition: kdialogbase.cpp:922
KDialogBase::yesClicked
void yesClicked()
The Yes button was pressed.
KDialogBase::setButtonApply
void setButtonApply(const KGuiItem &item=KStdGuiItem::apply())
Sets the appearance of the Apply button.
Definition: kdialogbase.cpp:946
KDialogBase::slotTry
virtual void slotTry()
Activated when the Try button has been clicked.
Definition: kdialogbase.cpp:1177
KDialogBase::applyClicked
void applyClicked()
The Apply button was pressed.
KDialogBase::updateGeometry
void updateGeometry()
Updates the margins and spacings.
Definition: kdialogbase.cpp:1542
KDialogBase::plainPage
TQFrame * plainPage()
Retrieve the empty page when the predefined layout is used in Plain mode.
Definition: kdialogbase.cpp:420
KDialogBase::setHelp
void setHelp(const TQString &anchor, const TQString &appname=TQString::null)
Sets the help path and topic.
Definition: kdialogbase.cpp:1279
KDialogBase::addHBoxPage
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.
Definition: kdialogbase.cpp:1322
KDialogBase::enableButtonApply
void enableButtonApply(bool state)
Enable or disable (gray out) the Apply button.
Definition: kdialogbase.cpp:854
KDialogBase::setShowIconsInTreeList
void setShowIconsInTreeList(bool state)
This function has only effect in TreeList mode.
Definition: kdialogbase.cpp:1045
KDialogBase::enableButtonOK
void enableButtonOK(bool state)
Enable or disable (gray out) the OK button.
Definition: kdialogbase.cpp:848
KDialogBase::slotUser3
virtual void slotUser3()
Activated when the User3 button has been clicked.
Definition: kdialogbase.cpp:1183
KDialogBase::defaultClicked
void defaultClicked()
The Default button was pressed.
KDialogBase::slotNo
virtual void slotNo()
Activated when the Yes button has been clicked.
Definition: kdialogbase.cpp:1208
KDialogBase::setButtonWhatsThis
void setButtonWhatsThis(ButtonCode id, const TQString &text)
Sets the "What's this?" text of any button.
Definition: kdialogbase.cpp:1016
KDialogBase::setTreeListAutoResize
void setTreeListAutoResize(bool state)
This function has only effect in TreeList mode.
Definition: kdialogbase.cpp:1037
KDialogBase::hidden
void hidden()
The dialog is about to be hidden.
KDialogBase::tryClicked
void tryClicked()
The Try button was pressed.
KDialogBase::setEscapeButton
void setEscapeButton(ButtonCode id)
Sets the button that will be activated when the Escape key is pressed.
Definition: kdialogbase.cpp:365
KDialogBase::setButtonOKText
void setButtonOKText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) TDE_DEPRECATED
Definition: kdialogbase.cpp:894
KDialogBase::setFolderIcon
void setFolderIcon(const TQStringList &path, const TQPixmap &pixmap)
Sets the icon used in TreeList Mode for the given path.
Definition: kdialogbase.cpp:1351
KDialogBase::slotClose
virtual void slotClose()
Activated when the Close button has been clicked.
Definition: kdialogbase.cpp:1222
KDialogBase::haveBackgroundTile
static bool haveBackgroundTile()
Check whether the background tile is set or not.
Definition: kdialogbase.cpp:1662
KDialogBase::applyPressed
virtual void applyPressed()
Definition: kdialogbase.cpp:1235
KDialogBase::getBackgroundTile
static const TQPixmap * getBackgroundTile() TDE_DEPRECATED
Definition: kdialogbase.cpp:1668
KDialogBase::user2Clicked
void user2Clicked()
The User2 button was pressed.
KDialogBase::addGridPage
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.
Definition: kdialogbase.cpp:1337
KDialogBase::delayedDestruct
void delayedDestruct()
Destruct the Dialog delayed.
Definition: kdialogbase.cpp:280
KDialogBase::enableLinkedHelp
void enableLinkedHelp(bool state)
Display or hide the help link area on the top of the dialog.
Definition: kdialogbase.cpp:1241
KDialogBase::actionButton
TQPushButton * actionButton(ButtonCode id)
Returns the action button that corresponds to the id.
Definition: kdialogbase.cpp:832
KDialogBase::KDialogBase
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() .
Definition: kdialogbase.cpp:99
KDialogBase::activePageIndex
int activePageIndex() const
Returns the index of the active page.
Definition: kdialogbase.cpp:1476
KDialogBase::calculateSize
TQSize calculateSize(int w, int h) const
Calculate the size hint for the dialog.
Definition: kdialogbase.cpp:1528
KDialogBase::setButtonBoxOrientation
void setButtonBoxOrientation(int orientation)
Sets the orientation of the button box.
Definition: kdialogbase.cpp:345
KDialogBase::aboutToShowPage
void aboutToShowPage(TQWidget *page)
A page is about to be shown.
KDialogBase::showTile
void showTile(bool state)
Enable hiding of the background tile (if any).
Definition: kdialogbase.cpp:1711
KDialogBase::saveDialogSize
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...
Definition: kdialogbase.cpp:1765
KDialogBase::slotUser1
virtual void slotUser1()
Activated when the User1 button has been clicked.
Definition: kdialogbase.cpp:1195
KDialogBase::setInitialSize
void setInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
Definition: kdialogbase.cpp:537
KDialogBase::showButtonCancel
void showButtonCancel(bool state)
Hide or display the Cancel button.
Definition: kdialogbase.cpp:888
KDialogBase::makeVBoxMainWidget
TQVBox * makeVBoxMainWidget()
Make a main widget.
Definition: kdialogbase.cpp:1373
KDialogBase::ButtonCode
ButtonCode
Definition: kdialogbase.h:198
KDialogBase::User3
@ User3
Show User defined button 3.
Definition: kdialogbase.h:208
KDialogBase::Stretch
@ Stretch
Definition: kdialogbase.h:213
KDialogBase::Default
@ Default
Show Default button.
Definition: kdialogbase.h:200
KDialogBase::Close
@ Close
Show Close-button.
Definition: kdialogbase.h:205
KDialogBase::Filler
@ Filler
Definition: kdialogbase.h:212
KDialogBase::Details
@ Details
Show Details button.
Definition: kdialogbase.h:211
KDialogBase::NoDefault
@ NoDefault
Used when specifying a default button; indicates that no button should be marked by default.
Definition: kdialogbase.h:214
KDialogBase::User2
@ User2
Show User defined button 2.
Definition: kdialogbase.h:207
KDialogBase::Apply
@ Apply
Show Apply button.
Definition: kdialogbase.h:202
KDialogBase::Try
@ Try
Show Try button.
Definition: kdialogbase.h:203
KDialogBase::User1
@ User1
Show User defined button 1.
Definition: kdialogbase.h:206
KDialogBase::Help
@ Help
Show Help button.
Definition: kdialogbase.h:199
KDialogBase::Ok
@ Ok
Show Ok button.
Definition: kdialogbase.h:201
KDialogBase::Cancel
@ Cancel
Show Cancel-button.
Definition: kdialogbase.h:204
KDialogBase::No
@ No
Show No button.
Definition: kdialogbase.h:209
KDialogBase::Yes
@ Yes
Show Yes button.
Definition: kdialogbase.h:210
KDialogBase::addPage
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.
Definition: kdialogbase.cpp:1296
KDialogBase::addButtonBelowList
void addButtonBelowList(const TQString &text, TQObject *recv, const char *slot)
Add a button at the bottom of the TreeList/IconList.
Definition: kdialogbase.cpp:1073
KDialogBase::setHelpLinkText
void setHelpLinkText(const TQString &text)
Sets the text that is shown as the linked text.
Definition: kdialogbase.cpp:1286
KDialogBase::setRootIsDecorated
void setRootIsDecorated(bool state)
This function has only effect in TreeList mode.
Definition: kdialogbase.cpp:1053
KDialogBase::showButtonOK
void showButtonOK(bool state)
Hide or display the OK button.
Definition: kdialogbase.cpp:876
KDialogBase::okClicked
void okClicked()
The OK button was pressed.
KDialogBase::backgroundTile
static const TQPixmap * backgroundTile()
Returns a pointer to the background tile if there is one.
Definition: kdialogbase.cpp:1670
KDialogBase::incInitialSize
void incInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
Definition: kdialogbase.cpp:545
KDialogBase::user1Clicked
void user1Clicked()
The User1 button was pressed.
KDialogBase::hideEvent
virtual void hideEvent(TQHideEvent *)
Emits the hidden signal.
Definition: kdialogbase.cpp:1611
KDialogBase::disableResize
void disableResize()
Convenience method.
Definition: kdialogbase.cpp:531
KDialogBase::getContentsRect
TQRect getContentsRect() const TDE_DEPRECATED
Definition: kdialogbase.cpp:1489
KDialogBase::helpLinkText
TQString helpLinkText() const
Returns the help link text.
Definition: kdialogbase.cpp:1536
KDialogBase::user3Clicked
void user3Clicked()
The User3 button was pressed.
KDialogBase::setButtonCancelText
void setButtonCancelText(const TQString &text=TQString::null, const TQString &tooltip=TQString::null, const TQString &quickhelp=TQString::null) TDE_DEPRECATED
Definition: kdialogbase.cpp:952
KDialogBase::setIconListAllVisible
void setIconListAllVisible(bool state)
This function has only effect in IconList mode.
Definition: kdialogbase.cpp:1085
KDialogBase::makeGridMainWidget
TQGrid * makeGridMainWidget(int n, Orientation dir)
Make a main widget.
Definition: kdialogbase.cpp:1403
KDialogBase::helpClickedSlot
void helpClickedSlot(const TQString &)
Connected to help link label.
Definition: kdialogbase.cpp:1229
KDialogBase::finished
void finished()
The dialog has finished.
KDialogBase::getBorderWidths
void getBorderWidths(int &ulx, int &uly, int &lrx, int &lry) const TDE_DEPRECATED
Definition: kdialogbase.cpp:1510
KDialogBase::noClicked
void noClicked()
The No button was pressed.
KDialogBase::slotHelp
virtual void slotHelp()
Activated when the Help button has been clicked.
Definition: kdialogbase.cpp:1094
KDialogBase::slotDefault
virtual void slotDefault()
Activated when the Default button has been clicked.
Definition: kdialogbase.cpp:1102
KDialogBase::pageIndex
int pageIndex(TQWidget *widget) const
Returns the index of a page created with addPage(), addVBoxPage(), addHBoxPage() or addGridPage().
Definition: kdialogbase.cpp:1482
KDialogBase::updateBackground
void updateBackground()
This method is called automatically whenever the background has changed.
Definition: kdialogbase.cpp:1685
KDialogBase::slotDelayedDestruct
void slotDelayedDestruct()
Deletes the dialog immediately.
Definition: kdialogbase.cpp:288
KDialogBase::setDetails
void setDetails(bool showDetails)
Sets the status of the Details button.
Definition: kdialogbase.cpp:1127
KDialogBase::setDetailsWidget
void setDetailsWidget(TQWidget *detailsWidget)
Sets the widget that gets shown when "Details" is enabled.
Definition: kdialogbase.cpp:1112
KDialogBase::slotDetails
virtual void slotDetails()
Activated when the Details button has been clicked.
Definition: kdialogbase.cpp:1107
KDialogBase::makeMainWidget
TQFrame * makeMainWidget()
Make a main widget.
Definition: kdialogbase.cpp:1359
KDialogBase::setBackgroundTile
static void setBackgroundTile(const TQPixmap *pix)
Sets the background tile.
Definition: kdialogbase.cpp:1676
KDialogBase::slotUser2
virtual void slotUser2()
Activated when the User2 button has been clicked.
Definition: kdialogbase.cpp:1189
KDialogBase::~KDialogBase
~KDialogBase()
Destructor.
Definition: kdialogbase.cpp:211
KDialogBase::adjustSize
virtual void adjustSize()
Adjust the size of the dialog to fit the contents just before TQDialog::exec() or TQDialog::show() is...
Definition: kdialogbase.cpp:427
KDialogBase::slotOk
virtual void slotOk()
Activated when the Ok button has been clicked.
Definition: kdialogbase.cpp:1164
KDialogBase::keyPressEvent
virtual void keyPressEvent(TQKeyEvent *e)
Maps some keys to the actions buttons.
Definition: kdialogbase.cpp:1553
KDialogBase::cancel
void cancel()
Force closing the dialog, setting its result code to the one Esc would set.
Definition: kdialogbase.cpp:1632
KDialogBase::makeHBoxMainWidget
TQHBox * makeHBoxMainWidget()
Make a main widget.
Definition: kdialogbase.cpp:1388
KDialogBase::closeClicked
void closeClicked()
The Close button was pressed.
KDialogBase::setButtonText
void setButtonText(ButtonCode id, const TQString &text)
Sets the text of any button.
Definition: kdialogbase.cpp:986
KDialogBase::DialogType
DialogType
Definition: kdialogbase.h:238
KDialog
Dialog with extended non-modal support and methods for KDE standard compliance.
Definition: kdialog.h:53
KDialog::marginHint
static int marginHint()
Return the number of pixels you shall use between a dialog edge and the outermost widget(s) according...
Definition: kdialog.cpp:104
KDialog::spacingHint
static int spacingHint()
Return the number of pixels you shall use between widgets inside a dialog according to the KDE standa...
Definition: kdialog.cpp:110
KDialog::setCaption
virtual void setCaption(const TQString &caption)
Make a KDE compliant caption.
Definition: kdialog.cpp:122
KDialog::layoutHintChanged
void layoutHintChanged()
Emitted when the margin size and/or spacing size have changed.
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:39
KJanusWidget
Easy to use widget with many layouts.
Definition: kjanuswidget.h:68
KJanusWidget::setShowIconsInTreeList
virtual void setShowIconsInTreeList(bool state)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:842
KJanusWidget::pageIndex
virtual int pageIndex(TQWidget *widget) const
Returns the index of a page created with addPage , addVBoxPage , addHBoxPage or addGridPage .
Definition: kjanuswidget.cpp:670
KJanusWidget::isValid
virtual bool isValid() const
Use this to verify that no memory allocation failed.
Definition: kjanuswidget.cpp:213
KJanusWidget::unfoldTreeList
void unfoldTreeList(bool persist=false)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:854
KJanusWidget::minimumSizeHint
virtual TQSize minimumSizeHint() const
Returns the minimum size that must be made available for the widget so that UIs can be displayed prop...
Definition: kjanuswidget.cpp:761
KJanusWidget::setIconListAllVisible
virtual void setIconListAllVisible(bool state)
This function has only effect in IconList mode.
Definition: kjanuswidget.cpp:834
KJanusWidget::addHBoxPage
virtual TQHBox * addHBoxPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in TreeList, IconList or Tabbed mode.
Definition: kjanuswidget.cpp:318
KJanusWidget::setSwallowedWidget
virtual bool setSwallowedWidget(TQWidget *widget)
Defines the widget to be swallowed.
Definition: kjanuswidget.cpp:501
KJanusWidget::setRootIsDecorated
virtual void setRootIsDecorated(bool state)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:847
KJanusWidget::activePageIndex
virtual int activePageIndex() const
Returns the index of the page that are currently displayed.
Definition: kjanuswidget.cpp:646
KJanusWidget::setFolderIcon
virtual void setFolderIcon(const TQStringList &path, const TQPixmap &pixmap)
Sets the icon used in TreeList Mode for the given path.
Definition: kjanuswidget.cpp:493
KJanusWidget::addGridPage
virtual TQGrid * addGridPage(int n, Orientation dir, const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in either TreeList or Tabbed mode.
Definition: kjanuswidget.cpp:346
KJanusWidget::plainPage
virtual TQFrame * plainPage()
Returns the empty widget that is available in Plain mode.
Definition: kjanuswidget.cpp:219
KJanusWidget::setTreeListAutoResize
virtual void setTreeListAutoResize(bool state)
This function has only effect in TreeList mode.
Definition: kjanuswidget.cpp:822
KJanusWidget::addVBoxPage
virtual TQVBox * addVBoxPage(const TQString &item, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in TreeList, IconList or Tabbed mode.
Definition: kjanuswidget.cpp:293
KJanusWidget::addButtonBelowList
void addButtonBelowList(const TQString &text, TQObject *recv, const char *slot)
Add a button at the bottom of the TreeList/IconList.
Definition: kjanuswidget.cpp:876
KJanusWidget::showPage
virtual bool showPage(int index)
Raises the page which was added by addPage().
Definition: kjanuswidget.cpp:580
KJanusWidget::addWidgetBelowList
void addWidgetBelowList(TQWidget *widget)
Add a widget at the bottom of the TreeList/IconList.
Definition: kjanuswidget.cpp:868
KJanusWidget::addPage
virtual TQFrame * addPage(const TQString &item, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a new page when the class is used in TreeList, IconList or Tabbed mode.
Definition: kjanuswidget.cpp:266
KPushButton
This is nothing but a TQPushButton with drag-support and KGuiItem support.
Definition: kpushbutton.h:38
KPushButton::setGuiItem
void setGuiItem(const KGuiItem &item)
Sets the KGuiItem for this button.
Definition: kpushbutton.cpp:120
KSeparator
Standard horizontal or vertical separator.
Definition: kseparator.h:34
KSeparator::setOrientation
void setOrientation(int orient)
Set the orientation of the separator to orient.
Definition: kseparator.cpp:48
KURLLabel
A drop-in replacement for TQLabel that displays hyperlinks.
Definition: kurllabel.h:72
KURLLabel::setFloat
void setFloat(bool do_float=true)
Turns on or off the "float" feature.
Definition: kurllabel.cpp:281
KURLLabel::setUnderline
void setUnderline(bool on=true)
Turns on or off the underlining.
Definition: kurllabel.cpp:153
TDEConfigBase::readNumEntry
int readNumEntry(const TQString &pKey, int nDefault=0) const
TDEConfigBase::writeEntry
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
TDEConfigGroupSaver
TDEConfig
TDEGlobalSettings::buttonLayout
static int buttonLayout()
TDEGlobal::config
static TDEConfig * config()
endl
kndbgstream & endl(kndbgstream &s)
kdDebug
kdbgstream kdDebug(int area=0)
TDEStdAccel::name
TQString name(StdAccel id)
tdelocale.h

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.1
This website is maintained by Timothy Pearson.