Added TDE license info dialog

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/318/head
Michele Calgaro 1 year ago
parent e8208c1dfb
commit b957aab3e4
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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()

@ -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

@ -0,0 +1,3 @@
##### create translation templates ##############
tde_l10n_create_template( "tdelicense" )

@ -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}
)

@ -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"

@ -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

@ -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();
}

@ -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;

@ -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
Loading…
Cancel
Save