Branch: master

691c9204 2019-04-12 15:33:10 Michele Calgaro
Added TDE Control module for trash policy configuration.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
A tdeioslave/trash/kcm_trash.cpp
A tdeioslave/trash/kcm_trash.desktop
A tdeioslave/trash/kcm_trash.h
A tdeioslave/trash/ktrashpropswidget.cpp
A tdeioslave/trash/ktrashpropswidget.h
M konqueror/sidebar/trees/init/trash.desktop
M tdeioslave/trash/CMakeLists.txt
M tdeioslave/trash/Makefile.am
M tdeioslave/trash/ktrashpropsdlgplugin.cpp
M tdeioslave/trash/ktrashpropsdlgplugin.desktop
M tdeioslave/trash/ktrashpropsdlgplugin.h

konqueror/sidebar/trees/init/trash.desktop

diff --git a/konqueror/sidebar/trees/init/trash.desktop b/konqueror/sidebar/trees/init/trash.desktop
index 1476381..2c1b750 100644
--- a/konqueror/sidebar/trees/init/trash.desktop
+++ b/konqueror/sidebar/trees/init/trash.desktop
@@ -8,8 +8,10 @@
 
 Name=Trash Folder
 Name[cz]=Složka koše
+Name[fr]=Dossier Corbeille
 Name[it]=Cartella Cestino
 
 Comment=This folder displays the contents of your Trash Bin
 Comment[cz]=Tato složka zobrazuje obsah vašeho koše
+Comment[fr]=Ce dossier montre le contenu de votre corbeille
 Comment[it]=Questa cartella visualizza il contenuto del tuo Cestino

tdeioslave/trash/CMakeLists.txt

diff --git a/tdeioslave/trash/CMakeLists.txt b/tdeioslave/trash/CMakeLists.txt
index 1082b57..2f1b184 100644
--- a/tdeioslave/trash/CMakeLists.txt
+++ b/tdeioslave/trash/CMakeLists.txt
@@ -26,19 +26,18 @@
 ##### other data ################################
 
 install( FILES ktrashpropsdlgplugin.desktop trash.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
+install( FILES kcm_trash.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
 
 
 ##### trashcommon (static) ######################
-
 set( target trashcommon )
 
 tde_add_library( ${target} STATIC_PIC AUTOMOC
-  SOURCES trashimpl.cpp discspaceutil.cpp 
+  SOURCES trashimpl.cpp discspaceutil.cpp ktrashpropswidget.cpp
 )
 
 
 ##### tdeio_trash (module) ########################
-
 set( target tdeio_trash )
 
 tde_add_kpart( ${target} AUTOMOC
@@ -47,8 +46,18 @@
   DESTINATION ${PLUGIN_INSTALL_DIR}
 )
 
-##### ktrashpropsdlgplugin (module) ########################
 
+##### kcm_trash (module) ########################
+set( target kcm_trash )
+
+tde_add_kpart( ${target} AUTOMOC
+  SOURCES kcm_trash.cpp
+  LINK trashcommon-static tdeio-shared
+  DESTINATION ${PLUGIN_INSTALL_DIR}
+)
+
+
+##### ktrashpropsdlgplugin (module) ########################
 set( target ktrashpropsdlgplugin )
 
 tde_add_kpart( ${target} AUTOMOC
@@ -57,8 +66,8 @@
   DESTINATION ${PLUGIN_INSTALL_DIR}
 )
 
-##### ktrash (executable) #######################
 
+##### ktrash (executable) #######################
 set( target ktrash )
 
 tde_add_executable( ${target}
@@ -67,6 +76,7 @@
   DESTINATION ${BIN_INSTALL_DIR}
 )
 
+
 ##### testtrash (executable) #######################
 tde_add_executable( testtrash
   SOURCES testtrash.cpp AUTOMOC

tdeioslave/trash/Makefile.am

diff --git a/tdeioslave/trash/Makefile.am b/tdeioslave/trash/Makefile.am
index 170701c..cee2825 100644
--- a/tdeioslave/trash/Makefile.am
+++ b/tdeioslave/trash/Makefile.am
@@ -3,11 +3,15 @@
 
 SUBDIRS = . tdefile-plugin
 
-kde_module_LTLIBRARIES = tdeio_trash.la ktrashpropsdlgplugin.la
+kde_module_LTLIBRARIES = tdeio_trash.la kcm_trash ktrashpropsdlgplugin.la
 
 tdeio_trash_la_SOURCES = tdeio_trash.cpp
 tdeio_trash_la_LIBADD  = libtrashcommon.la $(LIB_TDEIO)
 tdeio_trash_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined
+
+kcm_trash_la_SOURCES = kcm_trash.cpp
+kcm_trash_la_LIBADD  = libtrashcommon.la $(LIB_TDEIO)
+kcm_trash_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined
 
 bin_PROGRAMS = ktrash
 ktrash_SOURCES = ktrash.cpp
@@ -17,7 +21,7 @@
 kde_services_DATA = trash.protocol
 
 noinst_LTLIBRARIES = libtrashcommon.la
-libtrashcommon_la_SOURCES = trashimpl.cpp discspaceutil.cpp
+libtrashcommon_la_SOURCES = trashimpl.cpp discspaceutil.cpp ktrashpropswidget.cpp
 
 check_PROGRAMS = testtrash
 testtrash_SOURCES = testtrash.cpp
@@ -38,3 +42,5 @@
 
 services_DATA = ktrashpropsdlgplugin.desktop
 servicesdir = $(kde_servicesdir)
+
+xdg_apps_DATA = kcm_trash.desktop

tdeioslave/trash/kcm_trash.cpp

diff --git a/tdeioslave/trash/kcm_trash.cpp b/tdeioslave/trash/kcm_trash.cpp
new file mode 100644
index 0000000..abff4f6
--- /dev/null
+++ b/tdeioslave/trash/kcm_trash.cpp
@@ -0,0 +1,81 @@
+/*
+   This file is part of the TDE Project
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License version 2 as published by the Free Software Foundation.
+
+   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.
+*/
+
+#include "kcm_trash.h"
+#include "ktrashpropswidget.h"
+
+#include <tqlayout.h>
+#include <tqtabwidget.h>
+#include <tdelocale.h>
+#include <tdeglobal.h>
+#include <tdeaboutdata.h>
+#include <kdialog.h>
+
+
+extern "C"
+{
+  KDE_EXPORT TDECModule *create_trash(TQWidget *parent, const char *)
+  {
+    return new TrashModule(parent, "trash");
+  }
+}
+
+
+TrashModule::TrashModule(TQWidget *parent, const char *name)
+	: TDECModule(parent, name)
+{
+	TDEAboutData * about = new TDEAboutData("trash",
+	                                    I18N_NOOP("Trash"), "1",
+	                                    I18N_NOOP("Trash Control Panel Module"),
+	                                    TDEAboutData::License_GPL_V2,
+	                                    I18N_NOOP("(c) 2019 Michele Calgaro"));
+	setAboutData( about );
+  TDEGlobal::locale()->insertCatalogue("trash");
+
+  tab = new TQTabWidget(this);
+
+	policyWidget = new KTrashPropsWidget(this);
+  tab->addTab(policyWidget, i18n("Trash Polic&y"));
+  connect(policyWidget, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool)));
+
+  TQVBoxLayout *top = new TQVBoxLayout(this);
+  top->addWidget(tab);
+}
+
+void TrashModule::load()
+{
+  policyWidget->load();
+}
+
+void TrashModule::save()
+{
+  policyWidget->save();
+}
+
+void TrashModule::defaults()
+{
+  policyWidget->setDefaultValues();
+}
+
+TQString TrashModule::quickHelp() const
+{
+  return i18n("<h1>Trash</h1> Here you can choose the settings "
+              "for your Trash Bin size and clean up policy. ");
+}
+
+#include "kcm_trash.moc"

tdeioslave/trash/kcm_trash.desktop

diff --git a/tdeioslave/trash/kcm_trash.desktop b/tdeioslave/trash/kcm_trash.desktop
new file mode 100644
index 0000000..83b70c9
--- /dev/null
+++ b/tdeioslave/trash/kcm_trash.desktop
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Exec=tdecmshell kcm_trash
+Icon=trashcan_empty
+Type=Application
+#X-DocPath=kcontrol/kcmcgi/index.html
+
+X-TDE-ModuleType=Library
+X-TDE-Library=trash
+Categories=Qt;TDE;X-TDE-settings-system;
+
+Name=Trash
+Name[cz]=Koš
+Name[fr]=Corbeille
+Name[it]=Cestino
+
+Comment=Trash Properties
+Comment[cz]=Vlastnosti koše
+Comment[fr]=Propriétés de la Corbeille
+Comment[it]=Proprietà del cestino
+
+Keywords=trash;properties;size;limits;delete
+Keywords[cz]=koš,vlastnosti,velikost,limity,odstranit
+Keywords[fr]=corbeille;propriétés;taille;limites;supprimer
+Keywords[it]=cestino;proprietà;dimensioni;limiti;cancella

tdeioslave/trash/kcm_trash.h

diff --git a/tdeioslave/trash/kcm_trash.h b/tdeioslave/trash/kcm_trash.h
new file mode 100644
index 0000000..4987ccf
--- /dev/null
+++ b/tdeioslave/trash/kcm_trash.h
@@ -0,0 +1,47 @@
+/*
+   This file is part of the TDE Project
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License version 2 as published by the Free Software Foundation.
+
+   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.
+
** Diff limit reached (max: 250 lines) **
c53dbf95 2019-04-14 06:07:33 Michele Calgaro
Improved code for trash bin management.
1. When size limit is used, a file bigger than the trash size can't be
trashed anymore (a warning message is shown).
2. When size limit is used and warning policy selected, files can't be
trashed anymore if the total size of the trash will exceed the set size
(a warning message is shown).
3. When the trash size settings are modified, the content of the trash
is adjusted based on the new settings.
4. Fixed load/saving of trash options when more than one trash folder exists.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdeioslave/trash/ktrashpropsdlgplugin.cpp
M tdeioslave/trash/ktrashpropswidget.cpp
M tdeioslave/trash/trash_constant.h
M tdeioslave/trash/trashimpl.cpp
M tdeioslave/trash/trashimpl.h
** Diff limit reached (max: 250 lines) **
85e0371c 2019-04-14 12:43:08 Michele Calgaro
Unified widget code for trash property dialog and TDE control module.
This resolves bug 1923.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdeioslave/trash/kcm_trash.cpp
M tdeioslave/trash/ktrashpropsdlgplugin.cpp
M tdeioslave/trash/ktrashpropsdlgplugin.h
** Diff limit reached (max: 250 lines) **