diff options
author | Michele Calgaro <[email protected]> | 2023-03-26 01:09:47 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2023-03-27 10:33:57 +0900 |
commit | b957aab3e4e0c1b61a5701a5e4fee58a20aed7a8 (patch) | |
tree | d2fe97e849c7cf7f8c4fd88d1e2356830536c249 /doc/khelpcenter | |
parent | e8208c1dfb4dcd17b1168ac2614aa8d5b761f3fd (diff) | |
download | tdebase-b957aab3e4e0c1b61a5701a5e4fee58a20aed7a8.tar.gz tdebase-b957aab3e4e0c1b61a5701a5e4fee58a20aed7a8.zip |
Added TDE license info dialog
Signed-off-by: Michele Calgaro <[email protected]>
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'doc/khelpcenter')
-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 |
6 files changed, 222 insertions, 0 deletions
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; |