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

tdeui

  • tdeui
tdeaboutdialog.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 <espensa@online.no>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include <tqclipboard.h>
24 #include <tqimage.h>
25 #include <tqlabel.h>
26 #include <tqlayout.h>
27 #include <ktextedit.h>
28 #include <tqobjectlist.h>
29 #include <tqpainter.h>
30 #include <tqrect.h>
31 #include <tqtabwidget.h>
32 #include <tqtabbar.h>
33 
34 #include <tdeapplication.h>
35 #include <tdeglobal.h>
36 #include <tdeglobalsettings.h>
37 #include <tdelocale.h>
38 #include <ktextbrowser.h>
39 #include <kurllabel.h>
40 #include <tdeaboutdialog.h>
41 #include <kaboutdialog_private.h>
42 #include <kdebug.h>
43 
44 //MOC_SKIP_BEGIN
45 template class TQPtrList<TDEAboutContributor>;
46 //MOC_SKIP_END
47 
48 #define WORKTEXT_IDENTATION 16
49 #define Grid 3
50 
51 // ##############################################################
52 // MOC OUTPUT FILES:
53 #include "tdeaboutdialog.moc"
54 #include "kaboutdialog_private.moc"
55 // ##############################################################
56 
57 class TDEAboutTabWidget : public TQTabWidget
58 {
59 public:
60  TDEAboutTabWidget( TQWidget* parent ) : TQTabWidget( parent ) {}
61  TQSize sizeHint() const {
62  return TQTabWidget::sizeHint().expandedTo( tabBar()->sizeHint() + TQSize(4,4) );
63  }
64 };
65 
66 
67 
68 
69 TDEAboutContributor::TDEAboutContributor( TQWidget *_parent, const char *wname,
70  const TQString &_name,const TQString &_email,
71  const TQString &_url, const TQString &_work,
72  bool showHeader, bool showFrame,
73  bool showBold )
74  : TQFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0)
75 {
76  if( showFrame )
77  {
78  setFrameStyle(TQFrame::Panel | TQFrame::Raised);
79  }
80 
81  mLabel[0] = new TQLabel( this );
82  mLabel[1] = new TQLabel( this );
83  mLabel[2] = new TQLabel( this );
84  mLabel[3] = new TQLabel( this );
85  mText[0] = new TQLabel( this );
86  mText[1] = new KURLLabel( this );
87  mText[2] = new KURLLabel( this );
88  mText[3] = new TQLabel( this );
89 
90  setName( _name, i18n("Author"), false );
91  setEmail( _email, i18n("Email"), false );
92  setURL( _url, i18n("Homepage"), false );
93  setWork( _work, i18n("Task"), false );
94 
95  KURLLabel *kurl = static_cast<KURLLabel *>(mText[1]);
96  kurl->setFloat(true);
97  kurl->setUnderline(true);
98  kurl->setMargin(0);
99  connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)),
100  TQT_SLOT(emailClickedSlot(const TQString &)));
101 
102  kurl = static_cast<KURLLabel *>(mText[2]);
103  kurl->setFloat(true);
104  kurl->setUnderline(true);
105  kurl->setMargin(0);
106  connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)),
107  TQT_SLOT(urlClickedSlot(const TQString &)));
108 
109  mLabel[3]->setAlignment( AlignTop );
110 
111  fontChange( font() );
112  updateLayout();
113 }
114 
115 
116 void TDEAboutContributor::setName( const TQString &_text, const TQString &_header,
117  bool _update )
118 {
119  mLabel[0]->setText(_header);
120  mText[0]->setText(_text);
121  if( _update ) { updateLayout(); }
122 }
123 
124 
125 void TDEAboutContributor::setEmail( const TQString &_text, const TQString &_header,
126  bool _update )
127 {
128  mLabel[1]->setText(_header);
129  KURLLabel* const kurl = static_cast<KURLLabel *>(mText[1]);
130  kurl->setText(_text);
131  kurl->setURL(_text);
132  if( _update ) { updateLayout(); }
133 }
134 
135 
136 void TDEAboutContributor::setURL( const TQString &_text, const TQString &_header,
137  bool _update )
138 {
139  mLabel[2]->setText(_header);
140  KURLLabel* const kurl = static_cast<KURLLabel *>(mText[2]);
141  kurl->setText(_text);
142  kurl->setURL(_text);
143  if( _update ) { updateLayout(); }
144 }
145 
146 
147 void TDEAboutContributor::setWork( const TQString &_text, const TQString &_header,
148  bool _update )
149 {
150  mLabel[3]->setText(_header);
151  mText[3]->setText(_text);
152  if( _update ) { updateLayout(); }
153 }
154 
155 
156 TQString TDEAboutContributor::getName( void ) const
157 {
158  return mText[0]->text();
159 }
160 
161 
162 TQString TDEAboutContributor::getEmail( void ) const
163 {
164  return mText[1]->text();
165 }
166 
167 
168 TQString TDEAboutContributor::getURL( void ) const
169 {
170  return mText[2]->text();
171 }
172 
173 
174 TQString TDEAboutContributor::getWork( void ) const
175 {
176  return mText[3]->text();
177 }
178 
179 
180 
181 void TDEAboutContributor::updateLayout( void )
182 {
183  delete layout();
184 
185  int row = 0;
186  if( !mText[0]->text().isEmpty() ) { ++row; }
187  if( !mText[1]->text().isEmpty() ) { ++row; }
188  if( !mText[2]->text().isEmpty() ) { ++row; }
189  if( !mText[3]->text().isEmpty() ) { ++row; }
190 
191 
192  TQGridLayout *gbox;
193  if( row == 0 )
194  {
195  gbox = new TQGridLayout( this, 1, 1, 0 );
196  for( int i=0; i<4; ++i )
197  {
198  mLabel[i]->hide();
199  mText[i]->hide();
200  }
201  }
202  else
203  {
204  if( mText[0]->text().isEmpty() && !mShowHeader )
205  {
206  gbox = new TQGridLayout( this, row, 1, frameWidth()+1, 2 );
207  }
208  else
209  {
210  gbox = new TQGridLayout( this, row, 2, frameWidth()+1, 2 );
211  if( !mShowHeader )
212  {
213  gbox->addColSpacing( 0, KDialog::spacingHint()*2 );
214  }
215  gbox->setColStretch( 1, 10 );
216  }
217 
218  for( int i=0, r=0; i<4; ++i )
219  {
220  mLabel[i]->setFixedHeight( fontMetrics().lineSpacing() );
221  if( i != 3 )
222  {
223  mText[i]->setFixedHeight( fontMetrics().lineSpacing() );
224  }
225 
226  if( !mText[i]->text().isEmpty() )
227  {
228  if( mShowHeader )
229  {
230  gbox->addWidget( TQT_TQWIDGET(mLabel[i]), r, 0, (TQ_Alignment)AlignLeft );
231  gbox->addWidget( TQT_TQWIDGET(mText[i]), r, 1, (TQ_Alignment)AlignLeft );
232  mLabel[i]->show();
233  mText[i]->show();
234  }
235  else
236  {
237  mLabel[i]->hide();
238  if( !i )
239  {
240  gbox->addMultiCellWidget( TQT_TQWIDGET(mText[i]), r, r, 0, 1, (TQ_Alignment)AlignLeft );
241  }
242  else
243  {
244  gbox->addWidget( TQT_TQWIDGET(mText[i]), r, 1, (TQ_Alignment)AlignLeft );
245  }
246  mText[i]->show();
247  }
248  ++r;
249  }
250  else
251  {
252  mLabel[i]->hide();
253  mText[i]->hide();
254  }
255  }
256  }
257 
258  gbox->activate();
259  setMinimumSize( sizeHint() );
260 }
261 
262 
263 void TDEAboutContributor::fontChange( const TQFont &/*oldFont*/ )
264 {
265  if( mShowBold )
266  {
267  TQFont f( font() );
268  f.setBold( true );
269  mText[0]->setFont( f );
270  }
271  update();
272 }
273 
274 
275 TQSize TDEAboutContributor::sizeHint( void ) const
276 {
277  return minimumSizeHint();
278 }
279 
280 
281 void TDEAboutContributor::urlClickedSlot( const TQString &u )
282 {
283  emit openURL(u);
284 }
285 
286 
287 void TDEAboutContributor::emailClickedSlot( const TQString &e )
288 {
289  emit sendEmail( mText[0]->text(), e ) ;
290 }
291 
292 
293 //
294 // Internal widget for the TDEAboutDialog class.
295 //
296 TDEAboutContainerBase::TDEAboutContainerBase( int layoutType, TQWidget *_parent,
297  char *_name )
298  : TQWidget( _parent, _name ),
299  mImageLabel(0), mTitleLabel(0), mIconLabel(0),mVersionLabel(0),
300  mAuthorLabel(0), mImageFrame(0),mPageTab(0),mPlainSpace(0),d(0)
301 {
302  mTopLayout = new TQVBoxLayout( this, 0, KDialog::spacingHint() );
303  if( !mTopLayout ) { return; }
304 
305  if( layoutType & AbtImageOnly )
306  {
307  layoutType &= ~(AbtImageLeft|AbtImageRight|AbtTabbed|AbtPlain);
308  }
309  if( layoutType & AbtImageLeft )
310  {
311  layoutType &= ~AbtImageRight;
312  }
313 
314  if( layoutType & AbtTitle )
315  {
316  mTitleLabel = new TQLabel( this, "title" );
317  mTitleLabel->setAlignment(AlignCenter);
318  mTopLayout->addWidget( mTitleLabel );
319  mTopLayout->addSpacing( KDialog::spacingHint() );
320  }
321 
322  if( layoutType & AbtProduct )
323  {
324  TQWidget* const productArea = new TQWidget( this, "area" );
325  mTopLayout->addWidget( productArea, 0, TQApplication::reverseLayout() ? AlignRight : AlignLeft );
326 
327  TQHBoxLayout* const hbox = new TQHBoxLayout(productArea,0,KDialog::spacingHint());
328  if( !hbox ) { return; }
329 
330  mIconLabel = new TQLabel( productArea );
331  hbox->addWidget( mIconLabel, 0, AlignLeft|AlignHCenter );
332 
333  TQVBoxLayout* const vbox = new TQVBoxLayout();
334  if( !vbox ) { return; }
335  hbox->addLayout( vbox );
336 
337  mVersionLabel = new TQLabel( productArea, "version" );
338  mAuthorLabel = new TQLabel( productArea, "author" );
339  vbox->addWidget( mVersionLabel );
340  vbox->addWidget( mAuthorLabel );
341  hbox->activate();
342 
343  mTopLayout->addSpacing( KDialog::spacingHint() );
344  }
345 
346  TQHBoxLayout* const hbox = new TQHBoxLayout();
347  if( !hbox ) { return; }
348  mTopLayout->addLayout( hbox, 10 );
349 
350  if( layoutType & AbtImageLeft )
351  {
352  TQVBoxLayout* vbox = new TQVBoxLayout();
353  hbox->addLayout(vbox);
354  vbox->addSpacing(1);
355  mImageFrame = new TQFrame( this );
356  setImageFrame( true );
357  vbox->addWidget( mImageFrame );
358  vbox->addSpacing(1);
359 
360  vbox = new TQVBoxLayout( mImageFrame, 1 );
361  mImageLabel = new KImageTrackLabel( mImageFrame );
362  connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )),
363  TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) );
364  vbox->addStretch(10);
365  vbox->addWidget( mImageLabel );
366  vbox->addStretch(10);
367  vbox->activate();
368  }
369 
370  if( layoutType & AbtTabbed )
371  {
372  mPageTab = new TDEAboutTabWidget( this );
373  if( !mPageTab ) { return; }
374  hbox->addWidget( mPageTab, 10 );
375  }
376  else if( layoutType & AbtImageOnly )
377  {
378  mImageFrame = new TQFrame( this );
379  setImageFrame( true );
380  hbox->addWidget( mImageFrame, 10 );
381 
382  TQGridLayout* const gbox = new TQGridLayout(mImageFrame, 3, 3, 1, 0 );
383  gbox->setRowStretch( 0, 10 );
384  gbox->setRowStretch( 2, 10 );
385  gbox->setColStretch( 0, 10 );
386  gbox->setColStretch( 2, 10 );
387 
388  mImageLabel = new KImageTrackLabel( mImageFrame );
389  connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )),
390  TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) );
391  gbox->addWidget( mImageLabel, 1, 1 );
392  gbox->activate();
393  }
394  else
395  {
396  mPlainSpace = new TQFrame( this );
397  if( !mPlainSpace ) { return; }
398  hbox->addWidget( mPlainSpace, 10 );
399  }
400 
401  if( layoutType & AbtImageRight )
402  {
403  TQVBoxLayout *vbox = new TQVBoxLayout();
404  hbox->addLayout(vbox);
405  vbox->addSpacing(1);
406  mImageFrame = new TQFrame( this );
407  setImageFrame( true );
408  vbox->addWidget( mImageFrame );
409  vbox->addSpacing(1);
410 
411  vbox = new TQVBoxLayout( mImageFrame, 1 );
412  mImageLabel = new KImageTrackLabel( mImageFrame );
413  connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )),
414  TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) );
415  vbox->addStretch(10);
416  vbox->addWidget( mImageLabel );
417  vbox->addStretch(10);
418  vbox->activate();
419  }
420 
421  fontChange( font() );
422 }
423 
424 
425 void TDEAboutContainerBase::show( void )
426 {
427  TQWidget::show();
428 }
429 
430 TQSize TDEAboutContainerBase::sizeHint( void ) const
431 {
432  return minimumSize().expandedTo( TQSize( TQWidget::sizeHint().width(), 0 ) );
433 }
434 
435 void TDEAboutContainerBase::fontChange( const TQFont &/*oldFont*/ )
436 {
437  if( mTitleLabel )
438  {
439  TQFont f( TDEGlobalSettings::generalFont() );
440  f.setBold( true );
441  int fs = f.pointSize();
442  if (fs == -1)
443  fs = TQFontInfo(f).pointSize();
444  f.setPointSize( fs+2 ); // Lets not make it too big
445  mTitleLabel->setFont(f);
446  }
447 
448  if( mVersionLabel )
449  {
450  TQFont f( TDEGlobalSettings::generalFont() );
451  f.setBold( true );
452  mVersionLabel->setFont(f);
453  mAuthorLabel->setFont(f);
454  mVersionLabel->parentWidget()->layout()->activate();
455  }
456 
457  update();
458 }
459 
460 TQFrame *TDEAboutContainerBase::addTextPage( const TQString &title,
461  const TQString &text,
462  bool richText, int numLines )
463 {
464  TQFrame* const page = addEmptyPage( title );
465  if( !page ) { return 0; }
466  if( numLines <= 0 ) { numLines = 10; }
467 
468  TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() );
469 
470  if( richText )
471  {
472  KTextBrowser* const browser = new KTextBrowser( page, "browser" );
473  browser->setHScrollBarMode( TQScrollView::AlwaysOff );
474  browser->setText( text );
475  browser->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
476 
477  vbox->addWidget(browser);
478  connect(browser, TQT_SIGNAL(urlClick(const TQString &)),
479  TQT_SLOT(slotUrlClick(const TQString &)));
480  connect(browser, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
481  TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
482  }
483  else
484  {
485  KTextEdit* const textEdit = new KTextEdit( page, "text" );
486  textEdit->setReadOnly( true );
487  textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
488  textEdit->setWordWrap( TQTextEdit::NoWrap );
489  vbox->addWidget( textEdit );
490  }
491 
492  return page;
493 }
494 
495 TQFrame *TDEAboutContainerBase::addLicensePage( const TQString &title,
496  const TQString &text, int numLines)
497 {
498  TQFrame* const page = addEmptyPage( title );
499  if( !page ) { return 0; }
500  if( numLines <= 0 ) { numLines = 10; }
501 
502  TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() );
503 
504  KTextEdit* const textEdit = new KTextEdit( page, "license" );
505  textEdit->setFont( TDEGlobalSettings::fixedFont() );
506  textEdit->setReadOnly( true );
507  textEdit->setWordWrap( TQTextEdit::NoWrap );
508  textEdit->setText( text );
509  textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
510  vbox->addWidget( textEdit );
511  return page;
512 }
513 
514 
515 TDEAboutContainer *TDEAboutContainerBase::addContainerPage( const TQString &title,
516  int childAlignment,
517  int innerAlignment )
518 {
519  if( !mPageTab )
520  {
521  kdDebug(291) << "addPage: " << "Invalid layout" << endl;
522  return 0;
523  }
524 
525  TDEAboutContainer* const container = new TDEAboutContainer( mPageTab, "container",
526  KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
527  innerAlignment );
528  mPageTab->addTab( container, title );
529 
530  connect(container, TQT_SIGNAL(urlClick(const TQString &)),
531  TQT_SLOT(slotUrlClick(const TQString &)));
532  connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
533  TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
534 
535  return container;
536 }
537 
538 
539 TDEAboutContainer *TDEAboutContainerBase::addScrolledContainerPage(
540  const TQString &title,
541  int childAlignment,
542  int innerAlignment )
543 {
544  if( !mPageTab )
545  {
546  kdDebug(291) << "addPage: " << "Invalid layout" << endl;
547  return 0;
548  }
549 
550  TQFrame* const page = addEmptyPage( title );
551  TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() );
552  TQScrollView* const scrollView = new TQScrollView( page );
553  scrollView->viewport()->setBackgroundMode( PaletteBackground );
554  vbox->addWidget( scrollView );
555 
556  TDEAboutContainer* const container = new TDEAboutContainer( scrollView, "container",
557  KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
558  innerAlignment );
559  scrollView->addChild( container );
560 
561 
562  connect(container, TQT_SIGNAL(urlClick(const TQString &)),
563  TQT_SLOT(slotUrlClick(const TQString &)));
564  connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
565  TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
566 
567  return container;
568 }
569 
570 
571 TQFrame *TDEAboutContainerBase::addEmptyPage( const TQString &title )
572 {
573  if( !mPageTab )
574  {
575  kdDebug(291) << "addPage: " << "Invalid layout" << endl;
576  return 0;
577  }
578 
579  TQFrame* const page = new TQFrame( mPageTab, title.latin1() );
580  page->setFrameStyle( TQFrame::NoFrame );
581 
582  mPageTab->addTab( page, title );
583  return page;
584 }
585 
586 
587 TDEAboutContainer *TDEAboutContainerBase::addContainer( int childAlignment,
588  int innerAlignment )
589 {
590  TDEAboutContainer* const container = new TDEAboutContainer( this, "container",
591  0, KDialog::spacingHint(), childAlignment, innerAlignment );
592  mTopLayout->addWidget( container, 0, childAlignment );
593 
594  connect(container, TQT_SIGNAL(urlClick(const TQString &)),
595  TQT_SLOT(slotUrlClick(const TQString &)));
596  connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
597  TQT_SLOT(slotMailClick(const TQString &,const TQString &)));
598 
599  return container;
600 }
601 
602 
603 
604 void TDEAboutContainerBase::setTitle( const TQString &title )
605 {
606  if( !mTitleLabel )
607  {
608  kdDebug(291) << "setTitle: " << "Invalid layout" << endl;
609  return;
610  }
611  mTitleLabel->setText(title);
612 }
613 
614 
615 void TDEAboutContainerBase::setImage( const TQString &fileName )
616 {
617  if( !mImageLabel )
618  {
619  kdDebug(291) << "setImage: " << "Invalid layout" << endl;
620  return;
621  }
622  if( fileName.isNull() )
623  {
624  return;
625  }
626 
627  const TQPixmap logo( fileName );
628  if( !logo.isNull() )
629  mImageLabel->setPixmap( logo );
630 
631  mImageFrame->layout()->activate();
632 }
633 
634 void TDEAboutContainerBase::setProgramLogo( const TQString &fileName )
635 {
636  if( fileName.isNull() )
637  {
638  return;
639  }
640 
641  const TQPixmap logo( fileName );
642  setProgramLogo( logo );
643 }
644 
645 void TDEAboutContainerBase::setProgramLogo( const TQPixmap &pixmap )
646 {
647  if( !mIconLabel )
648  {
649  kdDebug(291) << "setProgramLogo: " << "Invalid layout" << endl;
650  return;
651  }
652  if( !pixmap.isNull() )
653  {
654  mIconLabel->setPixmap( pixmap );
655  }
656 }
657 
658 void TDEAboutContainerBase::setImageBackgroundColor( const TQColor &color )
659 {
660  if( mImageFrame )
661  {
662  mImageFrame->setBackgroundColor( color );
663  }
664 }
665 
666 
667 void TDEAboutContainerBase::setImageFrame( bool state )
668 {
669  if( mImageFrame )
670  {
671  if( state )
672  {
673  mImageFrame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
674  mImageFrame->setLineWidth(1);
675  }
676  else
677  {
678  mImageFrame->setFrameStyle( TQFrame::NoFrame );
679  mImageFrame->setLineWidth(0);
680  }
681  }
682 }
683 
684 
685 void TDEAboutContainerBase::setProduct( const TQString &appName,
686  const TQString &version,
687  const TQString &author,
688  const TQString &year )
689 {
690  if( !mIconLabel )
691  {
692  kdDebug(291) << "setProduct: " << "Invalid layout" << endl;
693  return;
694  }
695 
696  if ( kapp )
697  {
698  mIconLabel->setPixmap( kapp->icon() );
699  kdDebug(291) << "setPixmap (iconName): " << kapp->iconName() << endl;
700  }
701  else
702  kdDebug(291) << "no kapp" << endl;
703 
704  const TQString msg1 = i18n("%1 %2 (Using Trinity %3)").arg(appName).arg(version).
705  arg(TQString::fromLatin1(TDE_VERSION_STRING));
706  const TQString msg2 = !year.isEmpty() ? i18n("%1 %2, %3").arg('©').arg(year).
707  arg(author) : TQString::fromLatin1("");
708 
709  //if (!year.isEmpty())
710  // msg2 = i18n("%1 %2, %3").arg('©').arg(year).arg(author);
711 
712  mVersionLabel->setText( msg1 );
713  mAuthorLabel->setText( msg2 );
714  if( msg2.isEmpty() )
715  {
716  mAuthorLabel->hide();
717  }
718 
719  mIconLabel->parentWidget()->layout()->activate();
720 }
721 
722 
723 void TDEAboutContainerBase::slotMouseTrack( int mode, const TQMouseEvent *e )
724 {
725  emit mouseTrack( mode, e );
726 }
727 
728 
729 void TDEAboutContainerBase::slotUrlClick( const TQString &url )
730 {
731  emit urlClick( url );
732 }
733 
734 void TDEAboutContainerBase::slotMailClick( const TQString &_name,
735  const TQString &_address )
736 {
737  emit mailClick( _name, _address );
738 }
739 
740 
741 
742 TDEAboutContainer::TDEAboutContainer( TQWidget *_parent, const char *_name,
743  int _margin, int _spacing,
744  int childAlignment, int innerAlignment )
745  : TQFrame( _parent, _name ), d(0)
746 {
747  mAlignment = innerAlignment;
748 
749  TQGridLayout* const gbox = new TQGridLayout( this, 3, 3, _margin, _spacing );
750  if( childAlignment & AlignHCenter )
751  {
752  gbox->setColStretch( 0, 10 );
753  gbox->setColStretch( 2, 10 );
754  }
755  else if( childAlignment & AlignRight )
756  {
757  gbox->setColStretch( 0, 10 );
758  }
759  else
760  {
761  gbox->setColStretch( 2, 10 );
762  }
763 
764  if( childAlignment & AlignVCenter )
765  {
766  gbox->setRowStretch( 0, 10 );
767  gbox->setRowStretch( 2, 10 );
768  }
769  else if( childAlignment & AlignRight )
770  {
771  gbox->setRowStretch( 0, 10 );
772  }
773  else
774  {
775  gbox->setRowStretch( 2, 10 );
776  }
777 
778  mVbox = new TQVBoxLayout( _spacing );
779  gbox->addLayout( mVbox, 1, 1 );
780  gbox->activate();
781 }
782 
783 
784 void TDEAboutContainer::childEvent( TQChildEvent *e )
785 {
786  if( !e->inserted() || !e->child()->isWidgetType() )
787  {
788  return;
789  }
790 
791  TQWidget* const w = static_cast<TQWidget *>(e->child());
792  mVbox->addWidget( w, 0, mAlignment );
793  const TQSize s( sizeHint() );
794  setMinimumSize( s );
795 
796  TQObjectList const l = childrenListObject(); // silence please
797  TQObjectListIterator itr( l );
798  TQObject * o;
799  while ( (o = itr.current()) ) {
800  ++itr;
801  if( o->isWidgetType() )
802  {
803  TQT_TQWIDGET(o)->setMinimumWidth( s.width() );
804  }
805  }
806 }
807 
808 
809 TQSize TDEAboutContainer::sizeHint( void ) const
810 {
811  //
812  // The size is computed by adding the sizeHint().height() of all
813  // widget children and taking the width of the widest child and adding
814  // layout()->margin() and layout()->spacing()
815  //
816 
817  TQSize total_size;
818 
819  int numChild = 0;
820  TQObjectList const l = childrenListObject(); // silence please
821 
822  TQObjectListIterator itr( l );
823  TQObject * o;
824  while ( (o = itr.current()) ) {
825  ++itr;
826  if( o->isWidgetType() )
827  {
828  ++numChild;
829  TQWidget* const w= TQT_TQWIDGET(o);
830 
831  TQSize s = w->minimumSize();
832  if( s.isEmpty() )
833  {
834  s = w->minimumSizeHint();
835  if( s.isEmpty() )
836  {
837  s = w->sizeHint();
838  if( s.isEmpty() )
839  {
840  s = TQSize( 100, 100 ); // Default size
841  }
842  }
843  }
844  total_size.setHeight( total_size.height() + s.height() );
845  if( s.width() > total_size.width() ) { total_size.setWidth( s.width() ); }
846  }
847  }
848 
849  if( numChild > 0 )
850  {
851  //
852  // Seems I have to add 1 to the height to properly show the border
853  // of the last entry if layout()->margin() is 0
854  //
855 
856  total_size.setHeight( total_size.height() + layout()->spacing()*(numChild-1) );
857  total_size += TQSize( layout()->margin()*2, layout()->margin()*2 + 1 );
858  }
859  else
860  {
861  total_size = TQSize( 1, 1 );
862  }
863  return total_size;
864 }
865 
866 
867 TQSize TDEAboutContainer::minimumSizeHint( void ) const
868 {
869  return sizeHint();
870 }
871 
872 
873 void TDEAboutContainer::addWidget( TQWidget *widget )
874 {
875  widget->reparent( this, 0, TQPoint(0,0) );
876 }
877 
878 
879 void TDEAboutContainer::addPerson( const TQString &_name, const TQString &_email,
880  const TQString &_url, const TQString &_task,
881  bool showHeader, bool showFrame,bool showBold)
882 {
883 
884  TDEAboutContributor* const cont = new TDEAboutContributor( this, "pers",
885  _name, _email, _url, _task, showHeader, showFrame, showBold );
886  connect( cont, TQT_SIGNAL( openURL(const TQString&)),
887  this, TQT_SIGNAL( urlClick(const TQString &)));
888  connect( cont, TQT_SIGNAL( sendEmail(const TQString &, const TQString &)),
889  this, TQT_SIGNAL( mailClick(const TQString &, const TQString &)));
890 }
891 
892 
893 void TDEAboutContainer::addTitle( const TQString &title, int alignment,
894  bool showFrame, bool showBold )
895 {
896 
897  TQLabel* const label = new TQLabel( title, this, "title" );
898  if( showBold )
899  {
900  TQFont labelFont( font() );
901  labelFont.setBold( true );
902  label->setFont( labelFont );
903  }
904  if( showFrame )
905  {
906  label->setFrameStyle(TQFrame::Panel | TQFrame::Raised);
907  }
908  label->setAlignment( alignment );
909 }
910 
911 
912 void TDEAboutContainer::addImage( const TQString &fileName, int alignment )
913 {
914  if( fileName.isNull() )
915  {
916  return;
917  }
918 
919  KImageTrackLabel* const label = new KImageTrackLabel( this, "image" );
920  const TQImage logo( fileName );
921  if( !logo.isNull() )
922  {
923  TQPixmap pix;
924  pix = logo;
925  label->setPixmap( pix );
926  }
927  label->setAlignment( alignment );
928 }
929 
930 #if 0
931 //MOC_SKIP_BEGIN
932 
938 class TDEAboutContributor : public QFrame
939 {
940  // ############################################################################
941  Q_OBJECT
942  // ----------------------------------------------------------------------------
943 public:
945  TDEAboutContributor(TQWidget* parent=0, const char* name=0);
947  void setName(const TQString&);
949  TQString getName();
951  void setEmail(const TQString&);
953  TQString getEmail();
955  void setURL(const TQString&);
957  TQString getURL();
960  void setWork(const TQString&);
963  TQSize sizeHint();
964  TQSize minimumSizeHint(void);
965  virtual void show( void );
966 
967  // ----------------------------------------------------------------------------
968 protected:
969  // events:
971  void resizeEvent(TQResizeEvent*);
973  void paintEvent(TQPaintEvent*);
975  TQLabel *name;
978  KURLLabel *email;
980  KURLLabel *url;
982  TQString work;
983  // ----------------------------------------------------------------------------
984 protected slots:
986  void urlClickedSlot(const TQString&);
988  void emailClickedSlot(const TQString& emailaddress);
989  // ----------------------------------------------------------------------------
990 signals:
992  void sendEmail(const TQString& name, const TQString& email);
994  void openURL(const TQString& url);
995  // ############################################################################
996 };
997 
998 
999 
1000 TDEAboutContributor::TDEAboutContributor(TQWidget* parent, const char* n)
1001  : TQFrame(parent, n),
1002  name(new TQLabel(this)),
1003  email(new KURLLabel(this)),
1004  url(new KURLLabel(this))
1005 {
1006  // ############################################################
1007  if(name==0 || email==0)
1008  { // this will nearly never happen (out of memory in about box?)
1009  kdDebug() << "TDEAboutContributor::TDEAboutContributor: Out of memory." << endl;
1010  tqApp->quit();
1011  }
1012  setFrameStyle(TQFrame::Panel | TQFrame::Raised);
1013  // -----
1014  connect(email, TQT_SIGNAL(leftClickedURL(const TQString&)),
1015  TQT_SLOT(emailClickedSlot(const TQString&)));
1016  connect(url, TQT_SIGNAL(leftClickedURL(const TQString&)),
1017  TQT_SLOT(urlClickedSlot(const TQString&)));
1018  // ############################################################
1019 }
1020 
1021 void
1022 TDEAboutContributor::setName(const TQString& n)
1023 {
1024  // ############################################################
1025  name->setText(n);
1026  // ############################################################
1027 }
1028 
1029 QString
1030 TDEAboutContributor::getName()
1031 {
1032  // ###########################################################
1033  return name->text();
1034  // ###########################################################
1035 }
1036 void
1037 TDEAboutContributor::setURL(const TQString& u)
1038 {
1039  // ###########################################################
1040  url->setText(u);
1041  // ###########################################################
1042 }
1043 
1044 QString
1045 TDEAboutContributor::getURL()
1046 {
1047  // ###########################################################
1048  return url->text();
1049  // ###########################################################
1050 }
1051 
1052 void
1053 TDEAboutContributor::setEmail(const TQString& e)
1054 {
1055  // ###########################################################
1056  email->setText(e);
1057  // ###########################################################
1058 }
1059 
1060 QString
1061 TDEAboutContributor::getEmail()
1062 {
1063  // ###########################################################
1064  return email->text();
1065  // ###########################################################
1066 }
1067 
1068 void
1069 TDEAboutContributor::emailClickedSlot(const TQString& e)
1070 {
1071  // ###########################################################
1072  kdDebug() << "TDEAboutContributor::emailClickedSlot: called." << endl;
1073  emit(sendEmail(name->text(), e));
1074  // ###########################################################
1075 }
1076 
1077 void
1078 TDEAboutContributor::urlClickedSlot(const TQString& u)
1079 {
1080  // ###########################################################
1081  kdDebug() << "TDEAboutContributor::urlClickedSlot: called." << endl;
1082  emit(openURL(u));
1083  // ###########################################################
1084 }
1085 
1086 void
1087 TDEAboutContributor::setWork(const TQString& w)
1088 {
1089  // ###########################################################
1090  work=w;
1091  // ###########################################################
1092 }
1093 
1094 #endif
1095 
1096 
1097 #if 0
1098 QSize
1099 TDEAboutContributor::sizeHint()
1100 {
1101  // ############################################################################
1102  const int FrameWidth=frameWidth();
1103  const int WorkTextWidth=200;
1104  int maxx, maxy;
1105  TQRect rect;
1106  // ----- first calculate name and email width:
1107  maxx=name->sizeHint().width();
1108  maxx=TQMAX(maxx, email->sizeHint().width()+WORKTEXT_IDENTATION);
1109  // ----- now determine "work" text rectangle:
1110  if(!work.isEmpty()) // save time
1111  {
1112  rect=fontMetrics().boundingRect
1113  (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
1114  }
1115  if(maxx<rect.width())
1116  {
1117  maxx=WorkTextWidth+WORKTEXT_IDENTATION;
1118  }
1119  maxx=TQMAX(maxx, url->sizeHint().width()+WORKTEXT_IDENTATION);
1120  // -----
1121  maxy=2*(name->sizeHint().height()+Grid); // need a space above the KURLLabels
1122  maxy+=/* email */ name->sizeHint().height();
1123  maxy+=rect.height();
1124  // -----
1125  maxx+=2*FrameWidth;
1126  maxy+=2*FrameWidth;
1127  return TQSize(maxx, maxy);
1128  // ############################################################################
1129 }
1130 
1131 TQSize TDEAboutContributor::minimumSizeHint(void)
1132 {
1133  return( sizeHint() );
1134 }
1135 
1136 
1137 void TDEAboutContributor::show( void )
1138 {
1139  TQFrame::show();
1140  setMinimumSize( sizeHint() );
1141 }
1142 
1143 
1144 
1145 void
1146 TDEAboutContributor::resizeEvent(TQResizeEvent*)
1147 { // the widgets are simply aligned from top to bottom, since the parent is
1148  // expected to respect the size hint
1149  // ############################################################################
1150  int framewidth=frameWidth(), childwidth=width()-2*framewidth;
1151  int cy=framewidth;
1152  // -----
1153  name->setGeometry
1154  (framewidth, framewidth, childwidth, name->sizeHint().height());
1155  cy=name->height()+Grid;
1156  email->setGeometry
1157  (framewidth+WORKTEXT_IDENTATION, cy,
1158  childwidth-WORKTEXT_IDENTATION, /* email */ name->sizeHint().height());
1159  cy+=name->height()+Grid;
1160  url->setGeometry
1161  (framewidth+WORKTEXT_IDENTATION, cy,
1162  childwidth-WORKTEXT_IDENTATION, /* url */ name->sizeHint().height());
1163  // the work text is drawn in the paint event
1164  // ############################################################################
1165 }
1166 
1167 
1168 void
1169 TDEAboutContributor::paintEvent(TQPaintEvent* e)
1170 { // the widgets are simply aligned from top to bottom, since the parent is
1171  // expected to respect the size hint (the widget is only used locally by now)
1172  // ############################################################################
1173  int cy=frameWidth()+name->height()+email->height()+Grid+url->height()+Grid;
1174  int h=height()-cy-frameWidth();
1175  int w=width()-WORKTEXT_IDENTATION-2*frameWidth();
1176  // -----
1177  TQFrame::paintEvent(e);
1178  if(work.isEmpty()) return;
1179  TQPainter paint(this); // construct painter only if there is something to draw
1180  // -----
1181  paint.drawText(WORKTEXT_IDENTATION, cy, w, h, AlignLeft | WordBreak, work);
1182  // ############################################################################
1183 }
1184 // MOC_SKIP_END
1185 #endif
1186 
1187 
1188 #if 0
1189 TQSize TDEAboutContributor::sizeHint( void )
1190 {
1191  int s = KDialog::spacingHint();
1192  int h = fontMetrics().lineSpacing()*3 + 2*s;
1193  int m = frameWidth();
1194 
1195  int w = name->sizeHint().width();
1196  w = TQMAX( w, email->sizeHint().width()+s);
1197  w = TQMAX( w, url->sizeHint().width()+s);
1198 
1199  if( work.isEmpty() == false )
1200  {
1201  const int WorkTextWidth=200;
1202  TQRect r = fontMetrics().boundingRect
1203  (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
1204  if( w < r.width() )
1205  {
1206  w = TQMAX( w, WorkTextWidth+s );
1207  }
1208  h += TQMAX( fontMetrics().lineSpacing(), r.height() ) + s;
1209  }
1210  return( TQSize( w + 2*m, h + 2*m ) );
1211 
1212 
1213  /*
1214  int s = 3;
1215  int m = frameWidth() + KDialog::spacingHint();
1216  int h = ls * 3 + s * 2;
1217  int w = name->sizeHint().width();
1218 
1219  w = TQMAX( w, email->sizeHint().width()+WORKTEXT_IDENTATION);
1220  w = TQMAX( w, url->sizeHint().width()+WORKTEXT_IDENTATION);
1221  if( work.isEmpty() == false )
1222  {
1223  const int WorkTextWidth=200;
1224 
1225  TQRect r = fontMetrics().boundingRect
1226  (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
1227  if( w < r.width() )
1228  {
1229  w = TQMAX( w, WorkTextWidth + WORKTEXT_IDENTATION );
1230  }
1231  h += r.height() + s;
1232  }
1233  return( TQSize( w + 2*m, h + 2*m ) );
1234  */
1235 }
1236 
1237 
1238 //
1239 // The widgets are simply aligned from top to bottom, since the parent is
1240 // expected to respect the size hint
1241 //
1242 void TDEAboutContributor::resizeEvent(TQResizeEvent*)
1243 {
1244  int x = frameWidth();
1245  int s = KDialog::spacingHint();
1246  int h = fontMetrics().lineSpacing();
1247  int w = width() - 2*x;
1248  int y = x;
1249 
1250  name->setGeometry( x, y, w, h );
1251  y += h + s;
1252  email->setGeometry( x+s, y, w-s, h );
1253  y += h + s;
1254  url->setGeometry( x+s, y, w-s, h );
1255 
1256  /*
1257  int x = frameWidth() + KDialog::spacingHint();
1258  int y = x;
1259  int w = width() - 2*x;
1260  int h = name->sizeHint().height();
1261  int s = 3;
1262 
1263  name->setGeometry( x, y, w, h );
1264  y += h + s;
1265  email->setGeometry( x+WORKTEXT_IDENTATION, y, w-WORKTEXT_IDENTATION, h );
1266  y += h + s;
1267  url->setGeometry( x+WORKTEXT_IDENTATION, y, w-WORKTEXT_IDENTATION, h );
1268  //
1269  // the work text is drawn in the paint event
1270  //
1271  */
1272 }
1273 
1274 
1275 
1276 void TDEAboutContributor::paintEvent( TQPaintEvent *e )
1277 {
1278  TQFrame::paintEvent(e);
1279  if(work.isEmpty()) return;
1280 
1281  int x = frameWidth() + KDialog::spacingHint();
1282  int h = fontMetrics().lineSpacing();
1283  int y = height() - frameWidth() - fontMetrics().lineSpacing();
1284  int w = width() - frameWidth()*2 - KDialog::spacingHint();
1285 
1286  TQPainter paint( this );
1287  paint.drawText( x, y, w, h, AlignLeft | WordBreak, work );
1288 
1289  /*
1290 
1291  int s = 3;
1292  int x = frameWidth() + KDialog::spacingHint() + WORKTEXT_IDENTATION;
1293  int w = width()-WORKTEXT_IDENTATION-2*(frameWidth()+KDialog::spacingHint());
1294  int y = frameWidth()+KDialog::spacingHint()+(name->sizeHint().height()+s)*3;
1295  int h = height()-y-frameWidth();
1296 
1297  TQPainter paint( this );
1298  paint.drawText( x, y, w, h, AlignLeft | WordBreak, work );
1299  */
1300 }
1301 #endif
1302 
1303 
1304 
1305 
1306 
1307 
1308 TDEAboutWidget::TDEAboutWidget(TQWidget *_parent, const char *_name)
1309  : TQWidget(_parent, _name),
1310  version(new TQLabel(this)),
1311  cont(new TQLabel(this)),
1312  logo(new TQLabel(this)),
1313  author(new TDEAboutContributor(this)),
1314  maintainer(new TDEAboutContributor(this)),
1315  showMaintainer(false),
1316  d(0)
1317 {
1318  // #################################################################
1319  if( !version || !cont || !logo || !author || !maintainer )
1320  {
1321  // this will nearly never happen (out of memory in about box?)
1322  kdDebug() << "TDEAboutWidget::TDEAboutWidget: Out of memory." << endl;
1323  tqApp->quit();
1324  }
1325  // -----
1326  cont->setText(i18n("Other Contributors:"));
1327  logo->setText(i18n("(No logo available)"));
1328  logo->setFrameStyle(TQFrame::Panel | TQFrame::Raised);
1329  version->setAlignment(AlignCenter);
1330  // -----
1331  connect(author, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)),
1332  TQT_SLOT(sendEmailSlot(const TQString&, const TQString&)));
1333  connect(author, TQT_SIGNAL(openURL(const TQString&)),
1334  TQT_SLOT(openURLSlot(const TQString&)));
1335  connect(maintainer, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)),
1336  TQT_SLOT(sendEmailSlot(const TQString&, const TQString&)));
1337  connect(maintainer, TQT_SIGNAL(openURL(const TQString&)),
1338  TQT_SLOT(openURLSlot(const TQString&)));
1339  // #################################################################
1340 }
1341 
1342 
1343 void
1344 TDEAboutWidget::adjust()
1345 {
1346  // #################################################################
1347  int cx, cy, tempx;
1348  int maintWidth, maintHeight;
1349  TQSize total_size;
1350  // -----
1351  if(showMaintainer)
1352  {
1353  total_size=maintainer->sizeHint();
1354  maintWidth=total_size.width();
1355  maintHeight=total_size.height();
1356  } else {
1357  maintWidth=0;
1358  maintHeight=0;
1359  }
1360  total_size=author->sizeHint();
1361  logo->adjustSize();
1362  cy=version->sizeHint().height()+Grid;
1363  cx=logo->width();
1364  tempx=TQMAX(total_size.width(), maintWidth);
1365  cx+=Grid+tempx;
1366  cx=TQMAX(cx, version->sizeHint().width());
1367  cy+=TQMAX(logo->height(),
1368  total_size.height()+(showMaintainer ? Grid+maintHeight : 0));
1369  // -----
1370  if(!contributors.isEmpty())
1371  {
1372  cx=TQMAX(cx, cont->sizeHint().width());
1373  cy+=cont->sizeHint().height()+Grid;
1374  TQPtrListIterator<TDEAboutContributor> _pos(contributors);
1375  TDEAboutContributor* currEntry;
1376  while ( (currEntry = _pos.current()) )
1377  {
1378  ++_pos;
1379  cy+=currEntry->sizeHint().height();
1380  }
1381  }
1382  // -----
1383  setMinimumSize(cx, cy);
1384  // #################################################################
1385 }
1386 
1387 void
1388 TDEAboutWidget::setLogo(const TQPixmap& i)
1389 {
1390  // ############################################################################
1391  logo->setPixmap(i);
1392  // ############################################################################
1393 }
1394 
1395 void TDEAboutWidget::sendEmailSlot(const TQString &_name, const TQString &_email)
1396 {
1397  emit(sendEmail(_name, _email));
1398 }
1399 
1400 void TDEAboutWidget::openURLSlot(const TQString& _url)
1401 {
1402  emit(openURL(_url));
1403 }
1404 
1405 void
1406 TDEAboutWidget::setAuthor(const TQString &_name, const TQString &_email,
1407  const TQString &_url, const TQString &_w)
1408 {
1409  // ############################################################################
1410  author->setName(_name);
1411  author->setEmail(_email);
1412  author->setURL(_url);
1413  author->setWork(_w);
1414  // ############################################################################
1415 }
1416 
1417 void
1418 TDEAboutWidget::setMaintainer(const TQString &_name, const TQString &_email,
1419  const TQString &_url, const TQString &_w)
1420 {
1421  // ############################################################################
1422  maintainer->setName(_name);
1423  maintainer->setEmail(_email);
1424  maintainer->setWork(_w);
1425  maintainer->setURL(_url);
1426  showMaintainer=true;
1427  // ############################################################################
1428 }
1429 
1430 void
1431 TDEAboutWidget::addContributor(const TQString &_name, const TQString &_email,
1432  const TQString &_url, const TQString &_w)
1433 {
1434  // ############################################################################
1435  TDEAboutContributor* const c=new TDEAboutContributor(this);
1436  // -----
1437  c->setName(_name);
1438  c->setEmail(_email);
1439  c->setURL(_url);
1440  c->setWork(_w);
1441  contributors.append(c);
1442  connect(c, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)),
1443  TQT_SLOT(sendEmailSlot(const TQString&, const TQString&)));
1444  connect(c, TQT_SIGNAL(openURL(const TQString&)), TQT_SLOT(openURLSlot(const TQString&)));
1445  // ############################################################################
1446 }
1447 
1448 void
1449 TDEAboutWidget::setVersion(const TQString &_name)
1450 {
1451  // ############################################################################
1452  version->setText(_name);
1453  // ############################################################################
1454 }
1455 
1456 void
1457 TDEAboutWidget::resizeEvent(TQResizeEvent*)
1458 {
1459  // ############################################################################
1460  int _x=0, _y, cx, tempx, tempy;
1461  // ----- set version label geometry:
1462  version->setGeometry(0, 0, width(), version->sizeHint().height());
1463  _y=version->height()+Grid;
1464  // ----- move logo to correct position:
1465  logo->adjustSize();
1466  logo->move(0, _y);
1467  // ----- move author and maintainer right to it:
1468  tempx=logo->width()+Grid;
1469  cx=width()-tempx;
1470  author->setGeometry
1471  (tempx, _y, cx, author->sizeHint().height());
1472  maintainer->setGeometry
1473  (tempx, _y+author->height()+Grid, cx, maintainer->sizeHint().height());
1474 
1475  _y+=TQMAX(logo->height(),
1476  author->height()+(showMaintainer ? Grid+maintainer->height() : 0));
1477  // -----
1478  if(!contributors.isEmpty())
1479  {
1480  tempy=cont->sizeHint().height();
1481  cont->setGeometry(0, _y, width(), tempy);
1482  cont->show();
1483  _y+=tempy+Grid;
1484  } else {
1485  cont->hide();
1486  }
1487  TQPtrListIterator<TDEAboutContributor> _pos(contributors);
1488  TDEAboutContributor* currEntry;
1489  while( (currEntry = _pos.current()) )
1490  {
1491  ++_pos;
1492  tempy=currEntry->sizeHint().height();
1493  // y+=Grid;
1494  currEntry->setGeometry(_x, _y, width(), tempy);
1495  _y+=tempy;
1496  }
1497  if(showMaintainer)
1498  {
1499  maintainer->show();
1500  } else {
1501  maintainer->hide();
1502  }
1503  // ############################################################################
1504 }
1505 
1506 TDEAboutDialog::TDEAboutDialog(TQWidget *_parent, const char *_name, bool modal)
1507  : KDialogBase(_parent, _name, modal, TQString::null, Ok, Ok ),
1508  about(new TDEAboutWidget(this)), mContainerBase(0), d(0)
1509 {
1510  // #################################################################
1511  if(!about)
1512  {
1513  // this will nearly never happen (out of memory in about box?)
1514  kdDebug() << "TDEAboutDialog::TDEAboutDialog: Out of memory." << endl;
1515  tqApp->quit();
1516  }
1517  setMainWidget(about);
1518  connect(about, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)),
1519  TQT_SLOT(sendEmailSlot(const TQString&, const TQString&)));
1520  connect(about, TQT_SIGNAL(openURL(const TQString&)),
1521  TQT_SLOT(openURLSlot(const TQString&)));
1522  // #################################################################
1523 }
1524 
1525 
1526 TDEAboutDialog::TDEAboutDialog( int layoutType, const TQString &_caption,
1527  int buttonMask, ButtonCode defaultButton,
1528  TQWidget *_parent, const char *_name, bool modal,
1529  bool separator, const TQString &user1,
1530  const TQString &user2, const TQString &user3 )
1531  :KDialogBase( _parent, _name, modal, TQString::null, buttonMask, defaultButton,
1532  separator, user1, user2, user3 ),
1533  about(0), d(0)
1534 {
1535  setPlainCaption( i18n("About %1").arg(_caption) );
1536 
1537  mContainerBase = new TDEAboutContainerBase( layoutType, this );
1538  setMainWidget(mContainerBase);
1539 
1540  connect( mContainerBase, TQT_SIGNAL(urlClick(const TQString &)),
1541  this, TQT_SLOT(openURLSlot(const TQString &)));
1542  connect( mContainerBase, TQT_SIGNAL(mailClick(const TQString &,const TQString &)),
1543  this, TQT_SLOT(sendEmailSlot(const TQString &,const TQString &)));
1544  connect( mContainerBase, TQT_SIGNAL(mouseTrack(int, const TQMouseEvent *)),
1545  this, TQT_SLOT(mouseTrackSlot(int, const TQMouseEvent *)));
1546 }
1547 
1548 
1549 void TDEAboutDialog::show( void )
1550 {
1551  adjust();
1552  if( mContainerBase ) { mContainerBase->show(); }
1553  TQDialog::show();
1554 }
1555 
1556 
1557 void TDEAboutDialog::show( TQWidget * /*centerParent*/ )
1558 {
1559  adjust();
1560  if( mContainerBase ) { mContainerBase->show(); }
1561  TQDialog::show();
1562 }
1563 
1564 
1565 void TDEAboutDialog::adjust()
1566 {
1567  if( !about ) { return; }
1568  about->adjust();
1569  //initializeGeometry();
1570  resize( sizeHint() );
1571 }
1572 
1573 
1574 void TDEAboutDialog::setLogo(const TQPixmap& i)
1575 {
1576  if( !about ) { return; }
1577  about->setLogo(i);
1578 }
1579 
1580 
1581 void TDEAboutDialog::setMaintainer(const TQString &_name, const TQString &_email,
1582  const TQString &_url, const TQString &_w)
1583 {
1584  // #################################################################
1585  if( !about ) { return; }
1586  about->setMaintainer(_name, _email, _url, _w);
1587  // #################################################################
1588 }
1589 
1590 void TDEAboutDialog::setAuthor(const TQString &_name, const TQString &_email,
1591  const TQString &_url, const TQString &_work)
1592 {
1593  // #################################################################
1594  if( !about ) { return; }
1595  about->setAuthor(_name, _email, _url, _work);
1596  // #################################################################
1597 }
1598 
1599 void TDEAboutDialog::addContributor(const TQString &_name, const TQString &_email,
1600  const TQString &_url, const TQString &_w)
1601 {
1602  // #################################################################
1603  if( !about ) { return; }
1604  about->addContributor(_name, _email, _url, _w);
1605  // #################################################################
1606 }
1607 
1608 void TDEAboutDialog::setVersion(const TQString &_name)
1609 {
1610  // #################################################################
1611  if( !about ) { return; }
1612  about->setVersion(_name);
1613  // #################################################################
1614 }
1615 
1616 void TDEAboutDialog::sendEmailSlot(const TQString& /*name*/, const TQString& email)
1617 {
1618  if ( kapp )
1619  kapp->invokeMailer( email, TQString::null );
1620  /*
1621  kdDebug() << "TDEAboutDialog::sendEmailSlot: request to send an email to "
1622  << name << ", " << email << endl;
1623  emit(sendEmail(name, email));
1624  */
1625 }
1626 
1627 void TDEAboutDialog::openURLSlot(const TQString& url)
1628 {
1629  if ( kapp )
1630  kapp->invokeBrowser( url );
1631  //kdDebug() << "TDEAboutDialog::openURLSlot: request to open URL " << url << endl;
1632  //emit(openURL(url));
1633 }
1634 
1635 
1636 void TDEAboutDialog::mouseTrackSlot( int /*mode*/, const TQMouseEvent * /*e*/ )
1637 {
1638  // By default we do nothing. This method must be reimplemented.
1639 }
1640 
1641 
1642 TQFrame *TDEAboutDialog::addTextPage( const TQString &title, const TQString &text,
1643  bool richText, int numLines )
1644 {
1645  if( !mContainerBase ) { return 0; }
1646  return mContainerBase->addTextPage( title, text, richText, numLines );
1647 }
1648 
1649 TQFrame *TDEAboutDialog::addLicensePage( const TQString &title, const TQString &text,
1650  int numLines )
1651 {
1652  if( !mContainerBase ) { return 0; }
1653  return mContainerBase->addLicensePage( title, text, numLines );
1654 }
1655 
1656 
1657 TDEAboutContainer *TDEAboutDialog::addContainerPage( const TQString &title,
1658  int childAlignment, int innerAlignment )
1659 {
1660  if( !mContainerBase ) { return 0; }
1661  return mContainerBase->addContainerPage( title, childAlignment,
1662  innerAlignment);
1663 }
1664 
1665 
1666 TDEAboutContainer *TDEAboutDialog::addScrolledContainerPage( const TQString &title,
1667  int childAlignment, int innerAlignment )
1668 {
1669  if( !mContainerBase ) { return 0; }
1670  return mContainerBase->addScrolledContainerPage( title, childAlignment,
1671  innerAlignment);
1672 }
1673 
1674 
1675 
1676 TQFrame *TDEAboutDialog::addPage( const TQString &title )
1677 {
1678  if( !mContainerBase ) { return 0; }
1679  return mContainerBase->addEmptyPage( title );
1680 }
1681 
1682 
1683 TDEAboutContainer *TDEAboutDialog::addContainer( int childAlignment,
1684  int innerAlignment )
1685 {
1686  if( !mContainerBase ) { return 0; }
1687  return mContainerBase->addContainer( childAlignment, innerAlignment );
1688 }
1689 
1690 
1691 void TDEAboutDialog::setTitle( const TQString &title )
1692 {
1693  if( !mContainerBase ) { return; }
1694  mContainerBase->setTitle( title );
1695 }
1696 
1697 
1698 void TDEAboutDialog::setImage( const TQString &fileName )
1699 {
1700  if( !mContainerBase ) { return; }
1701  mContainerBase->setImage( fileName );
1702 }
1703 
1704 // KDE4: remove
1705 void TDEAboutDialog::setIcon( const TQString &fileName )
1706 {
1707  if( !mContainerBase ) { return; }
1708  mContainerBase->setProgramLogo( fileName );
1709 }
1710 
1711 void TDEAboutDialog::setProgramLogo( const TQString &fileName )
1712 {
1713  if( !mContainerBase ) { return; }
1714  mContainerBase->setProgramLogo( fileName );
1715 }
1716 
1717 void TDEAboutDialog::setProgramLogo( const TQPixmap &pixmap )
1718 {
1719  if( !mContainerBase ) { return; }
1720  mContainerBase->setProgramLogo( pixmap );
1721 }
1722 
1723 void TDEAboutDialog::setImageBackgroundColor( const TQColor &color )
1724 {
1725  if( !mContainerBase ) { return; }
1726  mContainerBase->setImageBackgroundColor( color );
1727 }
1728 
1729 
1730 void TDEAboutDialog::setImageFrame( bool state )
1731 {
1732  if( !mContainerBase ) { return; }
1733  mContainerBase->setImageFrame( state );
1734 }
1735 
1736 
1737 void TDEAboutDialog::setProduct( const TQString &appName, const TQString &version,
1738  const TQString &author, const TQString &year )
1739 {
1740  if( !mContainerBase ) { return; }
1741  mContainerBase->setProduct( appName, version, author, year );
1742 }
1743 
1744 
1745 
1746 void TDEAboutDialog::imageURL( TQWidget *_parent, const TQString &_caption,
1747  const TQString &_path, const TQColor &_imageColor,
1748  const TQString &_url )
1749 {
1750  TDEAboutDialog a( AbtImageOnly, TQString::null, Close, Close, _parent, "image", true );
1751  a.setPlainCaption( _caption );
1752  a.setImage( _path );
1753  a.setImageBackgroundColor( _imageColor );
1754 
1755  TDEAboutContainer* const c = a.addContainer( AlignCenter, AlignCenter );
1756  if( c )
1757  {
1758  c->addPerson( TQString::null, TQString::null, _url, TQString::null );
1759  }
1760  a.exec();
1761 }
1762 
1763 
1764 
1765 
1766 //
1767 // A class that can can monitor mouse movements on the image
1768 //
1769 KImageTrackLabel::KImageTrackLabel( TQWidget *_parent, const char *_name, WFlags f )
1770  : TQLabel( _parent, _name, f )
1771 {
1772  setText( i18n("Image missing"));
1773 }
1774 
1775 void KImageTrackLabel::mousePressEvent( TQMouseEvent *e )
1776 {
1777  emit mouseTrack( MousePress, e );
1778 }
1779 
1780 void KImageTrackLabel::mouseReleaseEvent( TQMouseEvent *e )
1781 {
1782  emit mouseTrack( MouseRelease, e );
1783 }
1784 
1785 void KImageTrackLabel::mouseDoubleClickEvent( TQMouseEvent *e )
1786 {
1787  emit mouseTrack( MouseDoubleClick, e );
1788 }
1789 
1790 void KImageTrackLabel::mouseMoveEvent ( TQMouseEvent *e )
1791 {
1792  emit mouseTrack( MouseDoubleClick, e );
1793 }
1794 
1795 void TDEAboutDialog::virtual_hook( int id, void* data )
1796 { KDialogBase::virtual_hook( id, data ); }
1797 
TDEAboutDialog::TDEAboutDialog
TDEAboutDialog(TQWidget *parent=0, const char *name=0, bool modal=true)
The standard Qt constructor (Constructor I).
Definition: tdeaboutdialog.cpp:1506
TDEAboutDialog::setAuthor
void setAuthor(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
(Constructor I only) Sets the author's name and email address.
Definition: tdeaboutdialog.cpp:1590
KURLLabel::setURL
void setURL(const TQString &url)
Sets the URL for this label to url.
Definition: kurllabel.cpp:178
TDEAboutWidget::setVersion
void setVersion(const TQString &name)
Sets the text describing the version.
Definition: tdeaboutdialog.cpp:1449
KDialogBase::Close
Show Close-button.
Definition: kdialogbase.h:205
TDEAboutContributor
Used internally by TDEAboutWidget.
Definition: tdeaboutdialog.h:92
TDEAboutDialog::mouseTrackSlot
virtual void mouseTrackSlot(int mode, const TQMouseEvent *e)
(Constructor II only) Tells the position of the mouse cursor when the left mouse button is pressed ab...
Definition: tdeaboutdialog.cpp:1636
TDEAboutDialog::addContainerPage
TDEAboutContainer * addContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container to a tab box.
Definition: tdeaboutdialog.cpp:1657
TDEAboutDialog
A KDialogBase with predefined main widget.
Definition: tdeaboutdialog.h:283
TDEAboutDialog::mContainerBase
TDEAboutContainerBase * mContainerBase
The main widget (Constructor II)
Definition: tdeaboutdialog.h:604
KURLLabel
A drop-in replacement for TQLabel that displays hyperlinks.
Definition: kurllabel.h:71
TDEAboutDialog::addContainer
TDEAboutContainer * addContainer(int childAlignment, int innerAlignment)
(Constructor II only) Adds a container.
Definition: tdeaboutdialog.cpp:1683
KURLLabel::setMargin
virtual void setMargin(int margin)
Reimplemented for internal reasons, the API is not affected.
Definition: kurllabel.cpp:425
TDEAboutDialog::setLogo
void setLogo(const TQPixmap &)
(Constructor I only) Sets the image as the application logo.
Definition: tdeaboutdialog.cpp:1574
TDEAboutWidget::resizeEvent
void resizeEvent(TQResizeEvent *)
The resize event.
Definition: tdeaboutdialog.cpp:1457
KDialog::setPlainCaption
virtual void setPlainCaption(const TQString &caption)
Make a plain caption without any modifications.
Definition: kdialog.cpp:129
TDEAboutDialog::setIcon
void setIcon(const TQString &fileName) KDE_DEPRECATED
(Constructor II only) Define the program logo to be shown in the dialog.
Definition: tdeaboutdialog.cpp:1705
kdDebug
kdbgstream kdDebug(int area=0)
KDialogBase::ButtonCode
ButtonCode
Definition: kdialogbase.h:197
TDEAboutDialog::addScrolledContainerPage
TDEAboutContainer * addScrolledContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container inside a TQScrollView to a tab box.
Definition: tdeaboutdialog.cpp:1666
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
TDEAboutDialog::setTitle
void setTitle(const TQString &title)
(Constructor II only) Sets a title (not caption) in the uppermost area of the dialog.
Definition: tdeaboutdialog.cpp:1691
TDEAboutDialog::about
TDEAboutWidget * about
The main widget (Constructor I)
Definition: tdeaboutdialog.h:599
TDEAboutWidget::contributors
TQPtrList< TDEAboutContributor > contributors
A set of people who contributed to the application.
Definition: tdeaboutdialog.h:244
TDEAboutWidget::logo
TQLabel * logo
The frame showing the logo.
Definition: tdeaboutdialog.h:228
TDEAboutWidget::setMaintainer
void setMaintainer(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
Sets the maintainers name and email address.
Definition: tdeaboutdialog.cpp:1418
TDEAboutContainer
TDEAboutContainer can be used to make a application specific AboutDialog.
Definition: tdeaboutdialog.h:50
TDEAboutWidget::sendEmailSlot
void sendEmailSlot(const TQString &name, const TQString &email)
Catches the signals from the contributors elements.
Definition: tdeaboutdialog.cpp:1395
KTextEdit::setReadOnly
virtual void setReadOnly(bool readOnly)
Reimplemented to set a proper "deactivated" background color.
Definition: ktextedit.cpp:309
TDEAboutDialog::setProgramLogo
void setProgramLogo(const TQString &fileName)
Overloaded version of setProgramLogo(const TQPixmap& pixmap).
Definition: tdeaboutdialog.cpp:1711
tdelocale.h
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
KDialogBase::setMainWidget
void setMainWidget(TQWidget *widget)
Sets the main user definable widget.
Definition: kdialogbase.cpp:1431
TDEGlobalSettings::generalFont
static TQFont generalFont()
TDEAboutWidget::addContributor
void addContributor(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
Shows this person as one of the major contributors.
Definition: tdeaboutdialog.cpp:1431
TDEAboutDialog::setImage
void setImage(const TQString &fileName)
(Constructor II only) Define an image to be shown in the dialog.
Definition: tdeaboutdialog.cpp:1698
TDEAboutDialog::addTextPage
TQFrame * addTextPage(const TQString &title, const TQString &text, bool richText=false, int numLines=10)
(Constructor II only) Adds a text page to a tab box.
Definition: tdeaboutdialog.cpp:1642
KURLLabel::setFloat
void setFloat(bool do_float=true)
Turns on or off the "float" feature.
Definition: kurllabel.cpp:281
TDEAboutWidget::setLogo
void setLogo(const TQPixmap &)
Sets the image as the application logo.
Definition: tdeaboutdialog.cpp:1388
TDEAboutDialog::addContributor
void addContributor(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
(Constructor I only) Show this person as one of the major contributors.
Definition: tdeaboutdialog.cpp:1599
TDEAboutDialog::setVersion
void setVersion(const TQString &name)
(Constructor I only) Sets the text describing the version.
Definition: tdeaboutdialog.cpp:1608
TDEAboutWidget::openURL
void openURL(const TQString &url)
An URL has been clicked.
TDEAboutDialog::setImageBackgroundColor
void setImageBackgroundColor(const TQColor &color)
(Constructor II only) The image has a minimum size, but is centered within an area if the dialog box ...
Definition: tdeaboutdialog.cpp:1723
KTextBrowser
Extended TQTextBrowser.
Definition: ktextbrowser.h:42
TDEAboutContainerBase
Used internally by TDEAboutDialog.
Definition: kaboutdialog_private.h:69
TDEAboutDialog::setMaintainer
void setMaintainer(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
(Constructor I only) Sets the maintainer's name and email address.
Definition: tdeaboutdialog.cpp:1581
TDEAboutDialog::show
virtual void show(void)
Makes a modeless (modal = false in constructor) dialog visible.
Definition: tdeaboutdialog.cpp:1549
TDEAboutDialog::setImageFrame
void setImageFrame(bool state)
(Constructor II only) Enables or disables a frame around the image.
Definition: tdeaboutdialog.cpp:1730
KURLLabel::setUnderline
void setUnderline(bool on=true)
Turns on or off the underlining.
Definition: kurllabel.cpp:153
TDEAboutDialog::addLicensePage
TQFrame * addLicensePage(const TQString &title, const TQString &text, int numLines=10)
(Constructor II only) Adds a license page to a tab box.
Definition: tdeaboutdialog.cpp:1649
TDEAboutDialog::sendEmailSlot
void sendEmailSlot(const TQString &name, const TQString &email)
Connected to widget->sendEmail.
Definition: tdeaboutdialog.cpp:1616
TDEAboutDialog::adjust
void adjust()
Adjusts the dialog.
Definition: tdeaboutdialog.cpp:1565
TDEAboutDialog::addPage
TQFrame * addPage(const TQString &title)
(Constructor II only) Adds an empty page to a tab box.
Definition: tdeaboutdialog.cpp:1676
TDEAboutWidget::TDEAboutWidget
TDEAboutWidget(TQWidget *parent=0, const char *name=0)
The Qt constructor.
Definition: tdeaboutdialog.cpp:1308
TDEAboutDialog::imageURL
static void imageURL(TQWidget *parent, const TQString &caption, const TQString &path, const TQColor &imageColor, const TQString &url)
Create a modal dialog with an image in the upper area with a URL link below.
Definition: tdeaboutdialog.cpp:1746
TDEAboutWidget::sendEmail
void sendEmail(const TQString &name, const TQString &email)
An email address has been selected by the user.
TDEAboutDialog::openURLSlot
void openURLSlot(const TQString &url)
Open this URL.
Definition: tdeaboutdialog.cpp:1627
TDEAboutDialog::sendEmail
void sendEmail(const TQString &name, const TQString &email)
Send an email to this person.
TDEAboutWidget::setAuthor
void setAuthor(const TQString &name, const TQString &email, const TQString &url, const TQString &work)
Sets the author's name and email address.
Definition: tdeaboutdialog.cpp:1406
TDEAboutDialog::setProduct
void setProduct(const TQString &appName, const TQString &version, const TQString &author, const TQString &year)
(Constructor II only) Prints the application name, KDE version, author, a copyright sign and a year s...
Definition: tdeaboutdialog.cpp:1737
TDEGlobalSettings::fixedFont
static TQFont fixedFont()
endl
kndbgstream & endl(kndbgstream &s)
TDEAboutWidget::adjust
void adjust()
Adjust the minimum size (after setting the properties of the image and the labels.
Definition: tdeaboutdialog.cpp:1344
TDEStdAccel::name
TQString name(StdAccel id)
TDEAboutWidget
TDEAboutWidget is the main widget for TDEAboutDialog.
Definition: tdeaboutdialog.h:150
TDEAboutWidget::openURLSlot
void openURLSlot(const TQString &url)
Catches the clicked URLs.
Definition: tdeaboutdialog.cpp:1400
TDEStdAccel::label
TQString label(StdAccel id)
KImageTrackLabel
Used internally by TDEAboutContainerBase.
Definition: kaboutdialog_private.h:35
TDEAboutWidget::showMaintainer
bool showMaintainer
Show the maintainer?
Definition: tdeaboutdialog.h:240
KTextEdit
A KDE'ified QTextEdit.
Definition: ktextedit.h:43
TDEAboutDialog::openURL
void openURL(const TQString &url)
Open the selected URL.
TDEAboutWidget::maintainer
TDEAboutContributor * maintainer
The application maintainer.
Definition: tdeaboutdialog.h:236

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.