diff options
Diffstat (limited to 'tdeioslave/media/tdecmodule')
-rw-r--r-- | tdeioslave/media/tdecmodule/CMakeLists.txt | 45 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/Makefile.am | 21 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/main.cpp | 104 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/main.h | 45 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/managermodule.cpp | 213 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/managermodule.h | 49 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/managermoduleview.ui | 343 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/media.desktop | 197 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/mimetypelistboxitem.cpp | 35 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/mimetypelistboxitem.h | 37 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/notifiermodule.cpp | 230 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/notifiermodule.h | 58 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/notifiermoduleview.ui | 171 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/serviceconfigdialog.cpp | 151 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/serviceconfigdialog.h | 48 | ||||
-rw-r--r-- | tdeioslave/media/tdecmodule/serviceview.ui | 248 |
16 files changed, 1995 insertions, 0 deletions
diff --git a/tdeioslave/media/tdecmodule/CMakeLists.txt b/tdeioslave/media/tdecmodule/CMakeLists.txt new file mode 100644 index 000000000..80128471e --- /dev/null +++ b/tdeioslave/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}/tdeioslave/media/libmediacommon + ${CMAKE_SOURCE_DIR}/tdeioslave/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 tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslave/media/tdecmodule/Makefile.am b/tdeioslave/media/tdecmodule/Makefile.am new file mode 100644 index 000000000..72f9f385c --- /dev/null +++ b/tdeioslave/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/tdeioslave/media/tdecmodule/main.cpp b/tdeioslave/media/tdecmodule/main.cpp new file mode 100644 index 000000000..9036583df --- /dev/null +++ b/tdeioslave/media/tdecmodule/main.cpp @@ -0,0 +1,104 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> + + 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 <tqtabwidget.h> +#include <tqlayout.h> + +#include <klocale.h> +#include <kaboutdata.h> +#include <kdialog.h> + +#include <kgenericfactory.h> + +#include "notifiermodule.h" +#include "managermodule.h" + + +typedef KGenericFactory<MediaModule, TQWidget> 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"), "[email protected]"); + about->addAuthor("Kevin Ottens", 0, "ervin ipsquad net"); + about->addAuthor("Valentine Sinitsyn", 0, "[email protected]"); + 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/tdeioslave/media/tdecmodule/main.h b/tdeioslave/media/tdecmodule/main.h new file mode 100644 index 000000000..5052d58eb --- /dev/null +++ b/tdeioslave/media/tdecmodule/main.h @@ -0,0 +1,45 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> + + 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 <tdecmodule.h> + +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/tdeioslave/media/tdecmodule/managermodule.cpp b/tdeioslave/media/tdecmodule/managermodule.cpp new file mode 100644 index 000000000..3a44c446e --- /dev/null +++ b/tdeioslave/media/tdecmodule/managermodule.cpp @@ -0,0 +1,213 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> + Copyright (c) 2006 Valentine Sinitsyn <[email protected]> + + 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 <config.h> + +#include "managermodule.h" + +#include <tdeconfig.h> +#include <klocale.h> +#include <dcopref.h> +#include <tqbutton.h> +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqobjectlist.h> +#include <kdirnotify_stub.h> + +#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/tdeioslave/media/tdecmodule/managermodule.h b/tdeioslave/media/tdecmodule/managermodule.h new file mode 100644 index 000000000..a0a384675 --- /dev/null +++ b/tdeioslave/media/tdecmodule/managermodule.h @@ -0,0 +1,49 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> + Copyright (c) 2006 Valentine Sinitsyn <[email protected]> + + 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 <tqmap.h> +#include <tdecmodule.h> + +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<TQObject *, int> settings; + +private slots: + void emitChanged(); +}; + +#endif diff --git a/tdeioslave/media/tdecmodule/managermoduleview.ui b/tdeioslave/media/tdecmodule/managermoduleview.ui new file mode 100644 index 000000000..afde70c75 --- /dev/null +++ b/tdeioslave/media/tdecmodule/managermoduleview.ui @@ -0,0 +1,343 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ManagerModuleView</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>ManagerModuleView</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <property name="caption"> + <string>ManagerModuleView</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_HalBackendEnabled</cstring> + </property> + <property name="text"> + <string>Enable HAL backend</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Select this if you want to enable the Hardware Abstraction Layer (http://hal.freedesktop.org/wiki/Software/hal) support.</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_CdPollingEnabled</cstring> + </property> + <property name="text"> + <string>Enable CD polling</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Select this to enable the CD polling.</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_AutostartEnabled</cstring> + </property> + <property name="text"> + <string>Enable medium application autostart after mount</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Select this if you want to enable application autostart after mounting a device.</string> + </property> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>groupbox_mount</cstring> + </property> + <property name="title"> + <string>Mount options</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>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.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout30</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox" row="1" column="0"> + <property name="name"> + <cstring>option_ro</cstring> + </property> + <property name="text"> + <string>Read only</string> + </property> + <property name="whatsThis" stdset="0"> + <string>By default, mount all file systems read-only.</string> + </property> + </widget> + <widget class="TQCheckBox" row="2" column="1"> + <property name="name"> + <cstring>option_uid</cstring> + </property> + <property name="text"> + <string>Mount as user</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Mount this file system as user.</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="1"> + <property name="name"> + <cstring>option_flush</cstring> + </property> + <property name="text"> + <string>Flushed IO</string> + </property> + <property name="tristate"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Always flush all data to the hot plug devices immediately and don't cache it.</string> + </property> + </widget> + <widget class="TQCheckBox" row="3" column="0"> + <property name="name"> + <cstring>option_sync</cstring> + </property> + <property name="text"> + <string>Synchronous</string> + </property> + <property name="tristate"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>All I/O to the file system should be done synchronously.</string> + </property> + </widget> + <widget class="TQCheckBox" row="2" column="0"> + <property name="name"> + <cstring>option_quiet</cstring> + </property> + <property name="text"> + <string>Quiet</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Attempts to chown or chmod files do not return errors, although they fail. Use with caution!</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="1"> + <property name="name"> + <cstring>option_utf8</cstring> + </property> + <property name="text"> + <string>UTF-8 charset</string> + </property> + <property name="whatsThis" stdset="0"> + <string>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.</string> + </property> + </widget> + <widget class="TQLayoutWidget" row="3" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>layout29</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>text_shortname</cstring> + </property> + <property name="text"> + <string>Short names:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>option_shortname</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string><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.</string> + </property> + </widget> + <widget class="TQComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>All Data</string> + </property> + </item> + <item> + <property name="text"> + <string>Ordered</string> + </property> + </item> + <item> + <property name="text"> + <string>Writeback</string> + </property> + </item> + <property name="name"> + <cstring>option_journaling</cstring> + </property> + <property name="currentItem"> + <number>1</number> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>text_journaling</cstring> + </property> + <property name="text"> + <string>Journaling:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>option_journaling</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string><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.</string> + </property> + </widget> + <widget class="TQComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>Lower</string> + </property> + </item> + <item> + <property name="text"> + <string>Windows 95</string> + </property> + </item> + <item> + <property name="text"> + <string>Windows NT</string> + </property> + </item> + <item> + <property name="text"> + <string>Mixed</string> + </property> + </item> + <property name="name"> + <cstring>option_shortname</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="TQCheckBox" row="0" column="0"> + <property name="name"> + <cstring>option_automount</cstring> + </property> + <property name="text"> + <string>Mount automatically</string> + </property> + <property name="whatsThis" stdset="0"> + <string>By default, mount all file systems automatically.</string> + </property> + </widget> + <widget class="TQCheckBox" row="4" column="0"> + <property name="name"> + <cstring>option_atime</cstring> + </property> + <property name="text"> + <string>Access time updates</string> + </property> + <property name="tristate"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>Update inode access time for each access.</string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>130</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <connection> + <sender>kcfg_HalBackendEnabled</sender> + <signal>toggled(bool)</signal> + <receiver>groupbox_mount</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>kcfg_HalBackendEnabled</tabstop> + <tabstop>kcfg_CdPollingEnabled</tabstop> + <tabstop>kcfg_AutostartEnabled</tabstop> + <tabstop>option_automount</tabstop> + <tabstop>option_ro</tabstop> + <tabstop>option_quiet</tabstop> + <tabstop>option_sync</tabstop> + <tabstop>option_atime</tabstop> + <tabstop>option_flush</tabstop> + <tabstop>option_utf8</tabstop> + <tabstop>option_uid</tabstop> + <tabstop>option_journaling</tabstop> + <tabstop>option_shortname</tabstop> +</tabstops> +<includes> + <include location="local" impldecl="in implementation">managermoduleview.ui.h</include> +</includes> +<functions> + <function access="private" specifier="non virtual">init()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tdeioslave/media/tdecmodule/media.desktop b/tdeioslave/media/tdecmodule/media.desktop new file mode 100644 index 000000000..d93f876f4 --- /dev/null +++ b/tdeioslave/media/tdecmodule/media.desktop @@ -0,0 +1,197 @@ +[Desktop Entry] +Type=Application +#DocPath= +Icon=system +Exec=tdecmshell 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/tdeioslave/media/tdecmodule/mimetypelistboxitem.cpp b/tdeioslave/media/tdecmodule/mimetypelistboxitem.cpp new file mode 100644 index 000000000..e7334248a --- /dev/null +++ b/tdeioslave/media/tdecmodule/mimetypelistboxitem.cpp @@ -0,0 +1,35 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> + + 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 <kmimetype.h> + +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/tdeioslave/media/tdecmodule/mimetypelistboxitem.h b/tdeioslave/media/tdecmodule/mimetypelistboxitem.h new file mode 100644 index 000000000..e02f58b11 --- /dev/null +++ b/tdeioslave/media/tdecmodule/mimetypelistboxitem.h @@ -0,0 +1,37 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> + + 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 <tqlistbox.h> +#include <tqstring.h> + +class MimetypeListBoxItem : public TQListBoxText +{ +public: + MimetypeListBoxItem(const TQString &mimetype, TQListBox *parent); + + const TQString &mimetype() const; + +private: + TQString m_mimetype; +}; + +#endif diff --git a/tdeioslave/media/tdecmodule/notifiermodule.cpp b/tdeioslave/media/tdecmodule/notifiermodule.cpp new file mode 100644 index 000000000..4146c514f --- /dev/null +++ b/tdeioslave/media/tdecmodule/notifiermodule.cpp @@ -0,0 +1,230 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> + + 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 <klocale.h> + +#include <tqlayout.h> +#include <kcombobox.h> +#include <kpushbutton.h> +#include <kstdguiitem.h> + +#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<NotifierAction*> services; + if ( m_mimetype.isEmpty() ) + { + services = m_settings.actions(); + } + else + { + services = m_settings.actionsForMimetype( m_mimetype ); + } + + TQValueList<NotifierAction*>::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<ActionListBoxItem*>(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<MimetypeListBoxItem*>( 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<ActionListBoxItem*>(m_view->actionsList->selectedItem()); + + NotifierServiceAction * action = dynamic_cast<NotifierServiceAction*>( 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<ActionListBoxItem*>(m_view->actionsList->selectedItem()); + + NotifierServiceAction *action; + action = dynamic_cast<NotifierServiceAction*>( action_item->action() ); + if ( action ) + { + m_settings.deleteAction( action ); + updateListBox(); + emit changed( true ); + } +} + +void NotifierModule::slotToggleAuto() +{ + ActionListBoxItem *action_item + = static_cast<ActionListBoxItem*>( 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/tdeioslave/media/tdecmodule/notifiermodule.h b/tdeioslave/media/tdecmodule/notifiermodule.h new file mode 100644 index 000000000..d5d97a96d --- /dev/null +++ b/tdeioslave/media/tdecmodule/notifiermodule.h @@ -0,0 +1,58 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> + + 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 <tdecmodule.h> +#include <tqlistbox.h> + +#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/tdeioslave/media/tdecmodule/notifiermoduleview.ui b/tdeioslave/media/tdecmodule/notifiermoduleview.ui new file mode 100644 index 000000000..ad508c03d --- /dev/null +++ b/tdeioslave/media/tdecmodule/notifiermoduleview.ui @@ -0,0 +1,171 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>NotifierModuleView</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>NotifierModuleView</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>mediumType</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Medium types:</string> + </property> + </widget> + <widget class="KComboBox"> + <property name="name"> + <cstring>mimetypesCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="whatsThis" stdset="0"> + <string>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".</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>addButton</cstring> + </property> + <property name="text"> + <string>&Add...</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Click here to add an action.</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>deleteButton</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Click here to delete the selected action if possible.</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>editButton</cstring> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Click here to edit the selected action if possible.</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>toggleAutoButton</cstring> + </property> + <property name="text"> + <string>&Toggle as Auto Action</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Click here to perform this action automatically on detection of the selected medium type (this option is disabled when "All Mime Types" is selected).</string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>buttonSpacer</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>70</width> + <height>101</height> + </size> + </property> + </spacer> + <widget class="KListBox" row="0" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>actionsList</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Here is the list of the available actions. You can modify them by using the buttons on your right.</string> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcombobox.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistbox.h</includehint> +</includehints> +</UI> diff --git a/tdeioslave/media/tdecmodule/serviceconfigdialog.cpp b/tdeioslave/media/tdecmodule/serviceconfigdialog.cpp new file mode 100644 index 000000000..61dd060f2 --- /dev/null +++ b/tdeioslave/media/tdecmodule/serviceconfigdialog.cpp @@ -0,0 +1,151 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> + + 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 <klocale.h> +#include <klineedit.h> +#include <kactionselector.h> +#include <kicondialog.h> +#include <tqlistbox.h> +#include <kservice.h> +#include <kopenwith.h> +#include <kpushbutton.h> +#include <kiconloader.h> +#include <tqpixmap.h> +#include <tqiconset.h> + + +#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<MimetypeListBoxItem*>( 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/tdeioslave/media/tdecmodule/serviceconfigdialog.h b/tdeioslave/media/tdecmodule/serviceconfigdialog.h new file mode 100644 index 000000000..24e907205 --- /dev/null +++ b/tdeioslave/media/tdecmodule/serviceconfigdialog.h @@ -0,0 +1,48 @@ +/* This file is part of the KDE Project + Copyright (c) 2005 Jean-Remy Falleri <[email protected]> + Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> + + 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 <kdialogbase.h> + +#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/tdeioslave/media/tdecmodule/serviceview.ui b/tdeioslave/media/tdecmodule/serviceview.ui new file mode 100644 index 000000000..a6c3063f6 --- /dev/null +++ b/tdeioslave/media/tdecmodule/serviceview.ui @@ -0,0 +1,248 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ServiceView</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>ServiceView</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>664</width> + <height>503</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>640</width> + <height>480</height> + </size> + </property> + <property name="caption"> + <string>Edit Service</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Edit Service</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KIconButton"> + <property name="name"> + <cstring>iconButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>40</width> + <height>40</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>40</width> + <height>40</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + <property name="iconSize"> + <number>32</number> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>labelEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>21</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="KActionSelector"> + <property name="name"> + <cstring>mimetypesSelector</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="availableLabel"> + <string>Available &medium types:</string> + </property> + <property name="selectedLabel"> + <string>Displa&y service for:</string> + </property> + <property name="showUpDownButtons"> + <bool>false</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel"> + <property name="name"> + <cstring>m_lbCommmand</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Command:</string> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>commandEdit</cstring> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>commandButton</cstring> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </grid> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kicondialog.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kactionselector.h</includehint> + <includehint>kactivelabel.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> |