delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / nepomuk / services / queryservice / folderconnection.cpp
blob0004e0162666668f347982469561b894ce7661f1
1 /*
2 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #include "folderconnection.h"
20 #include "folder.h"
22 #include <QtCore/QStringList>
24 #include <KDebug>
26 Nepomuk::Search::FolderConnection::FolderConnection( Folder* folder )
27 : QObject( folder ),
28 m_folder( folder )
30 connect( m_folder, SIGNAL( newEntries( QList<Nepomuk::Search::Result> ) ),
31 this, SIGNAL( newEntries( QList<Nepomuk::Search::Result> ) ) );
32 connect( m_folder, SIGNAL( entriesRemoved( QList<QUrl> ) ),
33 this, SLOT( slotEntriesRemoved( QList<QUrl> ) ) );
34 connect( m_folder, SIGNAL( finishedListing() ),
35 this, SIGNAL( finishedListing() ) );
37 m_folder->addConnection( this );
41 Nepomuk::Search::FolderConnection::~FolderConnection()
43 m_folder->removeConnection( this );
47 void Nepomuk::Search::FolderConnection::list()
49 kDebug();
50 if ( !m_folder->entries().isEmpty() ) {
51 emit newEntries( m_folder->entries() );
53 if ( m_folder->initialListingDone() ) {
54 emit finishedListing();
56 else {
57 // make sure the search has actually been started
58 m_folder->update();
63 void Nepomuk::Search::FolderConnection::slotEntriesRemoved( QList<QUrl> entries )
65 QStringList uris;
66 for ( int i = 0; i < entries.count(); ++i ) {
67 uris.append( entries[i].toString() );
69 emit entriesRemoved( uris );
73 void Nepomuk::Search::FolderConnection::close()
75 kDebug();
76 deleteLater();
79 #include "folderconnection.moc"