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

tdeui

  • tdeui
tdeaboutapplication.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 <tdeaboutapplication.h>
27 #include <kaboutdialog_private.h>
28 #include <tdeaboutdata.h>
29 #include <tdeapplication.h>
30 #include <tdeglobal.h>
31 #include <tdelocale.h>
32 #include <kurllabel.h>
33 #include <kactivelabel.h>
34 #include "ktextedit.h"
35 
36 TDEAboutApplication::TDEAboutApplication( TQWidget *parent, const char *name,
37  bool modal )
38  :TDEAboutDialog( AbtTabbed|AbtProduct,
39  kapp ? kapp->caption() : TQString::null,
40  Close, Close,
41  parent, name, modal )
42 {
43  buildDialog(TDEGlobal::instance()->aboutData());
44 }
45 
46 TDEAboutApplication::TDEAboutApplication( const TDEAboutData *aboutData, TQWidget *parent,
47  const char *name, bool modal )
48  :TDEAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close,
49  parent, name, modal )
50 {
51  buildDialog(aboutData);
52 }
53 
54 void TDEAboutApplication::buildDialog( const TDEAboutData *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  TDEAboutContainer *appPage = addContainerPage( i18n("&About"));
65 
66  TQString appPageText =
67  i18n("No information available.\n"
68  "The supplied TDEAboutData 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  TDEAboutContainer *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  TDEAboutContainer *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()
117  || aboutData->bugAddress() == "submit@bugs.trinitydesktop.org"
118  || aboutData->bugAddress() == "http://bugs.trinitydesktop.org")
119  text = i18n( "Please use <a href=\"http://bugs.trinitydesktop.org\">http://bugs.trinitydesktop.org</a> to report bugs.\n" );
120  else {
121  if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
122  {
123  text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() );
124  }
125  else {
126  text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() );
127  }
128  }
129  }
130  else
131  {
132  text = aboutData->customAuthorRichText();
133  }
134  activeLabel->setText( text );
135  authorPage->addWidget( activeLabel );
136  }
137 
138  TQValueList<TDEAboutPerson>::ConstIterator it;
139  for (it = aboutData->authors().begin();
140  it != aboutData->authors().end(); ++it)
141  {
142  authorPage->addPerson( (*it).name(), (*it).emailAddress(),
143  (*it).webAddress(), (*it).task() );
144  }
145  }
146 
147  int creditsCount = aboutData->credits().count();
148  if (creditsCount)
149  {
150  TDEAboutContainer *creditsPage =
151  addScrolledContainerPage( i18n("&Thanks To") );
152  TQValueList<TDEAboutPerson>::ConstIterator it;
153  for (it = aboutData->credits().begin();
154  it != aboutData->credits().end(); ++it)
155  {
156  creditsPage->addPerson( (*it).name(), (*it).emailAddress(),
157  (*it).webAddress(), (*it).task() );
158  }
159  }
160 
161  const TQValueList<TDEAboutTranslator> translatorList = aboutData->translators();
162 
163  if(translatorList.count() > 0)
164  {
165  TQString text = "<qt>";
166 
167  TQValueList<TDEAboutTranslator>::ConstIterator it;
168  for(it = translatorList.begin(); it != translatorList.end(); ++it)
169  {
170  text += TQString("<p>%1<br>&nbsp;&nbsp;&nbsp;"
171  "<a href=\"mailto:%2\">%2</a></p>")
172  .arg((*it).name())
173  .arg((*it).emailAddress())
174  .arg((*it).emailAddress());
175  }
176 
177  text += TDEAboutData::aboutTranslationTeam() + "</qt>";
178  addTextPage( i18n("T&ranslation"), text, true);
179  }
180 
181  if (!aboutData->license().isEmpty() )
182  {
183  addLicensePage( i18n("&License Agreement"), aboutData->license() );
184  }
185 
186  //
187  // Make sure the dialog has a reasonable width
188  //
189  setInitialSize( TQSize(400,1) );
190 }

tdeui

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

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.