diff options
Diffstat (limited to 'tdeioslave/trash/tdefile-plugin')
-rw-r--r-- | tdeioslave/trash/tdefile-plugin/CMakeLists.txt | 38 | ||||
-rw-r--r-- | tdeioslave/trash/tdefile-plugin/Makefile.am | 14 | ||||
-rw-r--r-- | tdeioslave/trash/tdefile-plugin/RETURNED_ITEMS | 4 | ||||
-rw-r--r-- | tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp | 93 | ||||
-rw-r--r-- | tdeioslave/trash/tdefile-plugin/tdefile_trash.desktop | 79 | ||||
-rw-r--r-- | tdeioslave/trash/tdefile-plugin/tdefile_trash.h | 42 | ||||
-rw-r--r-- | tdeioslave/trash/tdefile-plugin/tdefile_trash_system.desktop | 79 |
7 files changed, 349 insertions, 0 deletions
diff --git a/tdeioslave/trash/tdefile-plugin/CMakeLists.txt b/tdeioslave/trash/tdefile-plugin/CMakeLists.txt new file mode 100644 index 000000000..cfd52e186 --- /dev/null +++ b/tdeioslave/trash/tdefile-plugin/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (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 + tdefile_trash.desktop tdefile_trash_system.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_trash (module) ###################### + +set( target tdefile_trash ) + +tde_add_kpart( ${target} AUTOMOC + SOURCES tdefile_trash.cpp + LINK trashcommon-static tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslave/trash/tdefile-plugin/Makefile.am b/tdeioslave/trash/tdefile-plugin/Makefile.am new file mode 100644 index 000000000..4b2c5d40e --- /dev/null +++ b/tdeioslave/trash/tdefile-plugin/Makefile.am @@ -0,0 +1,14 @@ +## Makefile.am for trash file meta info plugin + +AM_CPPFLAGS = $(all_includes) + +kde_module_LTLIBRARIES = tdefile_trash.la + +tdefile_trash_la_SOURCES = tdefile_trash.cpp +tdefile_trash_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_trash_la_LIBADD = ../libtrashcommon.la $(LIB_TDEIO) + +METASOURCES = AUTO + +services_DATA = tdefile_trash.desktop tdefile_trash_system.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdeioslave/trash/tdefile-plugin/RETURNED_ITEMS b/tdeioslave/trash/tdefile-plugin/RETURNED_ITEMS new file mode 100644 index 000000000..f4e10f262 --- /dev/null +++ b/tdeioslave/trash/tdefile-plugin/RETURNED_ITEMS @@ -0,0 +1,4 @@ +tdefile_trash +=========== +QString OriginalPath +DateTime DateOfDeletion diff --git a/tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp b/tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp new file mode 100644 index 000000000..983a09db2 --- /dev/null +++ b/tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp @@ -0,0 +1,93 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 David Faure <faure@kde.org> + * Based on tdefile_txt.cpp by Nadeem Hasan <nhasan@kde.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "tdefile_trash.h" + +#include <kgenericfactory.h> +#include <kdebug.h> + +#include <tqfile.h> +#include <tqstringlist.h> +#include <tqdatetime.h> + +typedef KGenericFactory<KTrashPlugin> TrashFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_trash, TrashFactory("tdefile_trash")) + +KTrashPlugin::KTrashPlugin(TQObject *parent, const char *name, + const TQStringList &args) : KFilePlugin(parent, name, args) +{ + TDEGlobal::locale()->insertCatalogue( "tdeio_trash" ); + + kdDebug(7034) << "Trash file meta info plugin\n"; + + makeMimeTypeInfo("trash"); + makeMimeTypeInfo("system"); + + (void)impl.init(); +} + +void KTrashPlugin::makeMimeTypeInfo(const TQString& mimeType) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); + + KFileMimeTypeInfo::GroupInfo* group = + addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + item = addItemInfo(group, "OriginalPath", i18n("Original Path"), TQVariant::String); + item = addItemInfo(group, "DateOfDeletion", i18n("Date of Deletion"), TQVariant::DateTime); +} + +bool KTrashPlugin::readInfo(KFileMetaInfo& info, uint) +{ + KURL url = info.url(); + + if ( url.protocol()=="system" + && url.path().startsWith("/trash") ) + { + TQString path = url.path(); + path.remove(0, 6); + url.setProtocol("trash"); + url.setPath(path); + } + + //kdDebug() << k_funcinfo << info.url() << endl; + if ( url.protocol() != "trash" ) + return false; + + int trashId; + TQString fileId; + TQString relativePath; + if ( !TrashImpl::parseURL( url, trashId, fileId, relativePath ) ) + return false; + + TrashImpl::TrashedFileInfo trashInfo; + if ( !impl.infoForFile( trashId, fileId, trashInfo ) ) + return false; + + KFileMetaInfoGroup group = appendGroup(info, "General"); + appendItem(group, "OriginalPath", trashInfo.origPath); + appendItem(group, "DateOfDeletion", trashInfo.deletionDate); + + return true; +} + +#include "tdefile_trash.moc" diff --git a/tdeioslave/trash/tdefile-plugin/tdefile_trash.desktop b/tdeioslave/trash/tdefile-plugin/tdefile_trash.desktop new file mode 100644 index 000000000..18416c2f0 --- /dev/null +++ b/tdeioslave/trash/tdefile-plugin/tdefile_trash.desktop @@ -0,0 +1,79 @@ +[Desktop Entry] +Type=Service +Name=Trash File Info +Name[af]=Asblik inligting +Name[ar]=معلومات مفل المهملات +Name[az]=Zibil Faylı Məlumatı +Name[be]=Інфармацыя аб файле сметніцы +Name[bg]=Информация за кошчето +Name[bn]=আবর্জনা ফাইল তথ্য +Name[br]=Titouroù diwar-benn ar pod-lastez +Name[bs]=Smeće informacije o datoteci +Name[ca]=Informació del fitxer paperera +Name[cs]=Info o koši +Name[csb]=Wëdowiédzô ò lopkù w kòszu +Name[da]=Fil-info om affald +Name[de]=Mülleimer-Information +Name[el]=Πληροφορίες για τον Κάδο Απορριμμάτων +Name[en_GB]=Wastebin File Info +Name[eo]=Rubuja informo +Name[es]=Información de la papelera +Name[et]=Prügikasti failiinfo +Name[eu]=Zakarontziaren infoa +Name[fa]=اطلاعات پروندۀ زباله +Name[fi]=Roskakorin tiedot +Name[fr]=Info Fichier Corbeille +Name[fy]=Jiskefet ynformaasje +Name[gl]=Información do Lixo +Name[he]=מידע אודות קובץ אשפה +Name[hi]=रद्दी फ़ाइल जानकारी +Name[hr]=Podaci o otpadu +Name[hu]=Szemétkosár-jellemzők +Name[is]=Upplýsingar um ruslaskrá +Name[it]=Informazioni file del cestino +Name[ja]=ごみ箱情報 +Name[ka]=ურნაში არსებული ფაილის შესახებ ცნობი +Name[kk]=Өшірілген файл мәліметі +Name[km]=ព័ត៌មានឯកសារសំរាម +Name[ko]=휴지통 파일 정보 +Name[lt]=Šiukšlių bylos informacija +Name[lv]=Atkritumu faila informācija +Name[mk]=Инфо. за датотека од Корпата +Name[ms]=Maklumat Fail Sampah +Name[mt]=Skart +Name[nb]=Søppelfilinformasjon +Name[nds]=Affalltünn-Informatschonen +Name[ne]=रद्दीटोकरी फाइल सूचना +Name[nl]=Prullenbakinformatie +Name[nn]=Søppelfilinformasjon +Name[pa]=ਰੱਦੀ ਫਾਇਲ ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku w koszu +Name[pt]=Informações de Ficheiros no Lixo +Name[pt_BR]=Informações sobre o Arquivo de Lixo +Name[ro]=Informații fișier șters +Name[ru]=Сведения о файле в корзине +Name[rw]=Ibisobanuro byo Guta Idosiye +Name[se]=Ruskalihttedieđut +Name[sk]=Informácie o koši +Name[sl]=Informacije o Smeteh +Name[sr]=Информације о фајлу у смећу +Name[sr@Latn]=Informacije o fajlu u smeću +Name[sv]=Information om filer i papperskorgen +Name[ta]=குப்பைத்தொட்டி கோப்பு தகவல் +Name[te]=చెత్త బుట్ట దస్త్ర వివరాలు +Name[tg]=Файли ахборотии ахлотдон +Name[th]=ข้อมูลแฟ้มถังขยะ +Name[tr]=Çöp Dosya Bilgisi +Name[tt]=Taşlanğan Birem Turında +Name[uk]=Інформація про файл у смітнику +Name[uz]=Chiqindilar qutisi haqida maʼlumot +Name[uz@cyrillic]=Чиқиндилар қутиси ҳақида маълумот +Name[vi]=Thông tin về Tập tin trong Thùng rác +Name[wa]=Informåcion sol fitchî batch +Name[zh_CN]=回收站文件信息 +Name[zh_TW]=資源回收桶檔案資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_trash +X-TDE-Protocol=trash +PreferredGroups=General +PreferredItems=OriginalPath,DateOfDeletion diff --git a/tdeioslave/trash/tdefile-plugin/tdefile_trash.h b/tdeioslave/trash/tdefile-plugin/tdefile_trash.h new file mode 100644 index 000000000..71e4f2bff --- /dev/null +++ b/tdeioslave/trash/tdefile-plugin/tdefile_trash.h @@ -0,0 +1,42 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 David Faure <faure@kde.org> + * Based on tdefile_txt.h by Nadeem Hasan <nhasan@kde.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __TDEFILE_TRASH_H_ +#define __TDEFILE_TRASH_H_ + +#include <tdefilemetainfo.h> +#include "../trashimpl.h" + +class TQStringList; + +class KTrashPlugin: public KFilePlugin +{ + Q_OBJECT + +public: + KTrashPlugin(TQObject *parent, const char *name, const TQStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + +private: + void makeMimeTypeInfo(const TQString& mimeType); + TrashImpl impl; +}; + +#endif diff --git a/tdeioslave/trash/tdefile-plugin/tdefile_trash_system.desktop b/tdeioslave/trash/tdefile-plugin/tdefile_trash_system.desktop new file mode 100644 index 000000000..3413db36c --- /dev/null +++ b/tdeioslave/trash/tdefile-plugin/tdefile_trash_system.desktop @@ -0,0 +1,79 @@ +[Desktop Entry] +Type=Service +Name=Trash File Info +Name[af]=Asblik inligting +Name[ar]=معلومات مفل المهملات +Name[az]=Zibil Faylı Məlumatı +Name[be]=Інфармацыя аб файле сметніцы +Name[bg]=Информация за кошчето +Name[bn]=আবর্জনা ফাইল তথ্য +Name[br]=Titouroù diwar-benn ar pod-lastez +Name[bs]=Smeće informacije o datoteci +Name[ca]=Informació del fitxer paperera +Name[cs]=Info o koši +Name[csb]=Wëdowiédzô ò lopkù w kòszu +Name[da]=Fil-info om affald +Name[de]=Mülleimer-Information +Name[el]=Πληροφορίες για τον Κάδο Απορριμμάτων +Name[en_GB]=Wastebin File Info +Name[eo]=Rubuja informo +Name[es]=Información de la papelera +Name[et]=Prügikasti failiinfo +Name[eu]=Zakarontziaren infoa +Name[fa]=اطلاعات پروندۀ زباله +Name[fi]=Roskakorin tiedot +Name[fr]=Info Fichier Corbeille +Name[fy]=Jiskefet ynformaasje +Name[gl]=Información do Lixo +Name[he]=מידע אודות קובץ אשפה +Name[hi]=रद्दी फ़ाइल जानकारी +Name[hr]=Podaci o otpadu +Name[hu]=Szemétkosár-jellemzők +Name[is]=Upplýsingar um ruslaskrá +Name[it]=Informazioni file del cestino +Name[ja]=ごみ箱情報 +Name[ka]=ურნაში არსებული ფაილის შესახებ ცნობი +Name[kk]=Өшірілген файл мәліметі +Name[km]=ព័ត៌មានឯកសារសំរាម +Name[ko]=휴지통 파일 정보 +Name[lt]=Šiukšlių bylos informacija +Name[lv]=Atkritumu faila informācija +Name[mk]=Инфо. за датотека од Корпата +Name[ms]=Maklumat Fail Sampah +Name[mt]=Skart +Name[nb]=Søppelfilinformasjon +Name[nds]=Affalltünn-Informatschonen +Name[ne]=रद्दीटोकरी फाइल सूचना +Name[nl]=Prullenbakinformatie +Name[nn]=Søppelfilinformasjon +Name[pa]=ਰੱਦੀ ਫਾਇਲ ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku w koszu +Name[pt]=Informações de Ficheiros no Lixo +Name[pt_BR]=Informações sobre o Arquivo de Lixo +Name[ro]=Informații fișier șters +Name[ru]=Сведения о файле в корзине +Name[rw]=Ibisobanuro byo Guta Idosiye +Name[se]=Ruskalihttedieđut +Name[sk]=Informácie o koši +Name[sl]=Informacije o Smeteh +Name[sr]=Информације о фајлу у смећу +Name[sr@Latn]=Informacije o fajlu u smeću +Name[sv]=Information om filer i papperskorgen +Name[ta]=குப்பைத்தொட்டி கோப்பு தகவல் +Name[te]=చెత్త బుట్ట దస్త్ర వివరాలు +Name[tg]=Файли ахборотии ахлотдон +Name[th]=ข้อมูลแฟ้มถังขยะ +Name[tr]=Çöp Dosya Bilgisi +Name[tt]=Taşlanğan Birem Turında +Name[uk]=Інформація про файл у смітнику +Name[uz]=Chiqindilar qutisi haqida maʼlumot +Name[uz@cyrillic]=Чиқиндилар қутиси ҳақида маълумот +Name[vi]=Thông tin về Tập tin trong Thùng rác +Name[wa]=Informåcion sol fitchî batch +Name[zh_CN]=回收站文件信息 +Name[zh_TW]=資源回收桶檔案資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_trash +X-TDE-Protocol=system +PreferredGroups=General +PreferredItems=OriginalPath,DateOfDeletion |