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)
00074 {
00075 if( showFrame == true )
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 == true ) { 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 *kurl = static_cast<KURLLabel *>(mText[1]);
00127 kurl->setText(_text);
00128 kurl->setURL(_text);
00129 if( _update == true ) { 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 *kurl = static_cast<KURLLabel *>(mText[2]);
00138 kurl->setText(_text);
00139 kurl->setURL(_text);
00140 if( _update == true ) { 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 == true ) { 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 if( layout() != 0 )
00181 {
00182 delete layout();
00183 }
00184
00185 int row = 0;
00186 if( !mText[0]->text().isEmpty() ) { row += 1; }
00187 if( !mText[1]->text().isEmpty() ) { row += 1; }
00188 if( !mText[2]->text().isEmpty() ) { row += 1; }
00189 if( !mText[3]->text().isEmpty() ) { row += 1; }
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 == false )
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 == false )
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 == true )
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 == 0 )
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 == true )
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)
00301 {
00302 mTopLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() );
00303 if( mTopLayout == 0 ) { 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 *productArea = new QWidget( this, "area" );
00325 mTopLayout->addWidget( productArea, 0, QApplication::reverseLayout() ? AlignRight : AlignLeft );
00326
00327 QHBoxLayout *hbox = new QHBoxLayout(productArea,0,KDialog::spacingHint());
00328 if( hbox == 0 ) { return; }
00329
00330 mIconLabel = new QLabel( productArea );
00331 hbox->addWidget( mIconLabel, 0, AlignLeft|AlignHCenter );
00332
00333 QVBoxLayout *vbox = new QVBoxLayout();
00334 if( vbox == 0 ) { 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 *hbox = new QHBoxLayout();
00347 if( hbox == 0 ) { 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 == 0 ) { 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 *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 == 0 ) { 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 != 0 )
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 != 0 )
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 *page = addEmptyPage( title );
00465 if( page == 0 ) { return(0); }
00466 if( numLines <= 0 ) { numLines = 10; }
00467
00468 QVBoxLayout *vbox = new QVBoxLayout( page, KDialog::spacingHint() );
00469
00470 if( richText == true )
00471 {
00472 KTextBrowser *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 *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 *page = addEmptyPage( title );
00499 if( page == 0 ) { return(0); }
00500 if( numLines <= 0 ) { numLines = 10; }
00501
00502 QVBoxLayout *vbox = new QVBoxLayout( page, KDialog::spacingHint() );
00503
00504 KTextEdit *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 == 0 )
00520 {
00521 kdDebug(291) << "addPage: " << "Invalid layout" << endl;
00522 return( 0 );
00523 }
00524
00525 KAboutContainer *container = new KAboutContainer( mPageTab, "container",
00526 KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
00527 innerAlignment );
00528 mPageTab->addTab( container, title );
00529
00530 if( mContainerList.resize( mContainerList.size() + 1) == true )
00531 {
00532 mContainerList[ mContainerList.size()-1 ]=container;
00533 }
00534
00535 connect(container, SIGNAL(urlClick(const QString &)),
00536 SLOT(slotUrlClick(const QString &)));
00537 connect(container, SIGNAL(mailClick(const QString &,const QString &)),
00538 SLOT(slotMailClick(const QString &,const QString &)));
00539
00540 return( container );
00541 }
00542
00543
00544 KAboutContainer *KAboutContainerBase::addScrolledContainerPage(
00545 const QString &title,
00546 int childAlignment,
00547 int innerAlignment )
00548 {
00549 if( mPageTab == 0 )
00550 {
00551 kdDebug(291) << "addPage: " << "Invalid layout" << endl;
00552 return( 0 );
00553 }
00554
00555 QFrame *page = addEmptyPage( title );
00556 QVBoxLayout *vbox = new QVBoxLayout( page, KDialog::spacingHint() );
00557 QScrollView *scrollView = new QScrollView( page );
00558 scrollView->viewport()->setBackgroundMode( PaletteBackground );
00559 vbox->addWidget( scrollView );
00560
00561 KAboutContainer *container = new KAboutContainer( scrollView, "container",
00562 KDialog::spacingHint(), KDialog::spacingHint(), childAlignment,
00563 innerAlignment );
00564 scrollView->addChild( container );
00565
00566
00567 connect(container, SIGNAL(urlClick(const QString &)),
00568 SLOT(slotUrlClick(const QString &)));
00569 connect(container, SIGNAL(mailClick(const QString &,const QString &)),
00570 SLOT(slotMailClick(const QString &,const QString &)));
00571
00572 return( container );
00573 }
00574
00575
00576 QFrame *KAboutContainerBase::addEmptyPage( const QString &title )
00577 {
00578 if( mPageTab == 0 )
00579 {
00580 kdDebug(291) << "addPage: " << "Invalid layout" << endl;
00581 return( 0 );
00582 }
00583
00584 QFrame *page = new QFrame( mPageTab, title.latin1() );
00585 page->setFrameStyle( QFrame::NoFrame );
00586
00587 mPageTab->addTab( page, title );
00588 return( page );
00589 }
00590
00591
00592 KAboutContainer *KAboutContainerBase::addContainer( int childAlignment,
00593 int innerAlignment )
00594 {
00595 KAboutContainer *container = new KAboutContainer( this, "container",
00596 0, KDialog::spacingHint(), childAlignment, innerAlignment );
00597 mTopLayout->addWidget( container, 0, childAlignment );
00598
00599 if( mContainerList.resize( mContainerList.size() + 1) == true )
00600 {
00601 mContainerList[ mContainerList.size()-1 ]=container;
00602 }
00603
00604 connect(container, SIGNAL(urlClick(const QString &)),
00605 SLOT(slotUrlClick(const QString &)));
00606 connect(container, SIGNAL(mailClick(const QString &,const QString &)),
00607 SLOT(slotMailClick(const QString &,const QString &)));
00608
00609 return( container );
00610 }
00611
00612
00613
00614 void KAboutContainerBase::setTitle( const QString &title )
00615 {
00616 if( mTitleLabel == 0 )
00617 {
00618 kdDebug(291) << "setTitle: " << "Invalid layout" << endl;
00619 return;
00620 }
00621 mTitleLabel->setText(title);
00622 }
00623
00624
00625 void KAboutContainerBase::setImage( const QString &fileName )
00626 {
00627 if( mImageLabel == 0 )
00628 {
00629 kdDebug(291) << "setImage: " << "Invalid layout" << endl;
00630 return;
00631 }
00632 if( fileName.isNull() )
00633 {
00634 return;
00635 }
00636
00637 QPixmap logo( fileName );
00638 if( !logo.isNull() )
00639 mImageLabel->setPixmap( logo );
00640
00641 mImageFrame->layout()->activate();
00642 }
00643
00644 void KAboutContainerBase::setIcon( const QString &fileName )
00645 {
00646 if( mIconLabel == 0 )
00647 {
00648 kdDebug(291) << "setIcon: " << "Invalid layout" << endl;
00649 return;
00650 }
00651 if( fileName.isNull() )
00652 {
00653 return;
00654 }
00655
00656 QPixmap logo( fileName );
00657 if( !logo.isNull() )
00658 {
00659 mIconLabel->setPixmap( logo );
00660 }
00661 }
00662
00663 void KAboutContainerBase::setImageBackgroundColor( const QColor &color )
00664 {
00665 if( mImageFrame != 0 )
00666 {
00667 mImageFrame->setBackgroundColor( color );
00668 }
00669 }
00670
00671
00672 void KAboutContainerBase::setImageFrame( bool state )
00673 {
00674 if( mImageFrame != 0 )
00675 {
00676 if( state == true )
00677 {
00678 mImageFrame->setFrameStyle( QFrame::Panel | QFrame::Sunken );
00679 mImageFrame->setLineWidth(1);
00680 }
00681 else
00682 {
00683 mImageFrame->setFrameStyle( QFrame::NoFrame );
00684 mImageFrame->setLineWidth(0);
00685 }
00686 }
00687 }
00688
00689
00690 void KAboutContainerBase::setProduct( const QString &appName,
00691 const QString &version,
00692 const QString &author,
00693 const QString &year )
00694 {
00695 if( mIconLabel == 0 )
00696 {
00697 kdDebug(291) << "setProduct: " << "Invalid layout" << endl;
00698 return;
00699 }
00700
00701 if ( kapp )
00702 {
00703 mIconLabel->setPixmap( kapp->icon() );
00704 kdDebug(291) << "setPixmap (iconName): " << kapp->iconName() << endl;
00705 }
00706 else
00707 kdDebug(291) << "no kapp" << endl;
00708
00709 QString msg1 = i18n("%1 %2 (Using KDE %3)").arg(appName).arg(version).
00710 arg(QString::fromLatin1(KDE_VERSION_STRING));
00711 QString msg2 = !year.isEmpty() ? i18n("%1 %2, %3").arg('©').arg(year).
00712 arg(author) : QString::fromLatin1("");
00713
00714
00715
00716
00717 mVersionLabel->setText( msg1 );
00718 mAuthorLabel->setText( msg2 );
00719 if( msg2.isEmpty() )
00720 {
00721 mAuthorLabel->hide();
00722 }
00723
00724 mIconLabel->parentWidget()->layout()->activate();
00725 }
00726
00727
00728 void KAboutContainerBase::slotMouseTrack( int mode, const QMouseEvent *e )
00729 {
00730 emit mouseTrack( mode, e );
00731 }
00732
00733
00734 void KAboutContainerBase::slotUrlClick( const QString &url )
00735 {
00736 emit urlClick( url );
00737 }
00738
00739 void KAboutContainerBase::slotMailClick( const QString &_name,
00740 const QString &_address )
00741 {
00742 emit mailClick( _name, _address );
00743 }
00744
00745
00746
00747 KAboutContainer::KAboutContainer( QWidget *_parent, const char *_name,
00748 int _margin, int _spacing,
00749 int childAlignment, int innerAlignment )
00750 : QFrame( _parent, _name )
00751 {
00752 mAlignment = innerAlignment;
00753
00754 QGridLayout *gbox = new QGridLayout( this, 3, 3, _margin, _spacing );
00755 if( childAlignment & AlignHCenter )
00756 {
00757 gbox->setColStretch( 0, 10 );
00758 gbox->setColStretch( 2, 10 );
00759 }
00760 else if( childAlignment & AlignRight )
00761 {
00762 gbox->setColStretch( 0, 10 );
00763 }
00764 else
00765 {
00766 gbox->setColStretch( 2, 10 );
00767 }
00768
00769 if( childAlignment & AlignVCenter )
00770 {
00771 gbox->setRowStretch( 0, 10 );
00772 gbox->setRowStretch( 2, 10 );
00773 }
00774 else if( childAlignment & AlignRight )
00775 {
00776 gbox->setRowStretch( 0, 10 );
00777 }
00778 else
00779 {
00780 gbox->setRowStretch( 2, 10 );
00781 }
00782
00783 mVbox = new QVBoxLayout( _spacing );
00784 gbox->addLayout( mVbox, 1, 1 );
00785 gbox->activate();
00786 }
00787
00788
00789 void KAboutContainer::childEvent( QChildEvent *e )
00790 {
00791 if( !e->inserted() || !e->child()->isWidgetType() )
00792 {
00793 return;
00794 }
00795
00796 QWidget *w = static_cast<QWidget *>(e->child());
00797 mVbox->addWidget( w, 0, mAlignment );
00798 QSize s( sizeHint() );
00799 setMinimumSize( s );
00800
00801 QObjectList *l = const_cast<QObjectList *>(children());
00802 for( uint i=0; i < l->count(); i++ )
00803 {
00804 QObject *o = l->at(i);
00805 if( o->isWidgetType() )
00806 {
00807 static_cast<QWidget *>(o)->setMinimumWidth( s.width() );
00808 }
00809 }
00810 }
00811
00812
00813 QSize KAboutContainer::sizeHint( void ) const
00814 {
00815
00816
00817
00818
00819
00820
00821 QSize total_size;
00822
00823 int numChild = 0;
00824 QObjectList *l = const_cast<QObjectList *>(children());
00825
00826 for( uint i=0; i < l->count(); i++ )
00827 {
00828 QObject *o = l->at(i);
00829 if( o->isWidgetType() )
00830 {
00831 numChild += 1;
00832 QWidget *w= static_cast<QWidget *>(o);
00833
00834 QSize s = w->minimumSize();
00835 if( s.isEmpty() == true )
00836 {
00837 s = w->minimumSizeHint();
00838 if( s.isEmpty() == true )
00839 {
00840 s = w->sizeHint();
00841 if( s.isEmpty() == true )
00842 {
00843 s = QSize( 100, 100 );
00844 }
00845 }
00846 }
00847 total_size.setHeight( total_size.height() + s.height() );
00848 if( s.width() > total_size.width() ) { total_size.setWidth( s.width() ); }
00849 }
00850 }
00851
00852 if( numChild > 0 )
00853 {
00854
00855
00856
00857
00858
00859 total_size.setHeight( total_size.height() + layout()->spacing()*(numChild-1) );
00860 total_size += QSize( layout()->margin()*2, layout()->margin()*2 + 1 );
00861 }
00862 else
00863 {
00864 total_size = QSize( 1, 1 );
00865 }
00866 return( total_size );
00867 }
00868
00869
00870 QSize KAboutContainer::minimumSizeHint( void ) const
00871 {
00872 return( sizeHint() );
00873 }
00874
00875
00876 void KAboutContainer::addWidget( QWidget *widget )
00877 {
00878 widget->reparent( this, 0, QPoint(0,0) );
00879 }
00880
00881
00882 void KAboutContainer::addPerson( const QString &_name, const QString &_email,
00883 const QString &_url, const QString &_task,
00884 bool showHeader, bool showFrame,bool showBold)
00885 {
00886
00887 KAboutContributor *cont = new KAboutContributor( this, "pers",
00888 _name, _email, _url, _task, showHeader, showFrame, showBold );
00889 connect( cont, SIGNAL( openURL(const QString&)),
00890 this, SIGNAL( urlClick(const QString &)));
00891 connect( cont, SIGNAL( sendEmail(const QString &, const QString &)),
00892 this, SIGNAL( mailClick(const QString &, const QString &)));
00893 }
00894
00895
00896 void KAboutContainer::addTitle( const QString &title, int alignment,
00897 bool showFrame, bool showBold )
00898 {
00899
00900 QLabel *label = new QLabel( title, this, "title" );
00901 if( showBold == true )
00902 {
00903 QFont labelFont( font() );
00904 labelFont.setBold( true );
00905 label->setFont( labelFont );
00906 }
00907 if( showFrame == true )
00908 {
00909 label->setFrameStyle(QFrame::Panel | QFrame::Raised);
00910 }
00911 label->setAlignment( alignment );
00912 }
00913
00914
00915 void KAboutContainer::addImage( const QString &fileName, int alignment )
00916 {
00917 if( fileName.isNull() )
00918 {
00919 return;
00920 }
00921
00922 KImageTrackLabel *label = new KImageTrackLabel( this, "image" );
00923 QImage logo( fileName );
00924 if( logo.isNull() == false )
00925 {
00926 QPixmap pix;
00927 pix = logo;
00928 label->setPixmap( pix );
00929 }
00930 label->setAlignment( alignment );
00931 }
00932
00933 #if 0
00934
00940 class KAboutContributor : public QFrame
00941 {
00942
00943 Q_OBJECT
00944
00945 public:
00947 KAboutContributor(QWidget* parent=0, const char* name=0);
00949 void setName(const QString&);
00951 QString getName();
00953 void setEmail(const QString&);
00955 QString getEmail();
00957 void setURL(const QString&);
00959 QString getURL();
00962 void setWork(const QString&);
00965 QSize sizeHint();
00966 QSize minimumSizeHint(void);
00967 virtual void show( void );
00968
00969
00970 protected:
00971
00973 void resizeEvent(QResizeEvent*);
00975 void paintEvent(QPaintEvent*);
00977 QLabel *name;
00980 KURLLabel *email;
00982 KURLLabel *url;
00984 QString work;
00985
00986 protected slots:
00988 void urlClickedSlot(const QString&);
00990 void emailClickedSlot(const QString& emailaddress);
00991
00992 signals:
00994 void sendEmail(const QString& name, const QString& email);
00996 void openURL(const QString& url);
00997
00998 };
00999
01000
01001
01002 KAboutContributor::KAboutContributor(QWidget* parent, const char* n)
01003 : QFrame(parent, n),
01004 name(new QLabel(this)),
01005 email(new KURLLabel(this)),
01006 url(new KURLLabel(this))
01007 {
01008
01009 if(name==0 || email==0)
01010 {
01011 kdDebug() << "KAboutContributor::KAboutContributor: Out of memory." << endl;
01012 qApp->quit();
01013 }
01014 setFrameStyle(QFrame::Panel | QFrame::Raised);
01015
01016 connect(email, SIGNAL(leftClickedURL(const QString&)),
01017 SLOT(emailClickedSlot(const QString&)));
01018 connect(url, SIGNAL(leftClickedURL(const QString&)),
01019 SLOT(urlClickedSlot(const QString&)));
01020
01021 }
01022
01023 void
01024 KAboutContributor::setName(const QString& n)
01025 {
01026
01027 name->setText(n);
01028
01029 }
01030
01031 QString
01032 KAboutContributor::getName()
01033 {
01034
01035 return name->text();
01036
01037 }
01038 void
01039 KAboutContributor::setURL(const QString& u)
01040 {
01041
01042 url->setText(u);
01043
01044 }
01045
01046 QString
01047 KAboutContributor::getURL()
01048 {
01049
01050 return url->text();
01051
01052 }
01053
01054 void
01055 KAboutContributor::setEmail(const QString& e)
01056 {
01057
01058 email->setText(e);
01059
01060 }
01061
01062 QString
01063 KAboutContributor::getEmail()
01064 {
01065
01066 return email->text();
01067
01068 }
01069
01070 void
01071 KAboutContributor::emailClickedSlot(const QString& e)
01072 {
01073
01074 kdDebug() << "KAboutContributor::emailClickedSlot: called." << endl;
01075 emit(sendEmail(name->text(), e));
01076
01077 }
01078
01079 void
01080 KAboutContributor::urlClickedSlot(const QString& u)
01081 {
01082
01083 kdDebug() << "KAboutContributor::urlClickedSlot: called." << endl;
01084 emit(openURL(u));
01085
01086 }
01087
01088 void
01089 KAboutContributor::setWork(const QString& w)
01090 {
01091
01092 work=w;
01093
01094 }
01095
01096 #endif
01097
01098
01099 #if 0
01100 QSize
01101 KAboutContributor::sizeHint()
01102 {
01103
01104 const int FrameWidth=frameWidth();
01105 const int WorkTextWidth=200;
01106 int maxx, maxy;
01107 QRect rect;
01108
01109 maxx=name->sizeHint().width();
01110 maxx=QMAX(maxx, email->sizeHint().width()+WORKTEXT_IDENTATION);
01111
01112 if(!work.isEmpty())
01113 {
01114 rect=fontMetrics().boundingRect
01115 (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
01116 }
01117 if(maxx<rect.width())
01118 {
01119 maxx=WorkTextWidth+WORKTEXT_IDENTATION;
01120 }
01121 maxx=QMAX(maxx, url->sizeHint().width()+WORKTEXT_IDENTATION);
01122
01123 maxy=2*(name->sizeHint().height()+Grid);
01124 maxy+= name->sizeHint().height();
01125 maxy+=rect.height();
01126
01127 maxx+=2*FrameWidth;
01128 maxy+=2*FrameWidth;
01129 return QSize(maxx, maxy);
01130
01131 }
01132
01133 QSize KAboutContributor::minimumSizeHint(void)
01134 {
01135 return( sizeHint() );
01136 }
01137
01138
01139 void KAboutContributor::show( void )
01140 {
01141 QFrame::show();
01142 setMinimumSize( sizeHint() );
01143 }
01144
01145
01146
01147 void
01148 KAboutContributor::resizeEvent(QResizeEvent*)
01149 {
01150
01151
01152 int framewidth=frameWidth(), childwidth=width()-2*framewidth;
01153 int cy=framewidth;
01154
01155 name->setGeometry
01156 (framewidth, framewidth, childwidth, name->sizeHint().height());
01157 cy=name->height()+Grid;
01158 email->setGeometry
01159 (framewidth+WORKTEXT_IDENTATION, cy,
01160 childwidth-WORKTEXT_IDENTATION, name->sizeHint().height());
01161 cy+=name->height()+Grid;
01162 url->setGeometry
01163 (framewidth+WORKTEXT_IDENTATION, cy,
01164 childwidth-WORKTEXT_IDENTATION, name->sizeHint().height());
01165
01166
01167 }
01168
01169
01170 void
01171 KAboutContributor::paintEvent(QPaintEvent* e)
01172 {
01173
01174
01175 int cy=frameWidth()+name->height()+email->height()+Grid+url->height()+Grid;
01176 int h=height()-cy-frameWidth();
01177 int w=width()-WORKTEXT_IDENTATION-2*frameWidth();
01178
01179 QFrame::paintEvent(e);
01180 if(work.isEmpty()) return;
01181 QPainter paint(this);
01182
01183 paint.drawText(WORKTEXT_IDENTATION, cy, w, h, AlignLeft | WordBreak, work);
01184
01185 }
01186 #endif
01187
01188
01189 #if 0
01190 QSize KAboutContributor::sizeHint( void )
01191 {
01192 int s = KDialog::spacingHint();
01193 int h = fontMetrics().lineSpacing()*3 + 2*s;
01194 int m = frameWidth();
01195
01196 int w = name->sizeHint().width();
01197 w = QMAX( w, email->sizeHint().width()+s);
01198 w = QMAX( w, url->sizeHint().width()+s);
01199
01200 if( work.isEmpty() == false )
01201 {
01202 const int WorkTextWidth=200;
01203 QRect r = fontMetrics().boundingRect
01204 (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work);
01205 if( w < r.width() )
01206 {
01207 w = QMAX( w, WorkTextWidth+s );
01208 }
01209 h += QMAX( fontMetrics().lineSpacing(), r.height() ) + s;
01210 }
01211 return( QSize( w + 2*m, h + 2*m ) );
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
01243 void KAboutContributor::resizeEvent(QResizeEvent*)
01244 {
01245 int x = frameWidth();
01246 int s = KDialog::spacingHint();
01247 int h = fontMetrics().lineSpacing();
01248 int w = width() - 2*x;
01249 int y = x;
01250
01251 name->setGeometry( x, y, w, h );
01252 y += h + s;
01253 email->setGeometry( x+s, y, w-s, h );
01254 y += h + s;
01255 url->setGeometry( x+s, y, w-s, h );
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273 }
01274
01275
01276
01277 void KAboutContributor::paintEvent( QPaintEvent *e )
01278 {
01279 QFrame::paintEvent(e);
01280 if(work.isEmpty()) return;
01281
01282 int x = frameWidth() + KDialog::spacingHint();
01283 int h = fontMetrics().lineSpacing();
01284 int y = height() - frameWidth() - fontMetrics().lineSpacing();
01285 int w = width() - frameWidth()*2 - KDialog::spacingHint();
01286
01287 QPainter paint( this );
01288 paint.drawText( x, y, w, h, AlignLeft | WordBreak, work );
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301 }
01302 #endif
01303
01304
01305
01306
01307
01308
01309 KAboutWidget::KAboutWidget(QWidget *_parent, const char *_name)
01310 : QWidget(_parent, _name),
01311 version(new QLabel(this)),
01312 cont(new QLabel(this)),
01313 logo(new QLabel(this)),
01314 author(new KAboutContributor(this)),
01315 maintainer(new KAboutContributor(this)),
01316 showMaintainer(false)
01317 {
01318
01319 if( version==0 || cont==0 || logo==0 || author==0 || maintainer==0 )
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 for( ; _pos.current(); ++_pos)
01376 {
01377 cy+=_pos.current()->sizeHint().height();
01378 }
01379 }
01380
01381 setMinimumSize(cx, cy);
01382
01383 }
01384
01385 void
01386 KAboutWidget::setLogo(const QPixmap& i)
01387 {
01388
01389 logo->setPixmap(i);
01390
01391 }
01392
01393 void KAboutWidget::sendEmailSlot(const QString &_name, const QString &_email)
01394 {
01395 emit(sendEmail(_name, _email));
01396 }
01397
01398 void KAboutWidget::openURLSlot(const QString& _url)
01399 {
01400 emit(openURL(_url));
01401 }
01402
01403 void
01404 KAboutWidget::setAuthor(const QString &_name, const QString &_email,
01405 const QString &_url, const QString &_w)
01406 {
01407
01408 author->setName(_name);
01409 author->setEmail(_email);
01410 author->setURL(_url);
01411 author->setWork(_w);
01412
01413 }
01414
01415 void
01416 KAboutWidget::setMaintainer(const QString &_name, const QString &_email,
01417 const QString &_url, const QString &_w)
01418 {
01419
01420 maintainer->setName(_name);
01421 maintainer->setEmail(_email);
01422 maintainer->setWork(_w);
01423 maintainer->setURL(_url);
01424 showMaintainer=true;
01425
01426 }
01427
01428 void
01429 KAboutWidget::addContributor(const QString &_name, const QString &_email,
01430 const QString &_url, const QString &_w)
01431 {
01432
01433 KAboutContributor *c=new KAboutContributor(this);
01434
01435 c->setName(_name);
01436 c->setEmail(_email);
01437 c->setURL(_url);
01438 c->setWork(_w);
01439 contributors.append(c);
01440 connect(c, SIGNAL(sendEmail(const QString&, const QString&)),
01441 SLOT(sendEmailSlot(const QString&, const QString&)));
01442 connect(c, SIGNAL(openURL(const QString&)), SLOT(openURLSlot(const QString&)));
01443
01444 }
01445
01446 void
01447 KAboutWidget::setVersion(const QString &_name)
01448 {
01449
01450 version->setText(_name);
01451
01452 }
01453
01454 void
01455 KAboutWidget::resizeEvent(QResizeEvent*)
01456 {
01457
01458 int _x=0, _y, cx, tempx, tempy;
01459
01460 version->setGeometry(0, 0, width(), version->sizeHint().height());
01461 _y=version->height()+Grid;
01462
01463 logo->adjustSize();
01464 logo->move(0, _y);
01465
01466 tempx=logo->width()+Grid;
01467 cx=width()-tempx;
01468 author->setGeometry
01469 (tempx, _y, cx, author->sizeHint().height());
01470 maintainer->setGeometry
01471 (tempx, _y+author->height()+Grid, cx, maintainer->sizeHint().height());
01472
01473 _y+=QMAX(logo->height(),
01474 author->height()+(showMaintainer ? Grid+maintainer->height() : 0));
01475
01476 if(!contributors.isEmpty())
01477 {
01478 tempy=cont->sizeHint().height();
01479 cont->setGeometry(0, _y, width(), tempy);
01480 cont->show();
01481 _y+=tempy+Grid;
01482 } else {
01483 cont->hide();
01484 }
01485
01486 for(QPtrListIterator<KAboutContributor> _pos(contributors); _pos.current(); ++_pos)
01487 {
01488 tempy=_pos.current()->sizeHint().height();
01489
01490 _pos.current()->setGeometry(_x, _y, width(), tempy);
01491 _y+=tempy;
01492 }
01493 if(showMaintainer)
01494 {
01495 maintainer->show();
01496 } else {
01497 maintainer->hide();
01498 }
01499
01500 }
01501
01502 KAboutDialog::KAboutDialog(QWidget *_parent, const char *_name, bool modal)
01503 : KDialogBase(_parent, _name, modal, QString::null, Ok, Ok ),
01504 about(new KAboutWidget(this)), mContainerBase(0)
01505 {
01506
01507 if(about==0)
01508 {
01509
01510 kdDebug() << "KAboutDialog::KAboutDialog: Out of memory." << endl;
01511 qApp->quit();
01512 }
01513 setMainWidget(about);
01514 connect(about, SIGNAL(sendEmail(const QString&, const QString&)),
01515 SLOT(sendEmailSlot(const QString&, const QString&)));
01516 connect(about, SIGNAL(openURL(const QString&)),
01517 SLOT(openURLSlot(const QString&)));
01518
01519 }
01520
01521
01522 KAboutDialog::KAboutDialog( int layoutType, const QString &_caption,
01523 int buttonMask, ButtonCode defaultButton,
01524 QWidget *_parent, const char *_name, bool modal,
01525 bool separator, const QString &user1,
01526 const QString &user2, const QString &user3 )
01527 :KDialogBase( _parent, _name, modal, QString::null, buttonMask, defaultButton,
01528 separator, user1, user2, user3 ),
01529 about(0)
01530 {
01531 setPlainCaption( i18n("About %1").arg(_caption) );
01532
01533 mContainerBase = new KAboutContainerBase( layoutType, this );
01534 setMainWidget(mContainerBase);
01535
01536 connect( mContainerBase, SIGNAL(urlClick(const QString &)),
01537 this, SLOT(openURLSlot(const QString &)));
01538 connect( mContainerBase, SIGNAL(mailClick(const QString &,const QString &)),
01539 this, SLOT(sendEmailSlot(const QString &,const QString &)));
01540 connect( mContainerBase, SIGNAL(mouseTrack(int, const QMouseEvent *)),
01541 this, SLOT(mouseTrackSlot(int, const QMouseEvent *)));
01542 }
01543
01544
01545 void KAboutDialog::show( void )
01546 {
01547 adjust();
01548 if( mContainerBase != 0 ) { mContainerBase->show(); }
01549 QDialog::show();
01550 }
01551
01552
01553 void KAboutDialog::show( QWidget * )
01554 {
01555 adjust();
01556 if( mContainerBase != 0 ) { mContainerBase->show(); }
01557 QDialog::show();
01558 }
01559
01560
01561 void KAboutDialog::adjust()
01562 {
01563 if( about == 0 ) { return; }
01564 about->adjust();
01565
01566 resize( sizeHint() );
01567 }
01568
01569
01570 void KAboutDialog::setLogo(const QPixmap& i)
01571 {
01572 if( about == 0 ) { return; }
01573 about->setLogo(i);
01574 }
01575
01576
01577 void KAboutDialog::setMaintainer(const QString &_name, const QString &_email,
01578 const QString &_url, const QString &_w)
01579 {
01580
01581 if( about == 0 ) { return; }
01582 about->setMaintainer(_name, _email, _url, _w);
01583
01584 }
01585
01586 void KAboutDialog::setAuthor(const QString &_name, const QString &_email,
01587 const QString &_url, const QString &_work)
01588 {
01589
01590 if( about == 0 ) { return; }
01591 about->setAuthor(_name, _email, _url, _work);
01592
01593 }
01594
01595 void KAboutDialog::addContributor(const QString &_name, const QString &_email,
01596 const QString &_url, const QString &_w)
01597 {
01598
01599 if( about == 0 ) { return; }
01600 about->addContributor(_name, _email, _url, _w);
01601
01602 }
01603
01604 void KAboutDialog::setVersion(const QString &_name)
01605 {
01606
01607 if( about == 0 ) { return; }
01608 about->setVersion(_name);
01609
01610 }
01611
01612 void KAboutDialog::sendEmailSlot(const QString& , const QString& email)
01613 {
01614 if ( kapp )
01615 kapp->invokeMailer( email, QString::null );
01616
01617
01618
01619
01620
01621 }
01622
01623 void KAboutDialog::openURLSlot(const QString& url)
01624 {
01625 if ( kapp )
01626 kapp->invokeBrowser( url );
01627
01628
01629 }
01630
01631
01632 void KAboutDialog::mouseTrackSlot( int , const QMouseEvent * )
01633 {
01634
01635 }
01636
01637
01638 QFrame *KAboutDialog::addTextPage( const QString &title, const QString &text,
01639 bool richText, int numLines )
01640 {
01641 if( mContainerBase == 0 ) { return( 0 ); }
01642 return( mContainerBase->addTextPage( title, text, richText, numLines ) );
01643 }
01644
01645 QFrame *KAboutDialog::addLicensePage( const QString &title, const QString &text,
01646 int numLines )
01647 {
01648 if( mContainerBase == 0 ) { return( 0 ); }
01649 return( mContainerBase->addLicensePage( title, text, numLines ) );
01650 }
01651
01652
01653 KAboutContainer *KAboutDialog::addContainerPage( const QString &title,
01654 int childAlignment, int innerAlignment )
01655 {
01656 if( mContainerBase == 0 ) { return( 0 ); }
01657 return( mContainerBase->addContainerPage( title, childAlignment,
01658 innerAlignment) );
01659 }
01660
01661
01662 KAboutContainer *KAboutDialog::addScrolledContainerPage( const QString &title,
01663 int childAlignment, int innerAlignment )
01664 {
01665 if( mContainerBase == 0 ) { return( 0 ); }
01666 return( mContainerBase->addScrolledContainerPage( title, childAlignment,
01667 innerAlignment) );
01668 }
01669
01670
01671
01672 QFrame *KAboutDialog::addPage( const QString &title )
01673 {
01674 if( mContainerBase == 0 ) { return( 0 ); }
01675 return( mContainerBase->addEmptyPage( title ) );
01676 }
01677
01678
01679 KAboutContainer *KAboutDialog::addContainer( int childAlignment,
01680 int innerAlignment )
01681 {
01682 if( mContainerBase == 0 ) { return( 0 ); }
01683 return( mContainerBase->addContainer( childAlignment, innerAlignment ) );
01684 }
01685
01686
01687 void KAboutDialog::setTitle( const QString &title )
01688 {
01689 if( mContainerBase == 0 ) { return; }
01690 mContainerBase->setTitle( title );
01691 }
01692
01693
01694 void KAboutDialog::setImage( const QString &fileName )
01695 {
01696 if( mContainerBase == 0 ) { return; }
01697 mContainerBase->setImage( fileName );
01698 }
01699
01700 void KAboutDialog::setIcon( const QString &fileName )
01701 {
01702 if( mContainerBase == 0 ) { return; }
01703 mContainerBase->setIcon( fileName );
01704 }
01705
01706
01707 void KAboutDialog::setImageBackgroundColor( const QColor &color )
01708 {
01709 if( mContainerBase == 0 ) { return; }
01710 mContainerBase->setImageBackgroundColor( color );
01711 }
01712
01713
01714 void KAboutDialog::setImageFrame( bool state )
01715 {
01716 if( mContainerBase == 0 ) { return; }
01717 mContainerBase->setImageFrame( state );
01718 }
01719
01720
01721 void KAboutDialog::setProduct( const QString &appName, const QString &version,
01722 const QString &author, const QString &year )
01723 {
01724 if( mContainerBase == 0 ) { return; }
01725 mContainerBase->setProduct( appName, version, author, year );
01726 }
01727
01728
01729
01730 void KAboutDialog::imageURL( QWidget *_parent, const QString &_caption,
01731 const QString &_path, const QColor &_imageColor,
01732 const QString &_url )
01733 {
01734 KAboutDialog a( AbtImageOnly, QString::null, Close, Close, _parent, "image", true );
01735 a.setPlainCaption( _caption );
01736 a.setImage( _path );
01737 a.setImageBackgroundColor( _imageColor );
01738
01739 KAboutContainer *c = a.addContainer( AlignCenter, AlignCenter );
01740 if( c != 0 )
01741 {
01742 c->addPerson( QString::null, QString::null, _url, QString::null );
01743 }
01744 a.exec();
01745 }
01746
01747
01748
01749
01750
01751
01752
01753 KImageTrackLabel::KImageTrackLabel( QWidget *_parent, const char *_name, WFlags f )
01754 : QLabel( _parent, _name, f )
01755 {
01756 setText( i18n("Image missing"));
01757 }
01758
01759 void KImageTrackLabel::mousePressEvent( QMouseEvent *e )
01760 {
01761 emit mouseTrack( MousePress, e );
01762 }
01763
01764 void KImageTrackLabel::mouseReleaseEvent( QMouseEvent *e )
01765 {
01766 emit mouseTrack( MouseRelease, e );
01767 }
01768
01769 void KImageTrackLabel::mouseDoubleClickEvent( QMouseEvent *e )
01770 {
01771 emit mouseTrack( MouseDoubleClick, e );
01772 }
01773
01774 void KImageTrackLabel::mouseMoveEvent ( QMouseEvent *e )
01775 {
01776 emit mouseTrack( MouseDoubleClick, e );
01777 }
01778
01779 void KAboutDialog::virtual_hook( int id, void* data )
01780 { KDialogBase::virtual_hook( id, data ); }
01781