kaboutapplication.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <qlabel.h>
00026 #include <kaboutapplication.h>
00027 #include <kaboutdialog_private.h>
00028 #include <kaboutdata.h>
00029 #include <kapplication.h>
00030 #include <kglobal.h>
00031 #include <klocale.h>
00032 #include <kurllabel.h>
00033
00034 KAboutApplication::KAboutApplication( QWidget *parent, const char *name,
00035 bool modal )
00036 :KAboutDialog( AbtTabbed|AbtProduct,
00037 kapp ? kapp->caption() : QString::null,
00038 Close, Close,
00039 parent, name, modal )
00040 {
00041 buildDialog(KGlobal::instance()->aboutData());
00042 }
00043
00044 KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent,
00045 const char *name, bool modal )
00046 :KAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
00047 parent, name, modal )
00048 {
00049 buildDialog(aboutData);
00050 }
00051
00052 void KAboutApplication::buildDialog( const KAboutData *aboutData )
00053 {
00054 if( aboutData == 0 )
00055 {
00056
00057
00058
00059 setProduct( kapp ? kapp->caption() : QString::null, i18n("??"), QString::null, QString::null );
00060 KAboutContainer *appPage = addContainerPage( i18n("&About"));
00061
00062 QString appPageText =
00063 i18n("No information available.\n"
00064 "The supplied KAboutData object does not exist.");
00065 QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
00066 appPage->addWidget( appPageLabel );
00067 return;
00068 }
00069
00070 setProduct( aboutData->programName(), aboutData->version(),
00071 QString::null, QString::null );
00072
00073 QString appPageText = aboutData->shortDescription() + "\n";
00074
00075 if (!aboutData->otherText().isEmpty())
00076 appPageText += "\n" + aboutData->otherText()+"\n";
00077
00078 if (!aboutData->copyrightStatement().isEmpty())
00079 appPageText += "\n" + aboutData->copyrightStatement()+"\n";
00080
00081 KAboutContainer *appPage = addContainerPage( i18n("&About"));
00082
00083 QLabel *appPageLabel = new QLabel( appPageText, 0 );
00084 appPage->addWidget( appPageLabel );
00085
00086 if (!aboutData->homepage().isEmpty())
00087 {
00088 KURLLabel *url = new KURLLabel();
00089 url->setText(aboutData->homepage());
00090 url->setURL(aboutData->homepage());
00091 appPage->addWidget( url );
00092 connect( url, SIGNAL(leftClickedURL(const QString &)),
00093 this, SLOT(openURLSlot(const QString &)));
00094 }
00095
00096 int authorCount = aboutData->authors().count();
00097 if (authorCount)
00098 {
00099 QString authorPageTitle = authorCount == 1 ?
00100 i18n("A&uthor") : i18n("A&uthors");
00101 KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
00102 QValueList<KAboutPerson>::ConstIterator it;
00103 for (it = aboutData->authors().begin();
00104 it != aboutData->authors().end(); ++it)
00105 {
00106 authorPage->addPerson( (*it).name(), (*it).emailAddress(),
00107 (*it).webAddress(), (*it).task() );
00108 }
00109 }
00110
00111 int creditsCount = aboutData->credits().count();
00112 if (creditsCount)
00113 {
00114 KAboutContainer *creditsPage =
00115 addScrolledContainerPage( i18n("&Thanks To") );
00116 QValueList<KAboutPerson>::ConstIterator it;
00117 for (it = aboutData->credits().begin();
00118 it != aboutData->credits().end(); ++it)
00119 {
00120 creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
00121 (*it).webAddress(), (*it).task() );
00122 }
00123 }
00124
00125 const QValueList<KAboutTranslator> translatorList = aboutData->translators();
00126
00127 if(translatorList.count() > 0)
00128 {
00129 KAboutContainer *translatorPage =
00130 addScrolledContainerPage( i18n("T&ranslation") );
00131
00132 QValueList<KAboutTranslator>::ConstIterator it;
00133 for(it = translatorList.begin(); it != translatorList.end(); ++it)
00134 {
00135 translatorPage->addPerson((*it).name(), (*it).emailAddress(),
00136 0,0);
00137 }
00138
00139 QLabel *label = new QLabel(KAboutData::aboutTranslationTeam()
00140 ,translatorPage);
00141 label->adjustSize();
00142 label->setMinimumSize(label->sizeHint());
00143 translatorPage->addWidget(label);
00144 }
00145
00146 if (!aboutData->license().isEmpty() )
00147 {
00148 addLicensePage( i18n("&License Agreement"), aboutData->license() );
00149 }
00150
00151
00152
00153
00154 setInitialSize( QSize(400,1) );
00155 }
This file is part of the documentation for kdelibs Version 3.1.4.