From de7e5867a65e0a46f1388e3e50bc7eeddd1aecbf Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:02:02 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tdeioslave/system/CMakeLists.txt | 50 ++++ tdeioslave/system/Makefile.am | 31 ++ tdeioslave/system/dummy.cpp | 1 + tdeioslave/system/entries/CMakeLists.txt | 17 ++ tdeioslave/system/entries/Makefile.am | 3 + tdeioslave/system/entries/documents.desktop | 58 ++++ tdeioslave/system/entries/home.desktop | 78 ++++++ tdeioslave/system/entries/media.desktop | 71 +++++ tdeioslave/system/entries/remote.desktop | 73 +++++ tdeioslave/system/entries/trash.desktop | 84 ++++++ tdeioslave/system/entries/users.desktop | 67 +++++ tdeioslave/system/kdedmodule/CMakeLists.txt | 41 +++ tdeioslave/system/kdedmodule/Makefile.am | 13 + tdeioslave/system/kdedmodule/systemdirnotify.cpp | 187 ++++++++++++ .../system/kdedmodule/systemdirnotify.desktop | 65 +++++ tdeioslave/system/kdedmodule/systemdirnotify.h | 47 ++++ .../system/kdedmodule/systemdirnotifymodule.cpp | 37 +++ .../system/kdedmodule/systemdirnotifymodule.h | 36 +++ tdeioslave/system/kio_system.cpp | 189 +++++++++++++ tdeioslave/system/kio_system.h | 45 +++ tdeioslave/system/mimetypes/CMakeLists.txt | 14 + tdeioslave/system/mimetypes/Makefile.am | 6 + .../system/mimetypes/system_directory.desktop | 76 +++++ tdeioslave/system/system.protocol | 19 ++ tdeioslave/system/systemimpl.cpp | 312 +++++++++++++++++++++ tdeioslave/system/systemimpl.h | 68 +++++ tdeioslave/system/testsystem.cpp | 69 +++++ tdeioslave/system/testsystem.h | 34 +++ 28 files changed, 1791 insertions(+) create mode 100644 tdeioslave/system/CMakeLists.txt create mode 100644 tdeioslave/system/Makefile.am create mode 100644 tdeioslave/system/dummy.cpp create mode 100644 tdeioslave/system/entries/CMakeLists.txt create mode 100644 tdeioslave/system/entries/Makefile.am create mode 100644 tdeioslave/system/entries/documents.desktop create mode 100644 tdeioslave/system/entries/home.desktop create mode 100644 tdeioslave/system/entries/media.desktop create mode 100644 tdeioslave/system/entries/remote.desktop create mode 100644 tdeioslave/system/entries/trash.desktop create mode 100644 tdeioslave/system/entries/users.desktop create mode 100644 tdeioslave/system/kdedmodule/CMakeLists.txt create mode 100644 tdeioslave/system/kdedmodule/Makefile.am create mode 100644 tdeioslave/system/kdedmodule/systemdirnotify.cpp create mode 100644 tdeioslave/system/kdedmodule/systemdirnotify.desktop create mode 100644 tdeioslave/system/kdedmodule/systemdirnotify.h create mode 100644 tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp create mode 100644 tdeioslave/system/kdedmodule/systemdirnotifymodule.h create mode 100644 tdeioslave/system/kio_system.cpp create mode 100644 tdeioslave/system/kio_system.h create mode 100644 tdeioslave/system/mimetypes/CMakeLists.txt create mode 100644 tdeioslave/system/mimetypes/Makefile.am create mode 100644 tdeioslave/system/mimetypes/system_directory.desktop create mode 100644 tdeioslave/system/system.protocol create mode 100644 tdeioslave/system/systemimpl.cpp create mode 100644 tdeioslave/system/systemimpl.h create mode 100644 tdeioslave/system/testsystem.cpp create mode 100644 tdeioslave/system/testsystem.h (limited to 'tdeioslave/system') diff --git a/tdeioslave/system/CMakeLists.txt b/tdeioslave/system/CMakeLists.txt new file mode 100644 index 000000000..b9fea814d --- /dev/null +++ b/tdeioslave/system/CMakeLists.txt @@ -0,0 +1,50 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( kdedmodule ) +add_subdirectory( entries ) +add_subdirectory( mimetypes ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES system.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### kiosystem (static) ######################## + +set( target kiosystem ) + +tde_add_library( ${target} STATIC_PIC AUTOMOC + SOURCES kio_system.cpp systemimpl.cpp +) + + +##### kio_system (module) ####################### + +set( target kio_system ) + +tde_add_kpart( ${target} AUTOMOC + SOURCES dummy.cpp + EMBED kiosystem-static + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslave/system/Makefile.am b/tdeioslave/system/Makefile.am new file mode 100644 index 000000000..5fc63eb5c --- /dev/null +++ b/tdeioslave/system/Makefile.am @@ -0,0 +1,31 @@ +SUBDIRS= . kdedmodule entries mimetypes + +INCLUDES = $(all_includes) +METASOURCES = AUTO + +kde_module_LTLIBRARIES = kio_system.la + +kio_system_la_SOURCES = dummy.cpp +kio_system_la_LIBADD = libtdeiosystem.la $(LIB_KIO) +kio_system_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined + +dummy.cpp: + echo > dummy.cpp + +kde_services_DATA = system.protocol + +noinst_LTLIBRARIES = libtdeiosystem.la +libtdeiosystem_la_SOURCES = kio_system.cpp systemimpl.cpp + +check_PROGRAMS = testsystem +testsystem_SOURCES = testsystem.cpp +testsystem_LDADD = libtdeiosystem.la $(LIB_KIO) +testsystem_LDFLAGS = $(all_libraries) + +## TODO in unsermake: TESTS = testsystem +check: testsystem + ./testsystem + +messages: + $(XGETTEXT) `find . -name "*.cc" -o -name "*.cpp" -o -name "*.h"` -o $(podir)/tdeio_system.pot + diff --git a/tdeioslave/system/dummy.cpp b/tdeioslave/system/dummy.cpp new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tdeioslave/system/dummy.cpp @@ -0,0 +1 @@ + diff --git a/tdeioslave/system/entries/CMakeLists.txt b/tdeioslave/system/entries/CMakeLists.txt new file mode 100644 index 000000000..a1d15fa53 --- /dev/null +++ b/tdeioslave/system/entries/CMakeLists.txt @@ -0,0 +1,17 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +##### other data ################################ + +install( FILES + home.desktop documents.desktop users.desktop + media.desktop remote.desktop trash.desktop + DESTINATION ${DATA_INSTALL_DIR}/systemview ) diff --git a/tdeioslave/system/entries/Makefile.am b/tdeioslave/system/entries/Makefile.am new file mode 100644 index 000000000..5a666650f --- /dev/null +++ b/tdeioslave/system/entries/Makefile.am @@ -0,0 +1,3 @@ +systemviewdir = $(kde_datadir)/systemview +systemview_DATA = home.desktop documents.desktop users.desktop media.desktop remote.desktop trash.desktop + diff --git a/tdeioslave/system/entries/documents.desktop b/tdeioslave/system/entries/documents.desktop new file mode 100644 index 000000000..ae651c541 --- /dev/null +++ b/tdeioslave/system/entries/documents.desktop @@ -0,0 +1,58 @@ +[Desktop Entry] +Type=Link +URL=$( kxdglauncher --getpath --xdgname DOCUMENTS ) +Icon=folder_man +Name=Documents Folder +Name[af]=Dokument Gids +Name[ar]=مستنداتي +Name[be]=Тэчка для дакументаў +Name[bg]=Директория с документи +Name[bn]=ডকুমেন্ট ফোল্ডার +Name[br]=Renkell an teulioù +Name[bs]=Direktorij dokumenata +Name[ca]=Carpeta de documents +Name[cs]=Složka s dokumenty +Name[csb]=Katalog dokùmentów +Name[da]=Dokumentmappe +Name[de]=Dokumente +Name[eo]=Dokumenta dosierujo +Name[es]=Carpeta de documentos +Name[et]=Dokumentide kataloog +Name[eu]=Dokumentuen karpeta +Name[fa]=پوشۀ مستندات +Name[fi]=Asiakirjakansio +Name[fr]=Dossier des documents +Name[fy]=Ofkeppele kamera +Name[ga]=Fillteán na gCáipéisí +Name[gl]=Cartafol de Documentos +Name[hr]=Mapa dokumenata +Name[hu]=Dokumentumok könyvtár +Name[is]=Skjalamappa +Name[it]=Cartella documenti +Name[ja]=ドキュメントフォルダ +Name[kk]=Құжаттар қапшығы +Name[lt]=Dokumentų aplankai +Name[nb]=Dokumentmappe +Name[nds]=Dokmenten-Orner +Name[nl]=Documenten +Name[nn]=Dokumentmappe +Name[pa]=ਦਸਤਾਵੇਜ਼ ਫੋਲਡਰ +Name[pl]=Katalog dokumentów +Name[pt]=Pasta de Documentos +Name[pt_BR]=Pasta de Documentos +Name[ro]=Folder documente +Name[ru]=Документы +Name[se]=Dokumeantamáhppa +Name[sl]=Mapa z dokumenti +Name[sr@Latn]=Fascikla sa dokumentima +Name[sv]=Dokumentkatalog +Name[tg]=Ҳуҷҷатҳо +Name[tr]=Belgeler Dizini +Name[uk]=Тека документів +Name[uz]=Hujjatlar jildi +Name[uz@cyrillic]=Ҳужжатлар жилди +Name[vi]=Thư mục T� i liệu +Name[wa]=Ridant documints +Name[zh_CN]=文档文件夹 +Name[zh_TW]=文件目錄 + diff --git a/tdeioslave/system/entries/home.desktop b/tdeioslave/system/entries/home.desktop new file mode 100644 index 000000000..56c07117a --- /dev/null +++ b/tdeioslave/system/entries/home.desktop @@ -0,0 +1,78 @@ +[Desktop Entry] +Type=Link +Path=$HOME +Icon=folder_home +Name=Home Folder +Name[af]=Tuis Gids +Name[ar]=منزلي +Name[az]=Ev Qovluğu +Name[be]=Хатняя тэчка +Name[bg]=Домашна директория +Name[bn]=ব্যক্তিগত ফোল্ডার +Name[br]=Renkell ar gêr +Name[bs]=Home direktorij +Name[ca]=Carpeta inici +Name[cs]=Domovská složka +Name[csb]=Domôcy katalog +Name[cy]=Plygell Cartref +Name[da]=Hjemmemappe +Name[de]=Persönlicher Ordner +Name[el]=Προσωπικός φάκελος +Name[eo]=Hejma dosierujo +Name[es]=Carpeta personal +Name[et]=Kodukataloog +Name[eu]=Etxeko karpeta +Name[fa]=پوشۀ آغازه +Name[fi]=Kotikansio +Name[fr]=Dossier personnel +Name[fy]=Persoanlike map +Name[ga]=Fillteán Baile +Name[gl]=Cartafol Persoal +Name[he]=תיקיית בית +Name[hi]=मुख फ़ोल्डर +Name[hr]=Početna mapa korisnika +Name[hu]=Saját könyvtár +Name[is]=Heimasvæði +Name[it]=Cartella Home +Name[ja]=ホームフォルダ +Name[ka]=საწყისი საქაღალდე +Name[kk]=Мекен қапшығы +Name[km]=ថត​ផ្ទះ +Name[ko]=홈 폴더 +Name[lt]=Namų aplankas +Name[lv]=Mājas mape +Name[mk]=Домашна папка +Name[mn]=Хувийн лавлах +Name[ms]=Folder Laman Utama +Name[mt]=Direttorju Personali +Name[nb]=Hjemmemappe +Name[nds]=Tohuus-Orner +Name[ne]=गृह फोल्डर +Name[nl]=Persoonlijke map +Name[nn]=Heimemappe +Name[pa]=ਘਰ ਫੋਲਡਰ +Name[pl]=Katalog domowy +Name[pt]=Pasta Pessoal +Name[pt_BR]=Pasta do Usuário +Name[ro]=Folder personal +Name[ru]=Домашняя папка +Name[rw]=Ububiko Urugo +Name[se]=Ruoktomáhppa +Name[sk]=Domovský priečinok +Name[sl]=Domača mapa +Name[sr]=Домаћа фасцикла +Name[sr@Latn]=Domaća fascikla +Name[sv]=Hemkatalog +Name[ta]=வீட்டு அடைவு +Name[te]=ఇంటి ఫొల్డర్ +Name[tg]=Феҳристи хонагӣ +Name[th]=โฟลเดอร์ส่วนตัว +Name[tr]=Başlangıç Dizini +Name[tt]=Ana Törgäk +Name[uk]=Домашня тека +Name[uz]=Uy jildi +Name[uz@cyrillic]=Уй жилди +Name[vi]=Thư mục Nhà +Name[wa]=Ridant måjhon +Name[zh_CN]=主文件夹 +Name[zh_TW]=家目錄 diff --git a/tdeioslave/system/entries/media.desktop b/tdeioslave/system/entries/media.desktop new file mode 100644 index 000000000..8ad83923a --- /dev/null +++ b/tdeioslave/system/entries/media.desktop @@ -0,0 +1,71 @@ +[Desktop Entry] +Type=Link +URL=media:/ +Icon=system +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]=儲存媒體 diff --git a/tdeioslave/system/entries/remote.desktop b/tdeioslave/system/entries/remote.desktop new file mode 100644 index 000000000..8f064a83b --- /dev/null +++ b/tdeioslave/system/entries/remote.desktop @@ -0,0 +1,73 @@ +[Desktop Entry] +Type=Link +URL=remote:/ +Icon=network +Name=Remote Places +Name[af]=Afgeleë Plekke +Name[ar]=أماكن بعيدة +Name[be]=Аддаленыя месцы +Name[bg]=Отдалечени директории +Name[bn]=দূরবর্তী অবস্থান +Name[br]=Lec'hiadurioù a-bell +Name[bs]=Udaljena mjesta +Name[ca]=Llocs remots +Name[cs]=Vzdálená umístění +Name[csb]=Daleczi place +Name[da]=Eksterne steder +Name[de]=Netzwerk +Name[el]=Απομακρυσμένες τοποθεσίες +Name[eo]=Foraj Lokoj +Name[es]=Lugares remotos +Name[et]=Võrgukohad +Name[eu]=Urruneko lekuak +Name[fa]=جاهای دور +Name[fi]=Etäkohteet +Name[fr]=Emplacements distants +Name[fy]=Eksterne plakken +Name[ga]=Áiteanna Cianda +Name[gl]=Comparticións Remotas +Name[he]=מקומות מרוחקים +Name[hi]=रिमोट स्थान +Name[hr]=Udaljene lokacije +Name[hu]=Hálózati helyek +Name[is]=Fjarlægir staðir +Name[it]=Indirizzi remoti +Name[ja]=リモートの場所 +Name[ka]=დაშორებული ადგილები +Name[kk]=Қашықтағы орындар +Name[km]=កន្លែង​ពី​ចម្ងាយ +Name[ko]=원격 접속 +Name[lt]=Nutolusios vietos +Name[lv]=Attālinātās vietas +Name[mk]=Оддалечени места +Name[ms]=Tempat Jauh +Name[nb]=Eksterne steder +Name[nds]=Feern Steden +Name[ne]=टाढाको स्थान +Name[nl]=Externe plekken +Name[nn]=Eksterne plassar +Name[pa]=ਰਿਮੋਟ ਥਾਂ +Name[pl]=Zdalne miejsca +Name[pt]=Locais Remotos +Name[pt_BR]=Locais Remotos +Name[ro]=Locații distante +Name[ru]=Сетевые ресурсы +Name[rw]=Imyanya ya Kure +Name[se]=Gáiddus báikkit +Name[sk]=Vzdialené miesta +Name[sl]=Oddaljena mesta +Name[sr]=Удаљена места +Name[sr@Latn]=Udaljena mesta +Name[sv]=Fjärrplatser +Name[ta]=தொலைதூர இடங்கள் +Name[te]=సుదూరపు ప్రదేశాలు +Name[th]=ทางไกล +Name[tr]=Uzak Yerler +Name[tt]=Çittäge Urınnar +Name[uk]=Віддалені місця +Name[uz]=Masofadagi joylar +Name[uz@cyrillic]=Масофадаги жойлар +Name[vi]=Địa chỉ trên mạng +Name[wa]=Plaeces då lon +Name[zh_CN]=远程位置 +Name[zh_TW]=遠端空間 diff --git a/tdeioslave/system/entries/trash.desktop b/tdeioslave/system/entries/trash.desktop new file mode 100644 index 000000000..7de5f21b6 --- /dev/null +++ b/tdeioslave/system/entries/trash.desktop @@ -0,0 +1,84 @@ +[Desktop Entry] +Type=Link +URL=trash:/ +Icon=trashcan_full +EmptyIcon=trashcan_empty +Name=Trash +Name[af]=Gemors +Name[ar]=سلة النفايات +Name[az]=Zibil +Name[be]=Сметніца +Name[bg]=Кошче +Name[bn]=আবর্জনা +Name[br]=Pod-lastez +Name[bs]=Smeće +Name[ca]=Paperera +Name[cs]=Koš +Name[csb]=Kòsz +Name[cy]=Sbwriel +Name[da]=Affald +Name[de]=Mülleimer +Name[el]=Κάδος απορριμμάτων +Name[en_GB]=Wastebin +Name[eo]=Rubujo +Name[es]=Papelera +Name[et]=Prügikast +Name[eu]=Zaborra +Name[fa]=زباله +Name[fi]=Roskakori +Name[fr]=Corbeille +Name[fy]=Jiskefet +Name[ga]=Bruscar +Name[gl]=Lixo +Name[he]=אשפה +Name[hi]=रद्दी +Name[hr]=Otpad +Name[hsb]=Papjernik +Name[hu]=Szemétkosár +Name[is]=Rusl +Name[it]=Cestino +Name[ja]=ごみ箱 +Name[ka]=ურნა +Name[kk]=Өшірілгендер +Name[km]=ធុងសំរាម +Name[lo]=ຖັງຂີ້ເຫຍື່ອ +Name[lt]=Šiukšliadėžė +Name[lv]=Miskaste +Name[mk]=Корпа +Name[mn]=Хогийн сав +Name[ms]=Sampah +Name[mt]=Skart +Name[nb]=Papirkurv +Name[nds]=Affalltünn +Name[ne]=रद्दीटोकरी +Name[nl]=Prullenbak +Name[nn]=Papirkorg +Name[nso]=Seswaraditlakala +Name[pa]=ਰੱਦੀ +Name[pl]=Kosz +Name[pt]=Lixo +Name[pt_BR]=Lixo +Name[ro]=Gunoi +Name[ru]=Корзина +Name[se]=Ruskalihtti +Name[sk]=Kôš +Name[sl]=Smeti +Name[sr]=Смеће +Name[sr@Latn]=Smeće +Name[sv]=Skräp +Name[ta]=குப்பை +Name[te]=చెత్త బుట్ట +Name[tg]=Ахлотдон +Name[th]=ถังขยะ +Name[tr]=Çöp +Name[tt]=Çüplek +Name[uk]=Смітник +Name[uz]=Chiqindilar qutisi +Name[uz@cyrillic]=Чиқиндилар қутиси +Name[ven]=Tshikha +Name[vi]=Thùng rác +Name[wa]=Batch +Name[xh]=Inkukumo +Name[zh_CN]=回收站 +Name[zh_TW]=資源回收桶 +Name[zu]=Izibi diff --git a/tdeioslave/system/entries/users.desktop b/tdeioslave/system/entries/users.desktop new file mode 100644 index 000000000..3ae601b0b --- /dev/null +++ b/tdeioslave/system/entries/users.desktop @@ -0,0 +1,67 @@ +[Desktop Entry] +Type=Link +URL=home:/ +Icon=folder_home2 +Name=Users Folders +Name[af]=Gebruiker Gidse +Name[ar]=مجلّدات المستخدمين +Name[be]=Тэчкі карыстальнікаў +Name[bg]=Потребителски директории +Name[bn]=ব্যবহারকারী ফোল্ডার +Name[br]=Renkellioù an arveriaded +Name[bs]=Korisnički direktoriji +Name[ca]=Carpeta d'usuaris +Name[cs]=Složka uživatelů +Name[csb]=Katalodżi brëkòwników +Name[da]=Brugermapper +Name[de]=Alle Persönlichen Ordner +Name[el]=Φάκελος χρηστών +Name[eo]=Uzantaj dosierujoj +Name[es]=Carpetas de usuarios +Name[et]=Kasutajate kataloogid +Name[eu]=Erabiltzaileen karpetak +Name[fa]=پوشه‌های‌ کاربران +Name[fi]=Käyttäjäkansiot +Name[fr]=Dossiers utilisateurs +Name[fy]=Brûkersmappen +Name[ga]=Fillteáin Úsáideora +Name[gl]=Cartafoles dos Usuarios +Name[he]=תיקיות משתמשים +Name[hr]=Korisničke mape +Name[hu]=Felhasználói könyvtárak +Name[is]=Notandamöppur +Name[it]=Cartelle utenti +Name[ja]=ユーザフォルダ +Name[ka]=მომხმარებლის დასტები +Name[kk]=Пайдаланушылардың қапшығы +Name[km]=ថត​របស់អ្នកប្រើ +Name[ko]=홈 폴더 +Name[lt]=Naudotojų aplankai +Name[mk]=Кориснички папки +Name[nb]=Brukermapper +Name[nds]=All Tohuusornern +Name[ne]=प्रयोगकर्ता फोल्डर +Name[nl]=Gebruikersmappen +Name[nn]=Brukarmapper +Name[pa]=ਉਪਭੋਗੀ ਫੋਲਡਰ +Name[pl]=Katalogi użytkowników +Name[pt]=Pastas dos Utilizadores +Name[pt_BR]=Pastas do Usuários +Name[ro]=Foldere utilizatori +Name[ru]=Пользовательские папки +Name[se]=Geavaheaddji máhpat +Name[sk]=Priečinky používateľov +Name[sl]=Mapa z uporabniki +Name[sr]=Фасцикле корисникâ +Name[sr@Latn]=Fascikle korisnikâ +Name[sv]=Användares kataloger +Name[te]=యుజర్ల ఫొల్డర్లు +Name[th]=โฟลเดอร์ของผู้ใช้ +Name[tr]=Kullanıcı Dizinleri +Name[uk]=Теки користувачів +Name[uz]=Foydalanuvchilarning jildlari +Name[uz@cyrillic]=Фойдаланувчиларнинг жилдлари +Name[vi]=Thư mục Người dùng +Name[wa]=Ridant uzeu +Name[zh_CN]=用户文件夹 +Name[zh_TW]=使用者目錄 diff --git a/tdeioslave/system/kdedmodule/CMakeLists.txt b/tdeioslave/system/kdedmodule/CMakeLists.txt new file mode 100644 index 000000000..6df004620 --- /dev/null +++ b/tdeioslave/system/kdedmodule/CMakeLists.txt @@ -0,0 +1,41 @@ +################################################# +# +# (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} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES systemdirnotify.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) + + +##### kded_systemdirnotify (module) ############# + +set( target kded_systemdirnotify ) + +set( ${target}_SRCS + systemdirnotify.cpp systemdirnotify.skel + systemdirnotifymodule.cpp systemdirnotifymodule.skel +) + +tde_add_kpart( ${target} AUTOMOC + SOURCES ${${target}_SRCS} + LINK tdeinit_kded-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslave/system/kdedmodule/Makefile.am b/tdeioslave/system/kdedmodule/Makefile.am new file mode 100644 index 000000000..bc368f9b1 --- /dev/null +++ b/tdeioslave/system/kdedmodule/Makefile.am @@ -0,0 +1,13 @@ +kde_module_LTLIBRARIES = kded_systemdirnotify.la + +METASOURCES = AUTO +INCLUDES = $(all_includes) + +kded_systemdirnotify_la_SOURCES = systemdirnotify.cpp systemdirnotify.skel systemdirnotifymodule.cpp systemdirnotifymodule.skel +kded_systemdirnotify_la_LDFLAGS = $(all_libraries) -module -avoid-version +kded_systemdirnotify_la_LIBADD = $(LIB_KSYCOCA) + + +servicesdir = $(kde_servicesdir)/kded +services_DATA = systemdirnotify.desktop + diff --git a/tdeioslave/system/kdedmodule/systemdirnotify.cpp b/tdeioslave/system/kdedmodule/systemdirnotify.cpp new file mode 100644 index 000000000..3a6f029e6 --- /dev/null +++ b/tdeioslave/system/kdedmodule/systemdirnotify.cpp @@ -0,0 +1,187 @@ +/* This file is part of the KDE Project + Copyright (c) 2004 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 "systemdirnotify.h" + +#include +#include +#include +#include +#include + +#include + +#include + +SystemDirNotify::SystemDirNotify() +: mInited( false ) +{ +} + +void SystemDirNotify::init() +{ + if( mInited ) + // FIXME Work around a probable race condition by inserting printf delay before following + // code is executed -- the root cause of the race needs investigation and resolution. + printf("[systemdirnotify] SystemDirNotify::init(mInited)"); + return; + mInited = true; + TDEGlobal::dirs()->addResourceType("system_entries", + KStandardDirs::kde_default("data") + "systemview"); + + TQStringList names_found; + TQStringList dirList = TDEGlobal::dirs()->resourceDirs("system_entries"); + + TQStringList::ConstIterator dirpath = dirList.begin(); + TQStringList::ConstIterator end = dirList.end(); + for(; dirpath!=end; ++dirpath) + { + TQDir dir = *dirpath; + if (!dir.exists()) continue; + + TQStringList filenames + = dir.entryList( TQDir::Files | TQDir::Readable ); + + TQStringList::ConstIterator name = filenames.begin(); + TQStringList::ConstIterator endf = filenames.end(); + + for(; name!=endf; ++name) + { + if (!names_found.contains(*name)) + { + KDesktopFile desktop(*dirpath+*name, true); + + TQString system_name = *name; + system_name.truncate(system_name.length()-8); + + KURL system_url("system:/"+system_name); + + if ( !desktop.readURL().isEmpty() ) + { + m_urlMap[desktop.readURL()] = system_url; + names_found.append( *name ); + } + else if ( !desktop.readPath().isEmpty() ) + { + KURL url; + url.setPath( desktop.readPath() ); + m_urlMap[url] = system_url; + names_found.append( *name ); + } + } + } + } +} + +KURL SystemDirNotify::toSystemURL(const KURL &url) +{ + kdDebug() << "SystemDirNotify::toSystemURL(" << url << ")" << endl; + + init(); + TQMap::const_iterator it = m_urlMap.begin(); + TQMap::const_iterator end = m_urlMap.end(); + + for (; it!=end; ++it) + { + KURL base = it.key(); + + if ( base.isParentOf(url) ) + { + TQString path = KURL::relativePath(base.path(), + url.path()); + KURL result = it.data(); + result.addPath(path); + result.cleanPath(); + kdDebug() << result << endl; + return result; + } + } + + kdDebug() << "KURL()" << endl; + return KURL(); +} + +KURL::List SystemDirNotify::toSystemURLList(const KURL::List &list) +{ + init(); + KURL::List new_list; + + KURL::List::const_iterator it = list.begin(); + KURL::List::const_iterator end = list.end(); + + for (; it!=end; ++it) + { + KURL url = toSystemURL(*it); + + if (url.isValid()) + { + new_list.append(url); + } + } + + return new_list; +} + +ASYNC SystemDirNotify::FilesAdded(const KURL &directory) +{ + KURL new_dir = toSystemURL(directory); + + if (new_dir.isValid()) + { + KDirNotify_stub notifier("*", "*"); + notifier.FilesAdded( new_dir ); + if (new_dir.upURL().upURL()==KURL("system:/")) + { + notifier.FilesChanged( new_dir.upURL() ); + } + } +} + +ASYNC SystemDirNotify::FilesRemoved(const KURL::List &fileList) +{ + KURL::List new_list = toSystemURLList(fileList); + + if (!new_list.isEmpty()) + { + KDirNotify_stub notifier("*", "*"); + notifier.FilesRemoved( new_list ); + + KURL::List::const_iterator it = new_list.begin(); + KURL::List::const_iterator end = new_list.end(); + + for (; it!=end; ++it) + { + if ((*it).upURL().upURL()==KURL("system:/")) + { + notifier.FilesChanged( (*it).upURL() ); + } + } + } +} + +ASYNC SystemDirNotify::FilesChanged(const KURL::List &fileList) +{ + KURL::List new_list = toSystemURLList(fileList); + + if (!new_list.isEmpty()) + { + KDirNotify_stub notifier("*", "*"); + notifier.FilesChanged( new_list ); + } +} + diff --git a/tdeioslave/system/kdedmodule/systemdirnotify.desktop b/tdeioslave/system/kdedmodule/systemdirnotify.desktop new file mode 100644 index 000000000..31379df76 --- /dev/null +++ b/tdeioslave/system/kdedmodule/systemdirnotify.desktop @@ -0,0 +1,65 @@ +[Desktop Entry] +Type=Service +Name=KDED System Base URL Notifier +Name[af]=KDED Stelse URL inkennissteller +Name[be]=Праверка змены сістэмных файлаў KDED +Name[bs]=KDED sistemsko obavještenje o baznom URLu +Name[ca]=Notificador d'URL de base al sistema KDED +Name[cs]=Démon upozorňování na systémová URL +Name[csb]=Dôwanié wiédzë ù systemòwëch URL-ach dlô KDED +Name[da]=KDED Systembais-url påmindelser +Name[de]=Überwachung für Systemordner +Name[el]=Ειδοποιητής KDED για URL του συστήματος +Name[eo]=KDED Sistemo Bazo URL Atentigilo +Name[es]=Notificador de URL de base sistema de KDED +Name[et]=KDED süsteemsete URL-ide teadustaja +Name[eu]=KDEren sistema oinarri URL iragarlea +Name[fa]=اخطاردهندۀ نشانی وب پایۀ سیستم KDED +Name[fi]=KDED:in järjestelmä-osoitteiden ilmoittaja +Name[fr]=Notificateur d'URL système KDED +Name[fy]=KDED systeem basis URL-adres melding +Name[gl]=KDED Notificador de Base de URL Remota +Name[hi]=केडीईडी तंत्र आधार यूआरएल नोटिफ़ॉयर +Name[hr]=KDED sistemsko URL obavještavanje +Name[hu]=Alapcím-értesítő +Name[is]=KDED kerfis grunnslóðar tilkynnari +Name[it]=Notifica KDED System Base URL +Name[ja]=KDED システム ベース URL 通知 +Name[kk]=Жергілікті дискідегі өзгеріс туралы қулақтандыру +Name[ko]=KDED 원격 기반 URL 알리미 +Name[lt]=KDED sistemos pagrindinio URL priminiklis +Name[lv]=KDED sistēmas bāzes URL atgādinātājs +Name[ms]=Pemberitahu URL Pangkalan Sistem KDED +Name[nb]=KDED-Systembase URL-varsler +Name[nds]=KDED-Narichten för Systeem-Basis-URLs +Name[ne]=KDED प्रणाली आधारित यूआरएल सूचक +Name[nl]=KDED systeem basis URL-adres notificatie +Name[nn]=KDED-Systembase URL-varslar +Name[pa]=KDE ਸਿਸਟਮ ਆਧਾਰ URL ਸੂਚਨਾ +Name[pl]=Powiadamianie o systemowych URL-ach dla KDED +Name[pt]=Notificador URLs de Base de Sistema do KDED +Name[pt_BR]=Serviço de Notificação da URL da Base do Sistema +Name[ro]=Notificare KDED pentru URL sistem de bază +Name[ru]=Проверка изменения локальных файлов +Name[rw]=Mumenyekanisha wa URL KDED Sisitemu Shingiro +Name[sk]=KDED notifikátor systémovej URL +Name[sl]=Obvestilnik KDED sistemskega osnovnega URL-ja +Name[sr]=Обавештавач о системском базном URL-у, KDED +Name[sr@Latn]=Obaveštavač o sistemskom baznom URL-u, KDED +Name[sv]=KDED-meddelande om systembaswebbadresser +Name[ta]=KDED அமைப்பு சார்ந்த வலைமனை குறிப்பான் +Name[th]=ตัวแจ้งเตือนพื้นฐานของระบบ URL KDED +Name[tr]=KDED Sistem Tabanlı URL Hatırlatıcı +Name[tt]=Cirle URL Üzgärelü Beldergeçe +Name[uk]=Сповіщувач про системну основну адресу (URL) для KDED +Name[vi]=Trình thông báo URL hệ thống KDED +Name[wa]=Notifiaedje KDED d' URL sistinme di båze +Name[zh_CN]=KDED 系统基 URL 通知器 +Name[zh_TW]=KDED 系統基礎 URL 通知程式 +Comment=Provides change notification for folders monitored by the system:/ kio plugin +ServiceTypes=KDEDModule +X-TDE-ModuleType=Library +X-TDE-Library=systemdirnotify +X-TDE-FactoryName=systemdirnotify +X-TDE-Kded-load-on-demand=true +X-TDE-Kded-autoload=true diff --git a/tdeioslave/system/kdedmodule/systemdirnotify.h b/tdeioslave/system/kdedmodule/systemdirnotify.h new file mode 100644 index 000000000..b743ddb42 --- /dev/null +++ b/tdeioslave/system/kdedmodule/systemdirnotify.h @@ -0,0 +1,47 @@ +/* This file is part of the KDE Project + Copyright (c) 2004 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 _SYSTEMDIRNOTIFY_H_ +#define _SYSTEMDIRNOTIFY_H_ + +#include +#include +#include + +class SystemDirNotify : public KDirNotify +{ +K_DCOP + +public: + SystemDirNotify(); + +k_dcop: + virtual ASYNC FilesAdded (const KURL &directory); + virtual ASYNC FilesRemoved (const KURL::List &fileList); + virtual ASYNC FilesChanged (const KURL::List &fileList); + +private: + void init(); + KURL toSystemURL(const KURL &url); + KURL::List toSystemURLList(const KURL::List &list); + + TQMap m_urlMap; + bool mInited; +}; + +#endif diff --git a/tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp b/tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp new file mode 100644 index 000000000..64e8c8d62 --- /dev/null +++ b/tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp @@ -0,0 +1,37 @@ +/* This file is part of the KDE Project + Copyright (c) 2004 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 "systemdirnotifymodule.h" + +#include +#include +#include + +SystemDirNotifyModule::SystemDirNotifyModule(const TQCString &obj) + : KDEDModule(obj) +{ +} + +extern "C" { + KDE_EXPORT KDEDModule *create_systemdirnotify(const TQCString &obj) + { + TDEGlobal::locale()->insertCatalogue("kio_system"); + return new SystemDirNotifyModule(obj); + } +} + diff --git a/tdeioslave/system/kdedmodule/systemdirnotifymodule.h b/tdeioslave/system/kdedmodule/systemdirnotifymodule.h new file mode 100644 index 000000000..e979ba098 --- /dev/null +++ b/tdeioslave/system/kdedmodule/systemdirnotifymodule.h @@ -0,0 +1,36 @@ +/* This file is part of the KDE Project + Copyright (c) 2004 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 _SYSTEMDIRNOTIFYMODULE_H_ +#define _SYSTEMDIRNOTIFYMODULE_H_ + +#include + +#include "systemdirnotify.h" + +class SystemDirNotifyModule : public KDEDModule +{ +K_DCOP + +public: + SystemDirNotifyModule(const TQCString &obj); +private: + SystemDirNotify notifier; +}; + +#endif diff --git a/tdeioslave/system/kio_system.cpp b/tdeioslave/system/kio_system.cpp new file mode 100644 index 000000000..61f724093 --- /dev/null +++ b/tdeioslave/system/kio_system.cpp @@ -0,0 +1,189 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 +#include +#include +#include +#include + +#include + +#include "kio_system.h" + + +static const KCmdLineOptions options[] = +{ + { "+protocol", I18N_NOOP( "Protocol name" ), 0 }, + { "+pool", I18N_NOOP( "Socket name" ), 0 }, + { "+app", I18N_NOOP( "Socket name" ), 0 }, + KCmdLineLastOption +}; + +extern "C" { + KDE_EXPORT int kdemain( int argc, char **argv ) + { + // TDEApplication is necessary to use other ioslaves + putenv(strdup("SESSION_MANAGER=")); + TDECmdLineArgs::init(argc, argv, "kio_system", 0, 0, 0, 0); + TDECmdLineArgs::addCmdLineOptions( options ); + TDEApplication app( false, false ); + // We want to be anonymous even if we use DCOP + app.dcopClient()->attach(); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + SystemProtocol slave( args->arg(0), args->arg(1), args->arg(2) ); + slave.dispatchLoop(); + return 0; + } +} + + +SystemProtocol::SystemProtocol(const TQCString &protocol, + const TQCString &pool, const TQCString &app) + : ForwardingSlaveBase(protocol, pool, app) +{ +} + +SystemProtocol::~SystemProtocol() +{ +} + +bool SystemProtocol::rewriteURL(const KURL &url, KURL &newUrl) +{ + TQString name, path; + + if ( !m_impl.parseURL(url, name, path) ) + { + error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); + return false; + } + + if ( !m_impl.realURL(name, path, newUrl) ) + { + error( m_impl.lastErrorCode(), m_impl.lastErrorMessage() ); + return false; + } + + return true; +} + + +void SystemProtocol::stat(const KURL &url) +{ + kdDebug() << "SystemProtocol::stat: " << url << endl; + + TQString path = url.path(); + if ( path.isEmpty() || path == "/" ) + { + // The root is "virtual" - it's not a single physical directory + TDEIO::UDSEntry entry; + m_impl.createTopLevelEntry( entry ); + statEntry( entry ); + finished(); + return; + } + + TQString name; + bool ok = m_impl.parseURL(url, name, path); + + if ( !ok ) + { + error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); + return; + } + + if( path.isEmpty() ) + { + TDEIO::UDSEntry entry; + + if ( m_impl.statByName(name, entry) ) + { + statEntry(entry); + finished(); + } + else + { + error(TDEIO::ERR_DOES_NOT_EXIST, url.prettyURL()); + } + } + else + { + ForwardingSlaveBase::stat(url); + } +} + +void SystemProtocol::listDir(const KURL &url) +{ + kdDebug() << "SystemProtocol::listDir: " << url << endl; + + if ( url.path().length() <= 1 ) + { + listRoot(); + return; + } + + TQString name, path; + bool ok = m_impl.parseURL(url, name, path); + + if ( !ok ) + { + error(TDEIO::ERR_MALFORMED_URL, url.prettyURL()); + return; + } + + ForwardingSlaveBase::listDir(url); +} + +void SystemProtocol::listRoot() +{ + TDEIO::UDSEntry entry; + + TDEIO::UDSEntryList system_entries; + bool ok = m_impl.listRoot(system_entries); + + if (!ok) + { + error( m_impl.lastErrorCode(), m_impl.lastErrorMessage() ); + return; + } + + totalSize(system_entries.count()+1); + + m_impl.createTopLevelEntry(entry); + listEntry(entry, false); + + TDEIO::UDSEntryListIterator it = system_entries.begin(); + TDEIO::UDSEntryListIterator end = system_entries.end(); + + for(; it!=end; ++it) + { + listEntry(*it, false); + } + + entry.clear(); + listEntry(entry, true); + + finished(); +} + + +//#include "kio_system.moc" diff --git a/tdeioslave/system/kio_system.h b/tdeioslave/system/kio_system.h new file mode 100644 index 000000000..fb3423889 --- /dev/null +++ b/tdeioslave/system/kio_system.h @@ -0,0 +1,45 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 _KIO_MEDIA_H_ +#define _KIO_MEDIA_H_ + +#include + +#include "systemimpl.h" + +class SystemProtocol : public TDEIO::ForwardingSlaveBase +{ +public: + SystemProtocol(const TQCString &protocol, const TQCString &pool, + const TQCString &app); + virtual ~SystemProtocol(); + + virtual bool rewriteURL(const KURL &url, KURL &newUrl); + + virtual void stat(const KURL &url); + virtual void listDir(const KURL &url); + +private: + void listRoot(); + + SystemImpl m_impl; +}; + +#endif diff --git a/tdeioslave/system/mimetypes/CMakeLists.txt b/tdeioslave/system/mimetypes/CMakeLists.txt new file mode 100644 index 000000000..8695a7cd3 --- /dev/null +++ b/tdeioslave/system/mimetypes/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +##### other data ################################ + +install( FILES system_directory.desktop DESTINATION ${MIME_INSTALL_DIR}/inode ) diff --git a/tdeioslave/system/mimetypes/Makefile.am b/tdeioslave/system/mimetypes/Makefile.am new file mode 100644 index 000000000..4f58439a7 --- /dev/null +++ b/tdeioslave/system/mimetypes/Makefile.am @@ -0,0 +1,6 @@ +mimetypedir = $(kde_mimedir)/inode + +mimetype_DATA = system_directory.desktop + + +EXTRA_DIST = $(mimetype_DATA) diff --git a/tdeioslave/system/mimetypes/system_directory.desktop b/tdeioslave/system/mimetypes/system_directory.desktop new file mode 100644 index 000000000..57af9b112 --- /dev/null +++ b/tdeioslave/system/mimetypes/system_directory.desktop @@ -0,0 +1,76 @@ +[Desktop Entry] +Icon=kfm +Type=MimeType +MimeType=inode/system_directory +Comment=System Folder +Comment[af]=Stelsel Gids +Comment[ar]=مجلد النظام +Comment[be]=Сістэмная тэчка +Comment[bg]=Системна директория +Comment[bn]=সিস্টেম ফোল্ডার +Comment[br]=Renkell reiziad +Comment[bs]=Sistemski direktorij +Comment[ca]=Carpeta del sistema +Comment[cs]=Systémová složka +Comment[csb]=Systemòwi katalog +Comment[da]=Systemmappe +Comment[de]=Systemordner +Comment[el]=Φάκελος συστήματος +Comment[eo]=Sistema dosierujo +Comment[es]=Carpeta del sistema +Comment[et]=Süsteemi kataloog +Comment[eu]=Sistemaren karpeta +Comment[fa]=پوشۀ سیستم +Comment[fi]=Järjestelmän kansio +Comment[fr]=Dossier système +Comment[fy]=Systeemmap +Comment[ga]=Comhadlann Chórais +Comment[gl]=Cartafol do Sistema +Comment[he]=תיקיית מערכת +Comment[hr]=Sistemska mapa +Comment[hu]=Rendszermappa +Comment[is]=Kerfismappa +Comment[it]=Cartella di sistema +Comment[ja]=システムフォルダ +Comment[ka]=სისტემური საქაღალდე +Comment[kk]=Жүйелік қапшық +Comment[km]=ថត​ប្រព័ន្ធ +Comment[ko]=홈 폴더 +Comment[lt]=Sistemos aplankas +Comment[mk]=Системска папка +Comment[ms]=Folder Sistem +Comment[nb]=Systemmappe +Comment[nds]=Systeemorner +Comment[ne]=प्रणाली फोल्डर +Comment[nl]=Systeemmap +Comment[nn]=Systemmappe +Comment[pa]=ਸਿਸਟਮ ਫੋਲਡਰ +Comment[pl]=Katalog systemowy +Comment[pt]=Pasta de Sistema +Comment[pt_BR]=Pasta do Sistema +Comment[ro]=Folder de sistem +Comment[ru]=Системная папка +Comment[rw]=Ububiko Sisitemu +Comment[se]=Vuogádatmáhpa +Comment[sk]=Systémový priečinok +Comment[sl]=Sistemska mapa +Comment[sr]=Системска фасцикла +Comment[sr@Latn]=Sistemska fascikla +Comment[sv]=Systemkatalog +Comment[ta]=அமைப்பு அடைவு +Comment[te]=వ్యవస్థ ఫొల్డర్ +Comment[tg]=Феҳрасти система +Comment[th]=โฟลเดอร์ระบบ +Comment[tr]=Sistem Klasörü +Comment[tt]=Sistem Törgäge +Comment[uk]=Системна тека +Comment[uz]=Tizim jildi +Comment[uz@cyrillic]=Тизим жилди +Comment[vi]=Thư mục Hệ thống +Comment[wa]=Ridant sistinme +Comment[zh_CN]=系统文件夹 +Comment[zh_TW]=系統資料夾 +Patterns= + +X-TDE-AutoEmbed=true +X-TDE-IsAlso=inode/directory diff --git a/tdeioslave/system/system.protocol b/tdeioslave/system/system.protocol new file mode 100644 index 000000000..9aa6fbd6c --- /dev/null +++ b/tdeioslave/system/system.protocol @@ -0,0 +1,19 @@ +[Protocol] +exec=kio_system +protocol=system +input=none +output=filesystem +listing=Name,Type,Size,Date,AccessDate,Access,Owner,Group,Link +reading=true +writing=true +makedir=true +deleting=true +linking=true +moving=true +Icon=system +maxInstances=4 +#TODO DocPath=tdeioslave/file.html +Class=:local +deleteRecursive=true +fileNameUsedForCopying=Name + diff --git a/tdeioslave/system/systemimpl.cpp b/tdeioslave/system/systemimpl.cpp new file mode 100644 index 000000000..12732767c --- /dev/null +++ b/tdeioslave/system/systemimpl.cpp @@ -0,0 +1,312 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 "systemimpl.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +SystemImpl::SystemImpl() : TQObject() +{ + TDEGlobal::dirs()->addResourceType("system_entries", + KStandardDirs::kde_default("data") + "systemview"); +} + +bool SystemImpl::listRoot(TQValueList &list) +{ + kdDebug() << "SystemImpl::listRoot" << endl; + + TQStringList names_found; + TQStringList dirList = TDEGlobal::dirs()->resourceDirs("system_entries"); + + TQStringList::ConstIterator dirpath = dirList.begin(); + TQStringList::ConstIterator end = dirList.end(); + for(; dirpath!=end; ++dirpath) + { + TQDir dir = *dirpath; + if (!dir.exists()) continue; + + TQStringList filenames + = dir.entryList( TQDir::Files | TQDir::Readable ); + + + TDEIO::UDSEntry entry; + + TQStringList::ConstIterator filename = filenames.begin(); + TQStringList::ConstIterator endf = filenames.end(); + + for(; filename!=endf; ++filename) + { + if (!names_found.contains(*filename)) + { + entry.clear(); + createEntry(entry, *dirpath, *filename); + if ( !entry.isEmpty() ) + { + list.append(entry); + names_found.append(*filename); + } + } + } + } + + return true; +} + +bool SystemImpl::parseURL(const KURL &url, TQString &name, TQString &path) const +{ + TQString url_path = url.path(); + + int i = url_path.find('/', 1); + if (i > 0) + { + name = url_path.mid(1, i-1); + path = url_path.mid(i+1); + } + else + { + name = url_path.mid(1); + path = TQString::null; + } + + return name != TQString::null; +} + +bool SystemImpl::realURL(const TQString &name, const TQString &path, + KURL &url) const +{ + url = findBaseURL(name); + if (!url.isValid()) + { + return false; + } + + url.addPath(path); + return true; +} + +bool SystemImpl::statByName(const TQString &filename, TDEIO::UDSEntry& entry) +{ + kdDebug() << "SystemImpl::statByName" << endl; + + TQStringList dirList = TDEGlobal::dirs()->resourceDirs("system_entries"); + + TQStringList::ConstIterator dirpath = dirList.begin(); + TQStringList::ConstIterator end = dirList.end(); + for(; dirpath!=end; ++dirpath) + { + TQDir dir = *dirpath; + if (!dir.exists()) continue; + + TQStringList filenames + = dir.entryList( TQDir::Files | TQDir::Readable ); + + + TQStringList::ConstIterator name = filenames.begin(); + TQStringList::ConstIterator endf = filenames.end(); + + for(; name!=endf; ++name) + { + if (*name==filename+".desktop") + { + createEntry(entry, *dirpath, *name); + return true; + } + } + } + + return false; +} + +KURL SystemImpl::findBaseURL(const TQString &filename) const +{ + kdDebug() << "SystemImpl::findBaseURL" << endl; + + TQStringList dirList = TDEGlobal::dirs()->resourceDirs("system_entries"); + + TQStringList::ConstIterator dirpath = dirList.begin(); + TQStringList::ConstIterator end = dirList.end(); + for(; dirpath!=end; ++dirpath) + { + TQDir dir = *dirpath; + if (!dir.exists()) continue; + + TQStringList filenames + = dir.entryList( TQDir::Files | TQDir::Readable ); + + + TDEIO::UDSEntry entry; + + TQStringList::ConstIterator name = filenames.begin(); + TQStringList::ConstIterator endf = filenames.end(); + + for(; name!=endf; ++name) + { + if (*name==filename+".desktop") + { + KDesktopFile desktop(*dirpath+filename+".desktop", true); + if ( desktop.readURL().isEmpty() ) + { + KURL url; + url.setPath( desktop.readPath() ); + return url; + } + + return desktop.readURL(); + } + } + } + + return KURL(); +} + + +static void addAtom(TDEIO::UDSEntry &entry, unsigned int ID, long l, + const TQString &s = TQString::null) +{ + TDEIO::UDSAtom atom; + atom.m_uds = ID; + atom.m_long = l; + atom.m_str = s; + entry.append(atom); +} + + +void SystemImpl::createTopLevelEntry(TDEIO::UDSEntry &entry) const +{ + entry.clear(); + addAtom(entry, TDEIO::UDS_NAME, 0, "."); + addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR); + addAtom(entry, TDEIO::UDS_ACCESS, 0555); + addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/system_directory"); + addAtom(entry, TDEIO::UDS_ICON_NAME, 0, "system"); +} + +TQString SystemImpl::readPathINL(TQString filename) +{ + bool isPathExpanded = false; + TQString unexpandedPath; + TQFile f( filename ); + if (!f.open(IO_ReadOnly)) + return TQString(); + // set the codec for the current locale + TQTextStream s(&f); + TQString line = s.readLine(); + while (!line.isNull()) + { + if (line.startsWith("Path=$(")) { + isPathExpanded = true; + unexpandedPath = line.remove("Path="); + } + line = s.readLine(); + } + if (isPathExpanded == false) { + KDesktopFile desktop(filename, true); + return desktop.readPath(); + } + else { + return unexpandedPath; + } +} + +void SystemImpl::createEntry(TDEIO::UDSEntry &entry, + const TQString &directory, + const TQString &file) +{ + kdDebug() << "SystemImpl::createEntry" << endl; + + KDesktopFile desktop(directory+file, true); + + kdDebug() << "path = " << directory << file << endl; + + entry.clear(); + + // Ensure that we really want this entry to be displayed + if ( desktop.readURL().isEmpty() && readPathINL(directory+file).isEmpty() ) + { + return; + } + + addAtom(entry, TDEIO::UDS_NAME, 0, desktop.readName()); + + TQString new_filename = file; + new_filename.truncate(file.length()-8); + + if ( desktop.readURL().isEmpty() ) + { + addAtom(entry, TDEIO::UDS_URL, 0, readPathINL(directory+file)); + } + else + { + addAtom(entry, TDEIO::UDS_URL, 0, "system:/"+new_filename); + } + + addAtom(entry, TDEIO::UDS_FILE_TYPE, S_IFDIR); + addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, "inode/directory"); + + TQString icon = desktop.readIcon(); + TQString empty_icon = desktop.readEntry("EmptyIcon"); + + if (!empty_icon.isEmpty()) + { + KURL url = desktop.readURL(); + + m_lastListingEmpty = true; + + TDEIO::ListJob *job = TDEIO::listDir(url, false, false); + connect( job, TQT_SIGNAL( entries(TDEIO::Job *, + const TDEIO::UDSEntryList &) ), + this, TQT_SLOT( slotEntries(TDEIO::Job *, + const TDEIO::UDSEntryList &) ) ); + connect( job, TQT_SIGNAL( result(TDEIO::Job *) ), + this, TQT_SLOT( slotResult(TDEIO::Job *) ) ); + tqApp->eventLoop()->enterLoop(); + + if (m_lastListingEmpty) icon = empty_icon; + } + + addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon); +} + +void SystemImpl::slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &list) +{ + if (list.size()>0) + { + job->kill(true); + m_lastListingEmpty = false; + tqApp->eventLoop()->exitLoop(); + } +} + +void SystemImpl::slotResult(TDEIO::Job *) +{ + tqApp->eventLoop()->exitLoop(); +} + + +#include "systemimpl.moc" diff --git a/tdeioslave/system/systemimpl.h b/tdeioslave/system/systemimpl.h new file mode 100644 index 000000000..6270489c8 --- /dev/null +++ b/tdeioslave/system/systemimpl.h @@ -0,0 +1,68 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 SYSTEMIMPL_H +#define SYSTEMIMPL_H + +#include +#include +#include +#include +#include + +#include +#include + +class SystemImpl : public TQObject +{ +Q_OBJECT +public: + SystemImpl(); + + void createTopLevelEntry(TDEIO::UDSEntry& entry) const; + bool statByName(const TQString &filename, TDEIO::UDSEntry& entry); + + bool listRoot(TQValueList &list); + + bool parseURL(const KURL &url, TQString &name, TQString &path) const; + bool realURL(const TQString &name, const TQString &path, KURL &url) const; + + int lastErrorCode() const { return m_lastErrorCode; } + TQString lastErrorMessage() const { return m_lastErrorMessage; } + +private slots: + KURL findBaseURL(const TQString &filename) const; + void slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &list); + void slotResult(TDEIO::Job *job); + +private: + void createEntry(TDEIO::UDSEntry& entry, const TQString &directory, + const TQString &file); + + bool m_lastListingEmpty; + + TQString readPathINL(TQString filename); + + /// Last error code stored in class to simplify API. + /// Note that this means almost no method can be const. + int m_lastErrorCode; + TQString m_lastErrorMessage; +}; + +#endif diff --git a/tdeioslave/system/testsystem.cpp b/tdeioslave/system/testsystem.cpp new file mode 100644 index 000000000..7be993ff8 --- /dev/null +++ b/tdeioslave/system/testsystem.cpp @@ -0,0 +1,69 @@ +/* This file is part of the KDE project + Copyright (c) 2004 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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 "kio_system.h" +#include "testsystem.h" + +#include + +#include +#include +#include + +#include + +static bool check(const TQString& txt, TQString a, TQString b) +{ + if (a.isEmpty()) + a = TQString::null; + if (b.isEmpty()) + b = TQString::null; + if (a == b) { + kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl; + } + else { + kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl; + exit(1); + } + return true; +} + +int main(int argc, char *argv[]) +{ + TDEApplication::disableAutoDcopRegistration(); + TDECmdLineArgs::init(argc,argv,"testsystem", 0, 0, 0, 0); + TDEApplication app; + + TestSystem test; + test.setup(); + test.runAll(); + kdDebug() << "All tests OK." << endl; + return 0; // success. The exit(1) in check() is what happens in case of failure. +} + +void TestSystem::setup() +{ + +} + +void TestSystem::runAll() +{ + +} + diff --git a/tdeioslave/system/testsystem.h b/tdeioslave/system/testsystem.h new file mode 100644 index 000000000..2418e66cb --- /dev/null +++ b/tdeioslave/system/testsystem.h @@ -0,0 +1,34 @@ +/* This file is part of the KDE project + Copyright (c) 2004 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 as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 TESTSYSTEM_H +#define TESTSYSTEM_H + +class TestSystem +{ +public: + TestSystem() {} + void setup(); + void runAll(); + + // tests + +}; + +#endif -- cgit v1.2.1