mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Prepare the search criterion selector to use the new Nepomuk::Query::Term instead of a QString. The implementation still needs to be adapted, but this will be straight forward.
svn path=/trunk/KDE/kdebase/apps/; revision=1053447
This commit is contained in:
parent
61813e0df7
commit
7662e0e4d4
|
@ -195,10 +195,23 @@ kde4_add_app_icon(dolphin_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-fi
|
|||
|
||||
kde4_add_executable(dolphin ${dolphin_SRCS})
|
||||
|
||||
target_link_libraries(dolphin ${KDE4_KDEPRINT_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KUTILS_LIBRARY} konq dolphinprivate knewstuff2 ${KDE4_PHONON_LIBS})
|
||||
target_link_libraries(dolphin
|
||||
${KDE4_KDEPRINT_LIBS}
|
||||
${KDE4_KFILE_LIBS}
|
||||
${KDE4_KUTILS_LIBRARY}
|
||||
konq
|
||||
dolphinprivate
|
||||
knewstuff2
|
||||
${KDE4_PHONON_LIBS}
|
||||
)
|
||||
|
||||
if (Nepomuk_FOUND)
|
||||
target_link_libraries(dolphin ${NEPOMUK_LIBRARIES} ${SOPRANO_LIBRARIES})
|
||||
target_link_libraries(dolphin
|
||||
${NEPOMUK_LIBRARIES}
|
||||
${SOPRANO_LIBRARIES}
|
||||
${NEPOMUK_QUERY_LIBRARIES}
|
||||
nepomukannotation
|
||||
)
|
||||
endif (Nepomuk_FOUND)
|
||||
|
||||
install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "dolphin_searchsettings.h"
|
||||
#include "searchcriterionselector.h"
|
||||
|
||||
#include <nepomuk/andterm.h>
|
||||
#include <nepomuk/query.h>
|
||||
#include <nepomuk/term.h>
|
||||
|
||||
#include <kcombobox.h>
|
||||
#include <kdialog.h>
|
||||
#include <kicon.h>
|
||||
|
@ -173,17 +177,19 @@ DolphinSearchOptionsConfigurator::~DolphinSearchOptionsConfigurator()
|
|||
|
||||
KUrl DolphinSearchOptionsConfigurator::nepomukUrl() const
|
||||
{
|
||||
QString searchOptions;
|
||||
Nepomuk::Query::AndTerm andTerm;
|
||||
foreach (const SearchCriterionSelector* criterion, m_criterions) {
|
||||
const QString criterionString = criterion->toString();
|
||||
if (!criterionString.isEmpty()) {
|
||||
if (!searchOptions.isEmpty()) {
|
||||
searchOptions += ' ';
|
||||
}
|
||||
searchOptions += criterionString;
|
||||
}
|
||||
const Nepomuk::Query::Term term = criterion->queryTerm();
|
||||
andTerm.addSubTerm(term);
|
||||
}
|
||||
|
||||
// TODO: respect m_customSearchQuery
|
||||
|
||||
Nepomuk::Query::Query query;
|
||||
query.setTerm(andTerm);
|
||||
return query.toSearchUrl();
|
||||
|
||||
/*QString searchOptions;
|
||||
QString searchString = m_customSearchQuery;
|
||||
if (!searchString.isEmpty() && !searchOptions.isEmpty()) {
|
||||
searchString += ' ' + searchOptions;
|
||||
|
@ -192,7 +198,7 @@ KUrl DolphinSearchOptionsConfigurator::nepomukUrl() const
|
|||
}
|
||||
|
||||
searchString.insert(0, QLatin1String("nepomuksearch:/"));
|
||||
return KUrl(searchString);
|
||||
return KUrl(searchString);*/
|
||||
}
|
||||
|
||||
void DolphinSearchOptionsConfigurator::setCustomSearchQuery(const QString& searchQuery)
|
||||
|
|
|
@ -20,8 +20,16 @@
|
|||
|
||||
#include "searchcriterionselector.h"
|
||||
|
||||
#define DISABLE_NEPOMUK_LEGACY
|
||||
#include <nepomuk/comparisonterm.h>
|
||||
#include <nepomuk/nie.h>
|
||||
#include <nepomuk/literalterm.h>
|
||||
#include <nepomuk/query.h>
|
||||
|
||||
#include "searchcriterionvalue.h"
|
||||
|
||||
#include <Soprano/LiteralValue>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QList>
|
||||
|
@ -74,10 +82,10 @@ SearchCriterionSelector::~SearchCriterionSelector()
|
|||
{
|
||||
}
|
||||
|
||||
QString SearchCriterionSelector::toString() const
|
||||
Nepomuk::Query::Term SearchCriterionSelector::queryTerm() const
|
||||
{
|
||||
if (m_valueWidget == 0) {
|
||||
return QString();
|
||||
return Nepomuk::Query::Term();
|
||||
}
|
||||
|
||||
const int descIndex = m_descriptionsBox->currentIndex();
|
||||
|
@ -86,9 +94,15 @@ QString SearchCriterionSelector::toString() const
|
|||
const int compIndex = m_comparatorBox->currentIndex();
|
||||
const SearchCriterionDescription::Comparator& comp = descr.comparators()[compIndex];
|
||||
if (comp.operation.isEmpty()) {
|
||||
return QString();
|
||||
return Nepomuk::Query::Term();
|
||||
}
|
||||
|
||||
Nepomuk::Query::LiteralTerm literalTerm(Soprano::LiteralValue("dummy"));
|
||||
Nepomuk::Query::ComparisonTerm term(Nepomuk::Vocabulary::NIE::lastModified(),
|
||||
literalTerm,
|
||||
Nepomuk::Query::ComparisonTerm::Smaller);
|
||||
return term;
|
||||
/*
|
||||
QString criterion = comp.prefix + descr.identifier() + comp.operation;
|
||||
if (!m_valueWidget->value().isEmpty()) {
|
||||
const QString value = m_valueWidget->value();
|
||||
|
@ -100,7 +114,7 @@ QString SearchCriterionSelector::toString() const
|
|||
criterion += value;
|
||||
}
|
||||
}
|
||||
return criterion;
|
||||
return criterion;*/
|
||||
}
|
||||
|
||||
SearchCriterionSelector::Type SearchCriterionSelector::type() const
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#define DISABLE_NEPOMUK_LEGACY
|
||||
#include <nepomuk/term.h>
|
||||
#include <search/searchcriteriondescription.h>
|
||||
|
||||
class SearchCriterionValue;
|
||||
|
@ -50,11 +52,8 @@ public:
|
|||
SearchCriterionSelector(Type type, QWidget* parent = 0);
|
||||
virtual ~SearchCriterionSelector();
|
||||
|
||||
/**
|
||||
* Converts the string representation of the criterion.
|
||||
* The string is conform to get added to a nepomuk:/-URI.
|
||||
*/
|
||||
QString toString() const;
|
||||
/** Returns the query-term for the criterion. */
|
||||
Nepomuk::Query::Term queryTerm() const;
|
||||
|
||||
Type type() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue