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