[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase
From: Kévin Ottens <ervin () ipsquad ! net>
Date: 2005-06-29 18:04:43
Message-ID: 1120068283.759355.11417.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 429988 by ervin:
Take care of the fact that the trash can be accessed
through trash:/ or system:/trash/
M +1 -1 kioslave/trash/kfile-plugin/Makefile.am
M +23 -5 kioslave/trash/kfile-plugin/kfile_trash.cpp
A kioslave/trash/kfile-plugin/kfile_trash_system.desktop
M +6 -0 kioslave/trash/ktrash.cpp
M +14 -3 libkonq/konq_operations.cc
--- trunk/KDE/kdebase/kioslave/trash/kfile-plugin/Makefile.am #429987:429988
@@ -10,5 +10,5 @@
METASOURCES = AUTO
-services_DATA = kfile_trash.desktop
+services_DATA = kfile_trash.desktop kfile_trash_system.desktop
servicesdir = $(kde_servicesdir)
--- trunk/KDE/kdebase/kioslave/trash/kfile-plugin/kfile_trash.cpp #429987:429988
@@ -37,28 +37,46 @@
KGlobal::locale()->insertCatalogue( "kio_trash" );
kdDebug(7034) << "Trash file meta info plugin\n";
- KFileMimeTypeInfo* info = addMimeTypeInfo( "trash" );
+ 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);
-
- (void)impl.init();
}
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 ( info.url().protocol() != "trash" )
+ if ( url.protocol() != "trash" )
return false;
int trashId;
QString fileId;
QString relativePath;
- if ( !TrashImpl::parseURL( info.url(), trashId, fileId, relativePath ) )
+ if ( !TrashImpl::parseURL( url, trashId, fileId, relativePath ) )
return false;
TrashImpl::TrashedFileInfo trashInfo;
--- trunk/KDE/kdebase/kioslave/trash/ktrash.cpp #429987:429988
@@ -76,6 +76,12 @@
QCString restoreArg = args->getOption( "restore" );
if ( !restoreArg.isEmpty() ) {
+
+ if (restoreArg.find("system:/trash")==0) {
+ restoreArg.remove(0, 13);
+ restoreArg.prepend("trash:");
+ }
+
KURL trashURL( restoreArg );
if ( !trashURL.isValid() || trashURL.protocol() != "trash" ) {
kdError() << "Invalid URL for restoring a trashed file:" << trashURL << endl;
--- trunk/KDE/kdebase/libkonq/konq_operations.cc #429987:429988
@@ -766,11 +766,22 @@
if ( m_urlsIterator != m_urls.end() )
{
const KURL& url = *m_urlsIterator;
- Q_ASSERT( url.protocol() == "trash" );
+
+ KURL new_url = url;
+ if ( new_url.protocol()=="system"
+ && new_url.path().startsWith("/trash") )
+ {
+ QString path = new_url.path();
+ path.remove(0, 6);
+ new_url.setProtocol("trash");
+ new_url.setPath(path);
+ }
+
+ Q_ASSERT( new_url.protocol() == "trash" );
QByteArray packedArgs;
QDataStream stream( packedArgs, IO_WriteOnly );
- stream << (int)3 << url;
- KIO::Job* job = KIO::special( url, packedArgs );
+ stream << (int)3 << new_url;
+ KIO::Job* job = KIO::special( new_url, packedArgs );
addSubjob( job );
}
else // done!
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic