• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

  • kdeui
kaboutapplication.cpp
1 /*
2  * This file is part of the KDE Libraries
3  * Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and
4  * Espen Sand (espen@kde.org)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 // I (espen) prefer that header files are included alphabetically
24 
25 #include <tqlabel.h>
26 #include <kaboutapplication.h>
27 #include <kaboutdialog_private.h>
28 #include <kaboutdata.h>
29 #include <kapplication.h>
30 #include <kglobal.h>
31 #include <klocale.h>
32 #include <kurllabel.h>
33 #include <kactivelabel.h>
34 #include "ktextedit.h"
35 
36 KAboutApplication::KAboutApplication( TQWidget *parent, const char *name,
37  bool modal )
38  :KAboutDialog( AbtTabbed|AbtProduct,
39  kapp ? kapp->caption() : TQString::null,
40  Close, Close,
41  parent, name, modal )
42 {
43  buildDialog(KGlobal::instance()->aboutData());
44 }
45 
46 KAboutApplication::KAboutApplication( const KAboutData *aboutData, TQWidget *parent,
47  const char *name, bool modal )
48  :KAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
49  parent, name, modal )
50 {
51  buildDialog(aboutData);
52 }
53 
54 void KAboutApplication::buildDialog( const KAboutData *aboutData )
55 {
56  if( !aboutData )
57  {
58  //
59  // Recovery
60  //
61 
62  //i18n "??" is displayed as (pseudo-)version when no data is known about the application
63  setProduct( kapp ? kapp->caption() : TQString::null, i18n("??"), TQString::null, TQString::null );
64  KAboutContainer *appPage = addContainerPage( i18n("&About"));
65 
66  TQString appPageText =
67  i18n("No information available.\n"
68  "The supplied KAboutData object does not exist.");
69  TQLabel *appPageLabel = new TQLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
70  appPage->addWidget( appPageLabel );
71  return;
72  }
73 
74  setProduct( aboutData->programName(), aboutData->version(),
75  TQString::null, TQString::null );
76 
77  if (!aboutData->programLogo().isNull())
78  setProgramLogo( aboutData->programLogo() );
79 
80  TQString appPageText = aboutData->shortDescription() + "\n";
81 
82  if (!aboutData->otherText().isEmpty())
83  appPageText += "\n" + aboutData->otherText()+"\n";
84 
85  if (!aboutData->copyrightStatement().isEmpty())
86  appPageText += "\n" + aboutData->copyrightStatement()+"\n";
87 
88  KAboutContainer *appPage = addContainerPage( i18n("&About"));
89 
90  TQLabel *appPageLabel = new TQLabel( appPageText, 0 );
91  appPage->addWidget( appPageLabel );
92 
93  if (!aboutData->homepage().isEmpty())
94  {
95  KURLLabel *url = new KURLLabel();
96  url->setText(aboutData->homepage());
97  url->setURL(aboutData->homepage());
98  appPage->addWidget( url );
99  connect( url, TQT_SIGNAL(leftClickedURL(const TQString &)),
100  this, TQT_SLOT(openURLSlot(const TQString &)));
101  }
102 
103  int authorCount = aboutData->authors().count();
104  if (authorCount)
105  {
106  TQString authorPageTitle = authorCount == 1 ?
107  i18n("A&uthor") : i18n("A&uthors");
108  KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
109 
110  if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
111  {
112  TQString text;
113  KActiveLabel* activeLabel = new KActiveLabel( authorPage );
114  if (!aboutData->customAuthorTextEnabled())
115  {
116  if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.pearsoncomputing.net")
117  text = i18n( "Please use <a href=\"http://bugs.pearsoncomputing.net\">http://bugs.pearsoncomputing.net</a> to report bugs.\n" );
118  else {
119  if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
120  {
121  text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() );
122  }
123  else {
124  text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() );
125  }
126  }
127  }
128  else
129  {
130  text = aboutData->customAuthorRichText();
131  }
132  activeLabel->setText( text );
133  authorPage->addWidget( activeLabel );
134  }
135 
136  TQValueList<KAboutPerson>::ConstIterator it;
137  for (it = aboutData->authors().begin();
138  it != aboutData->authors().end(); ++it)
139  {
140  authorPage->addPerson( (*it).name(), (*it).emailAddress(),
141  (*it).webAddress(), (*it).task() );
142  }
143  }
144 
145  int creditsCount = aboutData->credits().count();
146  if (creditsCount)
147  {
148  KAboutContainer *creditsPage =
149  addScrolledContainerPage( i18n("&Thanks To") );
150  TQValueList<KAboutPerson>::ConstIterator it;
151  for (it = aboutData->credits().begin();
152  it != aboutData->credits().end(); ++it)
153  {
154  creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
155  (*it).webAddress(), (*it).task() );
156  }
157  }
158 
159  const TQValueList<KAboutTranslator> translatorList = aboutData->translators();
160 
161  if(translatorList.count() > 0)
162  {
163  TQString text = "<qt>";
164 
165  TQValueList<KAboutTranslator>::ConstIterator it;
166  for(it = translatorList.begin(); it != translatorList.end(); ++it)
167  {
168  text += TQString("<p>%1<br>&nbsp;&nbsp;&nbsp;"
169  "<a href=\"mailto:%2\">%2</a></p>")
170  .arg((*it).name())
171  .arg((*it).emailAddress())
172  .arg((*it).emailAddress());
173  }
174 
175  text += KAboutData::aboutTranslationTeam() + "</qt>";
176  addTextPage( i18n("T&ranslation"), text, true);
177  }
178 
179  if (!aboutData->license().isEmpty() )
180  {
181  addLicensePage( i18n("&License Agreement"), aboutData->license() );
182  }
183 
184  //
185  // Make sure the dialog has a reasonable width
186  //
187  setInitialSize( TQSize(400,1) );
188 }

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |