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 #include "ktextedit.h"
00034
00035 KAboutApplication::KAboutApplication( QWidget *parent, const char *name,
00036 bool modal )
00037 :KAboutDialog( AbtTabbed|AbtProduct,
00038 kapp ? kapp->caption() : QString::null,
00039 Close, Close,
00040 parent, name, modal )
00041 {
00042 buildDialog(KGlobal::instance()->aboutData());
00043 }
00044
00045 KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent,
00046 const char *name, bool modal )
00047 :KAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
00048 parent, name, modal )
00049 {
00050 buildDialog(aboutData);
00051 }
00052
00053 void KAboutApplication::buildDialog( const KAboutData *aboutData )
00054 {
00055 if( aboutData == 0 )
00056 {
00057
00058
00059
00060 setProduct( kapp ? kapp->caption() : QString::null, i18n("??"), QString::null, QString::null );
00061 KAboutContainer *appPage = addContainerPage( i18n("&About"));
00062
00063 QString appPageText =
00064 i18n("No information available.\n"
00065 "The supplied KAboutData object does not exist.");
00066 QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
00067 appPage->addWidget( appPageLabel );
00068 return;
00069 }
00070
00071 setProduct( aboutData->programName(), aboutData->version(),
00072 QString::null, QString::null );
00073
00074 QString appPageText = aboutData->shortDescription() + "\n";
00075
00076 if (!aboutData->otherText().isEmpty())
00077 appPageText += "\n" + aboutData->otherText()+"\n";
00078
00079 if (!aboutData->copyrightStatement().isEmpty())
00080 appPageText += "\n" + aboutData->copyrightStatement()+"\n";
00081
00082 KAboutContainer *appPage = addContainerPage( i18n("&About"));
00083
00084 QLabel *appPageLabel = new QLabel( appPageText, 0 );
00085 appPage->addWidget( appPageLabel );
00086
00087 if (!aboutData->homepage().isEmpty())
00088 {
00089 KURLLabel *url = new KURLLabel();
00090 url->setText(aboutData->homepage());
00091 url->setURL(aboutData->homepage());
00092 appPage->addWidget( url );
00093 connect( url, SIGNAL(leftClickedURL(const QString &)),
00094 this, SLOT(openURLSlot(const QString &)));
00095 }
00096
00097 int authorCount = aboutData->authors().count();
00098 if (authorCount)
00099 {
00100 QString authorPageTitle = authorCount == 1 ?
00101 i18n("A&uthor") : i18n("A&uthors");
00102 KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
00103 QValueList<KAboutPerson>::ConstIterator it;
00104 for (it = aboutData->authors().begin();
00105 it != aboutData->authors().end(); ++it)
00106 {
00107 authorPage->addPerson( (*it).name(), (*it).emailAddress(),
00108 (*it).webAddress(), (*it).task() );
00109 }
00110 }
00111
00112 int creditsCount = aboutData->credits().count();
00113 if (creditsCount)
00114 {
00115 KAboutContainer *creditsPage =
00116 addScrolledContainerPage( i18n("&Thanks To") );
00117 QValueList<KAboutPerson>::ConstIterator it;
00118 for (it = aboutData->credits().begin();
00119 it != aboutData->credits().end(); ++it)
00120 {
00121 creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
00122 (*it).webAddress(), (*it).task() );
00123 }
00124 }
00125
00126 const QValueList<KAboutTranslator> translatorList = aboutData->translators();
00127
00128 if(translatorList.count() > 0)
00129 {
00130 QString text = "<qt>";
00131
00132 QValueList<KAboutTranslator>::ConstIterator it;
00133 for(it = translatorList.begin(); it != translatorList.end(); ++it)
00134 {
00135 text += QString("<p>%1<br> "
00136 "<a href=\"mailto:%2\">%2</a></p>")
00137 .arg((*it).name())
00138 .arg((*it).emailAddress())
00139 .arg((*it).emailAddress());
00140 }
00141
00142 text += KAboutData::aboutTranslationTeam() + "</qt>";
00143 addTextPage( i18n("T&ranslation"), text, true);
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 kdeui Library Version 3.3.0.