• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDE3Support

  • kde3support
  • kdeui
k3aboutapplication.cpp
Go to the documentation of this file.
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#include "k3aboutapplication.h"
24
25#include <QList>
26#include <QPixmap>
27
28#include "k3aboutdialog_p.h"
29#include <kaboutdata.h>
30#include <kapplication.h>
31#include <QtGui/QLabel>
32#include <kglobal.h>
33#include <klocale.h>
34#include <QtGui/QStyle>
35
36K3AboutApplication::K3AboutApplication( const KAboutData *aboutData, QWidget *parent, bool modal )
37 :K3AboutDialog( Tabbed|Product, aboutData->programName(), parent ),
38 d( 0 )
39{
40 setButtons( Close );
41 setDefaultButton( Close );
42 setModal( modal );
43
44 if( aboutData == 0 )
45 aboutData = KGlobal::mainComponent().aboutData();
46
47 if( !aboutData )
48 {
49 // Recovery
50 setProduct(KGlobal::caption(), i18n("??"), QString(), QString());
51 K3AboutContainer *appPage = addContainerPage( i18n("&About"));
52
53 QString appPageText =
54 i18n("No information available.\n"
55 "The supplied KAboutData object does not exist.");
56 QLabel *appPageLabel = new QLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 );
57 appPage->addWidget( appPageLabel );
58 return;
59 }
60
61 setProduct( aboutData->programName(), aboutData->version(),
62 QString(), QString() );
63
64 if ( aboutData->programLogo().canConvert<QPixmap>() )
65 setProgramLogo( aboutData->programLogo().value<QPixmap>() );
66 else if ( aboutData->programLogo().canConvert<QImage>() )
67 setProgramLogo( QPixmap::fromImage(aboutData->programLogo().value<QImage>() ) );
68
69 QString appPageText = aboutData->shortDescription() + '\n';
70
71 if (!aboutData->otherText().isEmpty())
72 appPageText += '\n' + aboutData->otherText() + '\n';
73
74 if (!aboutData->copyrightStatement().isEmpty())
75 appPageText += '\n' + aboutData->copyrightStatement() + '\n';
76
77 K3AboutContainer *appPage = addContainerPage( i18n("&About"));
78
79 QLabel *appPageLabel = new QLabel( appPageText, 0 );
80 appPage->addWidget( appPageLabel );
81
82 if (!aboutData->homepage().isEmpty())
83 {
84 QLabel *url = new QLabel(appPage);
85 url->setOpenExternalLinks(true);
86 url->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
87 url->setText(QString("<a href=\"%1\">%1</a>").arg(aboutData->homepage()));
88 appPage->addWidget( url );
89 }
90
91 int authorCount = aboutData->authors().count();
92 if (authorCount)
93 {
94 QString authorPageTitle = authorCount == 1 ?
95 i18n("A&uthor") : i18n("A&uthors");
96 K3AboutContainer *authorPage = addScrolledContainerPage( authorPageTitle, Qt::AlignLeft, Qt::AlignLeft );
97
98 if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ())
99 {
100 QString text;
101 QLabel* activeLabel = new QLabel( authorPage );
102 activeLabel->setOpenExternalLinks(true);
103 activeLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
104 if (!aboutData->customAuthorTextEnabled())
105 {
106 if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.kde.org")
107 text = i18n( "Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs.\n" );
108 else {
109 if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) )
110 {
111 text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" , aboutData->authors().first().emailAddress() , aboutData->authors().first().emailAddress() );
112 }
113 else {
114 text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" , aboutData->bugAddress(), aboutData->bugAddress() );
115 }
116 }
117 }
118 else
119 {
120 text = aboutData->customAuthorRichText();
121 }
122 activeLabel->setText( text );
123 authorPage->addWidget( activeLabel );
124 }
125
126 QList<KAboutPerson> lst = aboutData->authors();
127 for (int i = 0; i < lst.size(); ++i)
128 {
129 authorPage->addPerson( lst.at(i).name(), lst.at(i).emailAddress(),
130 lst.at(i).webAddress(), lst.at(i).task() );
131 }
132 }
133
134 int creditsCount = aboutData->credits().count();
135 if (creditsCount)
136 {
137 K3AboutContainer *creditsPage = addScrolledContainerPage( i18n("&Thanks To") );
138
139 QList<KAboutPerson> lst = aboutData->credits();
140 for (int i = 0; i < lst.size(); ++i)
141 {
142 creditsPage->addPerson( lst.at(i).name(), lst.at(i).emailAddress(),
143 lst.at(i).webAddress(), lst.at(i).task() );
144 }
145 }
146
147 const QList<KAboutPerson> translatorList = aboutData->translators();
148
149 if(translatorList.count() > 0)
150 {
151 QString text = "<qt>";
152
153 QList<KAboutPerson>::ConstIterator it;
154 for(it = translatorList.begin(); it != translatorList.end(); ++it)
155 {
156 text += QString("<p>%1<br>&nbsp;&nbsp;&nbsp;"
157 "<a href=\"mailto:%2\">%2</a></p>")
158 .arg((*it).name())
159 .arg((*it).emailAddress())
160 .arg((*it).emailAddress());
161 }
162
163 text += KAboutData::aboutTranslationTeam() + "</qt>";
164 addTextPage( i18n("T&ranslation"), text, true);
165 }
166
167 if (!aboutData->license().isEmpty() )
168 {
169 addLicensePage( i18n("&License Agreement"), aboutData->license() );
170 }
171 // Make sure the dialog has a reasonable width
172 setInitialSize( QSize(400,1) );
173}
K3AboutApplication::K3AboutApplication
K3AboutApplication(const KAboutData *aboutData=0, QWidget *parent=0, bool modal=true)
Constructor.
Definition: k3aboutapplication.cpp:36
K3AboutContainer
K3AboutContainer can be used to make a application specific AboutDialog.
Definition: k3aboutdialog.h:47
K3AboutContainer::addWidget
void addWidget(QWidget *widget)
Definition: k3aboutdialog.cpp:820
K3AboutContainer::addPerson
void addPerson(const QString &name, const QString &email, const QString &url, const QString &task, bool showHeader=false, bool showframe=false, bool showBold=false)
Definition: k3aboutdialog.cpp:838
K3AboutDialog
A KDialog with predefined main widget.
Definition: k3aboutdialog.h:256
K3AboutDialog::addContainerPage
K3AboutContainer * addContainerPage(const QString &title, Qt::Alignment childAlignment=Qt::AlignCenter, Qt::Alignment innerAlignment=Qt::AlignCenter)
(Constructor II only) Adds a container to a tab box.
Definition: k3aboutdialog.cpp:1132
K3AboutDialog::setProduct
void setProduct(const QString &appName, const QString &version, const QString &author, const QString &year)
(Constructor II only) Prints the application name, KDE version, author, a copyright sign and a year s...
Definition: k3aboutdialog.cpp:1199
K3AboutDialog::addTextPage
QFrame * addTextPage(const QString &title, const QString &text, bool richText=false, int numLines=10)
(Constructor II only) Adds a text page to a tab box.
Definition: k3aboutdialog.cpp:1118
K3AboutDialog::addLicensePage
QFrame * addLicensePage(const QString &title, const QString &text, int numLines=10)
(Constructor II only) Adds a license page to a tab box.
Definition: k3aboutdialog.cpp:1125
K3AboutDialog::setProgramLogo
void setProgramLogo(const QString &fileName)
Overloaded version of setProgramLogo(const QPixmap& pixmap).
Definition: k3aboutdialog.cpp:1175
K3AboutDialog::addScrolledContainerPage
K3AboutContainer * addScrolledContainerPage(const QString &title, Qt::Alignment childAlignment=Qt::AlignCenter, Qt::Alignment innerAlignment=Qt::AlignCenter)
(Constructor II only) Adds a container inside a QScrollView to a tab box.
Definition: k3aboutdialog.cpp:1140
KAboutData
KAboutData::programLogo
QVariant programLogo() const
KAboutData::aboutTranslationTeam
static QString aboutTranslationTeam()
KAboutData::customAuthorRichText
QString customAuthorRichText() const
KAboutData::credits
QList< KAboutPerson > credits() const
KAboutData::programName
QString programName() const
KAboutData::customAuthorTextEnabled
bool customAuthorTextEnabled() const
KAboutData::authors
QList< KAboutPerson > authors() const
KAboutData::shortDescription
QString shortDescription() const
KAboutData::copyrightStatement
QString copyrightStatement() const
KAboutData::homepage
QString homepage() const
KAboutData::version
QString version() const
KAboutData::translators
QList< KAboutPerson > translators() const
KAboutData::bugAddress
QString bugAddress() const
KAboutData::license
QString license() const
KAboutData::otherText
QString otherText() const
KComponentData::aboutData
const KAboutData * aboutData() const
KDialog::setInitialSize
void setInitialSize(const QSize &size)
KDialog::setButtons
void setButtons(ButtonCodes buttonMask)
KDialog::Close
Close
KDialog::setDefaultButton
void setDefaultButton(ButtonCode id)
QLabel
QList
QWidget
k3aboutapplication.h
k3aboutdialog_p.h
kaboutdata.h
kapplication.h
kglobal.h
klocale.h
i18n
QString i18n(const char *text)
KGlobal::mainComponent
const KComponentData & mainComponent()
KGlobal::caption
QString caption()
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal