NepomukDaemons
folderconnection.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "folderconnection.h"
00020 #include "folder.h"
00021
00022 #include <QtCore/QStringList>
00023
00024 #include <KDebug>
00025
00026 Nepomuk::Search::FolderConnection::FolderConnection( Folder* folder )
00027 : QObject( folder ),
00028 m_folder( folder )
00029 {
00030 connect( m_folder, SIGNAL( newEntries( QList<Nepomuk::Search::Result> ) ),
00031 this, SIGNAL( newEntries( QList<Nepomuk::Search::Result> ) ) );
00032 connect( m_folder, SIGNAL( entriesRemoved( QList<QUrl> ) ),
00033 this, SLOT( slotEntriesRemoved( QList<QUrl> ) ) );
00034 connect( m_folder, SIGNAL( finishedListing() ),
00035 this, SIGNAL( finishedListing() ) );
00036
00037 m_folder->addConnection( this );
00038 }
00039
00040
00041 Nepomuk::Search::FolderConnection::~FolderConnection()
00042 {
00043 m_folder->removeConnection( this );
00044 }
00045
00046
00047 void Nepomuk::Search::FolderConnection::list()
00048 {
00049 kDebug();
00050 if ( !m_folder->entries().isEmpty() ) {
00051 emit newEntries( m_folder->entries() );
00052 }
00053 if ( m_folder->initialListingDone() ) {
00054 emit finishedListing();
00055 }
00056 else {
00057
00058 m_folder->update();
00059 }
00060 }
00061
00062
00063 void Nepomuk::Search::FolderConnection::slotEntriesRemoved( QList<QUrl> entries )
00064 {
00065 QStringList uris;
00066 for ( int i = 0; i < entries.count(); ++i ) {
00067 uris.append( entries[i].toString() );
00068 }
00069 emit entriesRemoved( uris );
00070 }
00071
00072
00073 void Nepomuk::Search::FolderConnection::close()
00074 {
00075 kDebug();
00076 deleteLater();
00077 }
00078
00079 #include "folderconnection.moc"