kaboutapplication.cpp Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kaboutapplication.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., 59 Temple Place - Suite 330,
    00019  * Boston, MA 02111-1307, 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
    00034 KAboutApplication::KAboutApplication( QWidget *parent, const char *name,
    00035                                       bool modal )
    00036   :KAboutDialog( AbtTabbed|AbtProduct,
    00037                  kapp ? kapp->caption() : QString::null,
    00038                  Close, Close,
    00039                  parent, name, modal )
    00040 {
    00041   buildDialog(KGlobal::instance()->aboutData());
    00042 }
    00043
    00044 KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent,
    00045                                       const char *name, bool modal )
    00046   :KAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
    00047                  parent, name, modal )
    00048 {
    00049   buildDialog(aboutData);
    00050 }
    00051
    00052 void KAboutApplication::buildDialog( const KAboutData *aboutData )
    00053 {
    00054   if( aboutData == 0 )
    00055   {
    00056     //
    00057     // Recovery
    00058     //
    00059     setProduct( kapp ? kapp->caption() : QString::null, i18n("??"), QString::null, QString::null );
    00060     KAboutContainer *appPage = addContainerPage( i18n("&About"));
    00061
    00062     QString appPageText =
    00063       i18n("No information available.\n"
    00064            "The supplied KAboutData object does not exist.");
    00065     QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
    00066     appPage->addWidget( appPageLabel );
    00067     return;
    00068   }
    00069
    00070   setProduct( aboutData->programName(), aboutData->version(),
    00071               QString::null, QString::null );
    00072
    00073   QString appPageText = aboutData->shortDescription() + "\n";
    00074
    00075   if (!aboutData->otherText().isEmpty())
    00076     appPageText += "\n" + aboutData->otherText()+"\n";
    00077
    00078   if (!aboutData->copyrightStatement().isEmpty())
    00079     appPageText += "\n" + aboutData->copyrightStatement()+"\n";
    00080
    00081   KAboutContainer *appPage = addContainerPage( i18n("&About"));
    00082
    00083   QLabel *appPageLabel = new QLabel( appPageText, 0 );
    00084   appPage->addWidget( appPageLabel );
    00085
    00086   if (!aboutData->homepage().isEmpty())
    00087   {
    00088     KURLLabel *url = new KURLLabel();
    00089     url->setText(aboutData->homepage());
    00090     url->setURL(aboutData->homepage());
    00091     appPage->addWidget( url );
    00092     connect( url, SIGNAL(leftClickedURL(const QString &)),
    00093              this, SLOT(openURLSlot(const QString &)));
    00094   }
    00095
    00096   int authorCount = aboutData->authors().count();
    00097   if (authorCount)
    00098   {
    00099     QString authorPageTitle = authorCount == 1 ?
    00100       i18n("A&uthor") : i18n("A&uthors");
    00101     KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
    00102     QValueList<KAboutPerson>::ConstIterator it;
    00103     for (it = aboutData->authors().begin();
    00104          it != aboutData->authors().end(); ++it)
    00105     {
    00106       authorPage->addPerson( (*it).name(), (*it).emailAddress(),
    00107                              (*it).webAddress(), (*it).task() );
    00108     }
    00109   }
    00110
    00111   int creditsCount = aboutData->credits().count();
    00112   if (creditsCount)
    00113   {
    00114     KAboutContainer *creditsPage =
    00115       addScrolledContainerPage( i18n("&Thanks To") );
    00116     QValueList<KAboutPerson>::ConstIterator it;
    00117     for (it = aboutData->credits().begin();
    00118          it != aboutData->credits().end(); ++it)
    00119     {
    00120       creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
    00121                               (*it).webAddress(), (*it).task() );
    00122     }
    00123   }
    00124
    00125   const QValueList<KAboutTranslator> translatorList = aboutData->translators();
    00126
    00127   if(translatorList.count() > 0)
    00128   {
    00129       KAboutContainer *translatorPage =
    00130           addScrolledContainerPage( i18n("T&ranslation") );
    00131
    00132       QValueList<KAboutTranslator>::ConstIterator it;
    00133       for(it = translatorList.begin(); it != translatorList.end(); ++it)
    00134       {
    00135           translatorPage->addPerson((*it).name(), (*it).emailAddress(),
    00136                   0,0);
    00137       }
    00138
    00139       QLabel *label = new QLabel(KAboutData::aboutTranslationTeam()
    00140               ,translatorPage);
    00141           label->adjustSize();
    00142           label->setMinimumSize(label->sizeHint());
    00143       translatorPage->addWidget(label);
    00144   }
    00145
    00146   if (!aboutData->license().isEmpty() )
    00147   {
    00148     addLicensePage( i18n("&License Agreement"), aboutData->license() );
    00149   }
    00150
    00151   //
    00152   // Make sure the dialog has a reasonable width
    00153   //
    00154   setInitialSize( QSize(400,1) );
    00155 }

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:55:41 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001