[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/nepomuk-kde/scribo/plugins/pimo
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2010-11-22 15:06:56
Message-ID: 20101122150656.1ABC4AC8A3 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1199735 by trueg:
cancel gracefully
M +9 -2 pimotextmatchplugin.cpp
--- trunk/playground/base/nepomuk-kde/scribo/plugins/pimo/pimotextmatchplugin.cpp \
#1199734:1199735 @@ -59,16 +59,20 @@
void buildTokenTree();
QString m_text;
TokenTree* m_tokenTree;
+ bool m_canceled;
};
PimoTextMatchPlugin::WorkThread::WorkThread( QObject* parent )
: QThread(parent),
- m_tokenTree(0)
+ m_tokenTree(0),
+ m_canceled(false)
{
}
PimoTextMatchPlugin::WorkThread::~WorkThread()
{
+ m_canceled = true;
+ wait();
delete m_tokenTree;
}
@@ -87,7 +91,10 @@
Qt::QueuedConnection);
foreach(const QChar& ch, m_text) {
detector->update(ch);
+ if(m_canceled)
+ break;
}
+ if(!m_canceled)
detector->finish();
delete detector;
}
@@ -108,7 +115,7 @@
Soprano::QueryResultIterator it
= Nepomuk::ResourceManager::instance()->mainModel()->executeQuery( \
query.toSparqlQuery(),
\
Soprano::Query::QueryLanguageSparql );
- while ( it.next() ) {
+ while ( !m_canceled && it.next() ) {
const QUrl res( it[0].uri() );
const QString label( it[1].toString() );
m_tokenTree->add(label, QVariant::fromValue(res));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic