From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kioslave/media/kcmodule/Makefile.am | 21 ++ kioslave/media/kcmodule/main.cpp | 103 ++++++++++ kioslave/media/kcmodule/main.h | 45 +++++ kioslave/media/kcmodule/managermodule.cpp | 74 +++++++ kioslave/media/kcmodule/managermodule.h | 34 ++++ kioslave/media/kcmodule/managermoduleview.ui | 72 +++++++ kioslave/media/kcmodule/media.desktop | 197 +++++++++++++++++++ kioslave/media/kcmodule/mimetypelistboxitem.cpp | 35 ++++ kioslave/media/kcmodule/mimetypelistboxitem.h | 37 ++++ kioslave/media/kcmodule/notifiermodule.cpp | 230 ++++++++++++++++++++++ kioslave/media/kcmodule/notifiermodule.h | 57 ++++++ kioslave/media/kcmodule/notifiermoduleview.ui | 171 ++++++++++++++++ kioslave/media/kcmodule/serviceconfigdialog.cpp | 151 +++++++++++++++ kioslave/media/kcmodule/serviceconfigdialog.h | 48 +++++ kioslave/media/kcmodule/serviceview.ui | 248 ++++++++++++++++++++++++ 15 files changed, 1523 insertions(+) create mode 100644 kioslave/media/kcmodule/Makefile.am create mode 100644 kioslave/media/kcmodule/main.cpp create mode 100644 kioslave/media/kcmodule/main.h create mode 100644 kioslave/media/kcmodule/managermodule.cpp create mode 100644 kioslave/media/kcmodule/managermodule.h create mode 100644 kioslave/media/kcmodule/managermoduleview.ui create mode 100644 kioslave/media/kcmodule/media.desktop create mode 100644 kioslave/media/kcmodule/mimetypelistboxitem.cpp create mode 100644 kioslave/media/kcmodule/mimetypelistboxitem.h create mode 100644 kioslave/media/kcmodule/notifiermodule.cpp create mode 100644 kioslave/media/kcmodule/notifiermodule.h create mode 100644 kioslave/media/kcmodule/notifiermoduleview.ui create mode 100644 kioslave/media/kcmodule/serviceconfigdialog.cpp create mode 100644 kioslave/media/kcmodule/serviceconfigdialog.h create mode 100644 kioslave/media/kcmodule/serviceview.ui (limited to 'kioslave/media/kcmodule') diff --git a/kioslave/media/kcmodule/Makefile.am b/kioslave/media/kcmodule/Makefile.am new file mode 100644 index 000000000..72f9f385c --- /dev/null +++ b/kioslave/media/kcmodule/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/kcmodule/main.cpp b/kioslave/media/kcmodule/main.cpp new file mode 100644 index 000000000..e431e95f8 --- /dev/null +++ b/kioslave/media/kcmodule/main.cpp @@ -0,0 +1,103 @@ +/* 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( QWidget *parent, const char *name, const QStringList& ) + : KCModule(MediaFactory::instance(), parent, name ) +{ + KGlobal::locale()->insertCatalogue("kio_media"); + QVBoxLayout *layout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); + QTabWidget *tab = new QTabWidget( this ); + + layout->addWidget( tab ); + + + + m_notifierModule = new NotifierModule( this, "notifier" ); + tab->addTab( m_notifierModule, i18n( "&Notifications" ) ); + connect( m_notifierModule, SIGNAL( changed( bool ) ), + this, SLOT( moduleChanged( bool ) ) ); + + m_managerModule = new ManagerModule( this, "manager" ); + tab->addTab( m_managerModule, i18n( "&Advanced" ) ); + connect( m_managerModule, SIGNAL( changed( bool ) ), + this, SLOT( moduleChanged( bool ) ) ); + + + + KAboutData * about = new KAboutData("kcmmedia", + I18N_NOOP("Storage Media"), + "0.6", + I18N_NOOP("Storage Media Control Panel Module"), + KAboutData::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->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 ); +} + +QString MediaModule::quickHelp() const +{ + return i18n("FIXME : Write me..."); +} + +#include "main.moc" diff --git a/kioslave/media/kcmodule/main.h b/kioslave/media/kcmodule/main.h new file mode 100644 index 000000000..1ab909527 --- /dev/null +++ b/kioslave/media/kcmodule/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 KCModule +{ + Q_OBJECT + +public: + MediaModule( QWidget *parent, const char *name, const QStringList& ); + + virtual void load(); + virtual void save(); + virtual void defaults(); + virtual QString quickHelp() const; + +protected slots: + void moduleChanged( bool state ); + +private: + KCModule *m_notifierModule; + KCModule *m_managerModule; +}; + +#endif diff --git a/kioslave/media/kcmodule/managermodule.cpp b/kioslave/media/kcmodule/managermodule.cpp new file mode 100644 index 000000000..e5f493d27 --- /dev/null +++ b/kioslave/media/kcmodule/managermodule.cpp @@ -0,0 +1,74 @@ +/* This file is part of the KDE Project + 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. +*/ + +#include + +#include "managermodule.h" + +#include +#include +#include +#include + +#include "managermoduleview.h" +#include "mediamanagersettings.h" + +ManagerModule::ManagerModule( QWidget* parent, const char* name ) + : KCModule( parent, name ) +{ + ManagerModuleView *view = new ManagerModuleView( this ); + + addConfig( MediaManagerSettings::self(), view ); + +#ifndef COMPILE_HALBACKEND + QString 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 + QString 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 ); + + load(); +} + +void ManagerModule::save() +{ + KCModule::save(); + + //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:/" ); +} + + +#include "managermodule.moc" diff --git a/kioslave/media/kcmodule/managermodule.h b/kioslave/media/kcmodule/managermodule.h new file mode 100644 index 000000000..7fa3d649a --- /dev/null +++ b/kioslave/media/kcmodule/managermodule.h @@ -0,0 +1,34 @@ +/* This file is part of the KDE Project + 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 _MANAGERMODULE_H_ +#define _MANAGERMODULE_H_ + +#include + +class ManagerModule : public KCModule +{ + Q_OBJECT + +public: + ManagerModule( QWidget* parent = 0, const char* name = 0); + + void save(); +}; + +#endif diff --git a/kioslave/media/kcmodule/managermoduleview.ui b/kioslave/media/kcmodule/managermoduleview.ui new file mode 100644 index 000000000..598718389 --- /dev/null +++ b/kioslave/media/kcmodule/managermoduleview.ui @@ -0,0 +1,72 @@ + +ManagerModuleView + + + ManagerModuleView + + + + 0 + 0 + 600 + 480 + + + + + 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. + + + + + spacer1 + + + Vertical + + + Expanding + + + + 21 + 360 + + + + + + + diff --git a/kioslave/media/kcmodule/media.desktop b/kioslave/media/kcmodule/media.desktop new file mode 100644 index 000000000..c49945253 --- /dev/null +++ b/kioslave/media/kcmodule/media.desktop @@ -0,0 +1,197 @@ +[Desktop Entry] +Type=Application +#DocPath= +Icon=system +Exec=kcmshell media + + +X-KDE-Library=media +X-KDE-FactoryName=media +X-KDE-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;KDE;X-KDE-settings-peripherals; diff --git a/kioslave/media/kcmodule/mimetypelistboxitem.cpp b/kioslave/media/kcmodule/mimetypelistboxitem.cpp new file mode 100644 index 000000000..86460ed88 --- /dev/null +++ b/kioslave/media/kcmodule/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 QString &mimetype, QListBox *parent) + : QListBoxText(parent), m_mimetype(mimetype) +{ + KMimeType::Ptr mime = KMimeType::mimeType( mimetype ); + setText( mime->comment() ); +} + +const QString &MimetypeListBoxItem::mimetype() const +{ + return m_mimetype; +} + diff --git a/kioslave/media/kcmodule/mimetypelistboxitem.h b/kioslave/media/kcmodule/mimetypelistboxitem.h new file mode 100644 index 000000000..fee215ecf --- /dev/null +++ b/kioslave/media/kcmodule/mimetypelistboxitem.h @@ -0,0 +1,37 @@ +/* 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 _MIMETYPELISTBOXITEM_H_ +#define _MIMETYPELISTBOXITEM_H_ + +#include +#include + +class MimetypeListBoxItem : public QListBoxText +{ +public: + MimetypeListBoxItem(const QString &mimetype, QListBox *parent); + + const QString &mimetype() const; + +private: + QString m_mimetype; +}; + +#endif diff --git a/kioslave/media/kcmodule/notifiermodule.cpp b/kioslave/media/kcmodule/notifiermodule.cpp new file mode 100644 index 000000000..015d7396a --- /dev/null +++ b/kioslave/media/kcmodule/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(QWidget *parent, const char *name) + : KCModule(parent, name) +{ + QBoxLayout *layout = new QVBoxLayout( 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") ); + + QStringList mimetypes = m_settings.supportedMimetypes(); + + QStringList::iterator it = mimetypes.begin(); + QStringList::iterator end = mimetypes.end(); + + for ( ; it!=end; ++it ) + { + new MimetypeListBoxItem( *it, m_view->mimetypesCombo->listBox() ); + } + + updateListBox(); + + connect( m_view->mimetypesCombo, SIGNAL( activated(int) ), + this, SLOT( slotMimeTypeChanged(int) ) ); + connect( m_view->actionsList, SIGNAL( selectionChanged(QListBoxItem*) ), + this, SLOT( slotActionSelected(QListBoxItem*) ) ); + connect( m_view->addButton, SIGNAL( clicked() ), + this, SLOT( slotAdd() ) ); + connect( m_view->editButton, SIGNAL( clicked() ), + this, SLOT( slotEdit() ) ); + connect( m_view->deleteButton, SIGNAL( clicked() ), + this, SLOT( slotDelete() ) ); + connect( m_view->toggleAutoButton, SIGNAL( clicked() ), + this, 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 ); + + QValueList services; + if ( m_mimetype.isEmpty() ) + { + services = m_settings.actions(); + } + else + { + services = m_settings.actionsForMimetype( m_mimetype ); + } + + QValueList::iterator it; + + for ( it = services.begin(); it != services.end(); ++it ) + { + new ActionListBoxItem( *it, m_mimetype, m_view->actionsList ); + } +} + +void NotifierModule::slotActionSelected(QListBoxItem *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 = QString(); + } + else + { + QListBoxItem *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 == QDialog::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 == QDialog::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/kcmodule/notifiermodule.h b/kioslave/media/kcmodule/notifiermodule.h new file mode 100644 index 000000000..6c71df51f --- /dev/null +++ b/kioslave/media/kcmodule/notifiermodule.h @@ -0,0 +1,57 @@ +/* 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 _NOTIFIERMODULE_H_ +#define _NOTIFIERMODULE_H_ + +#include + +#include "notifiersettings.h" +#include "notifiermoduleview.h" + +class NotifierModule : public KCModule +{ + Q_OBJECT + +public: + NotifierModule( QWidget* 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( QListBoxItem * item ); + void slotMimeTypeChanged( int index ); + +private: + void updateListBox(); + + QString m_mimetype; + NotifierSettings m_settings; + NotifierModuleView *m_view; +}; + +#endif diff --git a/kioslave/media/kcmodule/notifiermoduleview.ui b/kioslave/media/kcmodule/notifiermoduleview.ui new file mode 100644 index 000000000..87edc0f36 --- /dev/null +++ b/kioslave/media/kcmodule/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/kcmodule/serviceconfigdialog.cpp b/kioslave/media/kcmodule/serviceconfigdialog.cpp new file mode 100644 index 000000000..1a127d12b --- /dev/null +++ b/kioslave/media/kcmodule/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 QStringList &mimetypesList, + QWidget* 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 ); + + QIconSet iconSet = SmallIconSet("configure"); + QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); + m_view->commandButton->setIconSet( iconSet ); + m_view->commandButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); + + m_iconChanged = false; + + QStringList all_mimetypes = mimetypesList; + QStringList action_mimetypes = action->mimetypes(); + + QStringList::iterator it = all_mimetypes.begin(); + QStringList::iterator end = all_mimetypes.end(); + + for ( ; it!=end; ++it ) + { + QListBox *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, SIGNAL( iconChanged(QString) ), + this, SLOT( slotIconChanged() ) ); + connect( m_view->commandButton, SIGNAL( clicked() ), + this, 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(); + + QStringList mimetypes; + + uint list_count = m_view->mimetypesSelector->selectedListBox()->count(); + for( uint i=0; i < list_count; ++i ) + { + QListBoxItem *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 == QDialog::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/kcmodule/serviceconfigdialog.h b/kioslave/media/kcmodule/serviceconfigdialog.h new file mode 100644 index 000000000..090a978d4 --- /dev/null +++ b/kioslave/media/kcmodule/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 QStringList &mimetypesList, + QWidget* 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/kcmodule/serviceview.ui b/kioslave/media/kcmodule/serviceview.ui new file mode 100644 index 000000000..938a9bf89 --- /dev/null +++ b/kioslave/media/kcmodule/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.1