summaryrefslogtreecommitdiffstats
path: root/kiosktool/kcms
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-02-01 23:11:34 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-02-01 23:11:34 -0600
commit65f5e7cb4d09977affa95100ef20ddbfa4620a34 (patch)
tree116347138c6081c5aa4bf1e0db4ddbb04d3f6d0e /kiosktool/kcms
parent3c66b171a6f0ad667c538fd727bbcef54af71d37 (diff)
downloadkiosktool-65f5e7cb4d09977affa95100ef20ddbfa4620a34.tar.gz
kiosktool-65f5e7cb4d09977affa95100ef20ddbfa4620a34.zip
Rename many classes and header files to avoid conflicts with KDE4
Diffstat (limited to 'kiosktool/kcms')
-rw-r--r--kiosktool/kcms/Makefile.am6
-rw-r--r--kiosktool/kcms/autostart/Makefile.am17
-rw-r--r--kiosktool/kcms/autostart/kcmautostart.cpp202
-rw-r--r--kiosktool/kcms/autostart/kcmautostart.desktop56
-rw-r--r--kiosktool/kcms/autostart/kcmautostart.h68
5 files changed, 349 insertions, 0 deletions
diff --git a/kiosktool/kcms/Makefile.am b/kiosktool/kcms/Makefile.am
new file mode 100644
index 0000000..335ab60
--- /dev/null
+++ b/kiosktool/kcms/Makefile.am
@@ -0,0 +1,6 @@
+## Makefile.am for kiosktool's additional KCMs
+
+# this has all of the subdirectories that make will recurse into. if
+# there are none, comment this out
+#SUBDIRS = autostart
+
diff --git a/kiosktool/kcms/autostart/Makefile.am b/kiosktool/kcms/autostart/Makefile.am
new file mode 100644
index 0000000..993941a
--- /dev/null
+++ b/kiosktool/kcms/autostart/Makefile.am
@@ -0,0 +1,17 @@
+kde_module_LTLIBRARIES = kcm_autostart.la
+
+kcm_autostart_la_SOURCES = kcmautostart.cpp
+
+kcm_autostart_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+kcm_autostart_la_LIBADD = $(LIB_KIO)
+
+INCLUDES= $(all_includes)
+
+kcm_autostart_la_METASOURCES = AUTO
+
+KDE_ICON = autostart
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kcmautostart.pot
+
+xdg_apps_DATA = kcmautostart.desktop
diff --git a/kiosktool/kcms/autostart/kcmautostart.cpp b/kiosktool/kcms/autostart/kcmautostart.cpp
new file mode 100644
index 0000000..c0e6a62
--- /dev/null
+++ b/kiosktool/kcms/autostart/kcmautostart.cpp
@@ -0,0 +1,202 @@
+/*
+This file is part of the KDE project
+Copyright (C) 2004 Martijn Klingens <klingens@kde.org>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+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; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#include <tqlayout.h>
+#include <tqwhatsthis.h>
+#include <tqvgroupbox.h>
+#include <tqpushbutton.h>
+#include <tqheader.h>
+#include <tqtimer.h>
+#include <tqfileinfo.h>
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kdesktopfile.h>
+#include <kdialog.h>
+#include <kgenericfactory.h>
+#include <tdelistview.h>
+#include <kmessagebox.h>
+#include <kservice.h>
+#include <kstandarddirs.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+
+#include <kdebug.h>
+
+#include "kcmautostart.h"
+#include "kcmautostart.moc"
+
+typedef KGenericFactory<AutoStartConfig, TQWidget> AutoStartFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_autostart, AutoStartFactory( "kcmautostart" ) )
+
+AutoStartConfig::AutoStartConfig(TQWidget* parent, const char* name, const TQStringList &) :
+ TDECModule( AutoStartFactory::instance(), parent, name )
+{
+ TDEGlobal::dirs()->addResourceType("autostart", "share/autostart");
+ TDEAboutData *about =
+ new TDEAboutData( I18N_NOOP( "kcmautostart" ), I18N_NOOP( "TDE Service Manager" ),
+ 0, 0, TDEAboutData::License_GPL, I18N_NOOP( "(c) 2004 Martijn Klingens" ) );
+ about->addAuthor( "Martijn Klingens", 0, "klingens@kde.org" );
+
+#if KDE_IS_VERSION(3,2,91)
+ setAboutData( about );
+#endif
+
+ TQVBoxLayout *lay = new TQVBoxLayout( this, 0, KDialog::spacingHint() );
+
+ TQGroupBox *gb = new TQVGroupBox( i18n( "Startup Services" ), this );
+ TQWhatsThis::add(gb, i18n("This shows all KDE services that can be loaded "
+ "on KDE startup. Checked services will be invoked on next startup. "
+ "Be careful with deactivation of unknown services."));
+ lay->addWidget( gb );
+
+ _lvStartup = new TDEListView( gb );
+ _lvStartup->addColumn(i18n("Use"));
+ _lvStartup->addColumn(i18n("Service"));
+ _lvStartup->addColumn(i18n("Description"));
+ _lvStartup->setAllColumnsShowFocus(true);
+ _lvStartup->header()->setStretchEnabled(true, 2);
+
+ load();
+}
+
+void setModuleGroup(TDEConfig *config, const TQString &filename)
+{
+ TQString module = filename;
+ int i = module.findRev('/');
+ if (i != -1)
+ module = module.mid(i+1);
+ i = module.findRev('.');
+ if (i != -1)
+ module = module.left(i);
+
+ config->setGroup(TQString("Module-%1").arg(module));
+}
+
+bool AutoStartConfig::autoloadEnabled(TDEConfig *config, const TQString &filename)
+{
+ setModuleGroup(config, filename);
+ return config->readBoolEntry("autoload", true);
+}
+
+void AutoStartConfig::setAutoloadEnabled(TDEConfig *config, const TQString &filename, bool b)
+{
+ setModuleGroup(config, filename);
+ return config->writeEntry("autoload", b);
+}
+
+void AutoStartConfig::load() {
+ _lvStartup->clear();
+
+ TQStringList files = TDEGlobal::dirs()->findAllResources( "autostart", TQString::fromLatin1( "*.desktop" ), false, true );
+
+ for ( TQStringList::ConstIterator it = files.begin(); it != files.end(); it++ )
+ {
+ if ( KDesktopFile::isDesktopFile( TQFileInfo( *it ).fileName() ) )
+ {
+ KDesktopFile file( TQFileInfo( *it ).fileName(), true, "autostart" );
+ TQString name = file.readName();
+ if ( !name.isEmpty() )
+ {
+ CheckListItem *clitem = new CheckListItem( _lvStartup, TQString() );
+ connect( clitem, TQT_SIGNAL( changed( TQCheckListItem * ) ), TQT_SLOT( slotItemChecked( TQCheckListItem * ) ) );
+ clitem->setText( 1, name );
+ clitem->setText( 2, file.readComment() );
+ clitem->setText( 3, *it );
+ clitem->setOn( !file.readBoolEntry( "Hidden", false ) );
+ }
+ }
+ }
+}
+
+void AutoStartConfig::save()
+{
+ TQListViewItemIterator it( _lvStartup );
+ while ( it.current() )
+ {
+ if ( KDesktopFile::isDesktopFile( it.current()->text( 3 ) ) )
+ {
+ // Determine whether we need to change the file on a readonly desktop file
+ // by giving a full path first
+ TQString path = it.current()->text( 3 );
+ KDesktopFile file( path, true, "services" );
+ bool shouldBeHidden = !( static_cast<TQCheckListItem *>( it.current() )->isOn() );
+ if ( file.readBoolEntry( "Hidden", false ) != shouldBeHidden )
+ {
+ KDesktopFile outFile( TQFileInfo( path ).fileName(), false, "autostart" );
+ kdDebug() << "************** Writing out " << path << endl;
+ outFile.writeEntry( "Hidden", shouldBeHidden );
+ outFile.sync();
+ }
+ }
+ ++it;
+ }
+
+ //TQTimer::singleShot(0, this, TQT_SLOT(slotServiceRunningToggled()));
+}
+
+void AutoStartConfig::defaults()
+{
+ TQListViewItemIterator it( _lvStartup);
+ while ( it.current() != 0 ) {
+ if (it.current()->rtti()==1) {
+ TQCheckListItem *item = static_cast<TQCheckListItem *>(it.current());
+ item->setOn(false);
+ }
+ ++it;
+ }
+}
+
+void AutoStartConfig::slotReload()
+{
+ TQString current = _lvStartup->currentItem()->text(4);
+ load();
+ TQListViewItem *item = _lvStartup->findItem(current, 4);
+ if (item)
+ _lvStartup->setCurrentItem(item);
+}
+
+void AutoStartConfig::slotItemChecked(TQCheckListItem*)
+{
+ emit changed(true);
+}
+
+TQString AutoStartConfig::quickHelp() const
+{
+ return i18n("<h1>Service Manager</h1><p>This module allows you to have an overview of all plugins of the "
+ "KDE Daemon, also referred to as KDE Services. Generally, there are two types of service:</p>"
+ "<ul><li>Services invoked at startup</li><li>Services called on demand</li></ul>"
+ "<p>The latter are only listed for convenience. The startup services can be started and stopped. "
+ "In Administrator mode, you can also define whether services should be loaded at startup.</p>"
+ "<p><b> Use this with care: some services are vital for KDE; do not deactivate services if you"
+ " do not know what you are doing.</b></p>");
+}
+
+CheckListItem::CheckListItem(TQListView *parent, const TQString &text)
+ : TQObject(parent),
+ TQCheckListItem(parent, text, CheckBox)
+{ }
+
+void CheckListItem::stateChange(bool on)
+{
+ TQCheckListItem::stateChange(on);
+ emit changed(this);
+}
diff --git a/kiosktool/kcms/autostart/kcmautostart.desktop b/kiosktool/kcms/autostart/kcmautostart.desktop
new file mode 100644
index 0000000..599da87
--- /dev/null
+++ b/kiosktool/kcms/autostart/kcmautostart.desktop
@@ -0,0 +1,56 @@
+[Desktop Entry]
+Encoding=UTF-8
+Exec=tdecmshell kcmautostart
+Icon=autostart
+Type=Application
+
+X-TDE-ModuleType=Library
+X-TDE-Library=autostart
+X-TDE-Factoryname=autostart
+X-TDE-ParentApp=kcontrol
+
+Name=AutoStart Manager
+Name[da]=Autostarthåndtering
+Name[es]=Gestor de arranque automático
+Name[et]=Autostardi haldur
+Name[fr]=Gestion du lancement automatique
+Name[it]=Gestore di avvio automatico
+Name[nl]=Autostartbeheer
+Name[pt]=Gestor de Arranque Automático
+Name[pt_BR]=Gestor de Arranque Automático
+Name[sr]=Менаџер аутоматског покретања
+Name[sr@Latn]=Menadžer automatskog pokretanja
+Name[ta]=தானாக துவங்கும் மேலாளர்
+Name[xx]=xxAutoStart Managerxx
+Comment=AutoStart Configuration
+Comment[da]=Indstilling for autostart
+Comment[es]=Configuración de arranque automático
+Comment[et]=Autostardi seadistamine
+Comment[fr]=Configuration du lancement automatique
+Comment[it]=Configurazione dell'avvio automatico
+Comment[nl]=Autostartconfiguratie
+Comment[pt]=Configuração de Arranque Automático
+Comment[pt_BR]=Configuração de Arranque Automático
+Comment[ru]=Настройка служб
+Comment[sr]=Подешавање аутоматског покретања
+Comment[sr@Latn]=Podešavanje automatskog pokretanja
+Comment[sv]=Inställning av automatisk start
+Comment[ta]=தானாகவே துவங்கும் வடிவமைப்பு
+Comment[xx]=xxAutoStart Configurationxx
+Keywords=AutoStart,Services
+Keywords[da]=AutoStart, Tjenester
+Keywords[es]=Arranque automático,Servicios
+Keywords[et]=AutoStart,Teenused
+Keywords[fr]=Lancement automatique, Services
+Keywords[it]=Avvio automatico,Servizi
+Keywords[nl]=autoStart,services,diensten
+Keywords[pt]=Arranque Automático,Serviços
+Keywords[pt_BR]=Arranque Automático,Serviços
+Keywords[ru]=AutoStart,Services,Службы,Автозапуск
+Keywords[sr]=AutoStart,Services,аутоматско,покретање,сервиси
+Keywords[sr@Latn]=AutoStart,Services,automatsko,pokretanje,servisi
+Keywords[sv]=automatisk start,tjänster
+Keywords[ta]=தானாக துவங்கும், சேவைகள்
+Keywords[xx]=xxAutoStart,Servicesxx
+
+Categories=Qt;TDE;X-TDE-settings-components;
diff --git a/kiosktool/kcms/autostart/kcmautostart.h b/kiosktool/kcms/autostart/kcmautostart.h
new file mode 100644
index 0000000..dcfe25a
--- /dev/null
+++ b/kiosktool/kcms/autostart/kcmautostart.h
@@ -0,0 +1,68 @@
+/*
+ This file is part of the KDE project
+ Copyright (C) 2004 Martijn Klingens <klingens@kde.org>
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KCMAUTOSTART_H
+#define KCMAUTOSTART_H
+
+#include <tqlistview.h>
+#include <tdecmodule.h>
+
+class TDEListView;
+class TQStringList;
+class TQPushButton;
+
+class AutoStartConfig : public TDECModule
+{
+Q_OBJECT
+
+public:
+ AutoStartConfig(TQWidget* parent, const char* name= 0L, const TQStringList& foo = TQStringList());
+ ~AutoStartConfig() {};
+
+ void load();
+ void save();
+ void defaults();
+
+ TQString quickHelp() const;
+
+protected slots:
+ void slotReload();
+ void slotItemChecked(TQCheckListItem *item);
+
+ bool autoloadEnabled(TDEConfig *config, const TQString &filename);
+ void setAutoloadEnabled(TDEConfig *config, const TQString &filename, bool b);
+
+private:
+ TDEListView *_lvStartup;
+};
+
+class CheckListItem : public TQObject, public TQCheckListItem
+{
+ Q_OBJECT
+
+public:
+ CheckListItem(TQListView* parent, const TQString &text);
+ ~CheckListItem() { }
+signals:
+ void changed(TQCheckListItem*);
+protected:
+ virtual void stateChange(bool);
+};
+
+#endif // KCMAUTOSTART_H
+