You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
189 lines
6.2 KiB
189 lines
6.2 KiB
15 years ago
|
/*
|
||
|
* This file is part of the KDE Libraries
|
||
|
* Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and
|
||
|
* Espen Sand (espen@kde.org)
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Library General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public License
|
||
|
* along with this library; see the file COPYING.LIB. If not, write to
|
||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
// I (espen) prefer that header files are included alphabetically
|
||
|
|
||
15 years ago
|
#include <tqlabel.h>
|
||
15 years ago
|
#include <kaboutapplication.h>
|
||
|
#include <kaboutdialog_private.h>
|
||
|
#include <kaboutdata.h>
|
||
|
#include <kapplication.h>
|
||
|
#include <kglobal.h>
|
||
|
#include <klocale.h>
|
||
|
#include <kurllabel.h>
|
||
|
#include <kactivelabel.h>
|
||
|
#include "ktextedit.h"
|
||
|
|
||
15 years ago
|
KAboutApplication::KAboutApplication( TQWidget *parent, const char *name,
|
||
15 years ago
|
bool modal )
|
||
|
:KAboutDialog( AbtTabbed|AbtProduct,
|
||
15 years ago
|
kapp ? kapp->caption() : TQString::null,
|
||
15 years ago
|
Close, Close,
|
||
|
parent, name, modal )
|
||
|
{
|
||
|
buildDialog(KGlobal::instance()->aboutData());
|
||
|
}
|
||
|
|
||
15 years ago
|
KAboutApplication::KAboutApplication( const KAboutData *aboutData, TQWidget *parent,
|
||
15 years ago
|
const char *name, bool modal )
|
||
|
:KAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
|
||
|
parent, name, modal )
|
||
|
{
|
||
|
buildDialog(aboutData);
|
||
|
}
|
||
|
|
||
|
void KAboutApplication::buildDialog( const KAboutData *aboutData )
|
||
|
{
|
||
|
if( !aboutData )
|
||
|
{
|
||
|
//
|
||
|
// Recovery
|
||
|
//
|
||
|
|
||
|
//i18n "??" is displayed as (pseudo-)version when no data is known about the application
|
||
15 years ago
|
setProduct( kapp ? kapp->caption() : TQString::null, i18n("??"), TQString::null, TQString::null );
|
||
15 years ago
|
KAboutContainer *appPage = addContainerPage( i18n("&About"));
|
||
|
|
||
15 years ago
|
TQString appPageText =
|
||
15 years ago
|
i18n("No information available.\n"
|
||
|
"The supplied KAboutData object does not exist.");
|
||
15 years ago
|
TQLabel *appPageLabel = new TQLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
|
||
15 years ago
|
appPage->addWidget( appPageLabel );
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
setProduct( aboutData->programName(), aboutData->version(),
|
||
15 years ago
|
TQString::null, TQString::null );
|
||
15 years ago
|
|
||
|
if (!aboutData->programLogo().isNull())
|
||
|
setProgramLogo( aboutData->programLogo() );
|
||
|
|
||
15 years ago
|
TQString appPageText = aboutData->shortDescription() + "\n";
|
||
15 years ago
|
|
||
|
if (!aboutData->otherText().isEmpty())
|
||
|
appPageText += "\n" + aboutData->otherText()+"\n";
|
||
|
|
||
|
if (!aboutData->copyrightStatement().isEmpty())
|
||
|
appPageText += "\n" + aboutData->copyrightStatement()+"\n";
|
||
|
|
||
|
KAboutContainer *appPage = addContainerPage( i18n("&About"));
|
||
|
|
||
15 years ago
|
TQLabel *appPageLabel = new TQLabel( appPageText, 0 );
|
||
15 years ago
|
appPage->addWidget( appPageLabel );
|
||
|
|
||
|
if (!aboutData->homepage().isEmpty())
|
||
|
{
|
||
|
KURLLabel *url = new KURLLabel();
|
||
|
url->setText(aboutData->homepage());
|
||
|
url->setURL(aboutData->homepage());
|
||
|
appPage->addWidget( url );
|
||
15 years ago
|
connect( url, TQT_SIGNAL(leftClickedURL(const TQString &)),
|
||
|
this, TQT_SLOT(openURLSlot(const TQString &)));
|
||
15 years ago
|
}
|
||
|
|
||
|
int authorCount = aboutData->authors().count();
|
||
|
if (authorCount)
|
||
|
{
|
||
15 years ago
|
TQString authorPageTitle = authorCount == 1 ?
|
||
15 years ago
|
i18n("A&uthor") : i18n("A&uthors");
|
||
|
KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
|
||
|
|
||
|
if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
|
||
|
{
|
||
15 years ago
|
TQString text;
|
||
15 years ago
|
KActiveLabel* activeLabel = new KActiveLabel( authorPage );
|
||
|
if (!aboutData->customAuthorTextEnabled())
|
||
|
{
|
||
15 years ago
|
if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.pearsoncomputing.net")
|
||
|
text = i18n( "Please use <a href=\"http://bugs.pearsoncomputing.net\">http://bugs.pearsoncomputing.net</a> to report bugs.\n" );
|
||
15 years ago
|
else {
|
||
|
if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
|
||
|
{
|
||
|
text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() );
|
||
|
}
|
||
|
else {
|
||
|
text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
text = aboutData->customAuthorRichText();
|
||
|
}
|
||
|
activeLabel->setText( text );
|
||
|
authorPage->addWidget( activeLabel );
|
||
|
}
|
||
|
|
||
15 years ago
|
TQValueList<KAboutPerson>::ConstIterator it;
|
||
15 years ago
|
for (it = aboutData->authors().begin();
|
||
|
it != aboutData->authors().end(); ++it)
|
||
|
{
|
||
|
authorPage->addPerson( (*it).name(), (*it).emailAddress(),
|
||
|
(*it).webAddress(), (*it).task() );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int creditsCount = aboutData->credits().count();
|
||
|
if (creditsCount)
|
||
|
{
|
||
|
KAboutContainer *creditsPage =
|
||
|
addScrolledContainerPage( i18n("&Thanks To") );
|
||
15 years ago
|
TQValueList<KAboutPerson>::ConstIterator it;
|
||
15 years ago
|
for (it = aboutData->credits().begin();
|
||
|
it != aboutData->credits().end(); ++it)
|
||
|
{
|
||
|
creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
|
||
|
(*it).webAddress(), (*it).task() );
|
||
|
}
|
||
|
}
|
||
|
|
||
15 years ago
|
const TQValueList<KAboutTranslator> translatorList = aboutData->translators();
|
||
15 years ago
|
|
||
|
if(translatorList.count() > 0)
|
||
|
{
|
||
15 years ago
|
TQString text = "<qt>";
|
||
15 years ago
|
|
||
15 years ago
|
TQValueList<KAboutTranslator>::ConstIterator it;
|
||
15 years ago
|
for(it = translatorList.begin(); it != translatorList.end(); ++it)
|
||
|
{
|
||
15 years ago
|
text += TQString("<p>%1<br> "
|
||
15 years ago
|
"<a href=\"mailto:%2\">%2</a></p>")
|
||
|
.arg((*it).name())
|
||
|
.arg((*it).emailAddress())
|
||
|
.arg((*it).emailAddress());
|
||
|
}
|
||
|
|
||
|
text += KAboutData::aboutTranslationTeam() + "</qt>";
|
||
|
addTextPage( i18n("T&ranslation"), text, true);
|
||
|
}
|
||
|
|
||
|
if (!aboutData->license().isEmpty() )
|
||
|
{
|
||
|
addLicensePage( i18n("&License Agreement"), aboutData->license() );
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Make sure the dialog has a reasonable width
|
||
|
//
|
||
15 years ago
|
setInitialSize( TQSize(400,1) );
|
||
15 years ago
|
}
|