25 #include "aboutdialog.h" 30 #include <tdelocale.h> 31 #include <kiconloader.h> 32 #include <tdeaboutdata.h> 33 #include <kactivelabel.h> 34 #include <ktextbrowser.h> 43 AboutDialog::AboutDialog(
Kontact::Core *core,
const char *name )
44 : KDialogBase( IconList, i18n(
"About Kontact"), Ok, Ok, core, name, false,
48 addAboutData( i18n(
"Kontact Container" ), TQString(
"kontact" ),
49 TDEGlobal::instance()->aboutData() );
51 TQValueList<Plugin*> plugins = mCore->pluginList();
52 TQValueList<Plugin*>::ConstIterator end = plugins.end();
53 TQValueList<Plugin*>::ConstIterator it = plugins.begin();
54 for ( ; it != end; ++it )
55 addAboutPlugin( *it );
57 addLicenseText( TDEGlobal::instance()->aboutData() );
65 void AboutDialog::addAboutData(
const TQString &title,
const TQString &icon,
66 const TDEAboutData *about )
68 TQPixmap pixmap = TDEGlobal::iconLoader()->loadIcon( icon,
69 TDEIcon::Desktop, 48 );
71 TQFrame *topFrame = addPage( title, TQString(), pixmap );
73 TQBoxLayout *topLayout =
new TQVBoxLayout( topFrame );
76 TQLabel *label =
new TQLabel( i18n(
"No about information available." ),
78 topLayout->addWidget( label );
82 text +=
"<p><b>" + about->programName() +
"</b><br>";
84 text += i18n(
"Version %1</p>" ).arg( about->version() );
86 if ( !about->shortDescription().isEmpty() ) {
87 text +=
"<p>" + about->shortDescription() +
"<br>" +
88 about->copyrightStatement() +
"</p>";
91 TQString home = about->homepage();
92 if ( !home.isEmpty() ) {
93 text +=
"<a href=\"" + home +
"\">" + home +
"</a><br>";
96 text.replace(
"\n",
"<br>" );
98 KActiveLabel *label =
new KActiveLabel( text, topFrame );
99 label->setAlignment( AlignTop );
100 topLayout->addWidget( label );
103 TQTextEdit *personView =
new TQTextEdit( topFrame );
104 personView->setReadOnly(
true );
105 topLayout->addWidget( personView, 1 );
109 const TQValueList<TDEAboutPerson> authors = about->authors();
110 if ( !authors.isEmpty() ) {
111 text += i18n(
"<p><b>Authors:</b></p>" );
113 TQValueList<TDEAboutPerson>::ConstIterator it;
114 for ( it = authors.begin(); it != authors.end(); ++it ) {
115 text += formatPerson( (*it).name(), (*it).emailAddress() );
116 if ( !(*it).task().isEmpty() )
117 text +=
"<i>" + (*it).task() +
"</i><br>";
121 const TQValueList<TDEAboutPerson> credits = about->credits();
122 if ( !credits.isEmpty() ) {
123 text += i18n(
"<p><b>Thanks to:</b></p>" );
125 TQValueList<TDEAboutPerson>::ConstIterator it;
126 for ( it = credits.begin(); it != credits.end(); ++it ) {
127 text += formatPerson( (*it).name(), (*it).emailAddress() );
128 if ( !(*it).task().isEmpty() )
129 text +=
"<i>" + (*it).task() +
"</i><br>";
133 const TQValueList<TDEAboutTranslator> translators = about->translators();
134 if ( !translators.isEmpty() ) {
135 text += i18n(
"<p><b>Translators:</b></p>");
137 TQValueList<TDEAboutTranslator>::ConstIterator it;
138 for ( it = translators.begin(); it != translators.end(); ++it ) {
139 text += formatPerson( (*it).name(), (*it).emailAddress() );
143 personView->setText( text );
147 TQString AboutDialog::formatPerson(
const TQString &name,
const TQString &email )
149 TQString text = name;
150 if ( !email.isEmpty() ) {
151 text +=
" <<a href=\"mailto:" + email +
"\">" + email +
"</a>>";
158 void AboutDialog::addLicenseText(
const TDEAboutData *about )
160 if ( !about || about->license().isEmpty() )
163 TQPixmap pixmap = TDEGlobal::iconLoader()->loadIcon(
"signature",
164 TDEIcon::Desktop, 48 );
166 TQString title = i18n(
"%1 License" ).arg( about->programName() );
168 TQFrame *topFrame = addPage( title, TQString(), pixmap );
169 TQBoxLayout *topLayout =
new TQVBoxLayout( topFrame );
171 KTextBrowser *textBrowser =
new KTextBrowser( topFrame );
172 textBrowser->setText( TQString(
"<pre>%1</pre>" ).arg( about->license() ) );
174 topLayout->addWidget( textBrowser );
177 #include "aboutdialog.moc" This class provides the interface to the Kontact core for the plugins.
Base class for all Plugins in Kontact.
TQString title() const
Returns the localized title.
TQString icon() const
Returns the icon name.
virtual const TDEAboutData * aboutData()
Reimplement this method if you want to add your credits to the Kontact about dialog.