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
KActiveLabel* activeLabel =
new KActiveLabel( authorPage );
00109
if (aboutData->
bugAddress().
isEmpty() || aboutData->
bugAddress() ==
"submit@bugs.kde.org")
00110 activeLabel->setText( i18n(
"Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs, do not mail the authors directly." ) );
00111
else
00112 activeLabel->setText( i18n(
"Please use <a href=\"mailto:%1\">%1</a> to report bugs, do not mail the authors directly.\n" ).arg(aboutData->
bugAddress()).
arg(aboutData->
bugAddress()) );
00113 authorPage->
addWidget( activeLabel );
00114
00115
QValueList<KAboutPerson>::ConstIterator it;
00116
for (it = aboutData->
authors().begin();
00117 it != aboutData->
authors().end(); ++it)
00118 {
00119 authorPage->
addPerson( (*it).name(), (*it).emailAddress(),
00120 (*it).webAddress(), (*it).task() );
00121 }
00122 }
00123
00124
int creditsCount = aboutData->
credits().count();
00125
if (creditsCount)
00126 {
00127
KAboutContainer *creditsPage =
00128 addScrolledContainerPage( i18n(
"&Thanks To") );
00129
QValueList<KAboutPerson>::ConstIterator it;
00130
for (it = aboutData->
credits().begin();
00131 it != aboutData->
credits().end(); ++it)
00132 {
00133 creditsPage->
addPerson( (*it).name(), (*it).emailAddress(),
00134 (*it).webAddress(), (*it).task() );
00135 }
00136 }
00137
00138
const QValueList<KAboutTranslator> translatorList = aboutData->
translators();
00139
00140
if(translatorList.
count() > 0)
00141 {
00142
QString text =
"<qt>";
00143
00144
QValueList<KAboutTranslator>::ConstIterator it;
00145
for(it = translatorList.
begin(); it != translatorList.
end(); ++it)
00146 {
00147 text +=
QString(
"<p>%1<br> "
00148
"<a href=\"mailto:%2\">%2</a></p>")
00149 .
arg((*it).name())
00150 .arg((*it).emailAddress())
00151 .arg((*it).emailAddress());
00152 }
00153
00154 text +=
KAboutData::aboutTranslationTeam() +
"</qt>";
00155
addTextPage( i18n(
"T&ranslation"), text,
true);
00156 }
00157
00158
if (!aboutData->
license().
isEmpty() )
00159 {
00160
addLicensePage( i18n(
"&License Agreement"), aboutData->
license() );
00161 }
00162
00163
00164
00165
00166
setInitialSize(
QSize(400,1) );
00167 }