• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

tdeaboutapplication.cpp

00001 /*
00002  * This file is part of the KDE Libraries
00003  * Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and
00004  * Espen Sand (espen@kde.org)
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 // I (espen) prefer that header files are included alphabetically
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     // Recovery
00060     //
00061 
00062     //i18n "??" is displayed as (pseudo-)version when no data is known about the application
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>&nbsp;&nbsp;&nbsp;"
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   // Make sure the dialog has a reasonable width
00188   //
00189   setInitialSize( TQSize(400,1) );
00190 }

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.6.3
This website is maintained by Timothy Pearson.