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 #include <kactivelabel.h>
00034 #include "ktextedit.h"
00035
00036 KAboutApplication::KAboutApplication( QWidget *parent, const char *name,
00037 bool modal )
00038 :KAboutDialog( AbtTabbed|AbtProduct,
00039 kapp ? kapp->caption() : QString::null,
00040 Close, Close,
00041 parent, name, modal )
00042 {
00043 buildDialog(KGlobal::instance()->aboutData());
00044 }
00045
00046 KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent,
00047 const char *name, bool modal )
00048 :KAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
00049 parent, name, modal )
00050 {
00051 buildDialog(aboutData);
00052 }
00053
00054 void KAboutApplication::buildDialog( const KAboutData *aboutData )
00055 {
00056 if( !aboutData )
00057 {
00058
00059
00060
00061
00062
00063 setProduct( kapp ? kapp->caption() : QString::null, i18n("??"), QString::null, QString::null );
00064 KAboutContainer *appPage = addContainerPage( i18n("&About"));
00065
00066 QString appPageText =
00067 i18n("No information available.\n"
00068 "The supplied KAboutData object does not exist.");
00069 QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
00070 appPage->addWidget( appPageLabel );
00071 return;
00072 }
00073
00074 setProduct( aboutData->programName(), aboutData->version(),
00075 QString::null, QString::null );
00076
00077 if (!aboutData->programLogo().isNull())
00078 setProgramLogo( aboutData->programLogo() );
00079
00080 QString appPageText = aboutData->shortDescription() + "\n";
00081
00082 if (!aboutData->otherText().isEmpty())
00083 appPageText += "\n" + aboutData->otherText()+"\n";
00084
00085 if (!aboutData->copyrightStatement().isEmpty())
00086 appPageText += "\n" + aboutData->copyrightStatement()+"\n";
00087
00088 KAboutContainer *appPage = addContainerPage( i18n("&About"));
00089
00090 QLabel *appPageLabel = new QLabel( appPageText, 0 );
00091 appPage->addWidget( appPageLabel );
00092
00093 if (!aboutData->homepage().isEmpty())
00094 {
00095 KURLLabel *url = new KURLLabel();
00096 url->setText(aboutData->homepage());
00097 url->setURL(aboutData->homepage());
00098 appPage->addWidget( url );
00099 connect( url, SIGNAL(leftClickedURL(const QString &)),
00100 this, SLOT(openURLSlot(const QString &)));
00101 }
00102
00103 int authorCount = aboutData->authors().count();
00104 if (authorCount)
00105 {
00106 QString authorPageTitle = authorCount == 1 ?
00107 i18n("A&uthor") : i18n("A&uthors");
00108 KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
00109
00110 if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
00111 {
00112 QString text;
00113 KActiveLabel* activeLabel = new KActiveLabel( authorPage );
00114 if (!aboutData->customAuthorTextEnabled())
00115 {
00116 if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.kde.org")
00117 text = i18n( "Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs.\n" );
00118 else {
00119 if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
00120 {
00121 text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() );
00122 }
00123 else {
00124 text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() );
00125 }
00126 }
00127 }
00128 else
00129 {
00130 text = aboutData->customAuthorRichText();
00131 }
00132 activeLabel->setText( text );
00133 authorPage->addWidget( activeLabel );
00134 }
00135
00136 QValueList<KAboutPerson>::ConstIterator it;
00137 for (it = aboutData->authors().begin();
00138 it != aboutData->authors().end(); ++it)
00139 {
00140 authorPage->addPerson( (*it).name(), (*it).emailAddress(),
00141 (*it).webAddress(), (*it).task() );
00142 }
00143 }
00144
00145 int creditsCount = aboutData->credits().count();
00146 if (creditsCount)
00147 {
00148 KAboutContainer *creditsPage =
00149 addScrolledContainerPage( i18n("&Thanks To") );
00150 QValueList<KAboutPerson>::ConstIterator it;
00151 for (it = aboutData->credits().begin();
00152 it != aboutData->credits().end(); ++it)
00153 {
00154 creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
00155 (*it).webAddress(), (*it).task() );
00156 }
00157 }
00158
00159 const QValueList<KAboutTranslator> translatorList = aboutData->translators();
00160
00161 if(translatorList.count() > 0)
00162 {
00163 QString text = "<qt>";
00164
00165 QValueList<KAboutTranslator>::ConstIterator it;
00166 for(it = translatorList.begin(); it != translatorList.end(); ++it)
00167 {
00168 text += QString("<p>%1<br> "
00169 "<a href=\"mailto:%2\">%2</a></p>")
00170 .arg((*it).name())
00171 .arg((*it).emailAddress())
00172 .arg((*it).emailAddress());
00173 }
00174
00175 text += KAboutData::aboutTranslationTeam() + "</qt>";
00176 addTextPage( i18n("T&ranslation"), text, true);
00177 }
00178
00179 if (!aboutData->license().isEmpty() )
00180 {
00181 addLicensePage( i18n("&License Agreement"), aboutData->license() );
00182 }
00183
00184
00185
00186
00187 setInitialSize( QSize(400,1) );
00188 }