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

KDE3Support

k3aboutapplication.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 #include "k3aboutapplication.h"
00024 
00025 #include <QList>
00026 #include <QPixmap>
00027 
00028 #include "k3aboutdialog_p.h"
00029 #include <kaboutdata.h>
00030 #include <kapplication.h>
00031 #include <QtGui/QLabel>
00032 #include <kglobal.h>
00033 #include <klocale.h>
00034 #include <QtGui/QStyle>
00035 
00036 K3AboutApplication::K3AboutApplication( const KAboutData *aboutData, QWidget *parent, bool modal )
00037   :K3AboutDialog( Tabbed|Product, aboutData->programName(), parent ),
00038    d( 0 )
00039 {
00040   setButtons( Close );
00041   setDefaultButton( Close );
00042   setModal( modal );
00043 
00044   if( aboutData == 0 )
00045     aboutData = KGlobal::mainComponent().aboutData();
00046 
00047   if( !aboutData )
00048   {
00049     // Recovery
00050     setProduct(KGlobal::caption(), i18n("??"), QString(), QString());
00051     K3AboutContainer *appPage = addContainerPage( i18n("&About"));
00052 
00053     QString appPageText =
00054       i18n("No information available.\n"
00055      "The supplied KAboutData object does not exist.");
00056     QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
00057     appPage->addWidget( appPageLabel );
00058     return;
00059   }
00060 
00061   setProduct( aboutData->programName(), aboutData->version(),
00062         QString(), QString() );
00063 
00064   if ( aboutData->programLogo().canConvert<QPixmap>() )
00065     setProgramLogo( aboutData->programLogo().value<QPixmap>() );
00066   else if ( aboutData->programLogo().canConvert<QImage>() )
00067     setProgramLogo( QPixmap::fromImage(aboutData->programLogo().value<QImage>() ) );
00068 
00069   QString appPageText = aboutData->shortDescription() + '\n';
00070 
00071   if (!aboutData->otherText().isEmpty())
00072     appPageText += '\n' + aboutData->otherText() + '\n';
00073 
00074   if (!aboutData->copyrightStatement().isEmpty())
00075     appPageText += '\n' + aboutData->copyrightStatement() + '\n';
00076 
00077   K3AboutContainer *appPage = addContainerPage( i18n("&About"));
00078 
00079   QLabel *appPageLabel = new QLabel( appPageText, 0 );
00080   appPage->addWidget( appPageLabel );
00081 
00082   if (!aboutData->homepage().isEmpty())
00083   {
00084     QLabel *url = new QLabel(appPage);
00085     url->setOpenExternalLinks(true);
00086     url->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
00087     url->setText(QString("<a href=\"%1\">%1</a>").arg(aboutData->homepage()));
00088     appPage->addWidget( url );
00089   }
00090 
00091   int authorCount = aboutData->authors().count();
00092   if (authorCount)
00093   {
00094     QString authorPageTitle = authorCount == 1 ?
00095       i18n("A&uthor") : i18n("A&uthors");
00096     K3AboutContainer *authorPage = addScrolledContainerPage( authorPageTitle, Qt::AlignLeft, Qt::AlignLeft );
00097 
00098     if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
00099     {
00100       QString text;
00101       QLabel* activeLabel = new QLabel( authorPage );
00102       activeLabel->setOpenExternalLinks(true);
00103       activeLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
00104       if (!aboutData->customAuthorTextEnabled())
00105       {
00106         if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.kde.org")
00107           text = i18n( "Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs.\n" );
00108         else {
00109           if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
00110           {
00111             text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ,  aboutData->authors().first().emailAddress() ,  aboutData->authors().first().emailAddress() );
00112           }
00113           else {
00114             text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" , aboutData->bugAddress(), aboutData->bugAddress() );
00115           }
00116         }
00117       }
00118       else
00119       {
00120         text = aboutData->customAuthorRichText();
00121       }
00122       activeLabel->setText( text );
00123       authorPage->addWidget( activeLabel );
00124     }
00125 
00126     QList<KAboutPerson> lst = aboutData->authors();
00127     for (int i = 0; i < lst.size(); ++i)
00128     {
00129       authorPage->addPerson( lst.at(i).name(), lst.at(i).emailAddress(),
00130       lst.at(i).webAddress(), lst.at(i).task() );
00131     }
00132   }
00133 
00134   int creditsCount = aboutData->credits().count();
00135   if (creditsCount)
00136   {
00137     K3AboutContainer *creditsPage = addScrolledContainerPage( i18n("&Thanks To") );
00138 
00139     QList<KAboutPerson> lst = aboutData->credits();
00140     for (int i = 0; i < lst.size(); ++i)
00141     {
00142       creditsPage->addPerson( lst.at(i).name(), lst.at(i).emailAddress(),
00143            lst.at(i).webAddress(), lst.at(i).task() );
00144     }
00145   }
00146 
00147   const QList<KAboutPerson> translatorList = aboutData->translators();
00148 
00149   if(translatorList.count() > 0)
00150   {
00151       QString text = "<qt>";
00152 
00153       QList<KAboutPerson>::ConstIterator it;
00154       for(it = translatorList.begin(); it != translatorList.end(); ++it)
00155       {
00156         text += QString("<p>%1<br>&nbsp;&nbsp;&nbsp;"
00157             "<a href=\"mailto:%2\">%2</a></p>")
00158             .arg((*it).name())
00159             .arg((*it).emailAddress())
00160             .arg((*it).emailAddress());
00161       }
00162 
00163       text += KAboutData::aboutTranslationTeam() + "</qt>";
00164       addTextPage( i18n("T&ranslation"), text, true);
00165   }
00166 
00167   if (!aboutData->license().isEmpty() )
00168   {
00169     addLicensePage( i18n("&License Agreement"), aboutData->license() );
00170   }
00171   // Make sure the dialog has a reasonable width
00172   setInitialSize( QSize(400,1) );
00173 }

KDE3Support

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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