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 "ktextedit.h" 00034 00035 KAboutApplication::KAboutApplication( QWidget *parent, const char *name, 00036 bool modal ) 00037 :KAboutDialog( AbtTabbed|AbtProduct, 00038 kapp ? kapp->caption() : QString::null, 00039 Close, Close, 00040 parent, name, modal ) 00041 { 00042 buildDialog(KGlobal::instance()->aboutData()); 00043 } 00044 00045 KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent, 00046 const char *name, bool modal ) 00047 :KAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close, 00048 parent, name, modal ) 00049 { 00050 buildDialog(aboutData); 00051 } 00052 00053 void KAboutApplication::buildDialog( const KAboutData *aboutData ) 00054 { 00055 if( aboutData == 0 ) 00056 { 00057 // 00058 // Recovery 00059 // 00060 setProduct( kapp ? kapp->caption() : QString::null, i18n("??"), QString::null, QString::null ); 00061 KAboutContainer *appPage = addContainerPage( i18n("&About")); 00062 00063 QString appPageText = 00064 i18n("No information available.\n" 00065 "The supplied KAboutData object does not exist."); 00066 QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 ); 00067 appPage->addWidget( appPageLabel ); 00068 return; 00069 } 00070 00071 setProduct( aboutData->programName(), aboutData->version(), 00072 QString::null, QString::null ); 00073 00074 QString appPageText = aboutData->shortDescription() + "\n"; 00075 00076 if (!aboutData->otherText().isEmpty()) 00077 appPageText += "\n" + aboutData->otherText()+"\n"; 00078 00079 if (!aboutData->copyrightStatement().isEmpty()) 00080 appPageText += "\n" + aboutData->copyrightStatement()+"\n"; 00081 00082 KAboutContainer *appPage = addContainerPage( i18n("&About")); 00083 00084 QLabel *appPageLabel = new QLabel( appPageText, 0 ); 00085 appPage->addWidget( appPageLabel ); 00086 00087 if (!aboutData->homepage().isEmpty()) 00088 { 00089 KURLLabel *url = new KURLLabel(); 00090 url->setText(aboutData->homepage()); 00091 url->setURL(aboutData->homepage()); 00092 appPage->addWidget( url ); 00093 connect( url, SIGNAL(leftClickedURL(const QString &)), 00094 this, SLOT(openURLSlot(const QString &))); 00095 } 00096 00097 int authorCount = aboutData->authors().count(); 00098 if (authorCount) 00099 { 00100 QString authorPageTitle = authorCount == 1 ? 00101 i18n("A&uthor") : i18n("A&uthors"); 00102 KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle ); 00103 QValueList<KAboutPerson>::ConstIterator it; 00104 for (it = aboutData->authors().begin(); 00105 it != aboutData->authors().end(); ++it) 00106 { 00107 authorPage->addPerson( (*it).name(), (*it).emailAddress(), 00108 (*it).webAddress(), (*it).task() ); 00109 } 00110 } 00111 00112 int creditsCount = aboutData->credits().count(); 00113 if (creditsCount) 00114 { 00115 KAboutContainer *creditsPage = 00116 addScrolledContainerPage( i18n("&Thanks To") ); 00117 QValueList<KAboutPerson>::ConstIterator it; 00118 for (it = aboutData->credits().begin(); 00119 it != aboutData->credits().end(); ++it) 00120 { 00121 creditsPage->addPerson( (*it).name(), (*it).emailAddress(), 00122 (*it).webAddress(), (*it).task() ); 00123 } 00124 } 00125 00126 const QValueList<KAboutTranslator> translatorList = aboutData->translators(); 00127 00128 if(translatorList.count() > 0) 00129 { 00130 QString text = "<qt>"; 00131 00132 QValueList<KAboutTranslator>::ConstIterator it; 00133 for(it = translatorList.begin(); it != translatorList.end(); ++it) 00134 { 00135 text += QString("<p>%1<br>&nbsp;&nbsp;&nbsp;" 00136 "<a href=\"mailto:%2\">%2</a></p>") 00137 .arg((*it).name()) 00138 .arg((*it).emailAddress()) 00139 .arg((*it).emailAddress()); 00140 } 00141 00142 text += KAboutData::aboutTranslationTeam() + "</qt>"; 00143 addTextPage( i18n("T&ranslation"), text, true); 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 }
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 8 11:14:22 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003