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