diff options
Diffstat (limited to 'kioslave/trash/kfile-plugin')
-rw-r--r-- | kioslave/trash/kfile-plugin/Makefile.am | 14 | ||||
-rw-r--r-- | kioslave/trash/kfile-plugin/RETURNED_ITEMS | 4 | ||||
-rw-r--r-- | kioslave/trash/kfile-plugin/kfile_trash.cpp | 93 | ||||
-rw-r--r-- | kioslave/trash/kfile-plugin/kfile_trash.desktop | 79 | ||||
-rw-r--r-- | kioslave/trash/kfile-plugin/kfile_trash.h | 42 | ||||
-rw-r--r-- | kioslave/trash/kfile-plugin/kfile_trash_system.desktop | 79 |
6 files changed, 311 insertions, 0 deletions
diff --git a/kioslave/trash/kfile-plugin/Makefile.am b/kioslave/trash/kfile-plugin/Makefile.am new file mode 100644 index 000000000..0668553a8 --- /dev/null +++ b/kioslave/trash/kfile-plugin/Makefile.am @@ -0,0 +1,14 @@ +## Makefile.am for trash file meta info plugin + +AM_CPPFLAGS = $(all_includes) + +kde_module_LTLIBRARIES = kfile_trash.la + +kfile_trash_la_SOURCES = kfile_trash.cpp +kfile_trash_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kfile_trash_la_LIBADD = ../libtrashcommon.la $(LIB_KIO) + +METASOURCES = AUTO + +services_DATA = kfile_trash.desktop kfile_trash_system.desktop +servicesdir = $(kde_servicesdir) diff --git a/kioslave/trash/kfile-plugin/RETURNED_ITEMS b/kioslave/trash/kfile-plugin/RETURNED_ITEMS new file mode 100644 index 000000000..3e34c5b6d --- /dev/null +++ b/kioslave/trash/kfile-plugin/RETURNED_ITEMS @@ -0,0 +1,4 @@ +kfile_trash +=========== +QString OriginalPath +DateTime DateOfDeletion diff --git a/kioslave/trash/kfile-plugin/kfile_trash.cpp b/kioslave/trash/kfile-plugin/kfile_trash.cpp new file mode 100644 index 000000000..baa27143c --- /dev/null +++ b/kioslave/trash/kfile-plugin/kfile_trash.cpp @@ -0,0 +1,93 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 David Faure <faure@kde.org> + * Based on kfile_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 "kfile_trash.h" + +#include <kgenericfactory.h> +#include <kdebug.h> + +#include <qfile.h> +#include <qstringlist.h> +#include <qdatetime.h> + +typedef KGenericFactory<KTrashPlugin> TrashFactory; + +K_EXPORT_COMPONENT_FACTORY(kfile_trash, TrashFactory("kfile_trash")) + +KTrashPlugin::KTrashPlugin(QObject *parent, const char *name, + const QStringList &args) : KFilePlugin(parent, name, args) +{ + KGlobal::locale()->insertCatalogue( "kio_trash" ); + + kdDebug(7034) << "Trash file meta info plugin\n"; + + makeMimeTypeInfo("trash"); + makeMimeTypeInfo("system"); + + (void)impl.init(); +} + +void KTrashPlugin::makeMimeTypeInfo(const QString& mimeType) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); + + KFileMimeTypeInfo::GroupInfo* group = + addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + item = addItemInfo(group, "OriginalPath", i18n("Original Path"), QVariant::String); + item = addItemInfo(group, "DateOfDeletion", i18n("Date of Deletion"), QVariant::DateTime); +} + +bool KTrashPlugin::readInfo(KFileMetaInfo& info, uint) +{ + KURL url = info.url(); + + if ( url.protocol()=="system" + && url.path().startsWith("/trash") ) + { + QString 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; + QString fileId; + QString 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 "kfile_trash.moc" diff --git a/kioslave/trash/kfile-plugin/kfile_trash.desktop b/kioslave/trash/kfile-plugin/kfile_trash.desktop new file mode 100644 index 000000000..02d90422a --- /dev/null +++ b/kioslave/trash/kfile-plugin/kfile_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-KDE-Library=kfile_trash +X-KDE-Protocol=trash +PreferredGroups=General +PreferredItems=OriginalPath,DateOfDeletion diff --git a/kioslave/trash/kfile-plugin/kfile_trash.h b/kioslave/trash/kfile-plugin/kfile_trash.h new file mode 100644 index 000000000..8316f7402 --- /dev/null +++ b/kioslave/trash/kfile-plugin/kfile_trash.h @@ -0,0 +1,42 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 David Faure <faure@kde.org> + * Based on kfile_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 __KFILE_TRASH_H_ +#define __KFILE_TRASH_H_ + +#include <kfilemetainfo.h> +#include "../trashimpl.h" + +class QStringList; + +class KTrashPlugin: public KFilePlugin +{ + Q_OBJECT + +public: + KTrashPlugin(QObject *parent, const char *name, const QStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + +private: + void makeMimeTypeInfo(const QString& mimeType); + TrashImpl impl; +}; + +#endif diff --git a/kioslave/trash/kfile-plugin/kfile_trash_system.desktop b/kioslave/trash/kfile-plugin/kfile_trash_system.desktop new file mode 100644 index 000000000..5f57b5af3 --- /dev/null +++ b/kioslave/trash/kfile-plugin/kfile_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-KDE-Library=kfile_trash +X-KDE-Protocol=system +PreferredGroups=General +PreferredItems=OriginalPath,DateOfDeletion |