• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kontact

  • sources
  • kde-4.14
  • kdepim
  • kontact
  • src
aboutdialog.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KDE Kontact.
3 
4  Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program 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
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "aboutdialog.h"
26 using namespace Kontact;
27 
28 #include <KontactInterface/Core>
29 #include <KontactInterface/Plugin>
30 
31 #include <KAboutData>
32 #include <KComponentData>
33 #include <KLocale>
34 #include <KTextBrowser>
35 
36 #include <QBoxLayout>
37 #include <QLabel>
38 #include <QTextEdit>
39 
40 AboutDialog::AboutDialog( KontactInterface::Core *core )
41  : KPageDialog( core ), mCore( core )
42 {
43  setCaption( i18n( "About Kontact" ) );
44  setButtons( Close );
45  setDefaultButton( Close );
46  setModal( false );
47  showButtonSeparator( true );
48  setFaceType( KPageDialog::List );
49  addAboutData( i18n( "Kontact Container" ), QLatin1String( "kontact" ),
50  KGlobal::mainComponent().aboutData() );
51 
52  QList<KontactInterface::Plugin*> plugins = mCore->pluginList();
53  QList<KontactInterface::Plugin*>::ConstIterator end = plugins.constEnd();
54  QList<KontactInterface::Plugin*>::ConstIterator it = plugins.constBegin();
55  for ( ; it != end; ++it ) {
56  addAboutPlugin( *it );
57  }
58 
59  addLicenseText( KGlobal::mainComponent().aboutData() );
60 
61  setInitialSize( QSize( 600, 400 ) );
62  restoreDialogSize( KConfigGroup( KGlobal::config(), "AboutDialog" ) );
63  connect( this, SIGNAL(finished(int)), this, SLOT(saveSize()) );
64 }
65 
66 void AboutDialog::saveSize()
67 {
68  KConfigGroup group( KGlobal::config(), "AboutDialog" );
69  saveDialogSize( group );
70  group.sync();
71 }
72 
73 void AboutDialog::addAboutPlugin( KontactInterface::Plugin *plugin )
74 {
75  addAboutData( plugin->title(), plugin->icon(), plugin->aboutData() );
76 }
77 
78 void AboutDialog::addAboutData( const QString &title, const QString &icon,
79  const KAboutData *about )
80 {
81  QIcon pixmap = KIcon( icon );
82 
83  QFrame *topFrame = new QFrame();
84  KPageWidgetItem *pageItem = new KPageWidgetItem( topFrame, title );
85  pageItem->setIcon( KIcon( pixmap ) );
86 
87  addPage( pageItem );
88 
89  QBoxLayout *topLayout = new QVBoxLayout( topFrame );
90 
91  if ( !about ) {
92  QLabel *label = new QLabel( i18n( "No about information available." ), topFrame );
93  topLayout->addWidget( label );
94  } else {
95  QString text;
96 
97  text += QLatin1String("<p>");
98  text += QLatin1String("<b>") + about->programName() + QLatin1String("</b>");
99  text += QLatin1String("<br>");
100 
101  text += i18n( "Version %1", about->version() );
102  text += QLatin1String("</p>");
103 
104  if ( !about->shortDescription().isEmpty() ) {
105  text += QLatin1String("<p>") + about->shortDescription() +QLatin1String( "<br>") +
106  about->copyrightStatement() + QLatin1String("</p>");
107  }
108 
109  QString home = about->homepage();
110  if ( !home.isEmpty() ) {
111  text += QLatin1String("<a href=\"") + home + QLatin1String("\">") + home + QLatin1String("</a><br>");
112  }
113 
114  text.replace( QLatin1Char('\n'), QLatin1String("<br>") );
115 
116  QLabel *label = new QLabel( text, topFrame );
117  label->setAlignment( Qt::AlignTop );
118  label->setOpenExternalLinks(true);
119  label->setTextInteractionFlags(
120  Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse );
121  topLayout->addWidget( label );
122 
123  KTextBrowser *personView = new KTextBrowser( topFrame );
124  personView->setReadOnly( true );
125  topLayout->addWidget( personView, 1 );
126 
127  text.clear();
128  const QList<KAboutPerson> authors = about->authors();
129  if ( !authors.isEmpty() ) {
130  text += i18n( "<p><b>Authors:</b></p>" );
131 
132  QList<KAboutPerson>::ConstIterator it;
133  QList<KAboutPerson>::ConstIterator end(authors.end());
134  for ( it = authors.begin(); it != end; ++it ) {
135  text += formatPerson( (*it).name(), (*it).emailAddress() );
136  if ( !(*it).task().isEmpty() ) {
137  text += QLatin1String("<i>") + (*it).task() + QLatin1String("</i><br>");
138  }
139  }
140  }
141 
142  const QList<KAboutPerson> credits = about->credits();
143  if ( !credits.isEmpty() ) {
144  text += i18n( "<p><b>Thanks to:</b></p>" );
145 
146  QList<KAboutPerson>::ConstIterator it;
147  QList<KAboutPerson>::ConstIterator end(credits.end());
148  for ( it = credits.begin(); it != end; ++it ) {
149  text += formatPerson( (*it).name(), (*it).emailAddress() );
150  if ( !(*it).task().isEmpty() ) {
151  text += QLatin1String("<i>") + (*it).task() + QLatin1String("</i><br>");
152  }
153  }
154  }
155 
156  const QList<KAboutPerson> translators = about->translators();
157  if ( !translators.isEmpty() ) {
158  text += i18n( "<p><b>Translators:</b></p>" );
159 
160  QList<KAboutPerson>::ConstIterator it;
161  QList<KAboutPerson>::ConstIterator end(translators.end());
162  for ( it = translators.begin(); it != end; ++it ) {
163  text += formatPerson( (*it).name(), (*it).emailAddress() );
164  }
165  }
166  //krazy:excludeall=style (really need krazy conditional code sections)
167  text += i18n("<br /><br />\
168  <i>This Free Software product was improved as part of a commercial project:</i>\
169  <h3>Credits</h3>\
170  Project Kowi (March 2007 - )<br /><br />\
171  \
172  <b>Production / Project Coordination</b><br />\
173  Bernhard Reiter<br />\
174  <b>Director of Development</b><br />\
175  Till Adam\
176  <br /><br />\
177  \
178  <table border=\"0\" width=\"100%\"> \
179  <tr>\
180  <td colspan=\"2\">\
181  <b>Osnabr&uuml;ck Unit, Intevation GmbH</b>\
182  </td>\
183  </tr>\
184  <tr>\
185  <td width=\"60%\">\
186  Unit Lead<br />\
187  Senior QA, Packaging<br />\
188  QA, Packaging<br />\
189  Additional NSIS<br />\
190  Backup Coordinator\
191  </td>\
192  <td>\
193  Bernhard Reiter<br />\
194  Bernhard Herzog<br />\
195  Ludwig Reiter<br />\
196  Emanuel Sch&uuml;tze<br />\
197  Dr. Jan-Oliver Wagner\
198  </td>\
199  </tr>\
200  </table>\
201  <br /><br />\
202  \
203  <table border=\"0\" width=\"100%\">\
204  <tr>\
205  <td colspan=\"2\">\
206  <b>Berlin Unit, Klar&auml;lvdalens Datakonsult AB</b>\
207  </td>\
208  </tr>\
209  <tr>\
210  <td width=\"60%\">\
211  Unit Lead<br />\
212  Development<br />\
213  Development<br />\
214  Additional D. + Crypto<br />\
215  Crypto GUI Development\
216  </td>\
217  <td>\
218  Till Adam<br />\
219  Jaroslaw Staniek<br />\
220  Volker Krause<br />\
221  Frank Osterfeld<br />\
222  Marc Mutz\
223  </td>\
224  </tr>\
225  </table>\
226  <br /><br />\
227  \
228  <table border=\"0\" width=\"100%\">\
229  <tr>\
230  <td colspan=\"2\">\
231  <b>D&uuml;sseldorf Unit, g10 Code GmbH</b>\
232  </td>\
233  </tr>\
234  <tr>\
235  <td width=\"60%\">\
236  Crypto-Backend Porting<br />\
237  Crypto-Backend\
238  </td>\
239  <td>\
240  Werner Koch<br />\
241  Marcus Brinkmann\
242  </td>\
243  </tr>\
244  </table>\
245  <br /><br />\
246  \
247  <table border=\"0\" width=\"100%\">\
248  <tr>\
249  <td colspan=\"2\">\
250  <b>External QA Darmstadt, basysKom GmbH</b>\
251  </td>\
252  </tr>\
253  <tr>\
254  <td width=\"60%\">\
255  Unit-Lead\
256  </td>\
257  <td>\
258  Dr. Stefan Werden\
259  </td>\
260  </tr>\
261  </table><br /><br />");
262 
263  personView->setText( text );
264  }
265 }
266 
267 QString AboutDialog::formatPerson( const QString &name, const QString &email )
268 {
269  QString text = name;
270  if ( !email.isEmpty() ) {
271  text += QLatin1String(" &lt;<a href=\"mailto:") + email + QLatin1String("\">") + email + QLatin1String("</a>&gt;");
272  }
273 
274  text += QLatin1String("<br>");
275  return text;
276 }
277 
278 void AboutDialog::addLicenseText( const KAboutData *about )
279 {
280  if ( !about || about->license().isEmpty() ) {
281  return;
282  }
283 
284  QPixmap pixmap = KIconLoader::global()->loadIcon( QLatin1String("help-about"),
285  KIconLoader::Desktop, 48 );
286 
287  const QString title = i18n( "%1 License", about->programName() );
288 
289  QFrame *topFrame = new QFrame();
290  KPageWidgetItem *page = new KPageWidgetItem( topFrame, title );
291  page->setIcon( KIcon( pixmap ) );
292  addPage( page );
293  QBoxLayout *topLayout = new QVBoxLayout( topFrame );
294 
295  KTextBrowser *textBrowser = new KTextBrowser( topFrame );
296  textBrowser->setHtml( QString::fromLatin1( "<pre>%1</pre>" ).arg( about->license() ) );
297 
298  topLayout->addWidget( textBrowser );
299 }
300 
KPageDialog
Kontact::AboutDialog::addAboutData
void addAboutData(const QString &title, const QString &icon, const KAboutData *about)
Definition: aboutdialog.cpp:78
text
virtual QByteArray text(quint32 serialNumber) const =0
QLabel::setOpenExternalLinks
void setOpenExternalLinks(bool open)
QLabel::setAlignment
void setAlignment(QFlags< Qt::AlignmentFlag >)
Kontact::AboutDialog::addAboutPlugin
void addAboutPlugin(KontactInterface::Plugin *plugin)
Definition: aboutdialog.cpp:73
Kontact::AboutDialog::formatPerson
QString formatPerson(const QString &name, const QString &email)
Definition: aboutdialog.cpp:267
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QList::isEmpty
bool isEmpty() const
QString::isEmpty
bool isEmpty() const
aboutdialog.h
QVBoxLayout
QString
QList< KontactInterface::Plugin * >
QPixmap
Kontact::AboutDialog::addLicenseText
void addLicenseText(const KAboutData *about)
Definition: aboutdialog.cpp:278
QList::end
iterator end()
QSize
QLatin1Char
QFrame
QLabel::setTextInteractionFlags
void setTextInteractionFlags(QFlags< Qt::TextInteractionFlag > flags)
QLatin1String
QString::fromLatin1
QString fromLatin1(const char *str, int size)
QList::constEnd
const_iterator constEnd() const
Kontact::AboutDialog::AboutDialog
AboutDialog(KontactInterface::Core *core)
Definition: aboutdialog.cpp:40
QList::constBegin
const_iterator constBegin() const
QLabel
QBoxLayout
QList::begin
iterator begin()
QIcon
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kontact

Skip menu "kontact"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



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