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 <tqlabel.h>
00026 #include <tdeaboutapplication.h>
00027 #include <kaboutdialog_private.h>
00028 #include <tdeaboutdata.h>
00029 #include <tdeapplication.h>
00030 #include <tdeglobal.h>
00031 #include <tdelocale.h>
00032 #include <kurllabel.h>
00033 #include <kactivelabel.h>
00034 #include "ktextedit.h"
00035
00036 TDEAboutApplication::TDEAboutApplication( TQWidget *parent, const char *name,
00037 bool modal )
00038 :TDEAboutDialog( AbtTabbed|AbtProduct,
00039 kapp ? kapp->caption() : TQString::null,
00040 Close, Close,
00041 parent, name, modal )
00042 {
00043 buildDialog(TDEGlobal::instance()->aboutData());
00044 }
00045
00046 TDEAboutApplication::TDEAboutApplication( const TDEAboutData *aboutData, TQWidget *parent,
00047 const char *name, bool modal )
00048 :TDEAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
00049 parent, name, modal )
00050 {
00051 buildDialog(aboutData);
00052 }
00053
00054 void TDEAboutApplication::buildDialog( const TDEAboutData *aboutData )
00055 {
00056 if( !aboutData )
00057 {
00058
00059
00060
00061
00062
00063 setProduct( kapp ? kapp->caption() : TQString::null, i18n("??"), TQString::null, TQString::null );
00064 TDEAboutContainer *appPage = addContainerPage( i18n("&About"));
00065
00066 TQString appPageText =
00067 i18n("No information available.\n"
00068 "The supplied TDEAboutData object does not exist.");
00069 TQLabel *appPageLabel = new TQLabel( "\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 TQString::null, TQString::null );
00076
00077 if (!aboutData->programLogo().isNull())
00078 setProgramLogo( aboutData->programLogo() );
00079
00080 TQString 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 TDEAboutContainer *appPage = addContainerPage( i18n("&About"));
00089
00090 TQLabel *appPageLabel = new TQLabel( 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, TQT_SIGNAL(leftClickedURL(const TQString &)),
00100 this, TQT_SLOT(openURLSlot(const TQString &)));
00101 }
00102
00103 int authorCount = aboutData->authors().count();
00104 if (authorCount)
00105 {
00106 TQString authorPageTitle = authorCount == 1 ?
00107 i18n("A&uthor") : i18n("A&uthors");
00108 TDEAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
00109
00110 if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
00111 {
00112 TQString text;
00113 KActiveLabel* activeLabel = new KActiveLabel( authorPage );
00114 if (!aboutData->customAuthorTextEnabled())
00115 {
00116 if ( aboutData->bugAddress().isEmpty()
00117 || aboutData->bugAddress() == "submit@bugs.trinitydesktop.org"
00118 || aboutData->bugAddress() == "http://bugs.trinitydesktop.org")
00119 text = i18n( "Please use <a href=\"http://bugs.trinitydesktop.org\">http://bugs.trinitydesktop.org</a> to report bugs.\n" );
00120 else {
00121 if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
00122 {
00123 text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() );
00124 }
00125 else {
00126 text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() );
00127 }
00128 }
00129 }
00130 else
00131 {
00132 text = aboutData->customAuthorRichText();
00133 }
00134 activeLabel->setText( text );
00135 authorPage->addWidget( activeLabel );
00136 }
00137
00138 TQValueList<TDEAboutPerson>::ConstIterator it;
00139 for (it = aboutData->authors().begin();
00140 it != aboutData->authors().end(); ++it)
00141 {
00142 authorPage->addPerson( (*it).name(), (*it).emailAddress(),
00143 (*it).webAddress(), (*it).task() );
00144 }
00145 }
00146
00147 int creditsCount = aboutData->credits().count();
00148 if (creditsCount)
00149 {
00150 TDEAboutContainer *creditsPage =
00151 addScrolledContainerPage( i18n("&Thanks To") );
00152 TQValueList<TDEAboutPerson>::ConstIterator it;
00153 for (it = aboutData->credits().begin();
00154 it != aboutData->credits().end(); ++it)
00155 {
00156 creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
00157 (*it).webAddress(), (*it).task() );
00158 }
00159 }
00160
00161 const TQValueList<TDEAboutTranslator> translatorList = aboutData->translators();
00162
00163 if(translatorList.count() > 0)
00164 {
00165 TQString text = "<qt>";
00166
00167 TQValueList<TDEAboutTranslator>::ConstIterator it;
00168 for(it = translatorList.begin(); it != translatorList.end(); ++it)
00169 {
00170 text += TQString("<p>%1<br> "
00171 "<a href=\"mailto:%2\">%2</a></p>")
00172 .arg((*it).name())
00173 .arg((*it).emailAddress())
00174 .arg((*it).emailAddress());
00175 }
00176
00177 text += TDEAboutData::aboutTranslationTeam() + "</qt>";
00178 addTextPage( i18n("T&ranslation"), text, true);
00179 }
00180
00181 if (!aboutData->license().isEmpty() )
00182 {
00183 addLicensePage( i18n("&License Agreement"), aboutData->license() );
00184 }
00185
00186
00187
00188
00189 setInitialSize( TQSize(400,1) );
00190 }