• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kdeui

kaboutapplication.cpp

Go to the documentation of this file.
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 <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     // Recovery
00060     //
00061 
00062     //i18n "??" is displayed as (pseudo-)version when no data is known about the application
00063     setProduct( kapp ? kapp->caption() : QString::null, i18n("??"), QString::null, QString::null );
00064     KAboutContainer *appPage = addContainerPage( i18n("&About"));
00065 
00066     QString appPageText =
00067       i18n("No information available.\n"
00068      "The supplied KAboutData object does not exist.");
00069     QLabel *appPageLabel = new QLabel( "\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         QString::null, QString::null );
00076 
00077   if (!aboutData->programLogo().isNull())
00078     setProgramLogo( aboutData->programLogo() );
00079 
00080   QString 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   KAboutContainer *appPage = addContainerPage( i18n("&About"));
00089 
00090   QLabel *appPageLabel = new QLabel( 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, SIGNAL(leftClickedURL(const QString &)),
00100              this, SLOT(openURLSlot(const QString &)));
00101   }
00102 
00103   int authorCount = aboutData->authors().count();
00104   if (authorCount)
00105   {
00106     QString authorPageTitle = authorCount == 1 ?
00107       i18n("A&uthor") : i18n("A&uthors");
00108     KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
00109 
00110     if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
00111     {
00112       QString text;
00113       KActiveLabel* activeLabel = new KActiveLabel( authorPage );
00114       if (!aboutData->customAuthorTextEnabled())
00115       {
00116         if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.kde.org")
00117           text = i18n( "Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs.\n" );
00118         else {
00119           if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
00120           {
00121             text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() );
00122           }
00123           else {
00124             text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() );
00125           }
00126         }
00127       }
00128       else
00129       {
00130         text = aboutData->customAuthorRichText();
00131       }
00132       activeLabel->setText( text );
00133       authorPage->addWidget( activeLabel );
00134     }
00135 
00136     QValueList<KAboutPerson>::ConstIterator it;
00137     for (it = aboutData->authors().begin();
00138    it != aboutData->authors().end(); ++it)
00139     {
00140       authorPage->addPerson( (*it).name(), (*it).emailAddress(),
00141            (*it).webAddress(), (*it).task() );
00142     }
00143   }
00144 
00145   int creditsCount = aboutData->credits().count();
00146   if (creditsCount)
00147   {
00148     KAboutContainer *creditsPage =
00149       addScrolledContainerPage( i18n("&Thanks To") );
00150     QValueList<KAboutPerson>::ConstIterator it;
00151     for (it = aboutData->credits().begin();
00152    it != aboutData->credits().end(); ++it)
00153     {
00154       creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
00155             (*it).webAddress(), (*it).task() );
00156     }
00157   }
00158 
00159   const QValueList<KAboutTranslator> translatorList = aboutData->translators();
00160 
00161   if(translatorList.count() > 0)
00162   {
00163       QString text = "<qt>";
00164 
00165       QValueList<KAboutTranslator>::ConstIterator it;
00166       for(it = translatorList.begin(); it != translatorList.end(); ++it)
00167       {
00168    text += QString("<p>%1<br>&nbsp;&nbsp;&nbsp;"
00169        "<a href=\"mailto:%2\">%2</a></p>")
00170      .arg((*it).name())
00171      .arg((*it).emailAddress())
00172      .arg((*it).emailAddress());
00173       }
00174 
00175       text += KAboutData::aboutTranslationTeam() + "</qt>";
00176       addTextPage( i18n("T&ranslation"), text, true);
00177   }
00178 
00179   if (!aboutData->license().isEmpty() )
00180   {
00181     addLicensePage( i18n("&License Agreement"), aboutData->license() );
00182   }
00183 
00184   //
00185   // Make sure the dialog has a reasonable width
00186   //
00187   setInitialSize( QSize(400,1) );
00188 }

kdeui

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal