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