• 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()
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<KAboutPerson>::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  KAboutContainer *creditsPage =
151  addScrolledContainerPage( i18n("&Thanks To") );
152  TQValueList<KAboutPerson>::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<KAboutTranslator> translatorList = aboutData->translators();
162 
163  if(translatorList.count() > 0)
164  {
165  TQString text = "<qt>";
166 
167  TQValueList<KAboutTranslator>::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 += KAboutData::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 }
KURLLabel::setURL
void setURL(const TQString &url)
Sets the URL for this label to url.
Definition: kurllabel.cpp:178
KActiveLabel
Label with support for selection and clickable links.
Definition: kactivelabel.h:37
KAboutData::otherText
TQString otherText() const
KAboutDialog::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: kaboutdialog.cpp:1737
KAboutData::homepage
TQString homepage() const
KURLLabel
A drop-in replacement for TQLabel that displays hyperlinks.
Definition: kurllabel.h:71
KAboutContainer
KAboutContainer can be used to make a application specific AboutDialog.
Definition: kaboutdialog.h:50
KAboutDialog::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: kaboutdialog.cpp:1642
KAboutData::authors
const TQValueList< KAboutPerson > authors() const
KAboutDialog::openURLSlot
void openURLSlot(const TQString &url)
Open this URL.
Definition: kaboutdialog.cpp:1627
KAboutData::translators
const TQValueList< KAboutTranslator > translators() const
KAboutDialog::setProgramLogo
void setProgramLogo(const TQString &fileName)
Overloaded version of setProgramLogo(const TQPixmap& pixmap).
Definition: kaboutdialog.cpp:1711
klocale.h
KAboutDialog::addContainerPage
KAboutContainer * addContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container to a tab box.
Definition: kaboutdialog.cpp:1657
KAboutData::customAuthorTextEnabled
bool customAuthorTextEnabled() const
KAboutApplication::KAboutApplication
KAboutApplication(TQWidget *parent=0, const char *name=0, bool modal=true)
Constructor.
Definition: kaboutapplication.cpp:36
KAboutDialog::addScrolledContainerPage
KAboutContainer * addScrolledContainerPage(const TQString &title, int childAlignment=AlignCenter, int innerAlignment=AlignCenter)
(Constructor II only) Adds a container inside a TQScrollView to a tab box.
Definition: kaboutdialog.cpp:1666
KAboutData::credits
const TQValueList< KAboutPerson > credits() const
KAboutData
KAboutData::programLogo
TQImage programLogo() const
KGlobal::instance
static KInstance * instance()
KAboutDialog
A KDialogBase with predefined main widget.
Definition: kaboutdialog.h:283
KAboutData::bugAddress
TQString bugAddress() const
KAboutData::programName
TQString programName() const
KAboutData::shortDescription
TQString shortDescription() const
KDialogBase::setInitialSize
void setInitialSize(const TQSize &s, bool noResize=false)
Convenience method.
Definition: kdialogbase.cpp:537
KAboutData::version
TQString version() const
KAboutData::license
TQString license() const
KAboutData::aboutTranslationTeam
static TQString aboutTranslationTeam()
KAboutData::copyrightStatement
TQString copyrightStatement() const
KAboutDialog::addLicensePage
TQFrame * addLicensePage(const TQString &title, const TQString &text, int numLines=10)
(Constructor II only) Adds a license page to a tab box.
Definition: kaboutdialog.cpp:1649
KAboutData::customAuthorRichText
TQString customAuthorRichText() const

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.8
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |