00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <qclipboard.h>
00024 #include <qimage.h>
00025 #include <qlabel.h>
00026 #include <qlayout.h>
00027 #include <ktextedit.h>
00028 #include <qobjectlist.h>
00029 #include <qpainter.h>
00030 #include <qrect.h>
00031 #include <qtabwidget.h>
00032 #include <qtabbar.h>
00033
00034 #include <kapplication.h>
00035 #include <kglobal.h>
00036 #include <kglobalsettings.h>
00037 #include <klocale.h>
00038 #include <ktextbrowser.h>
00039 #include <kurllabel.h>
00040 #include <kaboutdialog.h>
00041 #include <kaboutdialog_private.h>
00042 #include <kdebug.h>
00043
00044
00045 template class QPtrList<KAboutContributor>;
00046
00047
00048 #define WORKTEXT_IDENTATION 16
00049 #define Grid 3
00050
00051
00052
00053 #include "kaboutdialog.moc"
00054 #include "kaboutdialog_private.moc"
00055
00056
00057 class KAboutTabWidget : public QTabWidget
00058 {
00059 public:
00060 KAboutTabWidget( QWidget* parent ) : QTabWidget( parent ) {}
00061 QSize sizeHint() const {
00062 return QTabWidget::sizeHint().expandedTo( tabBar()->sizeHint() + QSize(4,4) );
00063 }
00064 };
00065
00066
00067
00068
00069 KAboutContributor::KAboutContributor( QWidget *_parent, const char *wname,
00070 const QString &_name,const QString &_email,
00071 const QString &_url, const QString &_work,
00072 bool showHeader, bool showFrame,
00073 bool showBold )
00074 : QFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0)
00075 {
00076 if( showFrame )
00077 {
00078 setFrameStyle(QFrame::Panel | QFrame::Raised);
00079 }
00080
00081 mLabel[0] = new QLabel( this );
00082 mLabel[1] = new QLabel( this );
00083 mLabel[2] = new QLabel( this );
00084 mLabel[3] = new QLabel( this );
00085 mText[0] = new QLabel( this );
00086 mText[1] = new KURLLabel( this );
00087 mText[2] = new KURLLabel( this );
00088 mText[3] = new QLabel( this );
00089
00090 setName( _name, i18n("Author"), false );
00091 setEmail( _email, i18n("Email"), false );
00092 setURL( _url, i18n("Homepage"), false );
00093 setWork( _work, i18n("Task"), false );
00094
00095 KURLLabel *kurl = static_cast<KURLLabel *>(mText[1]);
00096 kurl->setFloat(true);
00097 kurl->setUnderline(true);
00098 kurl->setMargin(0);
00099 connect(kurl, SIGNAL(leftClickedURL(const QString &)),
00100 SLOT(emailClickedSlot(const QString &)));
00101
00102 kurl = static_cast<KURLLabel *>(mText[2]);
00103 kurl->setFloat(true);
00104 kurl->setUnderline(true);
00105 kurl->setMargin(0);
00106 connect(kurl, SIGNAL(leftClickedURL(const QString &)),
00107 SLOT(urlClickedSlot(const QString &)));
00108
00109 mLabel[3]->setAlignment( AlignTop );
00110
00111 fontChange( font() );
00112 updateLayout();
00113 }
00114
00115
00116 void KAboutContributor::setName( const QString &_text, const QString &_header,
00117 bool _update )
00118 {
00119 mLabel[0]->setText(_header);
00120 mText[0]->setText(_text);
00121 if( _update ) { updateLayout(); }
00122 }
00123
00124
00125 void KAboutContributor::setEmail( const QString &_text, const QString &_header,
00126 bool _update )
00127 {
00128 mLabel[1]->setText(_header);
00129 KURLLabel* const kurl = static_cast<KURLLabel *>(mText[1]);
00130 kurl->setText(_text);
00131 kurl->setURL(_text);
00132 if( _update ) { updateLayout(); }
00133 }
00134
00135
00136 void KAboutContributor::setURL( const QString &_text, const QString &_header,
00137 bool _update )
00138 {
00139 mLabel[2]->setText(_header);
00140 KURLLabel* const kurl = static_cast<KURLLabel *>(mText[2]);
00141 kurl->setText(_text);
00142 kurl->setURL(_text);
00143 if( _update ) { updateLayout(); }
00144 }
00145
00146
00147 void KAboutContributor::setWork( const QString &_text, const QString &_header,
00148 bool _update )
00149 {
00150 mLabel[3]->setText(_header);
00151 mText[3]->setText(_text);
00152 if( _update ) { updateLayout(); }
00153 }
00154
00155
00156 QString KAboutContributor::getName( void ) const
00157 {
00158 return mText[0]->text();
00159 }
00160
00161
00162 QString KAboutContributor::getEmail( void ) const
00163 {
00164 return mText[1]->text();
00165 }
00166
00167
00168 QString KAboutContributor::getURL( void ) const
00169 {
00170 return mText[2]->text();
00171 }
00172
00173
00174 QString KAboutContributor::getWork( void ) const
00175 {
00176 return mText[3]->text();
00177 }
00178
00179
00180
00181 void KAboutContributor::updateLayout( void )
00182 {
00183 delete layout();
00184
00185 int row = 0;
00186 if( !mText[0]->text().isEmpty() ) { ++row; }
00187 if( !mText[1]->text().isEmpty() ) { ++row; }
00188 if( !mText[2]->text().isEmpty() ) { ++row; }
00189 if( !mText[3]->text().isEmpty() ) { ++row; }
00190
00191
00192 QGridLayout *gbox;
00193 if( row == 0 )
00194 {
00195 gbox = new QGridLayout( this, 1, 1, 0 );
00196 for( int i=0; i<4; ++i )
00197 {
00198 mLabel[i]->hide();
00199 mText[i]->hide();
00200 }
00201 }
00202 else
00203 {
00204 if( mText[0]->text().isEmpty() && !mShowHeader )
00205 {
00206 gbox = new QGridLayout( this, row, 1, frameWidth()+1, 2 );
00207 }
00208 else
00209 {
00210 gbox = new QGridLayout( this, row, 2, frameWidth()+1, 2 );
00211 if( !mShowHeader )
00212 {
00213 gbox->addColSpacing( 0, KDialog::spacingHint()*2 );
00214 }
00215 gbox->setColStretch( 1, 10 );
00216 }
00217
00218 for( int i=0, r=0; i<4; ++i )
00219 {
00220 mLabel[i]->setFixedHeight( fontMetrics().lineSpacing() );
00221 if( i != 3 )
00222 {
00223 mText[i]->setFixedHeight( fontMetrics().lineSpacing() );
00224 }
00225
00226 if( !mText[i]->text().isEmpty() )
00227 {
00228 if( mShowHeader )
00229 {
00230 gbox->addWidget( mLabel[i], r, 0, AlignLeft );
00231 gbox->addWidget( mText[i], r, 1, AlignLeft );
00232 mLabel[i]->show();
00233 mText[i]->show();
00234 }
00235 else
00236 {
00237 mLabel[i]->hide();
00238 if( !i )
00239 {
00240 gbox->addMultiCellWidget( mText[i], r, r, 0, 1, AlignLeft );
00241 }
00242 else
00243 {
00244 gbox->addWidget( mText[i], r, 1, AlignLeft );
00245 }
00246 mText[i]->show();
00247 }
00248 ++r;
00249 }
00250 else
00251 {
00252 mLabel[i]->hide();
00253 mText[i]->hide();
00254 }
00255 }
00256 }
00257
00258 gbox->activate();
00259 setMinimumSize( sizeHint() );
00260 }
00261
00262
00263 void KAboutContributor::fontChange( const QFont & )
00264 {
00265 if( mShowBold )
00266 {
00267 QFont f( font() );
00268 f.setBold( true );
00269 mText[0]->setFont( f );
00270 }
00271 update();
00272 }
00273
00274
00275 QSize KAboutContributor::sizeHint( void ) const
00276 {
00277 return minimumSizeHint();
00278 }
00279
00280
00281 void KAboutContributor::urlClickedSlot( const QString &u )
00282 {
00283 emit openURL(u);
00284 }
00285
00286
00287 void KAboutContributor::emailClickedSlot( const QString &e )
00288 {
00289 emit sendEmail( mText[0]->text(), e ) ;
00290 }
00291
00292
00293
00294
00295
00296 KAboutContainerBase::KAboutContainerBase( int layoutType, QWidget *_parent,
00297 char *_name )
00298 : QWidget( _parent, _name ),
00299 mImageLabel(0), mTitleLabel(0), mIconLabel(0),mVersionLabel(0),
00300 mAuthorLabel(0), mImageFrame(0),mPageTab(0),mPlainSpace(0),d(0)
00301 {
00302 mTopLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() );
00303 if( !mTopLayout ) { return; }
00304
00305 if( layoutType & AbtImageOnly )
00306 {
00307 layoutType &= ~(AbtImageLeft|AbtImageRight|AbtTabbed|AbtPlain);
00308 }
00309 if( layoutType & AbtImageLeft )
00310 {
00311 layoutType &= ~AbtImageRight;
00312 }
00313
00314 if( layoutType & AbtTitle )
00315 {
00316 mTitleLabel = new QLabel( this, "title" );
00317 mTitleLabel->setAlignment(AlignCenter);
00318 mTopLayout->addWidget( mTitleLabel );
00319 mTopLayout->addSpacing( KDialog::spacingHint() );
00320 }
00321
00322 if( layoutType & AbtProduct )
00323 {
00324 QWidget* const productArea = new QWidget( this, "area" );
00325 mTopLayout->addWidget( productArea, 0, QApplication::reverseLayout() ? AlignRight : AlignLeft );
00326
00327 QHBoxLayout* const hbox = new QHBoxLayout(productArea,0,KDialog::spacingHint());
00328 if( !hbox ) { return; }
00329
00330 mIconLabel = new QLabel( productArea );
00331 hbox->addWidget( mIconLabel, 0, AlignLeft|AlignHCenter );
00332
00333 QVBoxLayout* const vbox = new QVBoxLayout();
00334 if( !vbox ) { return; }
00335 hbox->addLayout( vbox );
00336
00337 mVersionLabel = new QLabel( productArea, "version" );
00338 mAuthorLabel = new QLabel( productArea, "author" );
00339 vbox->addWidget( mVersionLabel );
00340 vbox->addWidget( mAuthorLabel );
00341 hbox->activate();
00342
00343 mTopLayout->addSpacing( KDialog::spacingHint() );
00344 }
00345
00346 QHBoxLayout* const hbox = new QHBoxLayout();
00347 if( !hbox ) { return; }
00348 mTopLayout->addLayout( hbox, 10 );
00349
00350 if( layoutType & AbtImageLeft )
00351 {
00352 QVBoxLayout* vbox = new QVBoxLayout();
00353 hbox->addLayout(vbox);
00354 vbox->addSpacing(1);
00355 mImageFrame = new QFrame( this );
00356 setImageFrame( true );
00357 vbox->addWidget( mImageFrame );
00358 vbox->addSpacing(1);
00359
00360 vbox = new QVBoxLayout( mImageFrame, 1 );
00361 mImageLabel = new KImageTrackLabel( mImageFrame );
00362 connect( mImageLabel, SIGNAL(mouseTrack( int, const QMouseEvent * )),
00363 SLOT( slotMouseTrack( int, const QMouseEvent * )) );
00364 vbox->addStretch(10);
00365 vbox->addWidget( mImageLabel );
00366 vbox->addStretch(10);
00367 vbox->activate();
00368 }
00369
00370 if( layoutType & AbtTabbed )
00371 {
00372 mPageTab = new KAboutTabWidget( this );
00373 if( !mPageTab ) { return; }
00374 hbox->addWidget( mPageTab, 10 );
00375 }
00376 else if( layoutType & AbtImageOnly )
00377 {
00378 mImageFrame = new QFrame( this );
00379 setImageFrame( true );
00380 hbox->addWidget( mImageFrame, 10 );
00381
00382 QGridLayout* const gbox = new QGridLayout(mImageFrame, 3, 3, 1, 0 );
00383 gbox->setRowStretch( 0, 10 );
00384 gbox->setRowStretch( 2, 10 );
00385 gbox->setColStretch( 0, 10 );
00386 gbox->setColStretch( 2, 10 );
00387
00388 mImageLabel = new KImageTrackLabel( mImageFrame );
00389 connect( mImageLabel, SIGNAL(mouseTrack( int, const QMouseEvent * )),
00390 SLOT( slotMouseTrack( int, const QMouseEvent * )) );
00391 gbox->addWidget( mImageLabel, 1, 1 );
00392 gbox->activate();
00393 }
00394 else
00395 {
00396 mPlainSpace = new QFrame( this );
00397 if( !mPlainSpace ) { return; }
00398 hbox->addWidget( mPlainSpace, 10 );
00399 }
00400
00401 if( layoutType & AbtImageRight )
00402 {
00403 QVBoxLayout *vbox = new QVBoxLayout();
00404 hbox->addLayout(vbox);
00405 vbox->addSpacing(1);
00406 mImageFrame = new QFrame( this );
00407 setImageFrame( true );
00408 vbox->addWidget( mImageFrame );
00409 vbox->addSpacing(1);
00410
00411 vbox = new QVBoxLayout( mImageFrame, 1 );
00412 mImageLabel = new KImageTrackLabel( mImageFrame );
00413 connect( mImageLabel, SIGNAL(mouseTrack( int, const QMouseEvent * )),
00414 SLOT( slotMouseTrack( int, const QMouseEvent * )) );
00415 vbox->addStretch(10);
00416 vbox->addWidget( mImageLabel );
00417 vbox->addStretch(10);
00418 vbox->activate();
00419 }
00420
00421 fontChange( font() );
00422 }
00423
00424
00425 void KAboutContainerBase::show( void )
00426 {
00427 QWidget::show();
00428 }
00429
00430 QSize KAboutContainerBase::sizeHint( void ) const
00431 {
00432 return minimumSize().expandedTo( QSize( QWidget::sizeHint().width(), 0 ) );
00433 }
00434
00435 void KAboutContainerBase::fontChange( const QFont & )
00436 {
00437 if( mTitleLabel )
00438 {
00439 QFont f( KGlobalSettings::generalFont() );
00440 f.setBold( true );
00441 int fs = f.pointSize();
00442 if (fs == -1)
00443 fs = QFontInfo(f).pointSize();
00444 f.setPointSize( fs+2 );
00445 mTitleLabel->setFont(f);
00446 }
00447
00448 if( mVersionLabel )
00449 {
00450 QFont f( KGlobalSettings::generalFont() );
00451 f.setBold( true );
00452 mVersionLabel->setFont(f);
00453 mAuthorLabel->setFont(f);
00454 mVersionLabel->parentWidget()->layout()->activate();
00455 }
00456
00457 update();
00458 }
00459
00460 QFrame *KAboutContainerBase::addTextPage( const QString &title,
00461 const QString &text,
00462 bool richText, int numLines )
00463 {
00464 QFrame* const page = addEmptyPage( title );
00465 if( !page ) { return 0; }
00466 if( numLines <= 0 ) { numLines = 10; }
00467
00468 QVBoxLayout* const vbox = new QVBoxLayout( page, KDialog::spacingHint() );
00469
00470 if( richText )
00471 {
00472 KTextBrowser* const browser = new KTextBrowser( page, "browser" );
00473 browser->setHScrollBarMode( QScrollView::AlwaysOff );
00474 browser->setText( text );
00475 browser->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
00476
00477 vbox->addWidget(browser);
00478 connect(browser, SIGNAL(urlClick(const QString &)),
00479 SLOT(slotUrlClick(const QString &)));
00480 connect(browser, SIGNAL(mailClick(const QString &,const QString &)),
00481 SLOT(slotMailClick(const QString &,const QString &)));
00482 }
00483 else
00484 {
00485 KTextEdit* const textEdit = new KTextEdit( page, "text" );
00486 textEdit->setReadOnly( true );
00487 textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
00488 textEdit->setWordWrap( QTextEdit::NoWrap );
00489 vbox->addWidget( textEdit );
00490 }
00491
00492 return page;
00493 }
00494
00495 QFrame *KAboutContainerBase::addLicensePage( const QString &title,
00496 const QString &text, int numLines)
00497 {
00498 QFrame* const page = addEmptyPage( title );
00499 if( !page ) { return 0; }
00500 if( numLines <= 0 ) { numLines = 10; }
00501
00502 QVBoxLayout* const vbox = new QVBoxLayout( page, KDialog::spacingHint() );
00503
00504 KTextEdit* const textEdit = new KTextEdit( page, "license" );
00505 textEdit->setFont( KGlobalSettings::fixedFont() );
00506 textEdit->setReadOnly( true );
00507 textEdit->setWordWrap( QTextEdit::NoWrap );
00508 textEdit->setText( text );
00509 textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines );
00510 vbox->addWidget( textEdit );
00511 return page;
00512 }
00513
00514
00515 KAboutContainer *KAboutContainerBase::addContainerPage( const QString &title,
00516 int childAlignment,
00517 int innerAlignment )
00518 {
00519 if( !mPageTab )
00520 {
00521 kdDebug(291) << "addPage: " << "Invalid layout" << endl;
00522 return 0;
00523 }
00524
00525 KAboutContainer* const container = new KAboutContainer( mPageTab, "container",
00526 KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
00527 innerAlignment );
00528 mPageTab->addTab( container, title );
00529
00530 connect(container, SIGNAL(urlClick(const QString &)),
00531 SLOT(slotUrlClick(const QString &)));
00532 connect(container, SIGNAL(mailClick(const QString &,const QString &)),
00533 SLOT(slotMailClick(const QString &,const QString &)));
00534
00535 return container;
00536 }
00537
00538
00539 KAboutContainer *KAboutContainerBase::addScrolledContainerPage(
00540 const QString &title,
00541 int childAlignment,
00542 int innerAlignment )
00543 {
00544 if( !mPageTab )
00545 {
00546 kdDebug(291) << "addPage: " << "Invalid layout" << endl;
00547 return 0;
00548 }
00549
00550 QFrame* const page = addEmptyPage( title );
00551 QVBoxLayout* const vbox = new QVBoxLayout( page, KDialog::spacingHint() );
00552 QScrollView* const scrollView = new QScrollView( page );
00553 scrollView->viewport()->setBackgroundMode( PaletteBackground );
00554 vbox->addWidget( scrollView );
00555
00556 KAboutContainer* const container = new KAboutContainer( scrollView, "container",
00557 KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
00558 innerAlignment );
00559 scrollView->addChild( container );
00560
00561
00562 connect(container, SIGNAL(urlClick(const QString &)),
00563 SLOT(slotUrlClick(const QString &)));
00564 connect(container, SIGNAL(mailClick(const QString &,const QString &)),
00565 SLOT(slotMailClick(const QString &,const QString &)));
00566
00567 return container;
00568 }
00569
00570
00571 QFrame *KAboutContainerBase::addEmptyPage( const QString &title )
00572 {
00573 if( !mPageTab )
00574 {
00575 kdDebug(291) << "addPage: " << "Invalid layout" << endl;
00576 return 0;
00577 }
00578
00579 QFrame* const page = new QFrame( mPageTab, title.latin1() );
00580 page->setFrameStyle( QFrame::NoFrame );
00581
00582 mPageTab->addTab( page, title );
00583 return page;
00584 }
00585
00586
00587 KAboutContainer *KAboutContainerBase::addContainer( int childAlignment,
00588 int innerAlignment )
00589 {
00590 KAboutContainer* const container = new KAboutContainer( this, "container",
00591 0, KDialog::spacingHint(), childAlignment, innerAlignment );
00592 mTopLayout->addWidget( container, 0, childAlignment );
00593
00594 connect(container, SIGNAL(urlClick(const QString &)),
00595 SLOT(slotUrlClick(const QString &)));
00596 connect(container, SIGNAL(mailClick(const QString &,const QString &)),
00597 SLOT(slotMailClick(const QString &,const QString &)));
00598
00599 return container;
00600 }
00601
00602
00603
00604 void KAboutContainerBase::setTitle( const QString &title )
00605 {
00606 if( !mTitleLabel )
00607 {
00608 kdDebug(291) << "setTitle: " << "Invalid layout" << endl;
00609 return;
00610 }
00611 mTitleLabel->setText(title);
00612 }
00613
00614
00615 void KAboutContainerBase::setImage( const QString &fileName )
00616 {
00617 if( !mImageLabel )
00618 {
00619 kdDebug(291) << "setImage: " << "Invalid layout" << endl;
00620 return;
00621 }
00622 if( fileName.isNull() )
00623 {
00624 return;
00625 }
00626
00627 const QPixmap logo( fileName );
00628 if( !logo.isNull() )
00629 mImageLabel->setPixmap( logo );
00630
00631 mImageFrame->layout()->activate();
00632 }
00633
00634 void KAboutContainerBase::setProgramLogo( const QString &fileName )
00635 {
00636 if( fileName.isNull() )
00637 {
00638 return;
00639 }
00640
00641 const QPixmap logo( fileName );
00642 setProgramLogo( logo );
00643 }
00644
00645 void KAboutContainerBase::setProgramLogo( const QPixmap &pixmap )
00646 {
00647 if( !mIconLabel )
00648 {
00649 kdDebug(291) << "setProgramLogo: " << "Invalid layout" << endl;
00650 return;
00651 }
00652 if( !pixmap.isNull() )
00653 {
00654 mIconLabel->setPixmap( pixmap );
00655 }
00656 }
00657
00658 void KAboutContainerBase::setImageBackgroundColor( const QColor &color )
00659 {
00660 if( mImageFrame )
00661 {
00662 mImageFrame->setBackgroundColor( color );
00663 }
00664 }
00665
00666
00667 void KAboutContainerBase::setImageFrame( bool state )
00668 {
00669 if( mImageFrame )
00670 {
00671 if( state )
00672 {
00673 mImageFrame->setFrameStyle( QFrame::Panel | QFrame::Sunken );
00674 mImageFrame->setLineWidth(1);
00675 }
00676 else
00677 {
00678 mImageFrame->setFrameStyle( QFrame::NoFrame );
00679 mImageFrame->setLineWidth(0);
00680 }
00681 }
00682 }
00683
00684
00685 void KAboutContainerBase::setProduct( const QString &appName,
00686 const QString &version,
00687 const QString &author,
00688 const QString &year )
00689 {
00690 if( !mIconLabel )
00691 {
00692 kdDebug(291) << "setProduct: " << "Invalid layout" << endl;
00693 return;
00694 }
00695
00696 if ( kapp )
00697 {
00698 mIconLabel->setPixmap( kapp->icon() );
00699 kdDebug(291) << "setPixmap (iconName): " << kapp->iconName() << endl;
00700 }
00701 else
00702 kdDebug(291) << "no kapp" << endl;
00703
00704 const QString msg1 = i18n("%1 %2 (Using KDE %3)").arg(appName).arg(version).
00705 arg(QString::fromLatin1(KDE_VERSION_STRING));
00706 const QString msg2 = !year.isEmpty() ? i18n("%1 %2, %3").arg('©').arg(year).
00707 arg(author) : QString::fromLatin1("");
00708
00709
00710
00711
00712 mVersionLabel->setText( msg1 );
00713 mAuthorLabel->setText( msg2 );
00714 if( msg2.isEmpty() )
00715 {
00716 mAuthorLabel->hide();
00717 }
00718
00719 mIconLabel->parentWidget()->layout()->activate();
00720 }
00721
00722
00723 void KAboutContainerBase::slotMouseTrack( int mode, const QMouseEvent *e )
00724 {
00725 emit mouseTrack( mode, e );
00726 }
00727
00728
00729 void KAboutContainerBase::slotUrlClick( const QString &url )
00730 {
00731 emit urlClick( url );
00732 }
00733
00734 void KAboutContainerBase::slotMailClick( const QString &_name,
00735 const QString &_address )
00736 {
00737 emit mailClick( _name, _address );
00738 }
00739
00740
00741
00742 KAboutContainer::KAboutContainer( QWidget *_parent, const char *_name,
00743 int _margin, int _spacing,
00744 int childAlignment, int innerAlignment )
00745 : QFrame( _parent, _name ), d(0)
00746 {
00747 mAlignment = innerAlignment;
00748
00749 QGridLayout* const gbox = new QGridLayout( this, 3, 3, _margin, _spacing );
00750 if( childAlignment & AlignHCenter )
00751 {
00752 gbox->setColStretch( 0, 10 );
00753 gbox->setColStretch( 2, 10 );
00754 }
00755 else if( childAlignment & AlignRight )
00756 {
00757 gbox->setColStretch( 0, 10 );
00758 }
00759 else
00760 {
00761 gbox->setColStretch( 2, 10 );
00762 }
00763
00764 if( childAlignment & AlignVCenter )
00765 {
00766 gbox->setRowStretch( 0, 10 );
00767 gbox->setRowStretch( 2, 10 );
00768 }
00769 else if( childAlignment & AlignRight )
00770 {
00771 gbox->setRowStretch( 0, 10 );
00772 }
00773 else
00774 {
00775 gbox->setRowStretch( 2, 10 );
00776 }
00777
00778 mVbox = new QVBoxLayout( _spacing );
00779 gbox->addLayout( mVbox, 1, 1 );
00780 gbox->activate();
00781 }
00782
00783
00784 void KAboutContainer::childEvent( QChildEvent *e )
00785 {
00786 if( !e->inserted() || !e->child()->isWidgetType() )
00787 {
00788 return;
00789 }
00790
00791 QWidget* const w = static_cast<QWidget *>(e->child());
00792 mVbox->addWidget( w, 0, mAlignment );
00793 const QSize s( sizeHint() );
00794 setMinimumSize( s );
00795
00796 QObjectList* const l = const_cast<QObjectList *>(children());
00797 QObjectListIterator itr( *l );
00798 QObject * o;
00799 while ( (o = itr.current()) ) {
00800 ++itr;
00801 if( o->isWidgetType() )
00802 {
00803 static_cast<QWidget *>(o)->setMinimumWidth( s.width() );
00804 }
00805 }
00806 }
00807
00808
00809 QSize KAboutContainer::sizeHint( void ) const
00810 {
00811
00812
00813
00814
00815
00816
00817 QSize total_size;
00818
00819 int numChild = 0;
00820 QObjectList* const l = const_cast<QObjectList *>(children());
00821
00822 QObjectListIterator itr( *l );
00823 QObject * o;
00824 while ( (o = itr.current()) ) {
00825 ++itr;
00826 if( o->isWidgetType() )
00827 {
00828 ++numChild;
00829 QWidget* const w= static_cast<QWidget *>(o);
00830
00831 QSize s = w->minimumSize();
00832 if( s.isEmpty() )
00833 {
00834 s = w->minimumSizeHint();
00835 if( s.isEmpty() )
00836 {
00837 s = w->sizeHint();
00838 if( s.isEmpty() )
00839 {
00840 s = QSize( 100, 100 );
00841 }
00842 }
00843 }
00844 total_size.setHeight( total_size.height() + s.height() );
00845 if( s.width() > total_size.width() ) { total_size.setWidth( s.width() ); }
00846 }
00847 }
00848
00849 if( numChild > 0 )
00850 {
00851
00852
00853
00854
00855
00856 total_size.setHeight( total_size.height() + layout()->spacing()*(numChild-1) );
00857 total_size += QSize( layout()->margin()*2, layout()->margin()*2 + 1 );
00858 }
00859 else
00860 {
00861 total_size = QSize( 1, 1 );
00862 }
00863 return total_size;
00864 }
00865
00866
00867 QSize KAboutContainer::minimumSizeHint( void ) const
00868 {
00869 return sizeHint();
00870 }
00871
00872
00873 void KAboutContainer::addWidget( QWidget *widget )
00874 {
00875 widget->reparent( this, 0, QPoint(0,0) );
00876 }
00877
00878
00879 void KAboutContainer::addPerson( const QString &_name, const QString &_email,
00880 const QString &_url, const QString &_task,
00881 bool showHeader, bool showFrame,bool showBold)
00882 {
00883
00884 KAboutContributor* const cont = new KAboutContributor( this, "pers",
00885 _name, _email, _url, _task, showHeader, showFrame, showBold );
00886 connect( cont, SIGNAL( openURL(const QString&)),
00887 this, SIGNAL( urlClick(const QString &)));
00888 connect( cont, SIGNAL( sendEmail(const QString &, const QString &)),
00889 this, SIGNAL( mailClick(const QString &, const QString &)));
00890 }
00891
00892
00893 void KAboutContainer::addTitle( const QString &title, int alignment,
00894 bool showFrame, bool showBold )
00895 {
00896
00897 QLabel* const label = new QLabel( title, this, "title" );
00898 if( showBold )
00899 {
00900 QFont labelFont( font() );
00901 labelFont.setBold( true );
00902 label->setFont( labelFont );
00903 }
00904 if( showFrame )
00905 {
00906 label->setFrameStyle(QFrame::Panel | QFrame::Raised);
00907 }
00908 label->setAlignment( alignment );
00909 }
00910
00911
00912 void KAboutContainer::addImage( const QString &fileName, int alignment )
00913 {
00914 if( fileName.isNull() )
00915 {
00916 return;
00917 }
00918
00919 KImageTrackLabel* const label = new KImageTrackLabel( this, "image" );
00920 const QImage logo( fileName );
00921 if( !logo.isNull() )
00922 {
00923 QPixmap pix;
00924 pix = logo;
00925 label->setPixmap( pix );
00926 }
00927 label->setAlignment( alignment );
00928 }
00929
00930 #if 0
00931
00932
00938 class KAboutContributor : public QFrame
00939 {
00940
00941 Q_OBJECT
00942
00943 public:
00945 KAboutContributor(QWidget* parent=0, const char* name=0);
00947 void setName(const QString&);
00949 QString getName();
00951 void setEmail(const QString&);
00953 QString getEmail();
00955 void setURL(const QString&);
00957 QString getURL();
00960 void setWork(const QString&);
00963 QSize sizeHint();
00964 QSize minimumSizeHint(void);
00965 virtual void show( void );
00966
00967
00968 protected:
00969
00971 void resizeEvent(QResizeEvent*);
00973 void paintEvent(QPaintEvent*);
00975 QLabel *name;
00978 KURLLabel *email;
00980 KURLLabel *url;
00982 QString work;
00983
00984 protected slots:
00986 void urlClickedSlot(const QString&);
00988 void emailClickedSlot(const QString& emailaddress);
00989
00990 signals:
00992 void sendEmail(const QString& name, const QString& email);
00994 void openURL(const QString& url);
00995
00996 };
00997
00998
00999
01000 KAboutContributor::KAboutContributor(QWidget* parent, const char* n)
01001 : QFrame(parent, n),
01002 name(new QLabel(this)),
01003 email(new KURLLabel(this)),
01004 url(new KURLLabel(this))
01005 {
01006
01007 if(name==0 || email==0)
01008 {
01009 kdDebug() << "KAboutContributor::KAboutContributor: Out of memory." << endl;
01010 qApp->quit();
01011 }
01012 setFrameStyle(QFrame::Panel | QFrame::Raised);
01013
01014 connect(email, SIGNAL(leftClickedURL(const QString&)),
01015 SLOT(emailClickedSlot(const QString&)));
01016 connect(url, SIGNAL(leftClickedURL(const QString&)),
01017 SLOT(urlClickedSlot(const QString&)));
01018
01019 }
01020
01021 void
01022 KAboutContributor::setName(const QString& n)
01023 {
01024
01025 name->setText(n);
01026
01027 }
01028
01029 QString
01030 KAboutContributor::getName()
01031 {
01032
01033 return name->text();
01034
01035 }
01036 void
01037 KAboutContributor::setURL(const QString& u)
01038 {
01039
01040 url->setText(u);
01041
01042 }
01043
01044 QString
01045 KAboutContributor::getURL()
01046 {
01047
01048 return url->text();
01049
01050 }
01051
01052 void
01053 KAboutContributor::setEmail(const QString& e)
01054 {
01055
01056 email->setText(e);
01057
01058 }
01059
01060 QString
01061 KAboutContributor::getEmail()
01062 {
01063
01064 return email->text();
01065
01066 }
01067
01068 void
01069 KAboutContributor::emailClickedSlot(const QString& e)
01070 {
01071
01072 kdDebug() << "KAboutContributor::emailClickedSlot: called." << endl;
01073 emit(sendEmail(name->text(), e));
01074
01075 }
01076
01077 void
01078 KAboutContributor::urlClickedSlot(const QString& u)
01079 {
01080
01081 kdDebug() << "KAboutContributor::urlClickedSlot: called." << endl;
01082 emit(openURL(u));
01083
01084 }
01085
01086 void
01087 KAboutContributor::setWork(const QString& w)
01088 {
01089
01090 work=w;
01091
01092 }
01093
01094 #endif
01095
01096
01097 #if 0
01098 QSize
01099 KAboutContributor::sizeHint()
01100 {
01101
01102 const int FrameWidth=frameWidth();
01103 const int WorkTextWidth=200;
01104 int maxx, maxy;
01105 QRect rect;
01106
01107 maxx=name->sizeHint().width();
01108 maxx=QMAX(maxx, email->sizeHint().width()+WORKTEXT_IDENTATION);
01109
01110 if(!work.isEmpty())
01111 {
01112 rect=fontMetrics().boundingRect
01113 (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
01114 }
01115 if(maxx<rect.width())
01116 {
01117 maxx=WorkTextWidth+WORKTEXT_IDENTATION;
01118 }
01119 maxx=QMAX(maxx, url->sizeHint().width()+WORKTEXT_IDENTATION);
01120
01121 maxy=2*(name->sizeHint().height()+Grid);
01122 maxy+= name->sizeHint().height();
01123 maxy+=rect.height();
01124
01125 maxx+=2*FrameWidth;
01126 maxy+=2*FrameWidth;
01127 return QSize(maxx, maxy);
01128
01129 }
01130
01131 QSize KAboutContributor::minimumSizeHint(void)
01132 {
01133 return( sizeHint() );
01134 }
01135
01136
01137 void KAboutContributor::show( void )
01138 {
01139 QFrame::show();
01140 setMinimumSize( sizeHint() );
01141 }
01142
01143
01144
01145 void
01146 KAboutContributor::resizeEvent(QResizeEvent*)
01147 {
01148
01149
01150 int framewidth=frameWidth(), childwidth=width()-2*framewidth;
01151 int cy=framewidth;
01152
01153 name->setGeometry
01154 (framewidth, framewidth, childwidth, name->sizeHint().height());
01155 cy=name->height()+Grid;
01156 email->setGeometry
01157 (framewidth+WORKTEXT_IDENTATION, cy,
01158 childwidth-WORKTEXT_IDENTATION, name->sizeHint().height());
01159 cy+=name->height()+Grid;
01160 url->setGeometry
01161 (framewidth+WORKTEXT_IDENTATION, cy,
01162 childwidth-WORKTEXT_IDENTATION, name->sizeHint().height());
01163
01164
01165 }
01166
01167
01168 void
01169 KAboutContributor::paintEvent(QPaintEvent* e)
01170 {
01171
01172
01173 int cy=frameWidth()+name->height()+email->height()+Grid+url->height()+Grid;
01174 int h=height()-cy-frameWidth();
01175 int w=width()-WORKTEXT_IDENTATION-2*frameWidth();
01176
01177 QFrame::paintEvent(e);
01178 if(work.isEmpty()) return;
01179 QPainter paint(this);
01180
01181 paint.drawText(WORKTEXT_IDENTATION, cy, w, h, AlignLeft | WordBreak, work);
01182
01183 }
01184
01185 #endif
01186
01187
01188 #if 0
01189 QSize KAboutContributor::sizeHint( void )
01190 {
01191 int s = KDialog::spacingHint();
01192 int h = fontMetrics().lineSpacing()*3 + 2*s;
01193 int m = frameWidth();
01194
01195 int w = name->sizeHint().width();
01196 w = QMAX( w, email->sizeHint().width()+s);
01197 w = QMAX( w, url->sizeHint().width()+s);
01198
01199 if( work.isEmpty() == false )
01200 {
01201 const int WorkTextWidth=200;
01202 QRect r = fontMetrics().boundingRect
01203 (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
01204 if( w < r.width() )
01205 {
01206 w = QMAX( w, WorkTextWidth+s );
01207 }
01208 h += QMAX( fontMetrics().lineSpacing(), r.height() ) + s;
01209 }
01210 return( QSize( w + 2*m, h + 2*m ) );
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235 }
01236
01237
01238
01239
01240
01241
01242 void KAboutContributor::resizeEvent(QResizeEvent*)
01243 {
01244 int x = frameWidth();
01245 int s = KDialog::spacingHint();
01246 int h = fontMetrics().lineSpacing();
01247 int w = width() - 2*x;
01248 int y = x;
01249
01250 name->setGeometry( x, y, w, h );
01251 y += h + s;
01252 email->setGeometry( x+s, y, w-s, h );
01253 y += h + s;
01254 url->setGeometry( x+s, y, w-s, h );
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272 }
01273
01274
01275
01276 void KAboutContributor::paintEvent( QPaintEvent *e )
01277 {
01278 QFrame::paintEvent(e);
01279 if(work.isEmpty()) return;
01280
01281 int x = frameWidth() + KDialog::spacingHint();
01282 int h = fontMetrics().lineSpacing();
01283 int y = height() - frameWidth() - fontMetrics().lineSpacing();
01284 int w = width() - frameWidth()*2 - KDialog::spacingHint();
01285
01286 QPainter paint( this );
01287 paint.drawText( x, y, w, h, AlignLeft | WordBreak, work );
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300 }
01301 #endif
01302
01303
01304
01305
01306
01307
01308 KAboutWidget::KAboutWidget(QWidget *_parent, const char *_name)
01309 : QWidget(_parent, _name),
01310 version(new QLabel(this)),
01311 cont(new QLabel(this)),
01312 logo(new QLabel(this)),
01313 author(new KAboutContributor(this)),
01314 maintainer(new KAboutContributor(this)),
01315 showMaintainer(false),
01316 d(0)
01317 {
01318
01319 if( !version || !cont || !logo || !author || !maintainer )
01320 {
01321
01322 kdDebug() << "KAboutWidget::KAboutWidget: Out of memory." << endl;
01323 qApp->quit();
01324 }
01325
01326 cont->setText(i18n("Other Contributors:"));
01327 logo->setText(i18n("(No logo available)"));
01328 logo->setFrameStyle(QFrame::Panel | QFrame::Raised);
01329 version->setAlignment(AlignCenter);
01330
01331 connect(author, SIGNAL(sendEmail(const QString&, const QString&)),
01332 SLOT(sendEmailSlot(const QString&, const QString&)));
01333 connect(author, SIGNAL(openURL(const QString&)),
01334 SLOT(openURLSlot(const QString&)));
01335 connect(maintainer, SIGNAL(sendEmail(const QString&, const QString&)),
01336 SLOT(sendEmailSlot(const QString&, const QString&)));
01337 connect(maintainer, SIGNAL(openURL(const QString&)),
01338 SLOT(openURLSlot(const QString&)));
01339
01340 }
01341
01342
01343 void
01344 KAboutWidget::adjust()
01345 {
01346
01347 int cx, cy, tempx;
01348 int maintWidth, maintHeight;
01349 QSize total_size;
01350
01351 if(showMaintainer)
01352 {
01353 total_size=maintainer->sizeHint();
01354 maintWidth=total_size.width();
01355 maintHeight=total_size.height();
01356 } else {
01357 maintWidth=0;
01358 maintHeight=0;
01359 }
01360 total_size=author->sizeHint();
01361 logo->adjustSize();
01362 cy=version->sizeHint().height()+Grid;
01363 cx=logo->width();
01364 tempx=QMAX(total_size.width(), maintWidth);
01365 cx+=Grid+tempx;
01366 cx=QMAX(cx, version->sizeHint().width());
01367 cy+=QMAX(logo->height(),
01368 total_size.height()+(showMaintainer ? Grid+maintHeight : 0));
01369
01370 if(!contributors.isEmpty())
01371 {
01372 cx=QMAX(cx, cont->sizeHint().width());
01373 cy+=cont->sizeHint().height()+Grid;
01374 QPtrListIterator<KAboutContributor> _pos(contributors);
01375 KAboutContributor* currEntry;
01376 while ( (currEntry = _pos.current()) )
01377 {
01378 ++_pos;
01379 cy+=currEntry->sizeHint().height();
01380 }
01381 }
01382
01383 setMinimumSize(cx, cy);
01384
01385 }
01386
01387 void
01388 KAboutWidget::setLogo(const QPixmap& i)
01389 {
01390
01391 logo->setPixmap(i);
01392
01393 }
01394
01395 void KAboutWidget::sendEmailSlot(const QString &_name, const QString &_email)
01396 {
01397 emit(sendEmail(_name, _email));
01398 }
01399
01400 void KAboutWidget::openURLSlot(const QString& _url)
01401 {
01402 emit(openURL(_url));
01403 }
01404
01405 void
01406 KAboutWidget::setAuthor(const QString &_name, const QString &_email,
01407 const QString &_url, const QString &_w)
01408 {
01409
01410 author->setName(_name);
01411 author->setEmail(_email);
01412 author->setURL(_url);
01413 author->setWork(_w);
01414
01415 }
01416
01417 void
01418 KAboutWidget::setMaintainer(const QString &_name, const QString &_email,
01419 const QString &_url, const QString &_w)
01420 {
01421
01422 maintainer->setName(_name);
01423 maintainer->setEmail(_email);
01424 maintainer->setWork(_w);
01425 maintainer->setURL(_url);
01426 showMaintainer=true;
01427
01428 }
01429
01430 void
01431 KAboutWidget::addContributor(const QString &_name, const QString &_email,
01432 const QString &_url, const QString &_w)
01433 {
01434
01435 KAboutContributor* const c=new KAboutContributor(this);
01436
01437 c->setName(_name);
01438 c->setEmail(_email);
01439 c->setURL(_url);
01440 c->setWork(_w);
01441 contributors.append(c);
01442 connect(c, SIGNAL(sendEmail(const QString&, const QString&)),
01443 SLOT(sendEmailSlot(const QString&, const QString&)));
01444 connect(c, SIGNAL(openURL(const QString&)), SLOT(openURLSlot(const QString&)));
01445
01446 }
01447
01448 void
01449 KAboutWidget::setVersion(const QString &_name)
01450 {
01451
01452 version->setText(_name);
01453
01454 }
01455
01456 void
01457 KAboutWidget::resizeEvent(QResizeEvent*)
01458 {
01459
01460 int _x=0, _y, cx, tempx, tempy;
01461
01462 version->setGeometry(0, 0, width(), version->sizeHint().height());
01463 _y=version->height()+Grid;
01464
01465 logo->adjustSize();
01466 logo->move(0, _y);
01467
01468 tempx=logo->width()+Grid;
01469 cx=width()-tempx;
01470 author->setGeometry
01471 (tempx, _y, cx, author->sizeHint().height());
01472 maintainer->setGeometry
01473 (tempx, _y+author->height()+Grid, cx, maintainer->sizeHint().height());
01474
01475 _y+=QMAX(logo->height(),
01476 author->height()+(showMaintainer ? Grid+maintainer->height() : 0));
01477
01478 if(!contributors.isEmpty())
01479 {
01480 tempy=cont->sizeHint().height();
01481 cont->setGeometry(0, _y, width(), tempy);
01482 cont->show();
01483 _y+=tempy+Grid;
01484 } else {
01485 cont->hide();
01486 }
01487 QPtrListIterator<KAboutContributor> _pos(contributors);
01488 KAboutContributor* currEntry;
01489 while( (currEntry = _pos.current()) )
01490 {
01491 ++_pos;
01492 tempy=currEntry->sizeHint().height();
01493
01494 currEntry->setGeometry(_x, _y, width(), tempy);
01495 _y+=tempy;
01496 }
01497 if(showMaintainer)
01498 {
01499 maintainer->show();
01500 } else {
01501 maintainer->hide();
01502 }
01503
01504 }
01505
01506 KAboutDialog::KAboutDialog(QWidget *_parent, const char *_name, bool modal)
01507 : KDialogBase(_parent, _name, modal, QString::null, Ok, Ok ),
01508 about(new KAboutWidget(this)), mContainerBase(0), d(0)
01509 {
01510
01511 if(!about)
01512 {
01513
01514 kdDebug() << "KAboutDialog::KAboutDialog: Out of memory." << endl;
01515 qApp->quit();
01516 }
01517 setMainWidget(about);
01518 connect(about, SIGNAL(sendEmail(const QString&, const QString&)),
01519 SLOT(sendEmailSlot(const QString&, const QString&)));
01520 connect(about, SIGNAL(openURL(const QString&)),
01521 SLOT(openURLSlot(const QString&)));
01522
01523 }
01524
01525
01526 KAboutDialog::KAboutDialog( int layoutType, const QString &_caption,
01527 int buttonMask, ButtonCode defaultButton,
01528 QWidget *_parent, const char *_name, bool modal,
01529 bool separator, const QString &user1,
01530 const QString &user2, const QString &user3 )
01531 :KDialogBase( _parent, _name, modal, QString::null, buttonMask, defaultButton,
01532 separator, user1, user2, user3 ),
01533 about(0), d(0)
01534 {
01535 setPlainCaption( i18n("About %1").arg(_caption) );
01536
01537 mContainerBase = new KAboutContainerBase( layoutType, this );
01538 setMainWidget(mContainerBase);
01539
01540 connect( mContainerBase, SIGNAL(urlClick(const QString &)),
01541 this, SLOT(openURLSlot(const QString &)));
01542 connect( mContainerBase, SIGNAL(mailClick(const QString &,const QString &)),
01543 this, SLOT(sendEmailSlot(const QString &,const QString &)));
01544 connect( mContainerBase, SIGNAL(mouseTrack(int, const QMouseEvent *)),
01545 this, SLOT(mouseTrackSlot(int, const QMouseEvent *)));
01546 }
01547
01548
01549 void KAboutDialog::show( void )
01550 {
01551 adjust();
01552 if( mContainerBase ) { mContainerBase->show(); }
01553 QDialog::show();
01554 }
01555
01556
01557 void KAboutDialog::show( QWidget * )
01558 {
01559 adjust();
01560 if( mContainerBase ) { mContainerBase->show(); }
01561 QDialog::show();
01562 }
01563
01564
01565 void KAboutDialog::adjust()
01566 {
01567 if( !about ) { return; }
01568 about->adjust();
01569
01570 resize( sizeHint() );
01571 }
01572
01573
01574 void KAboutDialog::setLogo(const QPixmap& i)
01575 {
01576 if( !about ) { return; }
01577 about->setLogo(i);
01578 }
01579
01580
01581 void KAboutDialog::setMaintainer(const QString &_name, const QString &_email,
01582 const QString &_url, const QString &_w)
01583 {
01584
01585 if( !about ) { return; }
01586 about->setMaintainer(_name, _email, _url, _w);
01587
01588 }
01589
01590 void KAboutDialog::setAuthor(const QString &_name, const QString &_email,
01591 const QString &_url, const QString &_work)
01592 {
01593
01594 if( !about ) { return; }
01595 about->setAuthor(_name, _email, _url, _work);
01596
01597 }
01598
01599 void KAboutDialog::addContributor(const QString &_name, const QString &_email,
01600 const QString &_url, const QString &_w)
01601 {
01602
01603 if( !about ) { return; }
01604 about->addContributor(_name, _email, _url, _w);
01605
01606 }
01607
01608 void KAboutDialog::setVersion(const QString &_name)
01609 {
01610
01611 if( !about ) { return; }
01612 about->setVersion(_name);
01613
01614 }
01615
01616 void KAboutDialog::sendEmailSlot(const QString& , const QString& email)
01617 {
01618 if ( kapp )
01619 kapp->invokeMailer( email, QString::null );
01620
01621
01622
01623
01624
01625 }
01626
01627 void KAboutDialog::openURLSlot(const QString& url)
01628 {
01629 if ( kapp )
01630 kapp->invokeBrowser( url );
01631
01632
01633 }
01634
01635
01636 void KAboutDialog::mouseTrackSlot( int , const QMouseEvent * )
01637 {
01638
01639 }
01640
01641
01642 QFrame *KAboutDialog::addTextPage( const QString &title, const QString &text,
01643 bool richText, int numLines )
01644 {
01645 if( !mContainerBase ) { return 0; }
01646 return mContainerBase->addTextPage( title, text, richText, numLines );
01647 }
01648
01649 QFrame *KAboutDialog::addLicensePage( const QString &title, const QString &text,
01650 int numLines )
01651 {
01652 if( !mContainerBase ) { return 0; }
01653 return mContainerBase->addLicensePage( title, text, numLines );
01654 }
01655
01656
01657 KAboutContainer *KAboutDialog::addContainerPage( const QString &title,
01658 int childAlignment, int innerAlignment )
01659 {
01660 if( !mContainerBase ) { return 0; }
01661 return mContainerBase->addContainerPage( title, childAlignment,
01662 innerAlignment);
01663 }
01664
01665
01666 KAboutContainer *KAboutDialog::addScrolledContainerPage( const QString &title,
01667 int childAlignment, int innerAlignment )
01668 {
01669 if( !mContainerBase ) { return 0; }
01670 return mContainerBase->addScrolledContainerPage( title, childAlignment,
01671 innerAlignment);
01672 }
01673
01674
01675
01676 QFrame *KAboutDialog::addPage( const QString &title )
01677 {
01678 if( !mContainerBase ) { return 0; }
01679 return mContainerBase->addEmptyPage( title );
01680 }
01681
01682
01683 KAboutContainer *KAboutDialog::addContainer( int childAlignment,
01684 int innerAlignment )
01685 {
01686 if( !mContainerBase ) { return 0; }
01687 return mContainerBase->addContainer( childAlignment, innerAlignment );
01688 }
01689
01690
01691 void KAboutDialog::setTitle( const QString &title )
01692 {
01693 if( !mContainerBase ) { return; }
01694 mContainerBase->setTitle( title );
01695 }
01696
01697
01698 void KAboutDialog::setImage( const QString &fileName )
01699 {
01700 if( !mContainerBase ) { return; }
01701 mContainerBase->setImage( fileName );
01702 }
01703
01704
01705 void KAboutDialog::setIcon( const QString &fileName )
01706 {
01707 if( !mContainerBase ) { return; }
01708 mContainerBase->setProgramLogo( fileName );
01709 }
01710
01711 void KAboutDialog::setProgramLogo( const QString &fileName )
01712 {
01713 if( !mContainerBase ) { return; }
01714 mContainerBase->setProgramLogo( fileName );
01715 }
01716
01717 void KAboutDialog::setProgramLogo( const QPixmap &pixmap )
01718 {
01719 if( !mContainerBase ) { return; }
01720 mContainerBase->setProgramLogo( pixmap );
01721 }
01722
01723 void KAboutDialog::setImageBackgroundColor( const QColor &color )
01724 {
01725 if( !mContainerBase ) { return; }
01726 mContainerBase->setImageBackgroundColor( color );
01727 }
01728
01729
01730 void KAboutDialog::setImageFrame( bool state )
01731 {
01732 if( !mContainerBase ) { return; }
01733 mContainerBase->setImageFrame( state );
01734 }
01735
01736
01737 void KAboutDialog::setProduct( const QString &appName, const QString &version,
01738 const QString &author, const QString &year )
01739 {
01740 if( !mContainerBase ) { return; }
01741 mContainerBase->setProduct( appName, version, author, year );
01742 }
01743
01744
01745
01746 void KAboutDialog::imageURL( QWidget *_parent, const QString &_caption,
01747 const QString &_path, const QColor &_imageColor,
01748 const QString &_url )
01749 {
01750 KAboutDialog a( AbtImageOnly, QString::null, Close, Close, _parent, "image", true );
01751 a.setPlainCaption( _caption );
01752 a.setImage( _path );
01753 a.setImageBackgroundColor( _imageColor );
01754
01755 KAboutContainer* const c = a.addContainer( AlignCenter, AlignCenter );
01756 if( c )
01757 {
01758 c->addPerson( QString::null, QString::null, _url, QString::null );
01759 }
01760 a.exec();
01761 }
01762
01763
01764
01765
01766
01767
01768
01769 KImageTrackLabel::KImageTrackLabel( QWidget *_parent, const char *_name, WFlags f )
01770 : QLabel( _parent, _name, f )
01771 {
01772 setText( i18n("Image missing"));
01773 }
01774
01775 void KImageTrackLabel::mousePressEvent( QMouseEvent *e )
01776 {
01777 emit mouseTrack( MousePress, e );
01778 }
01779
01780 void KImageTrackLabel::mouseReleaseEvent( QMouseEvent *e )
01781 {
01782 emit mouseTrack( MouseRelease, e );
01783 }
01784
01785 void KImageTrackLabel::mouseDoubleClickEvent( QMouseEvent *e )
01786 {
01787 emit mouseTrack( MouseDoubleClick, e );
01788 }
01789
01790 void KImageTrackLabel::mouseMoveEvent ( QMouseEvent *e )
01791 {
01792 emit mouseTrack( MouseDoubleClick, e );
01793 }
01794
01795 void KAboutDialog::virtual_hook( int id, void* data )
01796 { KDialogBase::virtual_hook( id, data ); }
01797