• 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 }
TDEAboutData::shortDescription
TQString shortDescription() const
KURLLabel::setURL
void setURL(const TQString &url)
Sets the URL for this label to url.
Definition: kurllabel.cpp:178
TDEAboutData::copyrightStatement
TQString copyrightStatement() const
TDEAboutDialog::addContainerPage
TDEAboutContainer * addContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container to a tab box.
Definition: tdeaboutdialog.cpp:1657
KActiveLabel
Label with support for selection and clickable links.
Definition: kactivelabel.h:37
TDEAboutDialog
A KDialogBase with predefined main widget.
Definition: tdeaboutdialog.h:283
KURLLabel
A drop-in replacement for TQLabel that displays hyperlinks.
Definition: kurllabel.h:71
TDEAboutData::customAuthorRichText
TQString customAuthorRichText() const
TDEAboutData
TDEAboutData::bugAddress
TQString bugAddress() const
TDEAboutDialog::addScrolledContainerPage
TDEAboutContainer * addScrolledContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container inside a TQScrollView to a tab box.
Definition: tdeaboutdialog.cpp:1666
TDEAboutData::aboutTranslationTeam
static TQString aboutTranslationTeam()
TDEAboutData::homepage
TQString homepage() const
TDEAboutData::programLogo
TQImage programLogo() const
TDEAboutData::credits
const TQValueList< TDEAboutPerson > credits() const
TDEAboutContainer
TDEAboutContainer can be used to make a application specific AboutDialog.
Definition: tdeaboutdialog.h:50
TDEAboutData::version
TQString version() const
TDEAboutDialog::setProgramLogo
void setProgramLogo(const TQString &fileName)
Overloaded version of setProgramLogo(const TQPixmap& pixmap).
Definition: tdeaboutdialog.cpp:1711
tdelocale.h
TDEGlobal::instance
static TDEInstance * instance()
TDEAboutData::programName
TQString programName() const
TDEAboutDialog::addTextPage
TQFrame * addTextPage(const TQString &title, const TQString &text, bool richText=false, int numLines=10)
(Constructor II only) Adds a text page to a tab box.
Definition: tdeaboutdialog.cpp:1642
TDEAboutData::license
TQString license() const
TDEAboutData::authors
const TQValueList< TDEAboutPerson > authors() const
TDEAboutDialog::addLicensePage
TQFrame * addLicensePage(const TQString &title, const TQString &text, int numLines=10)
(Constructor II only) Adds a license page to a tab box.
Definition: tdeaboutdialog.cpp:1649
KDialogBase::setInitialSize
void setInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
Definition: kdialogbase.cpp:537
TDEAboutDialog::openURLSlot
void openURLSlot(const TQString &url)
Open this URL.
Definition: tdeaboutdialog.cpp:1627
TDEAboutDialog::setProduct
void setProduct(const TQString &appName, const TQString &version, const TQString &author, const TQString &year)
(Constructor II only) Prints the application name, KDE version, author, a copyright sign and a year s...
Definition: tdeaboutdialog.cpp:1737
TDEAboutApplication::TDEAboutApplication
TDEAboutApplication(TQWidget *parent=0, const char *name=0, bool modal=true)
Constructor.
Definition: tdeaboutapplication.cpp:36
TDEAboutData::otherText
TQString otherText() const
TDEAboutData::customAuthorTextEnabled
bool customAuthorTextEnabled() const
TDEAboutData::translators
const TQValueList< TDEAboutTranslator > translators() const

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.