kdeui Library API Documentation

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 #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 setProduct( kapp ? kapp->caption() : QString::null, i18n("??"), QString::null, QString::null ); 00062 KAboutContainer *appPage = addContainerPage( i18n("&About")); 00063 00064 QString appPageText = 00065 i18n("No information available.\n" 00066 "The supplied KAboutData object does not exist."); 00067 QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 ); 00068 appPage->addWidget( appPageLabel ); 00069 return; 00070 } 00071 00072 setProduct( aboutData->programName(), aboutData->version(), 00073 QString::null, QString::null ); 00074 00075 if (!aboutData->programLogo().isNull()) 00076 setProgramLogo( aboutData->programLogo() ); 00077 00078 QString appPageText = aboutData->shortDescription() + "\n"; 00079 00080 if (!aboutData->otherText().isEmpty()) 00081 appPageText += "\n" + aboutData->otherText()+"\n"; 00082 00083 if (!aboutData->copyrightStatement().isEmpty()) 00084 appPageText += "\n" + aboutData->copyrightStatement()+"\n"; 00085 00086 KAboutContainer *appPage = addContainerPage( i18n("&About")); 00087 00088 QLabel *appPageLabel = new QLabel( appPageText, 0 ); 00089 appPage->addWidget( appPageLabel ); 00090 00091 if (!aboutData->homepage().isEmpty()) 00092 { 00093 KURLLabel *url = new KURLLabel(); 00094 url->setText(aboutData->homepage()); 00095 url->setURL(aboutData->homepage()); 00096 appPage->addWidget( url ); 00097 connect( url, SIGNAL(leftClickedURL(const QString &)), 00098 this, SLOT(openURLSlot(const QString &))); 00099 } 00100 00101 int authorCount = aboutData->authors().count(); 00102 if (authorCount) 00103 { 00104 QString authorPageTitle = authorCount == 1 ? 00105 i18n("A&uthor") : i18n("A&uthors"); 00106 KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle ); 00107 00108 KActiveLabel* activeLabel = new KActiveLabel( authorPage ); 00109 if (aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.kde.org") 00110 activeLabel->setText( i18n( "Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs, do not mail the authors directly." ) ); 00111 else 00112 activeLabel->setText( i18n( "Please use <a href=\"mailto:%1\">%1</a> to report bugs, do not mail the authors directly.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress()) ); 00113 authorPage->addWidget( activeLabel ); 00114 00115 QValueList<KAboutPerson>::ConstIterator it; 00116 for (it = aboutData->authors().begin(); 00117 it != aboutData->authors().end(); ++it) 00118 { 00119 authorPage->addPerson( (*it).name(), (*it).emailAddress(), 00120 (*it).webAddress(), (*it).task() ); 00121 } 00122 } 00123 00124 int creditsCount = aboutData->credits().count(); 00125 if (creditsCount) 00126 { 00127 KAboutContainer *creditsPage = 00128 addScrolledContainerPage( i18n("&Thanks To") ); 00129 QValueList<KAboutPerson>::ConstIterator it; 00130 for (it = aboutData->credits().begin(); 00131 it != aboutData->credits().end(); ++it) 00132 { 00133 creditsPage->addPerson( (*it).name(), (*it).emailAddress(), 00134 (*it).webAddress(), (*it).task() ); 00135 } 00136 } 00137 00138 const QValueList<KAboutTranslator> translatorList = aboutData->translators(); 00139 00140 if(translatorList.count() > 0) 00141 { 00142 QString text = "<qt>"; 00143 00144 QValueList<KAboutTranslator>::ConstIterator it; 00145 for(it = translatorList.begin(); it != translatorList.end(); ++it) 00146 { 00147 text += QString("<p>%1<br>&nbsp;&nbsp;&nbsp;" 00148 "<a href=\"mailto:%2\">%2</a></p>") 00149 .arg((*it).name()) 00150 .arg((*it).emailAddress()) 00151 .arg((*it).emailAddress()); 00152 } 00153 00154 text += KAboutData::aboutTranslationTeam() + "</qt>"; 00155 addTextPage( i18n("T&ranslation"), text, true); 00156 } 00157 00158 if (!aboutData->license().isEmpty() ) 00159 { 00160 addLicensePage( i18n("&License Agreement"), aboutData->license() ); 00161 } 00162 00163 // 00164 // Make sure the dialog has a reasonable width 00165 // 00166 setInitialSize( QSize(400,1) ); 00167 }
KDE Logo
This file is part of the documentation for kdeui Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:10:05 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003