diff options
Diffstat (limited to 'src/urlbar/resourcelinkdialog.cpp')
-rw-r--r-- | src/urlbar/resourcelinkdialog.cpp | 162 |
1 files changed, 79 insertions, 83 deletions
diff --git a/src/urlbar/resourcelinkdialog.cpp b/src/urlbar/resourcelinkdialog.cpp index dbff77b8..799171f2 100644 --- a/src/urlbar/resourcelinkdialog.cpp +++ b/src/urlbar/resourcelinkdialog.cpp @@ -54,22 +54,18 @@ #include <KIcon> // Nepomuk Includes -#include <Nepomuk2/Query/Term> -#include <Nepomuk2/Query/Result> -#include <Nepomuk2/Query/ResourceTypeTerm> -#include <Nepomuk2/Query/QueryServiceClient> -#include <Nepomuk2/Vocabulary/PIMO> -#include <Nepomuk2/Vocabulary/NCO> -#include <Nepomuk2/Query/QueryParser> -#include <Nepomuk2/Variant> - -// Nepomuk Ported Classes -#include "nepomuk/utils/simpleresourcemodel.h" - -// Soprano Includes -#include <Soprano/Vocabulary/NAO> - -class Nepomuk2::ResourceLinkDialog::Private +#include <Nepomuk/Utils/SimpleResourceModel> +#include <Nepomuk/Query/Term> +#include <Nepomuk/Query/Result> +#include <Nepomuk/Query/ResourceTypeTerm> +#include <Nepomuk/Query/QueryServiceClient> +#include <Nepomuk/Vocabulary/PIMO> +#include <Nepomuk/Vocabulary/NCO> +#include <Nepomuk/Query/QueryParser> +#include <Nepomuk/Variant> + + +class Nepomuk::ResourceLinkDialog::Private { public: void _k_selectionChanged(); @@ -86,20 +82,20 @@ public: QPushButton *m_newResourceButton; Utils::SimpleResourceModel *m_resourceModel; Utils::SimpleResourceModel *m_linkedResourceModel; - Nepomuk2::ResourceLinkDialog *q; + Nepomuk::ResourceLinkDialog *q; - Nepomuk2::Resource m_nfoResource; + Nepomuk::Resource m_nfoResource; }; -void Nepomuk2::ResourceLinkDialog::Private::_k_selectionChanged() +void Nepomuk::ResourceLinkDialog::Private::_k_selectionChanged() { q->enableButton(KDialog::User1, !m_resourceView->selectionModel()->selectedRows().isEmpty()); } -Nepomuk2::ResourceLinkDialog::ResourceLinkDialog(Nepomuk2::Resource &nfoResource, QWidget* parent): +Nepomuk::ResourceLinkDialog::ResourceLinkDialog(Nepomuk::Resource &nfoResource, QWidget* parent): KDialog(parent), d(new Private()) { @@ -186,21 +182,21 @@ Nepomuk2::ResourceLinkDialog::ResourceLinkDialog(Nepomuk2::Resource &nfoResource } -Nepomuk2::ResourceLinkDialog::~ResourceLinkDialog() +Nepomuk::ResourceLinkDialog::~ResourceLinkDialog() { delete d; } -void Nepomuk2::ResourceLinkDialog::setRelatedResources() +void Nepomuk::ResourceLinkDialog::setRelatedResources() { - QList<Nepomuk2::Resource> relatedResourceList = d->m_nfoResource.isRelateds(); + QList<Nepomuk::Resource> relatedResourceList = d->m_nfoResource.isRelateds(); d->m_linkedResourceModel->setResources(relatedResourceList); } -void Nepomuk2::ResourceLinkDialog::linkResourceSlot() +void Nepomuk::ResourceLinkDialog::linkResourceSlot() { QModelIndexList selectedResourceList; selectedResourceList << d->m_resourceView->selectionModel()->selectedIndexes(); @@ -213,16 +209,16 @@ void Nepomuk2::ResourceLinkDialog::linkResourceSlot() } -void Nepomuk2::ResourceLinkDialog::unlinkResourceSlot() +void Nepomuk::ResourceLinkDialog::unlinkResourceSlot() { - d->m_nfoResource.removeProperty(Soprano::Vocabulary::NAO::isRelated().toString(), + d->m_nfoResource.removeProperty(Nepomuk::Resource::isRelatedUri(), d->m_linkedResourceModel->resourceForIndex( d->m_linkedResources->selectionModel()->currentIndex())); setRelatedResources(); } -void Nepomuk2::ResourceLinkDialog::showContextMenu(const QPoint &pos) +void Nepomuk::ResourceLinkDialog::showContextMenu(const QPoint &pos) { d->m_removeResourceAction = new KAction(this); d->m_removeResourceAction->setText(i18n("&Unlink ")); @@ -236,9 +232,9 @@ void Nepomuk2::ResourceLinkDialog::showContextMenu(const QPoint &pos) } -void Nepomuk2::ResourceLinkDialog::createNewResourceSlot() +void Nepomuk::ResourceLinkDialog::createNewResourceSlot() { - QPointer<Nepomuk2::NewResourceDialog> r = new Nepomuk2::NewResourceDialog(d->m_resourceSelect->currentIndex(), d->m_nfoResource); + QPointer<Nepomuk::NewResourceDialog> r = new Nepomuk::NewResourceDialog(d->m_resourceSelect->currentIndex(), d->m_nfoResource); r->exec(); setRelatedResources(); @@ -247,60 +243,60 @@ void Nepomuk2::ResourceLinkDialog::createNewResourceSlot() } -void Nepomuk2::ResourceLinkDialog::dynamicSearchingSlot() +void Nepomuk::ResourceLinkDialog::dynamicSearchingSlot() { - Nepomuk2::Query::Query query; - Nepomuk2::Query::QueryServiceClient *test; + Nepomuk::Query::Query query; + Nepomuk::Query::QueryServiceClient *test; switch (d->m_resourceSelect->currentIndex()) { case 1: - query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Person()); - test = new Nepomuk2::Query::QueryServiceClient(this); + query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person()); + test = new Nepomuk::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)), - d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>))); + connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)), + d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>))); break; case 2: - query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Project()); - test = new Nepomuk2::Query::QueryServiceClient(this); + query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project()); + test = new Nepomuk::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)), - d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>))); + connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)), + d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>))); break; case 3: - query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Task()); - test = new Nepomuk2::Query::QueryServiceClient(this); + query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task()); + test = new Nepomuk::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)), - d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>))); + connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)), + d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>))); break; case 4: - query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Location()); - test = new Nepomuk2::Query::QueryServiceClient(this); + query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location()); + test = new Nepomuk::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)), - d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>))); + connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)), + d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>))); break; case 5: - query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Note()); - test = new Nepomuk2::Query::QueryServiceClient(this); + query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note()); + test = new Nepomuk::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)), - d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>))); + connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)), + d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>))); break; default: @@ -309,7 +305,7 @@ void Nepomuk2::ResourceLinkDialog::dynamicSearchingSlot() } -void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index) +void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index) { enableButton(User1, true); d->m_newResourceButton->setEnabled(true); @@ -321,12 +317,12 @@ void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index) //List Personal Contacts if (index == 1) { - Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Person()); - Nepomuk2::Query::Query query(term); + Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person()); + Nepomuk::Query::Query query(term); query.setLimit(20); - QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query); - QList <Nepomuk2::Resource> resource; - Q_FOREACH(const Nepomuk2::Query::Result & result, results) + QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query); + QList <Nepomuk::Resource> resource; + Q_FOREACH(const Nepomuk::Query::Result & result, results) { resource.append(result.resource()); } @@ -335,12 +331,12 @@ void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index) //List Projects else if (index == 2) { - Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Project()); - Nepomuk2::Query::Query query(term); + Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project()); + Nepomuk::Query::Query query(term); query.setLimit(20); - QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query); - QList <Nepomuk2::Resource> resource; - Q_FOREACH(const Nepomuk2::Query::Result & result, results) + QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query); + QList <Nepomuk::Resource> resource; + Q_FOREACH(const Nepomuk::Query::Result & result, results) { resource.append(result.resource()); } @@ -349,12 +345,12 @@ void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index) //List Tasks else if (index == 3) { - Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Task()); - Nepomuk2::Query::Query query(term); + Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task()); + Nepomuk::Query::Query query(term); query.setLimit(20); - QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query); - QList <Nepomuk2::Resource> resource; - Q_FOREACH(const Nepomuk2::Query::Result & result, results) + QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query); + QList <Nepomuk::Resource> resource; + Q_FOREACH(const Nepomuk::Query::Result & result, results) { resource.append(result.resource()); } @@ -363,12 +359,12 @@ void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index) //List Places else if (index == 4) { - Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Location()); - Nepomuk2::Query::Query query(term); + Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location()); + Nepomuk::Query::Query query(term); query.setLimit(20); - QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query); - QList <Nepomuk2::Resource> resource; - Q_FOREACH(const Nepomuk2::Query::Result & result, results) + QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query); + QList <Nepomuk::Resource> resource; + Q_FOREACH(const Nepomuk::Query::Result & result, results) { resource.append(result.resource()); } @@ -377,12 +373,12 @@ void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index) //List Notes else if (index == 5) { - Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Note()); - Nepomuk2::Query::Query query(term); + Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note()); + Nepomuk::Query::Query query(term); query.setLimit(20); - QList<Nepomuk2::Query::Result>results = Nepomuk2::Query::QueryServiceClient::syncQuery(query); - QList <Nepomuk2::Resource> resource; - Q_FOREACH(const Nepomuk2::Query::Result & result, results) + QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query); + QList <Nepomuk::Resource> resource; + Q_FOREACH(const Nepomuk::Query::Result & result, results) { resource.append(result.resource()); } |