[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/nepomuk-kde/kioslaves/tags
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2008-01-22 11:43:41
Message-ID: 1201002221.352309.26759.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 764706 by trueg:
use Xesame
M +1 -0 CMakeLists.txt
M +17 -21 kio_tags.cpp
M +57 -57 kio_tags.h
--- trunk/playground/base/nepomuk-kde/kioslaves/tags/CMakeLists.txt #764705:764706
@@ -18,6 +18,7 @@
${KDE4_KDECORE_LIBS}
${KDE4_KIO_LIBS}
${NEPOMUK_LIBRARIES}
+ ${SOPRANO_LIBRARIES}
)
install(TARGETS kio_tags DESTINATION ${PLUGIN_INSTALL_DIR})
--- trunk/playground/base/nepomuk-kde/kioslaves/tags/kio_tags.cpp #764705:764706
@@ -3,7 +3,7 @@
* $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
*
* This file is part of the Nepomuk KDE project.
- * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
+ * Copyright (C) 2007-2008 Sebastian Trueg <trueg@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
@@ -30,6 +30,9 @@
#include <QtCore/QEventLoop>
+#include <Soprano/Vocabulary/Xesam>
+
+
using namespace KIO;
extern "C"
@@ -130,7 +133,7 @@
Q_UNUSED( permissions );
Q_UNUSED( flags );
- error( ERR_UNSUPPORTED_ACTION, i18n( "Cannot write files into a tag without a \
source URL" ) ); + error( ERR_UNSUPPORTED_ACTION, i18n( "Cannot put URL '%1' into \
a tag without a source URL", url.prettyUrl() ) ); }
@@ -149,7 +152,7 @@
res.addTag( Tag( newTag ) );
finished();
}
- }
+ }
}
}
@@ -252,10 +255,13 @@
// create a virtual folder stat thingi
KIO::UDSEntry uds;
uds.insert( KIO::UDSEntry::UDS_NAME, tag );
+ uds.insert( KIO::UDSEntry::UDS_URL, Tag( tag \
).resourceUri().toString() );
// FIXME: add this once we have the data
// uds.insert( KIO::UDS_CREATION_TIME, date );
+ uds.insert( KIO::UDSEntry::UDS_ACCESS, 0700 );
+ uds.insert( KIO::UDSEntry::UDS_USER, KUser().loginName() );
uds.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
uds.insert( KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1( \
"inode/directory" ) );
@@ -321,19 +327,10 @@
it != tags.end(); ++it ) {
Tag& tag = *it;
- if ( tag.identifiers().isEmpty() ) {
- if ( tag.label().isEmpty() ) {
- kDebug() << "Tag " << tag.uri() << " does not have any \
identifiers!";
- continue;
- }
- else {
- tag.addIdentifier( tag.label() );
- }
- }
-
// create a virtual folder stat thingi
KIO::UDSEntry uds;
- uds.insert( KIO::UDSEntry::UDS_NAME, tag.identifiers().first() );
+ uds.insert( KIO::UDSEntry::UDS_NAME, tag.genericLabel() );
+// uds.insert( KIO::UDSEntry::UDS_URL, tag.resourceUri().toString() );
// FIXME: add this once we have the data
// uds.insert( KIO::UDS_CREATION_TIME, date );
@@ -352,8 +349,7 @@
}
-static const char* s_nfoFileUrl = \
"http://ont.semanticdesktop.org/2007/03/22/nfo#fileUrl";
-
+// we only list files here ATM
void Nepomuk::TagsProtocol::listTag( const QString& tag )
{
kDebug() << ": " << tag;
@@ -366,10 +362,10 @@
it != taggedOnes.constEnd(); ++it ) {
const Resource& res = *it;
// FIXME: use the File class
- if ( res.hasProperty( s_nfoFileUrl ) ) {
- m_currentPath = KUrl( res.property( s_nfoFileUrl ).toString() ).path();
+ if ( res.hasProperty( Soprano::Vocabulary::Xesam::url().toString() ) ) {
+ m_currentUrl = KUrl( res.property( \
Soprano::Vocabulary::Xesam::url().toString() ).toString() );
- KIO::StatJob* job = KIO::stat( m_currentPath, false );
+ KIO::StatJob* job = KIO::stat( m_currentUrl, false );
connect( job, SIGNAL( result(KJob *) ),
this, SLOT( slotResult(KJob *) ) );
connect( job, SIGNAL( redirection(KIO::Job *, const KUrl &) ),
@@ -394,8 +390,8 @@
KIO::StatJob* stat_job = qobject_cast<KIO::StatJob*>(job);
if ( stat_job != 0 ) {
KIO::UDSEntry uds = stat_job->statResult();
-// uds[KIO::UDS_URL] = QString( "tags:/%1%2" ).arg( m_currentTag ).arg( \
m_currentPath );
- kDebug() << "listing URL: " << uds.stringValue( KIO::UDSEntry::UDS_URL \
); + // FIXME: The line below makes KDirModel crash since different \
protocols in one hierarchy are not allowed +// uds.insert( \
KIO::UDSEntry::UDS_URL, m_currentUrl.url() ); listEntry( uds, false );
}
}
--- trunk/playground/base/nepomuk-kde/kioslaves/tags/kio_tags.h #764705:764706
@@ -3,7 +3,7 @@
* $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
*
* This file is part of the Nepomuk KDE project.
- * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
+ * Copyright (C) 2007-2008 Sebastian Trueg <trueg@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
@@ -22,81 +22,81 @@
namespace Nepomuk {
class TagsProtocol : public KIO::ForwardingSlaveBase
{
- Q_OBJECT
+ Q_OBJECT
public:
- TagsProtocol( const QByteArray& poolSocket, const QByteArray& appSocket );
- virtual ~TagsProtocol();
+ TagsProtocol( const QByteArray& poolSocket, const QByteArray& appSocket );
+ virtual ~TagsProtocol();
- /**
- * List all files and folders tagged with the corresponding tag.
- */
- void listDir( const KUrl& url );
+ /**
+ * List all files and folders tagged with the corresponding tag.
+ */
+ void listDir( const KUrl& url );
- /**
- * Results in the creation of a new tag.
- */
- void mkdir( const KUrl &url, int permissions );
+ /**
+ * Results in the creation of a new tag.
+ */
+ void mkdir( const KUrl &url, int permissions );
- /**
- * Will be forwarded for files.
- */
- void get( const KUrl& url );
+ /**
+ * Will be forwarded for files.
+ */
+ void get( const KUrl& url );
- /**
- * Not supported.
- */
- void put( const KUrl& url, int permissions, KIO::JobFlags flags );
+ /**
+ * Not supported.
+ */
+ void put( const KUrl& url, int permissions, KIO::JobFlags flags );
- /**
- * Files and folders can be copied to the virtual folders resulting
- * is assignment of the corresponding tag.
- */
- void copy( const KUrl& src, const KUrl& dest, int permissions, KIO::JobFlags flags \
); + /**
+ * Files and folders can be copied to the virtual folders resulting
+ * is assignment of the corresponding tag.
+ */
+ void copy( const KUrl& src, const KUrl& dest, int permissions, KIO::JobFlags \
flags );
- /**
- * File renaming will be forwarded.
- * Folder renaming results in renaming of the tag.
- */
- void rename( const KUrl& src, const KUrl& dest, KIO::JobFlags flags );
+ /**
+ * File renaming will be forwarded.
+ * Folder renaming results in renaming of the tag.
+ */
+ void rename( const KUrl& src, const KUrl& dest, KIO::JobFlags flags );
- /**
- * File deletion means remocing the tag
- * Folder deletion will result in deletion of the tag.
- */
- void del( const KUrl& url, bool isfile );
+ /**
+ * File deletion means remocing the tag
+ * Folder deletion will result in deletion of the tag.
+ */
+ void del( const KUrl& url, bool isfile );
- /**
- * Files will be forwarded.
- * Folders will be created as virtual folders.
- */
- void mimetype( const KUrl& url );
+ /**
+ * Files will be forwarded.
+ * Folders will be created as virtual folders.
+ */
+ void mimetype( const KUrl& url );
- /**
- * Files will be forwarded.
- * Folders will be created as virtual folders.
- */
- void stat( const KUrl& url );
+ /**
+ * Files will be forwarded.
+ * Folders will be created as virtual folders.
+ */
+ void stat( const KUrl& url );
protected:
- /**
- * reimplemented from ForwardingSlaveBase
- */
- bool rewriteUrl( const KUrl& url, KUrl& newURL );
+ /**
+ * reimplemented from ForwardingSlaveBase
+ */
+ bool rewriteUrl( const KUrl& url, KUrl& newURL );
private Q_SLOTS:
- void slotRedirection( KIO::Job *job, const KUrl& url );
- void slotResult( KJob* job );
+ void slotRedirection( KIO::Job *job, const KUrl& url );
+ void slotResult( KJob* job );
private:
- bool splitUrl( const KUrl& url, QString& tag, QString& path, bool signalError = \
true );
- void listTags();
- void listTag( const QString& tag );
+ bool splitUrl( const KUrl& url, QString& tag, QString& path, bool \
signalError = true ); + void listTags();
+ void listTag( const QString& tag );
- QString m_currentTag;
- QString m_currentPath;
+ QString m_currentTag;
+ KUrl m_currentUrl;
- QEventLoop m_eventLoop;
+ QEventLoop m_eventLoop;
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic