From 1a9478c6e1b77b05814af8fa02cd563a5da8946b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 25 Jan 2013 16:23:58 -0600 Subject: Fix FTBFS resulting from KCModule rename --- kioslave/media/tdecmodule/CMakeLists.txt | 45 +++ kioslave/media/tdecmodule/Makefile.am | 21 ++ kioslave/media/tdecmodule/main.cpp | 104 +++++++ kioslave/media/tdecmodule/main.h | 45 +++ kioslave/media/tdecmodule/managermodule.cpp | 213 ++++++++++++++ kioslave/media/tdecmodule/managermodule.h | 49 ++++ kioslave/media/tdecmodule/managermoduleview.ui | 343 ++++++++++++++++++++++ kioslave/media/tdecmodule/media.desktop | 197 +++++++++++++ kioslave/media/tdecmodule/mimetypelistboxitem.cpp | 35 +++ kioslave/media/tdecmodule/mimetypelistboxitem.h | 37 +++ kioslave/media/tdecmodule/notifiermodule.cpp | 230 +++++++++++++++ kioslave/media/tdecmodule/notifiermodule.h | 58 ++++ kioslave/media/tdecmodule/notifiermoduleview.ui | 171 +++++++++++ kioslave/media/tdecmodule/serviceconfigdialog.cpp | 151 ++++++++++ kioslave/media/tdecmodule/serviceconfigdialog.h | 48 +++ kioslave/media/tdecmodule/serviceview.ui | 248 ++++++++++++++++ 16 files changed, 1995 insertions(+) create mode 100644 kioslave/media/tdecmodule/CMakeLists.txt create mode 100644 kioslave/media/tdecmodule/Makefile.am create mode 100644 kioslave/media/tdecmodule/main.cpp create mode 100644 kioslave/media/tdecmodule/main.h create mode 100644 kioslave/media/tdecmodule/managermodule.cpp create mode 100644 kioslave/media/tdecmodule/managermodule.h create mode 100644 kioslave/media/tdecmodule/managermoduleview.ui create mode 100644 kioslave/media/tdecmodule/media.desktop create mode 100644 kioslave/media/tdecmodule/mimetypelistboxitem.cpp create mode 100644 kioslave/media/tdecmodule/mimetypelistboxitem.h create mode 100644 kioslave/media/tdecmodule/notifiermodule.cpp create mode 100644 kioslave/media/tdecmodule/notifiermodule.h create mode 100644 kioslave/media/tdecmodule/notifiermoduleview.ui create mode 100644 kioslave/media/tdecmodule/serviceconfigdialog.cpp create mode 100644 kioslave/media/tdecmodule/serviceconfigdialog.h create mode 100644 kioslave/media/tdecmodule/serviceview.ui (limited to 'kioslave/media/tdecmodule') diff --git a/kioslave/media/tdecmodule/CMakeLists.txt b/kioslave/media/tdecmodule/CMakeLists.txt new file mode 100644 index 000000000..4a1dc2345 --- /dev/null +++ b/kioslave/media/tdecmodule/CMakeLists.txt @@ -0,0 +1,45 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR}/kioslave/media/libmediacommon + ${CMAKE_SOURCE_DIR}/kioslave/media/libmediacommon + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES media.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_media (module) ######################## + +set( target kcm_media ) + +set( ${target}_SRCS + notifiermodule.cpp notifiermoduleview.ui serviceconfigdialog.cpp + serviceview.ui mimetypelistboxitem.cpp managermodule.cpp + managermoduleview.ui main.cpp +) + +tde_add_kpart( ${target} AUTOMOC + SOURCES ${${target}_SRCS} + LINK mediacommon-static kio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kioslave/media/tdecmodule/Makefile.am b/kioslave/media/tdecmodule/Makefile.am new file mode 100644 index 000000000..72f9f385c --- /dev/null +++ b/kioslave/media/tdecmodule/Makefile.am @@ -0,0 +1,21 @@ +INCLUDES = -I$(srcdir)/../libmediacommon -I../libmediacommon $(all_includes) +METASOURCES = AUTO + +kde_module_LTLIBRARIES = kcm_media.la +kcm_media_la_SOURCES = notifiermodule.cpp notifiermoduleview.ui \ + serviceconfigdialog.cpp serviceview.ui \ + mimetypelistboxitem.cpp \ + managermodule.cpp managermoduleview.ui \ + main.cpp + +kcm_media_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +kcm_media_la_LIBADD = ../libmediacommon/libmediacommon.la $(LIB_KIO) + +noinst_HEADERS = notifiermodule.h managermodule.h \ + serviceconfigdialog.h mimetypelistboxitem.h \ + main.h + +xdg_apps_DATA = media.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmmedia.pot diff --git a/kioslave/media/tdecmodule/main.cpp b/kioslave/media/tdecmodule/main.cpp new file mode 100644 index 000000000..9036583df --- /dev/null +++ b/kioslave/media/tdecmodule/main.cpp @@ -0,0 +1,104 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 Kévin Ottens + + 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 "main.h" + +#include +#include + +#include +#include +#include + +#include + +#include "notifiermodule.h" +#include "managermodule.h" + + +typedef KGenericFactory MediaFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_media, MediaFactory( "kcmmedia" ) ) + + +MediaModule::MediaModule( TQWidget *parent, const char *name, const TQStringList& ) + : TDECModule(MediaFactory::instance(), parent, name ) +{ + TDEGlobal::locale()->insertCatalogue("kio_media"); + TQVBoxLayout *layout = new TQVBoxLayout( this, 0, KDialog::spacingHint() ); + TQTabWidget *tab = new TQTabWidget( this ); + + layout->addWidget( tab ); + + + + m_notifierModule = new NotifierModule( this, "notifier" ); + tab->addTab( m_notifierModule, i18n( "&Notifications" ) ); + connect( m_notifierModule, TQT_SIGNAL( changed( bool ) ), + this, TQT_SLOT( moduleChanged( bool ) ) ); + + m_managerModule = new ManagerModule( this, "manager" ); + tab->addTab( m_managerModule, i18n( "&Advanced" ) ); + connect( m_managerModule, TQT_SIGNAL( changed( bool ) ), + this, TQT_SLOT( moduleChanged( bool ) ) ); + + + + TDEAboutData * about = new TDEAboutData("kcmmedia", + I18N_NOOP("Storage Media"), + "0.6", + I18N_NOOP("Storage Media Control Panel Module"), + TDEAboutData::License_GPL_V2, + I18N_NOOP("(c) 2005 Jean-Remy Falleri")); + about->addAuthor("Jean-Remy Falleri", I18N_NOOP("Maintainer"), "jr.falleri@laposte.net"); + about->addAuthor("Kevin Ottens", 0, "ervin ipsquad net"); + about->addAuthor("Valentine Sinitsyn", 0, "e_val@inbox.ru"); + about->addCredit("Achim Bohnet", I18N_NOOP("Help for the application design")); + + setAboutData( about ); +} + +void MediaModule::load() +{ + m_notifierModule->load(); + m_managerModule->load(); +} + +void MediaModule::save() +{ + m_notifierModule->save(); + m_managerModule->save(); +} + +void MediaModule::defaults() +{ + m_notifierModule->defaults(); + m_managerModule->defaults(); +} + +void MediaModule::moduleChanged( bool state ) +{ + emit changed( state ); +} + +TQString MediaModule::quickHelp() const +{ + return i18n("FIXME : Write me..."); +} + +#include "main.moc" diff --git a/kioslave/media/tdecmodule/main.h b/kioslave/media/tdecmodule/main.h new file mode 100644 index 000000000..5052d58eb --- /dev/null +++ b/kioslave/media/tdecmodule/main.h @@ -0,0 +1,45 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 Kvin Ottens + + 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. +*/ + +#ifndef _MAIN_H_ +#define _MAIN_H_ + +#include + +class MediaModule : public TDECModule +{ + Q_OBJECT + +public: + MediaModule( TQWidget *parent, const char *name, const TQStringList& ); + + virtual void load(); + virtual void save(); + virtual void defaults(); + virtual TQString quickHelp() const; + +protected slots: + void moduleChanged( bool state ); + +private: + TDECModule *m_notifierModule; + TDECModule *m_managerModule; +}; + +#endif diff --git a/kioslave/media/tdecmodule/managermodule.cpp b/kioslave/media/tdecmodule/managermodule.cpp new file mode 100644 index 000000000..4c9859889 --- /dev/null +++ b/kioslave/media/tdecmodule/managermodule.cpp @@ -0,0 +1,213 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Kvin Ottens + Copyright (c) 2006 Valentine Sinitsyn + + 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 + +#include "managermodule.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "managermoduleview.h" +#include "mediamanagersettings.h" + +ManagerModule::ManagerModule( TQWidget* parent, const char* name ) + : TDECModule( parent, name ) +{ + view = new ManagerModuleView( this ); + + addConfig( MediaManagerSettings::self(), view ); + +#ifndef COMPILE_HALBACKEND + TQString hal_text = view->kcfg_HalBackendEnabled->text(); + hal_text += " ("+i18n("No support for HAL on this system")+")"; + view->kcfg_HalBackendEnabled->setText( hal_text ); +#endif + view->kcfg_HalBackendEnabled->setEnabled( false ); + +#ifndef COMPILE_LINUXCDPOLLING + TQString poll_text = view->kcfg_CdPollingEnabled->text(); + poll_text += " ("+i18n("No support for CD polling on this system")+")"; + view->kcfg_CdPollingEnabled->setText( poll_text ); +#endif + view->kcfg_CdPollingEnabled->setEnabled( false ); + + connect( view->option_automount, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_ro, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_quiet, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_flush, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_uid, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_utf8, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_sync, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_atime, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_shortname, SIGNAL( activated(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_journaling, SIGNAL( activated(int) ), this, SLOT( emitChanged() ) ); + + load(); +} + + +void ManagerModule::load() +{ + TDECModule::load(); + + TDEConfig config("mediamanagerrc"); + config.setGroup("DefaultOptions"); + + view->option_automount->setChecked( config.readBoolEntry("automount", false) ); + view->option_ro->setChecked( config.readBoolEntry("ro", false) ); + view->option_quiet->setChecked( config.readBoolEntry("quiet", false) ); + if (config.hasKey("flush")) + view->option_flush->setChecked( config.readBoolEntry("flush") ); + else + view->option_flush->setNoChange(); + view->option_uid->setChecked( config.readBoolEntry("uid", true) ); + view->option_utf8->setChecked( config.readBoolEntry("utf8", true) ); + if (config.hasKey("sync")) + view->option_sync->setChecked( config.readBoolEntry("sync") ); + else + view->option_sync->setNoChange(); + if (config.hasKey("atime")) + view->option_atime->setChecked( config.readBoolEntry("atime") ); + else + view->option_atime->setNoChange(); + + QString value; + + value = config.readEntry("shortname", "lower").lower(); + for (int i = 0; i < view->option_shortname->count(); i++) + if (view->option_shortname->text(i).lower() == value) view->option_shortname->setCurrentItem(i); + + value = config.readEntry("journaling", "ordered").lower(); + for (int i = 0; i < view->option_journaling->count(); i++) + if (view->option_journaling->text(i).lower() == value) view->option_journaling->setCurrentItem(i); + + rememberSettings(); +} + +void ManagerModule::save() +{ + TDECModule::save(); + + TDEConfig config("mediamanagerrc"); + config.setGroup("DefaultOptions"); + + config.writeEntry("automount", view->option_automount->isChecked()); + config.writeEntry("ro", view->option_ro->isChecked()); + config.writeEntry("quiet", view->option_quiet->isChecked()); + if (view->option_flush->state() == TQButton::NoChange) + config.deleteEntry("flush"); + else + config.writeEntry("flush", view->option_flush->isChecked()); + config.writeEntry("uid", view->option_uid->isChecked()); + config.writeEntry("utf8", view->option_utf8->isChecked()); + if (view->option_sync->state() == TQButton::NoChange) + config.deleteEntry("sync"); + else + config.writeEntry("sync", view->option_sync->isChecked()); + if (view->option_atime->state() == TQButton::NoChange) + config.deleteEntry("atime"); + else + config.writeEntry("atime", view->option_atime->isChecked()); + config.writeEntry("journaling", view->option_journaling->currentText().lower()); + config.writeEntry("shortname", view->option_shortname->currentText().lower()); + + rememberSettings(); + + //Well... reloadBackends is buggy with HAL, it seems to be linked + //to a bug in the unmaintained Qt3 DBUS binding ;-/ + //DCOPRef mediamanager( "kded", "mediamanager" ); + //DCOPReply reply = mediamanager.call( "reloadBackends" ); + + // So we use this hack instead... + DCOPRef kded( "kded", "kded" ); + kded.call( "unloadModule", "mediamanager" ); + kded.call( "loadModule", "mediamanager" ); + + KDirNotify_stub notifier( "*", "*" ); + notifier.FilesAdded( "media:/" ); +} + +void ManagerModule::defaults() +{ + TDECModule::defaults(); + + view->option_automount->setChecked(false); + view->option_ro->setChecked(false); + view->option_quiet->setChecked(false); + view->option_flush->setNoChange(); + view->option_uid->setChecked(true); + view->option_utf8->setChecked(true); + view->option_sync->setNoChange(); + view->option_atime->setNoChange(); + view->option_journaling->setCurrentItem(1); + view->option_shortname->setCurrentItem(0); +} + +void ManagerModule::rememberSettings() +{ + TQObjectList *options = view->queryList(0, "^option_"); + TQObject *current = 0; + TQObjectListIterator it(*options); + + settings.clear(); + while ( (current = it.current()) != 0 ) { + if (current->isA("TQCheckBox")) + settings[current] = ((TQCheckBox *)current)->state(); + else if (current->isA("TQComboBox")) + settings[current] = ((TQComboBox *)current)->currentItem(); + ++it; + } + delete options; + +} + +void ManagerModule::emitChanged() +{ + TQObjectList *options = view->queryList(0, "^option_"); + TQObject *current = 0; + TQObjectListIterator it(*options); + int value = -1; + bool somethingChanged = false; + + while ( (current = it.current()) != 0 ) { + if (current->isA("TQCheckBox")) + value = ((TQCheckBox *)current)->state(); + else if (current->isA("TQComboBox")) + value = ((TQComboBox *)current)->currentItem(); + + if (settings[current] != value) { + somethingChanged = true; + break; + } + + ++it; + } + delete options; + + emit changed(somethingChanged); +} + +#include "managermodule.moc" diff --git a/kioslave/media/tdecmodule/managermodule.h b/kioslave/media/tdecmodule/managermodule.h new file mode 100644 index 000000000..a0a384675 --- /dev/null +++ b/kioslave/media/tdecmodule/managermodule.h @@ -0,0 +1,49 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Kvin Ottens + Copyright (c) 2006 Valentine Sinitsyn + + 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. +*/ + +#ifndef _MANAGERMODULE_H_ +#define _MANAGERMODULE_H_ + +#include +#include + +class ManagerModuleView; + +class ManagerModule : public TDECModule +{ + Q_OBJECT + +public: + ManagerModule( TQWidget* parent = 0, const char* name = 0); + + void load(); + void save(); + void defaults(); + +private: + void rememberSettings(); + + ManagerModuleView *view; + TQMap settings; + +private slots: + void emitChanged(); +}; + +#endif diff --git a/kioslave/media/tdecmodule/managermoduleview.ui b/kioslave/media/tdecmodule/managermoduleview.ui new file mode 100644 index 000000000..afde70c75 --- /dev/null +++ b/kioslave/media/tdecmodule/managermoduleview.ui @@ -0,0 +1,343 @@ + +ManagerModuleView + + + ManagerModuleView + + + + 0 + 0 + 600 + 480 + + + + ManagerModuleView + + + + unnamed + + + + kcfg_HalBackendEnabled + + + Enable HAL backend + + + Select this if you want to enable the Hardware Abstraction Layer (http://hal.freedesktop.org/wiki/Software/hal) support. + + + + + kcfg_CdPollingEnabled + + + Enable CD polling + + + Select this to enable the CD polling. + + + + + kcfg_AutostartEnabled + + + Enable medium application autostart after mount + + + Select this if you want to enable application autostart after mounting a device. + + + + + groupbox_mount + + + Mount options + + + + unnamed + + + + textLabel3 + + + Here you can specify default mount options for your storage media. Please note that some options are not supported for certain filesystems and/or medium. You will be able to redefine all these options on per-volume basis later, using Properties dialog of the corresponding volume.<br> +Some of the options are tristate. Leave them "undefined" to let KDE choose the best value depending on your media. + + + WordBreak|AlignVCenter + + + + + layout30 + + + + unnamed + + + + option_ro + + + Read only + + + By default, mount all file systems read-only. + + + + + option_uid + + + Mount as user + + + Mount this file system as user. + + + + + option_flush + + + Flushed IO + + + true + + + Always flush all data to the hot plug devices immediately and don't cache it. + + + + + option_sync + + + Synchronous + + + true + + + All I/O to the file system should be done synchronously. + + + + + option_quiet + + + Quiet + + + Attempts to chown or chmod files do not return errors, although they fail. Use with caution! + + + + + option_utf8 + + + UTF-8 charset + + + UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the console. It can be be enabled for the filesystem with this option. + + + + + layout29 + + + + unnamed + + + + text_shortname + + + Short names: + + + option_shortname + + + <h2>Defines the behaviour for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be preferred display.</h2> + +<h3><b>Lower</b></h3> +Force the short name to lower case upon display; store a long name when the short name is not all upper case. + +<h3><b>Windows 95</b></h3> +Force the short name to upper case upon display; store a long name when the short name is not all upper case. + +<h3><b>Windows NT</b></h3> +Display the shortname as is; store a long name when the short name is not all lower case or all upper case. + +<h3><b>Mixed</b></h3> +Display the short name as is; store a long name when the short name is not all upper case. + + + + + + All Data + + + + + Ordered + + + + + Writeback + + + + option_journaling + + + 1 + + + + + text_journaling + + + Journaling: + + + option_journaling + + + <h2>Specifies the journalling mode for file data. Metadata is always journaled. </h2> + +<h3><b>All Data</b></h3> + All data is committed into the journal prior to being written into the main file system. This is the slowest variant with the highest data security. + +<h3><b>Ordered</b></h3> + All data is forced directly out to the main file system prior to its metadata being committed to the journal. + +<h3><b>Write Back</b></h3> + Data ordering is not preserved - data may be written into the main file system after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal file system integrity, however it can allow old data to appear in files after a crash and journal recovery. + + + + + + Lower + + + + + Windows 95 + + + + + Windows NT + + + + + Mixed + + + + option_shortname + + + + + + + option_automount + + + Mount automatically + + + By default, mount all file systems automatically. + + + + + option_atime + + + Access time updates + + + true + + + Update inode access time for each access. + + + + + + + + + spacer1 + + + Vertical + + + Expanding + + + + 21 + 130 + + + + + + + + kcfg_HalBackendEnabled + toggled(bool) + groupbox_mount + setEnabled(bool) + + + + kcfg_HalBackendEnabled + kcfg_CdPollingEnabled + kcfg_AutostartEnabled + option_automount + option_ro + option_quiet + option_sync + option_atime + option_flush + option_utf8 + option_uid + option_journaling + option_shortname + + + managermoduleview.ui.h + + + init() + + + diff --git a/kioslave/media/tdecmodule/media.desktop b/kioslave/media/tdecmodule/media.desktop new file mode 100644 index 000000000..4afd68cb5 --- /dev/null +++ b/kioslave/media/tdecmodule/media.desktop @@ -0,0 +1,197 @@ +[Desktop Entry] +Type=Application +#DocPath= +Icon=system +Exec=kcmshell media + + +X-TDE-Library=media +X-TDE-FactoryName=media +X-TDE-ParentApp=kcontrol + +Name=Storage Media +Name[af]=Stoor Media +Name[ar]=وسائط التخزين +Name[be]=Носьбіты +Name[bg]=Съхраняващи устройства +Name[bn]=স্টোরেজ মিডিয়া +Name[bs]=Uređaji za smještaj podataka +Name[ca]=Suports d'emmagatzematge +Name[cs]=Úložná zařízení +Name[csb]=Zôpisowné media +Name[da]=Opbevaringsmedie +Name[de]=Speichermedien +Name[el]=Συσκευές αποθήκευσης +Name[eo]=Enmemoriga Medio +Name[es]=Dispositivos de almacenamiento +Name[et]=Andmekandjad +Name[eu]=Biltegiratze-euskarria +Name[fa]=رسانۀ ذخیره‌گاه +Name[fi]=Tallennusmedia +Name[fr]=Support de stockage +Name[fy]=Opslachapparaten +Name[ga]=Meán Stórais +Name[gl]=Medios de armacenaxe +Name[he]=התקנים +Name[hi]=भंडार मीडिया +Name[hr]=Mediji za pohranjivanje +Name[hu]=Tárolóeszközök +Name[is]=Geymslumiðlar +Name[it]=Dispositivi di archiviazione +Name[ja]=記憶メディア +Name[ka]=მონაცემთა შენახვის მოწყობილობები +Name[kk]=Жинақтаушы құрылғылар +Name[km]=ឧបករណ៍​ផ្ទុក +Name[lt]=Saugojimo įrenginiai +Name[lv]=Datu nesējs +Name[mk]=Медиуми за податоци +Name[ms]=Media Storan +Name[nb]=Lagringsenheter +Name[nds]=Spiekermedien +Name[ne]=भण्डारण मिडिया +Name[nl]=Opslagapparaten +Name[nn]=Lagringsmedium +Name[pa]=ਸਟੋਰੇਜ਼ ਮੀਡਿਆ +Name[pl]=Urządzenia przechowywania danych +Name[pt]=Dispositivos de Armazenamento +Name[pt_BR]=Mídia de Armazenamento +Name[ro]=Mediu de stocare +Name[ru]=Устройства хранения данных +Name[rw]=Uburyo bwo Kubika +Name[se]=Vurkenmedia +Name[sk]=Zálohovacie médiá +Name[sl]=Nosilci za shranjevanje +Name[sr]=Складишни медијуми +Name[sr@Latn]=Skladišni medijumi +Name[sv]=Lagringsmedia +Name[ta]=சேகரிப்பு ஊடகம் +Name[tg]=Захирагоҳи маълумот +Name[th]=สื่อเก็บข้อมูล +Name[tr]=Depolama Ortamı +Name[tt]=Saqlawlı Media +Name[uk]=Пристрої зберігання інформації +Name[uz]=Saqlash uskunalari +Name[uz@cyrillic]=Сақлаш ускуналари +Name[vi]=Ổ chứa Dữ liệu +Name[wa]=Sopoirts di wårdaedje +Name[zh_CN]=存储介质 +Name[zh_TW]=儲存媒體 + +Comment=Configure Storage Media +Comment[af]=Stel Stoor Media op +Comment[ar]=إعداد وسائط التخزين +Comment[be]=Настаўленні носьбітаў +Comment[bg]=Настройване на устройствата за съхранение на информация +Comment[bn]=স্টোরেজ মিডিয়া কনফিগার করুন +Comment[bs]=Podesite prikaz uređaja +Comment[ca]=Configura els suports d'emmagatzematge +Comment[cs]=Nastavení úložných médií +Comment[csb]=Kònfigùracëjô zôpisownëch mediów +Comment[da]=Opsætning af opbevarelsesmedie +Comment[de]=Speichermedien einrichten +Comment[el]=Ρύθμιση μέσων αποθήκευσης +Comment[eo]=Agordo de enmemoriga medio +Comment[es]=Configuración de las medios de almacenamiento +Comment[et]=Salvestusandmekandjate seadistused +Comment[eu]=Konfiguratu biltegiratze-euskarria +Comment[fa]=پیکربندی رسانۀ ذخیره‌گاه +Comment[fi]=Aseta tallennusmedia +Comment[fr]=Configurer le média de stockage +Comment[fy]=Opslachmedia ynstelle +Comment[ga]=Cumraigh Meáin Stórála +Comment[gl]=Configurar Medios de Armacenaxe +Comment[he]=שינוי הגדרות מדיות אחסון +Comment[hr]=Konfiguriranje medija za pohranu +Comment[hu]=A tárolóeszközök beállítása +Comment[is]=Stillingar geymslumiðla +Comment[it]=Configura dispositivi di archiviazione +Comment[ja]=記憶メディアの設定 +Comment[ka]=შენახვის მედიის გამართვა +Comment[kk]=Жинақтаушыларды баптау +Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ឧបករណ៍​ផ្ទុក +Comment[lt]=Konfigūruoti saugojimo įrenginius +Comment[mk]=Конфигурирајте ги медиумите за податоци +Comment[nb]=Sett opp lagringsmedier +Comment[nds]=Spiekermedien instellen +Comment[ne]=भण्डारण मिडिया कन्फिगर गर्नुहोस् +Comment[nl]=Opslagmedia instellen +Comment[nn]=Set opp lagringsmedium +Comment[pa]=ਸਟੋਰੇਜ਼ ਮੀਡਿਆ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja nośników danych +Comment[pt]=Configurar os Suportes de Armazenamento +Comment[pt_BR]=Configura as mídias de armazenamento +Comment[ro]=Configurează mediile de stocare +Comment[ru]=Настройка подключаемых устройств хранения +Comment[se]=Heivet vurkenmediaid +Comment[sk]=Nastavenie zálohovacích médií +Comment[sl]=Nastavitve nosilcev za shranjevanje +Comment[sr]=Подешавање медијума за складиштење +Comment[sr@Latn]=Podešavanje medijuma za skladištenje +Comment[sv]=Anpassa lagringsmedia +Comment[th]=ตั้งค่าสื่อบันทึก +Comment[tr]=Depolama Aygıtlarını Yapılandır +Comment[tt]=Saqlaw Cıhazların Caylaw +Comment[uk]=Налаштування пристроїв зберігання інформації +Comment[uz]=Saqlash uskunalarni moslash +Comment[uz@cyrillic]=Сақлаш ускуналарни мослаш +Comment[vi]=Cấu hình Ổ lưu trữ Dữ liệu +Comment[wa]=Apontiaedjes sopoirts di wårdaedje +Comment[zh_CN]=配置存储介质 +Comment[zh_TW]=設定儲存媒體 + +Keywords=storage,media,usb,cdrom,device +Keywords[ar]=تخزين,وسائط,usb,قرص مدمج cdrom,جهاز +Keywords[be]=Носьбіт,Прылада,storage,media,usb,cdrom,device +Keywords[bg]=съхранение, информация, компактдиск, устройство, данни, storage, media, usb, cdrom, device +Keywords[bs]=storage,media,usb,cdrom,device,uređaji,mediji +Keywords[ca]=emmagatzematge,suport,usb,cdrom,dispositiu +Keywords[cs]=úložiště,média,USB,CDROM,zařízení +Keywords[csb]=pòdôwczi,trzëmanié pòdôwków,zôpisowné media,usb,cdrom,ùrządzenié,nëk +Keywords[da]=opbevaring,medie,usb,cdrom,enhed +Keywords[de]=Speicher,Medien,Medium,USB,CD-Rom,cdrom,Gerät +Keywords[el]=αποθήκευση,μέσο,usb,cdrom,συσκευή +Keywords[eo]=memorigilo,medio,usb,lumdisko,aparato +Keywords[es]=almacenamiento,medios,usb,cdrom,dispositivo +Keywords[et]=salvestamine,andmekandja,usb,cd,seade +Keywords[eu]=biltegiratzea,euskarriak,usb,cdrom,gailua +Keywords[fa]=ذخیره‌گاه، رسانه، گذرگاه سریال جهانی، دیسک فشرده، دستگاه +Keywords[fi]=varasto,media,usb,cdrom,laite +Keywords[fr]=stockage,media,média,medium,usb,cdrom,périphérique +Keywords[fy]=storage,opslach,media,usb,cd-rom,kompakt-skiif,device,apparaat,mp3-speler,usb-stick,geheugenkaart +Keywords[ga]=stóráil,stóras,meáin,meán,usb,cdrom,dlúthdhiosca,gléas +Keywords[gl]=armacenaxe,medios,usb,cdrom,dispositivo +Keywords[he]=storage,media,usb,cdrom,device,מדיה,התקן,סידירום,תקליטור +Keywords[hr]=storage,media,usb,cdrom,device,pohrana,snimanje,mediji,uređaj +Keywords[hu]=tároló,adathordozó,USB,CD-ROM,eszköz +Keywords[is]=geymsla,miðill,usb,cdrom,tæki +Keywords[it]=storage,media,usb,cdrom,dispositivi,dvd,penna usb,memory stick,stick +Keywords[ja]=記憶,メディア,usb,cdrom,デバイス +Keywords[km]=ឧបករណ៍​ផ្ទុក, usb,ស៊ីឌីរ៉ូម,ឧបករណ៍ +Keywords[lt]=storage,media,usb,cdrom,device,saugojimas,media,įrenginiai,usb +Keywords[mk]=storage,media,usb,cdrom,device,медиуми,усб,цдром,уред +Keywords[nb]=lagring,media,usb,CD-spiller,CD-ROM,enheter,minnepinner,harddisker,HD,eksterne harddisker,zip-disker +Keywords[nds]=Spieker,Medien,USB,CDROM,Reedschap +Keywords[ne]=भण्डारण, मिडिया,usb,cdrom, यन्त्र +Keywords[nl]=storage,opslag,media,usb,cd-rom,device,apparaat,mp3-speler,usb-stick,geheugenkaart +Keywords[nn]=lagring,media,usb,CD-spiller,CD-ROM,einingar,minnepinnar,harddiskar,HD,eksterne harddiskar,zip-diskar +Keywords[pa]=ਸਟੋਰੇਜ਼,ਮੀਡਿਆ,ਜੰਤਰ,usb,cdrom +Keywords[pl]=dane,przechowywanie danych,nośnik danych,nośniki danych,usb,cdrom,urządzenie +Keywords[pt]=armazenamento,discos,usb,cdrom,dispositivo +Keywords[pt_BR]=armazenamento,mídia,usb,cd-rom,device,dispositivo +Keywords[ro]=stocare,mediu,usb,cdrom,dispozitiv +Keywords[ru]=storage,media,usb,cdrom,device,устройство хранения +Keywords[sl]=shranjevanje,nosilec,usb,cdrom,naprava +Keywords[sr]=storage,media,usb,cdrom,device,складиштење,медијум,уређај +Keywords[sr@Latn]=storage,media,usb,cdrom,device,skladištenje,medijum,uređaj +Keywords[sv]=lagring,media,usb,cdrom,enhet +Keywords[th]=ที่เก็บข้อมูล,สื่อ,ยูเอสบี,,ซีดีรอม,อุปกรณ์ +Keywords[tr]=depolama,ortam,usb,cdrom,device +Keywords[uk]=зберігання,носій,медіа,usb,cdrom,пристрій +Keywords[uz]=saqlash uskunasi,usb,cdrom,kompakt-disk +Keywords[uz@cyrillic]=сақлаш ускунаси,usb,cdrom,компакт-диск +Keywords[vi]=lưu trữ,ổ,usb,cdrom,thiết bị +Keywords[wa]=wårdaedje,media,usb,cdrom,device,éndjin +Keywords[zh_CN]=storage,media,usb,cdrom,device,存储,介质,设备 +Keywords[zh_TW]=storage,media,usb,cdrom,device,儲存,媒體,光碟機,裝置 + +Categories=Qt;TDE;X-TDE-settings-peripherals; diff --git a/kioslave/media/tdecmodule/mimetypelistboxitem.cpp b/kioslave/media/tdecmodule/mimetypelistboxitem.cpp new file mode 100644 index 000000000..e7334248a --- /dev/null +++ b/kioslave/media/tdecmodule/mimetypelistboxitem.cpp @@ -0,0 +1,35 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 Kévin Ottens + + 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 "mimetypelistboxitem.h" + +#include + +MimetypeListBoxItem::MimetypeListBoxItem(const TQString &mimetype, TQListBox *parent) + : TQListBoxText(parent), m_mimetype(mimetype) +{ + KMimeType::Ptr mime = KMimeType::mimeType( mimetype ); + setText( mime->comment() ); +} + +const TQString &MimetypeListBoxItem::mimetype() const +{ + return m_mimetype; +} + diff --git a/kioslave/media/tdecmodule/mimetypelistboxitem.h b/kioslave/media/tdecmodule/mimetypelistboxitem.h new file mode 100644 index 000000000..e02f58b11 --- /dev/null +++ b/kioslave/media/tdecmodule/mimetypelistboxitem.h @@ -0,0 +1,37 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 K�vin Ottens + + 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. +*/ + +#ifndef _MIMETYPELISTBOXITEM_H_ +#define _MIMETYPELISTBOXITEM_H_ + +#include +#include + +class MimetypeListBoxItem : public TQListBoxText +{ +public: + MimetypeListBoxItem(const TQString &mimetype, TQListBox *parent); + + const TQString &mimetype() const; + +private: + TQString m_mimetype; +}; + +#endif diff --git a/kioslave/media/tdecmodule/notifiermodule.cpp b/kioslave/media/tdecmodule/notifiermodule.cpp new file mode 100644 index 000000000..4146c514f --- /dev/null +++ b/kioslave/media/tdecmodule/notifiermodule.cpp @@ -0,0 +1,230 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 Kévin Ottens + + 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 "notifiermodule.h" + +#include + +#include +#include +#include +#include + +#include "notifiersettings.h" +#include "serviceconfigdialog.h" +#include "actionlistboxitem.h" +#include "mimetypelistboxitem.h" + +NotifierModule::NotifierModule(TQWidget *parent, const char *name) + : TDECModule(parent, name) +{ + TQBoxLayout *layout = new TQVBoxLayout( this, 0, KDialog::spacingHint() ); + + m_view = new NotifierModuleView( this ); + layout->addWidget( m_view ); + + m_view->addButton->setGuiItem( KStdGuiItem::add() ); + m_view->editButton->setGuiItem( KStdGuiItem::properties() ); + m_view->deleteButton->setGuiItem( KStdGuiItem::del() ); + + m_view->mimetypesCombo->insertItem( i18n("All Mime Types") ); + + TQStringList mimetypes = m_settings.supportedMimetypes(); + + TQStringList::iterator it = mimetypes.begin(); + TQStringList::iterator end = mimetypes.end(); + + for ( ; it!=end; ++it ) + { + new MimetypeListBoxItem( *it, m_view->mimetypesCombo->listBox() ); + } + + updateListBox(); + + connect( m_view->mimetypesCombo, TQT_SIGNAL( activated(int) ), + this, TQT_SLOT( slotMimeTypeChanged(int) ) ); + connect( m_view->actionsList, TQT_SIGNAL( selectionChanged(TQListBoxItem*) ), + this, TQT_SLOT( slotActionSelected(TQListBoxItem*) ) ); + connect( m_view->addButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotAdd() ) ); + connect( m_view->editButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotEdit() ) ); + connect( m_view->deleteButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotDelete() ) ); + connect( m_view->toggleAutoButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotToggleAuto() ) ); +} + +NotifierModule::~NotifierModule() +{ +} + +void NotifierModule::load() +{ + m_settings.reload(); + slotMimeTypeChanged( m_view->mimetypesCombo->currentItem() ); +} + +void NotifierModule::save() +{ + m_settings.save(); +} + +void NotifierModule::defaults() +{ + m_settings.clearAutoActions(); + slotMimeTypeChanged( m_view->mimetypesCombo->currentItem() ); +} + +void NotifierModule::updateListBox() +{ + m_view->actionsList->clear(); + slotActionSelected( 0L ); + + TQValueList services; + if ( m_mimetype.isEmpty() ) + { + services = m_settings.actions(); + } + else + { + services = m_settings.actionsForMimetype( m_mimetype ); + } + + TQValueList::iterator it; + + for ( it = services.begin(); it != services.end(); ++it ) + { + new ActionListBoxItem( *it, m_mimetype, m_view->actionsList ); + } +} + +void NotifierModule::slotActionSelected(TQListBoxItem *item) +{ + NotifierAction *action = 0L; + + if ( item!=0L ) + { + ActionListBoxItem *action_item + = static_cast(item); + action = action_item->action(); + } + + bool isWritable = action!=0L && action->isWritable(); + m_view->deleteButton->setEnabled( isWritable ); + m_view->editButton->setEnabled( isWritable ); + m_view->addButton->setEnabled( TRUE ); + m_view->toggleAutoButton->setEnabled( action!=0L && !m_mimetype.isEmpty() ); +} + +void NotifierModule::slotMimeTypeChanged(int index) +{ + if ( index == 0 ) + { + m_mimetype = TQString(); + } + else + { + TQListBoxItem *item = m_view->mimetypesCombo->listBox()->item( index ); + MimetypeListBoxItem *mime_item + = static_cast( item ); + m_mimetype = mime_item->mimetype(); + } + + updateListBox(); +} + +void NotifierModule::slotAdd() +{ + NotifierServiceAction *action = new NotifierServiceAction(); + ServiceConfigDialog dialog(action, m_settings.supportedMimetypes(), this); + + int value = dialog.exec(); + + if ( value == TQDialog::Accepted ) + { + m_settings.addAction( action ); + updateListBox(); + emit changed( true ); + } + else + { + delete action; + } +} + +void NotifierModule::slotEdit() +{ + ActionListBoxItem *action_item + = static_cast(m_view->actionsList->selectedItem()); + + NotifierServiceAction * action = dynamic_cast( action_item->action() ); + if ( action ) + { + ServiceConfigDialog dialog(action, m_settings.supportedMimetypes(), this); + + int value = dialog.exec(); + + if ( value == TQDialog::Accepted ) + { + updateListBox(); + emit changed( true ); + } + } +} + +void NotifierModule::slotDelete() +{ + ActionListBoxItem *action_item + = static_cast(m_view->actionsList->selectedItem()); + + NotifierServiceAction *action; + action = dynamic_cast( action_item->action() ); + if ( action ) + { + m_settings.deleteAction( action ); + updateListBox(); + emit changed( true ); + } +} + +void NotifierModule::slotToggleAuto() +{ + ActionListBoxItem *action_item + = static_cast( m_view->actionsList->selectedItem() ); + NotifierAction *action = action_item->action(); + + int index = m_view->actionsList->index( action_item ); + + if ( action->autoMimetypes().contains( m_mimetype ) ) + { + m_settings.resetAutoAction( m_mimetype ); + } + else + { + m_settings.setAutoAction( m_mimetype, action ); + } + + updateListBox(); + emit changed( true ); + + m_view->actionsList->setSelected( index, true ); +} + +#include "notifiermodule.moc" diff --git a/kioslave/media/tdecmodule/notifiermodule.h b/kioslave/media/tdecmodule/notifiermodule.h new file mode 100644 index 000000000..d5d97a96d --- /dev/null +++ b/kioslave/media/tdecmodule/notifiermodule.h @@ -0,0 +1,58 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 K�vin Ottens + + 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. +*/ + +#ifndef _NOTIFIERMODULE_H_ +#define _NOTIFIERMODULE_H_ + +#include +#include + +#include "notifiersettings.h" +#include "notifiermoduleview.h" + +class NotifierModule : public TDECModule +{ + Q_OBJECT + +public: + NotifierModule( TQWidget* parent = 0, const char* name = 0); + ~NotifierModule(); + + void load(); + void save(); + void defaults(); + +private slots: + void slotAdd(); + void slotDelete(); + void slotEdit(); + void slotToggleAuto(); + + void slotActionSelected( TQListBoxItem * item ); + void slotMimeTypeChanged( int index ); + +private: + void updateListBox(); + + TQString m_mimetype; + NotifierSettings m_settings; + NotifierModuleView *m_view; +}; + +#endif diff --git a/kioslave/media/tdecmodule/notifiermoduleview.ui b/kioslave/media/tdecmodule/notifiermoduleview.ui new file mode 100644 index 000000000..ad508c03d --- /dev/null +++ b/kioslave/media/tdecmodule/notifiermoduleview.ui @@ -0,0 +1,171 @@ + +NotifierModuleView + + + NotifierModuleView + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + layout4 + + + + unnamed + + + + layout2 + + + + unnamed + + + + mediumType + + + + 5 + 5 + 0 + 0 + + + + Medium types: + + + + + mimetypesCombo + + + + 3 + 0 + 0 + 0 + + + + Here is the list of the available types of medium which can be monitored. You can filter the available actions by selecting a type of medium. If you want to see all the actions, select "All Mime Types". + + + + + + + layout3 + + + + unnamed + + + + layout1 + + + + unnamed + + + + addButton + + + &Add... + + + Click here to add an action. + + + + + deleteButton + + + &Delete + + + Click here to delete the selected action if possible. + + + + + editButton + + + &Edit... + + + Click here to edit the selected action if possible. + + + + + toggleAutoButton + + + &Toggle as Auto Action + + + Click here to perform this action automatically on detection of the selected medium type (this option is disabled when "All Mime Types" is selected). + + + + + + + buttonSpacer + + + Vertical + + + Expanding + + + + 70 + 101 + + + + + + actionsList + + + Here is the list of the available actions. You can modify them by using the buttons on your right. + + + + + + + + + + + kcombobox.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + klistbox.h + + diff --git a/kioslave/media/tdecmodule/serviceconfigdialog.cpp b/kioslave/media/tdecmodule/serviceconfigdialog.cpp new file mode 100644 index 000000000..61dd060f2 --- /dev/null +++ b/kioslave/media/tdecmodule/serviceconfigdialog.cpp @@ -0,0 +1,151 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 Kévin Ottens + + 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 "serviceconfigdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "mimetypelistboxitem.h" + +ServiceConfigDialog::ServiceConfigDialog(NotifierServiceAction *action, + const TQStringList &mimetypesList, + TQWidget* parent, const char* name) + : KDialogBase(parent, name, true, i18n("Edit Service"), Ok|Cancel, Ok, true), + m_action(action) +{ + m_view = new ServiceView(this); + + m_view->iconButton->setIcon( m_action->iconName() ); + m_view->labelEdit->setText( m_action->label() ); + m_view->commandEdit->setText( m_action->service().m_strExec ); + + TQIconSet iconSet = SmallIconSet("configure"); + TQPixmap pixMap = iconSet.pixmap( TQIconSet::Small, TQIconSet::Normal ); + m_view->commandButton->setIconSet( iconSet ); + m_view->commandButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); + + m_iconChanged = false; + + TQStringList all_mimetypes = mimetypesList; + TQStringList action_mimetypes = action->mimetypes(); + + TQStringList::iterator it = all_mimetypes.begin(); + TQStringList::iterator end = all_mimetypes.end(); + + for ( ; it!=end; ++it ) + { + TQListBox *list; + + if ( action_mimetypes.contains( *it ) ) + { + list = m_view->mimetypesSelector->selectedListBox(); + } + else + { + list = m_view->mimetypesSelector->availableListBox(); + } + + new MimetypeListBoxItem( *it, list ); + } + + setMainWidget(m_view); + setCaption( m_action->label() ); + + connect( m_view->iconButton, TQT_SIGNAL( iconChanged(TQString) ), + this, TQT_SLOT( slotIconChanged() ) ); + connect( m_view->commandButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotCommand() ) ); +} + +bool operator==( KDEDesktopMimeType::Service s1, KDEDesktopMimeType::Service s2 ) +{ + return ( s1.m_strName==s2.m_strName ) + && ( s1.m_strIcon==s2.m_strIcon ) + && ( s1.m_strExec==s2.m_strExec ); +} + +bool operator!=( KDEDesktopMimeType::Service s1, KDEDesktopMimeType::Service s2 ) +{ + return !( s1==s2 ); +} + +void ServiceConfigDialog::slotOk() +{ + KDEDesktopMimeType::Service service; + service.m_strName = m_view->labelEdit->text(); + service.m_strIcon = m_view->iconButton->icon(); + service.m_strExec = m_view->commandEdit->text(); + + TQStringList mimetypes; + + uint list_count = m_view->mimetypesSelector->selectedListBox()->count(); + for( uint i=0; i < list_count; ++i ) + { + TQListBoxItem *item = m_view->mimetypesSelector->selectedListBox()->item(i); + MimetypeListBoxItem *mime_item = static_cast( item ); + mimetypes.append( mime_item->mimetype() ); + } + + if ( service!=m_action->service() || mimetypes!=m_action->mimetypes() ) + { + m_action->setService( service ); + m_action->setMimetypes( mimetypes ); + accept(); + } + else + { + reject(); + } +} + +void ServiceConfigDialog::slotIconChanged() +{ + m_iconChanged = true; +} + +void ServiceConfigDialog::slotCommand() +{ + KOpenWithDlg d(this); + int value = d.exec(); + if ( value == TQDialog::Accepted ) + { + KService::Ptr service = d.service(); + if ( service != 0L ) + { + m_view->commandEdit->setText( service->exec() ); + if ( m_iconChanged == false ) + { + m_view->iconButton->setIcon( service->icon() ); + } + } + } +} + +#include "serviceconfigdialog.moc" diff --git a/kioslave/media/tdecmodule/serviceconfigdialog.h b/kioslave/media/tdecmodule/serviceconfigdialog.h new file mode 100644 index 000000000..24e907205 --- /dev/null +++ b/kioslave/media/tdecmodule/serviceconfigdialog.h @@ -0,0 +1,48 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri + Copyright (c) 2005 Kvin Ottens + + 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. +*/ + +#ifndef _SERVICECONFIGDIALOG_H_ +#define _SERVICECONFIGDIALOG_H_ + +#include + +#include "notifierserviceaction.h" +#include "serviceview.h" + +class ServiceConfigDialog : public KDialogBase +{ + Q_OBJECT + +public: + ServiceConfigDialog(NotifierServiceAction *action, + const TQStringList &mimetypesList, + TQWidget* parent = 0, const char* name = 0); + +public slots: + void slotOk(); + void slotIconChanged(); + void slotCommand(); + +private: + ServiceView *m_view; + NotifierServiceAction *m_action; + bool m_iconChanged; +}; + +#endif diff --git a/kioslave/media/tdecmodule/serviceview.ui b/kioslave/media/tdecmodule/serviceview.ui new file mode 100644 index 000000000..a6c3063f6 --- /dev/null +++ b/kioslave/media/tdecmodule/serviceview.ui @@ -0,0 +1,248 @@ + +ServiceView + + + ServiceView + + + + 0 + 0 + 664 + 503 + + + + + 3 + 3 + 0 + 0 + + + + + 640 + 480 + + + + Edit Service + + + + unnamed + + + + groupBox1 + + + + 7 + 7 + 0 + 0 + + + + Edit Service + + + + unnamed + + + + layout8 + + + + unnamed + + + + layout6 + + + + unnamed + + + + iconButton + + + + 0 + 0 + 0 + 0 + + + + + 40 + 40 + + + + + 40 + 40 + + + + + + + 32 + + + + + layout5 + + + + unnamed + + + + spacer4 + + + Vertical + + + Minimum + + + + 20 + 20 + + + + + + labelEdit + + + + 7 + 0 + 0 + 0 + + + + + + spacer5 + + + Vertical + + + Minimum + + + + 20 + 21 + + + + + + + + + + line1 + + + HLine + + + Sunken + + + Horizontal + + + + + mimetypesSelector + + + + 5 + 5 + 0 + 0 + + + + Available &medium types: + + + Displa&y service for: + + + false + + + + + layout7 + + + + unnamed + + + + m_lbCommmand + + + + 1 + 1 + 0 + 0 + + + + Command: + + + + + commandEdit + + + + + commandButton + + + + + + + + + + + + + kicondialog.h + klineedit.h + kactionselector.h + kactivelabel.h + klineedit.h + kpushbutton.h + + -- cgit v1.2.3