diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | Makefile.am.in | 2 | ||||
-rw-r--r-- | doc/khelpcenter/license/CMakeL10n.txt | 3 | ||||
-rw-r--r-- | doc/khelpcenter/license/CMakeLists.txt | 31 | ||||
-rw-r--r-- | doc/khelpcenter/license/TDELicenseDlg.cpp | 122 | ||||
-rw-r--r-- | doc/khelpcenter/license/TDELicenseDlg.h | 17 | ||||
-rw-r--r-- | doc/khelpcenter/license/mainWindow.cpp | 40 | ||||
-rw-r--r-- | doc/khelpcenter/license/tde_license_info.desktop | 9 | ||||
-rw-r--r-- | tde_show_license_info | 28 |
9 files changed, 252 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a3c1b4a22..4d7af2bd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,7 +302,7 @@ tde_conditional_add_subdirectory( BUILD_TQT3INTEGRATION tqt3integration ) ##### install starttde & related stuff ########## if( BUILD_STARTTDE ) - install( PROGRAMS starttde migratekde3 r14-xdg-update tde_release_notes + install( PROGRAMS starttde migratekde3 r14-xdg-update tde_release_notes tde_show_license_info DESTINATION ${BIN_INSTALL_DIR} ) endif() diff --git a/Makefile.am.in b/Makefile.am.in index 793c08688..ece4e7f2c 100644 --- a/Makefile.am.in +++ b/Makefile.am.in @@ -9,7 +9,7 @@ COMPILE_AFTER_kcontrol = tdm kdesktop AUTOMAKE_OPTIONS = foreign 1.6.1 -bin_SCRIPTS = starttde migratekde3 r14-xdg-update tde_release_notes +bin_SCRIPTS = starttde migratekde3 r14-xdg-update tde_release_notes tde_show_license_info EXTRA_DIST = admin bsd-port debian tdebase.spec.in README.pam kde.pamd tdescreensaver.pamd mkpamserv diff --git a/doc/khelpcenter/license/CMakeL10n.txt b/doc/khelpcenter/license/CMakeL10n.txt new file mode 100644 index 000000000..6fc757869 --- /dev/null +++ b/doc/khelpcenter/license/CMakeL10n.txt @@ -0,0 +1,3 @@ +##### create translation templates ############## + +tde_l10n_create_template( "tdelicense" ) diff --git a/doc/khelpcenter/license/CMakeLists.txt b/doc/khelpcenter/license/CMakeLists.txt new file mode 100644 index 000000000..ee0dfb94b --- /dev/null +++ b/doc/khelpcenter/license/CMakeLists.txt @@ -0,0 +1,31 @@ +################################################# +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tde_license_info.desktop DESTINATION ${AUTOSTART_INSTALL_DIR} ) + + +##### tde_license_info (executable) ######################### + +tde_add_executable( tde_license_info AUTOMOC + SOURCES mainWindow.cpp TDELicenseDlg.cpp + LINK tdeui-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/doc/khelpcenter/license/TDELicenseDlg.cpp b/doc/khelpcenter/license/TDELicenseDlg.cpp new file mode 100644 index 000000000..6d36afe92 --- /dev/null +++ b/doc/khelpcenter/license/TDELicenseDlg.cpp @@ -0,0 +1,122 @@ +#include <tqfile.h> +#include <tqlabel.h> +#include <tqlayout.h> + +#include <kiconloader.h> +#include <kpushbutton.h> +#include <kseparator.h> +#include <kstddirs.h> +#include <ktabwidget.h> +#include <ktextbrowser.h> +#include <tdelocale.h> + +#include "TDELicenseDlg.h" + +TDELicenseDlg::TDELicenseDlg(TQWidget *parent, const char *name) + : KDialog(parent, name) +{ + setCaption(i18n("TDE License")); + setIcon(TDEGlobal::iconLoader()->loadIcon("about_kde", TDEIcon::NoGroup, TDEIcon::SizeSmall)); + resize(850, 750); + + TQVBoxLayout *vbox = new TQVBoxLayout(this, marginHint(), spacingHint()); + + // Top label + TQLabel *topLabel = new TQLabel(this); + topLabel->setText(i18n( + "The Trinity Desktop Environment (TDE) project is a computer desktop\n" + "environment for Unix-like operating systems with a primary goal of\n" + "retaining the function and form of traditional desktop computers.\n\n" + "Its components are provided under the following licenses, as applicable.\n\n" + "Thanks for using TDE!")); + vbox->addWidget(topLabel); + + TQSpacerItem *spacerV = new TQSpacerItem(10, 10, TQSizePolicy::Minimum, + TQSizePolicy::Minimum); + vbox->addItem(spacerV); + + // License tab widget + KTabWidget *twLicense = new KTabWidget(this); + twLicense->setTabReorderingEnabled(false); + twLicense->setAutomaticResizeTabs(true); + twLicense->setTabCloseActivatePrevious(true); + twLicense->setMouseWheelScroll(true); + twLicense->setTabPosition(TQTabWidget::Top); + + KTextBrowser *tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("GPL_V2")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("GPL v2")); + + tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("GPL_V3")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("GPL v3")); + + tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("LGPL_V2")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("LGPL v2")); + + tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("LGPL_V3")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("LGPL v3")); + + tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("BSD")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("BSD")); + + tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("ARTISTIC")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("Artistic")); + + tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("QPL_V1.0")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("QPL v1.0")); + + tbLicense = new KTextBrowser(twLicense); + tbLicense->setText(readLicenseFile("MIT")); + tbLicense->moveCursor(TQTextEdit::MoveHome, false); + twLicense->addTab(tbLicense, i18n("MIT")); + + twLicense->setCurrentPage(0); + vbox->addWidget(twLicense); + + KSeparator *sep = new KSeparator(KSeparator::HLine, this); + vbox->addWidget(sep); + + // Close button + TQHBoxLayout *hboxBottom = new TQHBoxLayout(vbox, 4); + TQSpacerItem *spacerHBottom = new TQSpacerItem(10, 10, TQSizePolicy::Expanding, + TQSizePolicy::Minimum); + hboxBottom->addItem(spacerHBottom); + KPushButton *okButton = new KPushButton(KStdGuiItem::ok(), this); + connect(okButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(accept())); + okButton->setDefault(true); + okButton->setFocus(); + hboxBottom->addWidget(okButton); +} + +TQString TDELicenseDlg::readLicenseFile(const TQString &licenseName) +{ + TQString licensePath = locate("data", TQString("LICENSES/%1").arg(licenseName)); + if (licensePath.isEmpty()) + { + return i18n("License file not found!"); + } + + TQFile licenseFile(licensePath); + if (licenseFile.open(IO_ReadOnly)) + { + TQTextStream txtstr(&licenseFile); + return txtstr.read(); + } + + return i18n("Unable to open license file!"); +} + +#include "TDELicenseDlg.moc" diff --git a/doc/khelpcenter/license/TDELicenseDlg.h b/doc/khelpcenter/license/TDELicenseDlg.h new file mode 100644 index 000000000..f0dadf404 --- /dev/null +++ b/doc/khelpcenter/license/TDELicenseDlg.h @@ -0,0 +1,17 @@ +#ifndef __TDELICENSE_DLG_H__ +#define __TDELICENSE_DLG_H__ + +#include <kdialog.h> + +class TDELicenseDlg : public KDialog +{ + Q_OBJECT + +public: + TDELicenseDlg(TQWidget *parent = 0, const char *name = 0); + +protected: + static TQString readLicenseFile(const TQString &licenseName); +}; + +#endif diff --git a/doc/khelpcenter/license/mainWindow.cpp b/doc/khelpcenter/license/mainWindow.cpp new file mode 100644 index 000000000..b6885e92b --- /dev/null +++ b/doc/khelpcenter/license/mainWindow.cpp @@ -0,0 +1,40 @@ +/* + This program is free software; you can redistribute it and/or + modify it under the terms of version 2 of the GNU General Public + License as published by the Free Software Foundation + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdelocale.h> + +#include "TDELicenseDlg.h" + +int main(int argc, char *argv[]) +{ + TDELocale::setMainCatalogue("tdelicense"); + TDEAboutData aboutData("TDELicense", I18N_NOOP("TDE License"), + "0.1", I18N_NOOP("TDE License"), TDEAboutData::License_GPL, + "(c) 2023, TDE Developers"); + TDECmdLineArgs::init(argc,argv, &aboutData); + TDEApplication::addCmdLineOptions(); + TDEApplication app; + TQObject::connect(tqApp, TQT_SIGNAL(lastWindowClosed()), tqApp, TQT_SLOT(quit())); + + TDELicenseDlg *licenseDlg = new TDELicenseDlg(); + app.setMainWidget(licenseDlg); + licenseDlg->show(); + + return app.exec(); +} diff --git a/doc/khelpcenter/license/tde_license_info.desktop b/doc/khelpcenter/license/tde_license_info.desktop new file mode 100644 index 000000000..3cabcfad0 --- /dev/null +++ b/doc/khelpcenter/license/tde_license_info.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=tde_show_license_info +Exec=tde_show_license_info +Type=Application +X-TDE-autostart-phase=2 +X-TDE-StartupNotify=false +X-TDE-UniqueApplet=true +Categories=System; diff --git a/tde_show_license_info b/tde_show_license_info new file mode 100644 index 000000000..212845f53 --- /dev/null +++ b/tde_show_license_info @@ -0,0 +1,28 @@ +#!/bin/sh +# +# A script to open/autostart the dialog showing the licenses +# under which TDE components are provided. +# The dialog will be shown once for each TDE minor releases (R14.x.0) + +# As this script is run as a global TDE autostart app, all +# environment variables should already be set. + +if [ "$TDEDIR" = "" ] || [ "$TDEHOME" = "" ]; then + exit 1 +fi + +RELEASE_MINOR_VERSION="$( ${TDEDIR}/bin/tde-config --version | sed -n 's|^TDE: \(R[0-9]\+\.[0-9]\+\)\.[0-9]\+[^0-9]*|\1|p' )" +LICENSE_INFO="$( ${TDEDIR}/bin/kreadconfig --file ${TDEHOME}/share/config/kdeglobals --group "License Info" --key "${RELEASE_MINOR_VERSION}" )" + +if [ "$LICENSE_INFO" = "" ] || [ "$LICENSE_INFO" != "true" ]; then + echo "[tde_license_info] Release minor version: $RELEASE_MINOR_VERSION" + echo "[tde_license_info] License info: $LICENSE_INFO" + ${TDEDIR}/bin/tde_license_info + ${TDEDIR}/bin/kwriteconfig --file ${TDEHOME}/share/config/kdeglobals --group "License Info" --key "$RELEASE_MINOR_VERSION" --type bool "true" + LICENSE_INFO="$( ${TDEDIR}/bin/kreadconfig --file ${TDEHOME}/share/config/kdeglobals --group "License Info" --key "$RELEASE_MINOR_VERSION" )" + echo "[tde_license_info] License info: $LICENSE_INFO" +fi + +unset LICENSE_INFO RELEASE_MINOR_VERSION +exit 0 + |