diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-02-14 17:17:18 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-02-14 17:17:18 -0600 |
commit | 8bd62a3b0d3b362b783a273e2460811392485bbd (patch) | |
tree | 908bded302457ea012474f3a52d67fb9cfce99c3 /tdeui/tdeaboutapplication.cpp | |
parent | d8ece7c070ff053c8a429d4a7d7a14d4b8c107b3 (diff) | |
download | tdelibs-8bd62a3b0d3b362b783a273e2460811392485bbd.tar.gz tdelibs-8bd62a3b0d3b362b783a273e2460811392485bbd.zip |
Rename common header files for consistency with class renaming
Diffstat (limited to 'tdeui/tdeaboutapplication.cpp')
-rw-r--r-- | tdeui/tdeaboutapplication.cpp | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/tdeui/tdeaboutapplication.cpp b/tdeui/tdeaboutapplication.cpp new file mode 100644 index 000000000..08ee46450 --- /dev/null +++ b/tdeui/tdeaboutapplication.cpp @@ -0,0 +1,188 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and + * Espen Sand (espen@kde.org) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +// I (espen) prefer that header files are included alphabetically + +#include <tqlabel.h> +#include <tdeaboutapplication.h> +#include <kaboutdialog_private.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <kglobal.h> +#include <klocale.h> +#include <kurllabel.h> +#include <kactivelabel.h> +#include "ktextedit.h" + +TDEAboutApplication::TDEAboutApplication( TQWidget *parent, const char *name, + bool modal ) + :TDEAboutDialog( AbtTabbed|AbtProduct, + kapp ? kapp->caption() : TQString::null, + Close, Close, + parent, name, modal ) +{ + buildDialog(TDEGlobal::instance()->aboutData()); +} + +TDEAboutApplication::TDEAboutApplication( const TDEAboutData *aboutData, TQWidget *parent, + const char *name, bool modal ) + :TDEAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close, + parent, name, modal ) +{ + buildDialog(aboutData); +} + +void TDEAboutApplication::buildDialog( const TDEAboutData *aboutData ) +{ + if( !aboutData ) + { + // + // Recovery + // + + //i18n "??" is displayed as (pseudo-)version when no data is known about the application + setProduct( kapp ? kapp->caption() : TQString::null, i18n("??"), TQString::null, TQString::null ); + TDEAboutContainer *appPage = addContainerPage( i18n("&About")); + + TQString appPageText = + i18n("No information available.\n" + "The supplied TDEAboutData object does not exist."); + TQLabel *appPageLabel = new TQLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 ); + appPage->addWidget( appPageLabel ); + return; + } + + setProduct( aboutData->programName(), aboutData->version(), + TQString::null, TQString::null ); + + if (!aboutData->programLogo().isNull()) + setProgramLogo( aboutData->programLogo() ); + + TQString appPageText = aboutData->shortDescription() + "\n"; + + if (!aboutData->otherText().isEmpty()) + appPageText += "\n" + aboutData->otherText()+"\n"; + + if (!aboutData->copyrightStatement().isEmpty()) + appPageText += "\n" + aboutData->copyrightStatement()+"\n"; + + TDEAboutContainer *appPage = addContainerPage( i18n("&About")); + + TQLabel *appPageLabel = new TQLabel( appPageText, 0 ); + appPage->addWidget( appPageLabel ); + + if (!aboutData->homepage().isEmpty()) + { + KURLLabel *url = new KURLLabel(); + url->setText(aboutData->homepage()); + url->setURL(aboutData->homepage()); + appPage->addWidget( url ); + connect( url, TQT_SIGNAL(leftClickedURL(const TQString &)), + this, TQT_SLOT(openURLSlot(const TQString &))); + } + + int authorCount = aboutData->authors().count(); + if (authorCount) + { + TQString authorPageTitle = authorCount == 1 ? + i18n("A&uthor") : i18n("A&uthors"); + TDEAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle ); + + if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ()) + { + TQString text; + KActiveLabel* activeLabel = new KActiveLabel( authorPage ); + if (!aboutData->customAuthorTextEnabled()) + { + if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.pearsoncomputing.net") + text = i18n( "Please use <a href=\"http://bugs.pearsoncomputing.net\">http://bugs.pearsoncomputing.net</a> to report bugs.\n" ); + else { + if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) ) + { + text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() ); + } + else { + text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() ); + } + } + } + else + { + text = aboutData->customAuthorRichText(); + } + activeLabel->setText( text ); + authorPage->addWidget( activeLabel ); + } + + TQValueList<TDEAboutPerson>::ConstIterator it; + for (it = aboutData->authors().begin(); + it != aboutData->authors().end(); ++it) + { + authorPage->addPerson( (*it).name(), (*it).emailAddress(), + (*it).webAddress(), (*it).task() ); + } + } + + int creditsCount = aboutData->credits().count(); + if (creditsCount) + { + TDEAboutContainer *creditsPage = + addScrolledContainerPage( i18n("&Thanks To") ); + TQValueList<TDEAboutPerson>::ConstIterator it; + for (it = aboutData->credits().begin(); + it != aboutData->credits().end(); ++it) + { + creditsPage->addPerson( (*it).name(), (*it).emailAddress(), + (*it).webAddress(), (*it).task() ); + } + } + + const TQValueList<TDEAboutTranslator> translatorList = aboutData->translators(); + + if(translatorList.count() > 0) + { + TQString text = "<qt>"; + + TQValueList<TDEAboutTranslator>::ConstIterator it; + for(it = translatorList.begin(); it != translatorList.end(); ++it) + { + text += TQString("<p>%1<br> " + "<a href=\"mailto:%2\">%2</a></p>") + .arg((*it).name()) + .arg((*it).emailAddress()) + .arg((*it).emailAddress()); + } + + text += TDEAboutData::aboutTranslationTeam() + "</qt>"; + addTextPage( i18n("T&ranslation"), text, true); + } + + if (!aboutData->license().isEmpty() ) + { + addLicensePage( i18n("&License Agreement"), aboutData->license() ); + } + + // + // Make sure the dialog has a reasonable width + // + setInitialSize( TQSize(400,1) ); +} |