From 09983747f71fd7bd8f8dc0cece1fe3b4a996ef72 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 10 Feb 2013 10:10:45 +0100 Subject: Restore rekonq migration to nepomuk2 Being kde 4.10 been released, we are ready to. I yet could not understand if this compiles (without nepomuk) in 4.9. CCMAIL:david.narvaez@computer.org CCMAIL:me@vhanda.in REVIEW: 108152 --- src/urlbar/bookmarkwidget.cpp | 16 ++-- src/urlbar/bookmarkwidget.h | 13 ++- src/urlbar/newresourcedialog.cpp | 30 +++---- src/urlbar/newresourcedialog.h | 6 +- src/urlbar/resourcelinkdialog.cpp | 162 +++++++++++++++++++------------------- src/urlbar/resourcelinkdialog.h | 4 +- 6 files changed, 116 insertions(+), 115 deletions(-) (limited to 'src/urlbar') diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp index fc3139d0..f3ac6d9d 100644 --- a/src/urlbar/bookmarkwidget.cpp +++ b/src/urlbar/bookmarkwidget.cpp @@ -153,8 +153,8 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent) m_tagLine->setPlaceholderText(i18n("add tags(comma separated)")); - QList tagList = Nepomuk::Tag::allTags(); - Q_FOREACH(const Nepomuk::Tag &t, tagList) + QList tagList = Nepomuk2::Tag::allTags(); + Q_FOREACH(const Nepomuk2::Tag &t, tagList) { m_tList.append(t.label()); } @@ -287,9 +287,9 @@ void BookmarkWidget::removeBookmark() #ifdef HAVE_NEPOMUK -void BookmarkWidget::addTags(QList tagList) +void BookmarkWidget::addTags(QList tagList) { - Q_FOREACH(const Nepomuk::Tag & tag, tagList) + Q_FOREACH(const Nepomuk2::Tag & tag, tagList) { if (!m_nfoResource.tags().contains(tag)) { @@ -297,7 +297,7 @@ void BookmarkWidget::addTags(QList tagList) } } - Q_FOREACH(Nepomuk::Tag tag, m_nfoResource.tags()) + Q_FOREACH(Nepomuk2::Tag tag, m_nfoResource.tags()) { if (!tagList.contains(tag)) { @@ -308,7 +308,7 @@ void BookmarkWidget::addTags(QList tagList) void BookmarkWidget::parseTags() { - QList tagList; + QList tagList; if (m_tagLine->text().contains(',')) { QString text = m_tagLine->text(); @@ -334,7 +334,7 @@ void BookmarkWidget::loadTags() QString list; if (!m_nfoResource.tags().isEmpty()) { - Q_FOREACH(const Nepomuk::Tag & tag, m_nfoResource.tags()) + Q_FOREACH(const Nepomuk2::Tag & tag, m_nfoResource.tags()) { list.append(tag.genericLabel()); list.append(","); @@ -358,7 +358,7 @@ void BookmarkWidget::addCommentSlot() void BookmarkWidget::linkToResourceSlot() { - QPointer r = new Nepomuk::ResourceLinkDialog(m_nfoResource); + QPointer r = new Nepomuk2::ResourceLinkDialog(m_nfoResource); r->exec(); r->deleteLater(); diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h index 39f6fbd4..e6021c90 100644 --- a/src/urlbar/bookmarkwidget.h +++ b/src/urlbar/bookmarkwidget.h @@ -34,14 +34,11 @@ #include #include -// Nepomuk config include -#include - // Nepomuk Includes #ifdef HAVE_NEPOMUK -#include -#include -#include +#include +#include +#include #endif // Forward Declarations @@ -61,7 +58,7 @@ public: void showAt(const QPoint &pos); #ifdef HAVE_NEPOMUK - void addTags(QList); + void addTags(QList); void parseTags(); void loadTags(); #endif @@ -91,7 +88,7 @@ private: QStringList m_tList; #ifdef HAVE_NEPOMUK - Nepomuk::Resource m_nfoResource; + Nepomuk2::Resource m_nfoResource; bool m_isNepomukEnabled; #endif }; diff --git a/src/urlbar/newresourcedialog.cpp b/src/urlbar/newresourcedialog.cpp index 39cffc36..592d1b31 100644 --- a/src/urlbar/newresourcedialog.cpp +++ b/src/urlbar/newresourcedialog.cpp @@ -29,10 +29,10 @@ #include "newresourcedialog.moc" // Nepomuk Includes -#include -#include -#include -#include +#include +#include +#include +#include // Qt Includes #include @@ -40,20 +40,20 @@ #include -class Nepomuk::NewResourceDialog::Private +class Nepomuk2::NewResourceDialog::Private { public: KLineEdit *m_resourceName; QPlainTextEdit *m_description; QLabel *m_titleResource; QLabel *m_desResource; - Nepomuk::NewResourceDialog *q; - Nepomuk::Resource m_nofResource; + Nepomuk2::NewResourceDialog *q; + Nepomuk2::Resource m_nofResource; int m_index; }; -Nepomuk::NewResourceDialog::NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent): +Nepomuk2::NewResourceDialog::NewResourceDialog(int index, Nepomuk2::Resource& nfoResource, QWidget* parent): KDialog(parent), d(new Private()) { @@ -80,41 +80,41 @@ Nepomuk::NewResourceDialog::NewResourceDialog(int index, Nepomuk::Resource& nfoR } -Nepomuk::NewResourceDialog::~NewResourceDialog() +Nepomuk2::NewResourceDialog::~NewResourceDialog() { delete d; } -void Nepomuk::NewResourceDialog::newResourceSlot() +void Nepomuk2::NewResourceDialog::newResourceSlot() { if (d->m_index == 1) { - Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Person()); + Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Person()); newResource.addSymbol("user-identity"); d->m_nofResource.addIsRelated(newResource); } else if (d->m_index == 2) { - Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Project()); + Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Project()); newResource.addSymbol("project-development"); d->m_nofResource.addIsRelated(newResource); } else if (d->m_index == 3) { - Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Task()); + Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Task()); newResource.addSymbol("view-pim-tasks"); d->m_nofResource.addIsRelated(newResource); } else if (d->m_index == 4) { - Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Location()); + Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Location()); newResource.addSymbol("user-location"); d->m_nofResource.addIsRelated(newResource); } else if (d->m_index == 5) { - Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Note()); + Nepomuk2::Resource newResource(d->m_resourceName->text(), Nepomuk2::Vocabulary::PIMO::Note()); newResource.addSymbol("knotes"); d->m_nofResource.addIsRelated(newResource); } diff --git a/src/urlbar/newresourcedialog.h b/src/urlbar/newresourcedialog.h index 651c631c..7aacb358 100644 --- a/src/urlbar/newresourcedialog.h +++ b/src/urlbar/newresourcedialog.h @@ -32,17 +32,17 @@ #include #include -#include +#include -namespace Nepomuk +namespace Nepomuk2 { class NewResourceDialog : public KDialog { Q_OBJECT public: - explicit NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent = 0); + explicit NewResourceDialog(int index, Nepomuk2::Resource& nfoResource, QWidget* parent = 0); virtual ~NewResourceDialog(); private Q_SLOTS: diff --git a/src/urlbar/resourcelinkdialog.cpp b/src/urlbar/resourcelinkdialog.cpp index 80369b17..668dc65e 100644 --- a/src/urlbar/resourcelinkdialog.cpp +++ b/src/urlbar/resourcelinkdialog.cpp @@ -54,18 +54,22 @@ #include // Nepomuk Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -class Nepomuk::ResourceLinkDialog::Private +#include +#include +#include +#include +#include +#include +#include +#include + +// Nepomuk Ported Classes +#include "nepomuk/utils/simpleresourcemodel.h" + +// Soprano Includes +#include + +class Nepomuk2::ResourceLinkDialog::Private { public: void _k_selectionChanged(); @@ -82,20 +86,20 @@ public: QPushButton *m_newResourceButton; Utils::SimpleResourceModel *m_resourceModel; Utils::SimpleResourceModel *m_linkedResourceModel; - Nepomuk::ResourceLinkDialog *q; + Nepomuk2::ResourceLinkDialog *q; - Nepomuk::Resource m_nfoResource; + Nepomuk2::Resource m_nfoResource; }; -void Nepomuk::ResourceLinkDialog::Private::_k_selectionChanged() +void Nepomuk2::ResourceLinkDialog::Private::_k_selectionChanged() { q->enableButton(KDialog::User1, !m_resourceView->selectionModel()->selectedRows().isEmpty()); } -Nepomuk::ResourceLinkDialog::ResourceLinkDialog(Nepomuk::Resource &nfoResource, QWidget* parent): +Nepomuk2::ResourceLinkDialog::ResourceLinkDialog(Nepomuk2::Resource &nfoResource, QWidget* parent): KDialog(parent), d(new Private()) { @@ -182,21 +186,21 @@ Nepomuk::ResourceLinkDialog::ResourceLinkDialog(Nepomuk::Resource &nfoResource, } -Nepomuk::ResourceLinkDialog::~ResourceLinkDialog() +Nepomuk2::ResourceLinkDialog::~ResourceLinkDialog() { delete d; } -void Nepomuk::ResourceLinkDialog::setRelatedResources() +void Nepomuk2::ResourceLinkDialog::setRelatedResources() { - QList relatedResourceList = d->m_nfoResource.isRelateds(); + QList relatedResourceList = d->m_nfoResource.isRelateds(); d->m_linkedResourceModel->setResources(relatedResourceList); } -void Nepomuk::ResourceLinkDialog::linkResourceSlot() +void Nepomuk2::ResourceLinkDialog::linkResourceSlot() { QModelIndexList selectedResourceList; selectedResourceList << d->m_resourceView->selectionModel()->selectedIndexes(); @@ -209,16 +213,16 @@ void Nepomuk::ResourceLinkDialog::linkResourceSlot() } -void Nepomuk::ResourceLinkDialog::unlinkResourceSlot() +void Nepomuk2::ResourceLinkDialog::unlinkResourceSlot() { - d->m_nfoResource.removeProperty(Nepomuk::Resource::isRelatedUri(), + d->m_nfoResource.removeProperty(Soprano::Vocabulary::NAO::isRelated().toString(), d->m_linkedResourceModel->resourceForIndex( d->m_linkedResources->selectionModel()->currentIndex())); setRelatedResources(); } -void Nepomuk::ResourceLinkDialog::showContextMenu(const QPoint &pos) +void Nepomuk2::ResourceLinkDialog::showContextMenu(const QPoint &pos) { d->m_removeResourceAction = new KAction(this); d->m_removeResourceAction->setText(i18n("&Unlink ")); @@ -232,9 +236,9 @@ void Nepomuk::ResourceLinkDialog::showContextMenu(const QPoint &pos) } -void Nepomuk::ResourceLinkDialog::createNewResourceSlot() +void Nepomuk2::ResourceLinkDialog::createNewResourceSlot() { - QPointer r = new Nepomuk::NewResourceDialog(d->m_resourceSelect->currentIndex(), d->m_nfoResource); + QPointer r = new Nepomuk2::NewResourceDialog(d->m_resourceSelect->currentIndex(), d->m_nfoResource); r->exec(); setRelatedResources(); @@ -243,60 +247,60 @@ void Nepomuk::ResourceLinkDialog::createNewResourceSlot() } -void Nepomuk::ResourceLinkDialog::dynamicSearchingSlot() +void Nepomuk2::ResourceLinkDialog::dynamicSearchingSlot() { - Nepomuk::Query::Query query; - Nepomuk::Query::QueryServiceClient *test; + Nepomuk2::Query::Query query; + Nepomuk2::Query::QueryServiceClient *test; switch (d->m_resourceSelect->currentIndex()) { case 1: - query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person()); - test = new Nepomuk::Query::QueryServiceClient(this); + query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Person()); + test = new Nepomuk2::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList)), - d->m_resourceModel, SLOT(addResults(QList))); + connect(test, SIGNAL(newEntries(QList)), + d->m_resourceModel, SLOT(addResults(QList))); break; case 2: - query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project()); - test = new Nepomuk::Query::QueryServiceClient(this); + query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Project()); + test = new Nepomuk2::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList)), - d->m_resourceModel, SLOT(addResults(QList))); + connect(test, SIGNAL(newEntries(QList)), + d->m_resourceModel, SLOT(addResults(QList))); break; case 3: - query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task()); - test = new Nepomuk::Query::QueryServiceClient(this); + query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Task()); + test = new Nepomuk2::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList)), - d->m_resourceModel, SLOT(addResults(QList))); + connect(test, SIGNAL(newEntries(QList)), + d->m_resourceModel, SLOT(addResults(QList))); break; case 4: - query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location()); - test = new Nepomuk::Query::QueryServiceClient(this); + query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Location()); + test = new Nepomuk2::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList)), - d->m_resourceModel, SLOT(addResults(QList))); + connect(test, SIGNAL(newEntries(QList)), + d->m_resourceModel, SLOT(addResults(QList))); break; case 5: - query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text()); - query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note()); - test = new Nepomuk::Query::QueryServiceClient(this); + query = Nepomuk2::Query::QueryParser::parseQuery(d->m_searchBox->text()); + query = query && Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Note()); + test = new Nepomuk2::Query::QueryServiceClient(this); test->query(query); d->m_resourceModel->clear(); - connect(test, SIGNAL(newEntries(QList)), - d->m_resourceModel, SLOT(addResults(QList))); + connect(test, SIGNAL(newEntries(QList)), + d->m_resourceModel, SLOT(addResults(QList))); break; default: @@ -305,7 +309,7 @@ void Nepomuk::ResourceLinkDialog::dynamicSearchingSlot() } -void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index) +void Nepomuk2::ResourceLinkDialog::resourceSelectedSlot(int index) { enableButton(User1, true); d->m_newResourceButton->setEnabled(true); @@ -317,12 +321,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index) //List Personal Contacts if (index == 1) { - Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person()); - Nepomuk::Query::Query query(term); + Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Person()); + Nepomuk2::Query::Query query(term); query.setLimit(20); - QListresults = Nepomuk::Query::QueryServiceClient::syncQuery(query); - QList resource; - Q_FOREACH(const Nepomuk::Query::Result & result, results) + QListresults = Nepomuk2::Query::QueryServiceClient::syncQuery(query); + QList resource; + Q_FOREACH(const Nepomuk2::Query::Result & result, results) { resource.append(result.resource()); } @@ -331,12 +335,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index) //List Projects else if (index == 2) { - Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project()); - Nepomuk::Query::Query query(term); + Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Project()); + Nepomuk2::Query::Query query(term); query.setLimit(20); - QListresults = Nepomuk::Query::QueryServiceClient::syncQuery(query); - QList resource; - Q_FOREACH(const Nepomuk::Query::Result & result, results) + QListresults = Nepomuk2::Query::QueryServiceClient::syncQuery(query); + QList resource; + Q_FOREACH(const Nepomuk2::Query::Result & result, results) { resource.append(result.resource()); } @@ -345,12 +349,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index) //List Tasks else if (index == 3) { - Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task()); - Nepomuk::Query::Query query(term); + Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Task()); + Nepomuk2::Query::Query query(term); query.setLimit(20); - QListresults = Nepomuk::Query::QueryServiceClient::syncQuery(query); - QList resource; - Q_FOREACH(const Nepomuk::Query::Result & result, results) + QListresults = Nepomuk2::Query::QueryServiceClient::syncQuery(query); + QList resource; + Q_FOREACH(const Nepomuk2::Query::Result & result, results) { resource.append(result.resource()); } @@ -359,12 +363,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index) //List Places else if (index == 4) { - Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location()); - Nepomuk::Query::Query query(term); + Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Location()); + Nepomuk2::Query::Query query(term); query.setLimit(20); - QListresults = Nepomuk::Query::QueryServiceClient::syncQuery(query); - QList resource; - Q_FOREACH(const Nepomuk::Query::Result & result, results) + QListresults = Nepomuk2::Query::QueryServiceClient::syncQuery(query); + QList resource; + Q_FOREACH(const Nepomuk2::Query::Result & result, results) { resource.append(result.resource()); } @@ -373,12 +377,12 @@ void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index) //List Notes else if (index == 5) { - Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note()); - Nepomuk::Query::Query query(term); + Nepomuk2::Query::Term term = Nepomuk2::Query::ResourceTypeTerm(Nepomuk2::Vocabulary::PIMO::Note()); + Nepomuk2::Query::Query query(term); query.setLimit(20); - QListresults = Nepomuk::Query::QueryServiceClient::syncQuery(query); - QList resource; - Q_FOREACH(const Nepomuk::Query::Result & result, results) + QListresults = Nepomuk2::Query::QueryServiceClient::syncQuery(query); + QList resource; + Q_FOREACH(const Nepomuk2::Query::Result & result, results) { resource.append(result.resource()); } diff --git a/src/urlbar/resourcelinkdialog.h b/src/urlbar/resourcelinkdialog.h index e628aa10..689ef4fe 100644 --- a/src/urlbar/resourcelinkdialog.h +++ b/src/urlbar/resourcelinkdialog.h @@ -36,7 +36,7 @@ #include -namespace Nepomuk +namespace Nepomuk2 { class Resource; @@ -50,7 +50,7 @@ class ResourceLinkDialog : public KDialog Q_OBJECT public: - explicit ResourceLinkDialog(Nepomuk::Resource& nfoResource, QWidget* parent = 0); + explicit ResourceLinkDialog(Nepomuk2::Resource& nfoResource, QWidget* parent = 0); virtual ~ResourceLinkDialog(); void setRelatedResources(); -- cgit v1.2.1