diff --git a/CMakeLists.txt b/CMakeLists.txt index 501299b..acb98dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,36 +1,34 @@ project(Koko) cmake_minimum_required(VERSION 2.8.12) find_package(ECM 0.0.9 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH}) find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Qml Quick Widgets Test Sql Positioning) find_package(KF5 5.5 REQUIRED COMPONENTS I18n Declarative Config DBusAddons KIO) find_package(Exiv2 0.21 REQUIRED) -find_package(KF5Baloo) - include(FeatureSummary) include(ECMAddTests) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) include(GenerateExportHeader) include(ECMInstallIcons) include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src ${EXIV2_INCLUDE_DIR} ) kde_enable_exceptions() add_subdirectory(src) add_subdirectory(autotests) add_subdirectory(qml) add_subdirectory(qmlUiKirigami) add_subdirectory(icons) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/qml/BalooDisabled.qml b/qml/BalooDisabled.qml deleted file mode 100644 index 925ea0f..0000000 --- a/qml/BalooDisabled.qml +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2014-2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -import QtQuick 2.1 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.1 as QtControls - -Item { - signal finished() - - ColumnLayout { - anchors.centerIn: parent - - Heading { - text: "Koko" - font.bold: true - font.pointSize: 100 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - Heading { - text: "By KDE" - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - level: 3 - } - - - QtControls.Label { - text: "Plasma File Search (Baloo) is currently disabled." - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - QtControls.Label { - text: "Please enable Baloo and restart Koko." - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - } -} diff --git a/qml/main.qml b/qml/main.qml index 2229003..f23f664 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -1,416 +1,398 @@ /* * Copyright (C) 2014-2015 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . * */ import QtQuick 2.1 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.0 import QtQuick.Window 2.1 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.koko 0.1 as Koko MainWindow { id: window property string currentFilePath: view.currentItem && view.currentItem.filePath ? view.currentItem.filePath : "" toolBar: ToolBar { RowLayout { PlasmaComponents.ToolButton { iconName: "format-justify-fill" onClicked: window.toggleLeftSidebar(); } PlasmaComponents.ToolButton { iconName: "draw-arrow-up" text: "Up" enabled: view.depth > 1 onClicked: goUp(); } // // Navigation // PlasmaComponents.ToolButton { iconName: "draw-arrow-back" text: "Previous" enabled: view.currentItem && view.currentItem.objectName == "imageViewer" && view.currentItem.hasPreviousImage() onClicked: goBack(); } PlasmaComponents.ToolButton { iconName: "draw-arrow-forward" text: "Next" enabled: view.currentItem && view.currentItem.objectName == "imageViewer" && view.currentItem.hasNextImage() onClicked: goForward(); } } } leftSidebar: ColumnLayout { width: 350 Heading { text: "Navigation" font.bold: true level: 2 } ExclusiveGroup { id: group; } ColumnLayout { Layout.fillWidth: true Heading { text: "Locations" font.bold: true Layout.fillWidth: true level: 4 } PlasmaComponents.ToolButton { text: "By Country" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: locationView, properties: { focus: true, group: Koko.ImageLocationModel.Country } }) } checkable: true exclusiveGroup: group } PlasmaComponents.ToolButton { text: "By State" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: locationView, properties: { focus: true, group: Koko.ImageLocationModel.State } }) } checkable: true exclusiveGroup: group } PlasmaComponents.ToolButton { text: "By City" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: locationView, properties: { focus: true, group: Koko.ImageLocationModel.City } }) } checkable: true exclusiveGroup: group } } ColumnLayout { Layout.fillWidth: true Heading { text: "Time" font.bold: true Layout.fillWidth: true level: 4 } PlasmaComponents.ToolButton { text: "By Year" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: timeImages, properties: { focus: true, group: Koko.ImageTimeModel.Year } }) } checkable: true exclusiveGroup: group } PlasmaComponents.ToolButton { text: "By Month" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: timeImages, properties: { focus: true, group: Koko.ImageTimeModel.Month } }) } checkable: true exclusiveGroup: group } PlasmaComponents.ToolButton { text: "By Week" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: timeImages, properties: { focus: true, group: Koko.ImageTimeModel.Week } }) } checkable: true exclusiveGroup: group } PlasmaComponents.ToolButton { text: "By Day" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: timeImages, properties: { focus: true, group: Koko.ImageTimeModel.Day } }) } checkable: true exclusiveGroup: group } } ColumnLayout { Layout.fillWidth: true Heading { text: "Path" font.bold: true Layout.fillWidth: true level: 4 } PlasmaComponents.ToolButton { text: "By Folder" iconName: "system-search" Layout.fillWidth: true onClicked: { view.clear() view.push({ item: folderImages, properties: { focus: true } }) } checkable: true exclusiveGroup: group checked: true } } } mainItem: StackView { id: view focus: true delegate: StackViewDelegate { pushTransition: StackViewTransition { PropertyAnimation { target: enterItem property: "y" from: exitItem.height to: 0 } } popTransition: StackViewTransition { PropertyAnimation { target: exitItem property: "y" from: 0 to: enterItem.height } } } Component { id: locationView Locations { onImagesSelected: { view.push({ item: imageGrid, properties: { focus: true, model: files } }) } group: Koko.ImageLocationModel.City } } Component { id: imageGrid ImageGrid { onImageSelected: { view.push({ item: imageViewer, properties: { focus: true, model: model, filePath: filePath, currentIndex: index } }) } } } Component { id: imageViewer ImageViewer { objectName: "imageViewer" onDeleteImage: view.get(0).deleteImage(filePath, index) onListEmpty: { goUp() goUp() } } } Component { id: timeImages TimeImages { onImagesSelected: { view.push({ item: imageGrid, properties: { focus: true, model: files } }) } } } Component { id: folderImages Folders { onImagesSelected: { view.push({ item: imageGrid, properties: { focus: true, model: files } }) } } } Component { id: firstRun FirstRun { visible: false progress: kokoProcessor.initialProgress numFiles: kokoProcessor.numFiles finished: kokoProcessor.finished Layout.fillWidth: true Layout.fillHeight: true Connections { target: kokoProcessor onFinishedChanged: { kokoConfig.initialRun = false view.finishInitialization(); } } } } - Component { - id: balooDisabled - BalooDisabled { - Layout.fillWidth: true - Layout.fillHeight: true - } - } - Component.onCompleted: { if (kokoConfig) { - if (kokoConfig.balooEnabled == false) { - push({ - item: balooDisabled, - immediate: true, - replace: true - }) - leftSidebar.visible = false - toolBar.visible = false - return; - } - else if (kokoConfig.initialRun) { + if (kokoConfig.initialRun) { push({ item: firstRun, immediate: true, replace: true }) leftSidebar.enabled = false toolBar.enabled = false return; } } view.finishInitialization(); } Keys.onPressed: { if (event.key == Qt.Key_Escape || event.key == Qt.Key_Backspace) { goUp(); } } function finishInitialization() { clear() leftSidebar.enabled = true toolBar.enabled = true push({ item: folderImages, replace: true, properties: { focus: true } }) } } function goUp() { if (view.currentItem.objectName == "imageViewer") { // This is being done so that if the user changes the image in the ImageViewer // using the left/right keys, then when they go back to the ImageGrid // the correct image is selected var ci = view.currentItem.currentIndex view.pop() view.currentItem.index = ci view.currentItem.positionViewAtIndex(ci, GridView.Center) } else { view.pop() } view.currentItem.focus = true } function goBack() { view.currentItem.previousImage(); } function goForward() { view.currentItem.nextImage(); } contentItem.implicitWidth: 1800 contentItem.implicitHeight: 1000 } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 337efcf..de2c015 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,142 +1,124 @@ # # Common Library # set(LIB_SRCS imagestorage.cpp + filesystemimagefetcher.cpp + ${LIB_SRCS} ) -if (KF5Baloo_FOUND) - set(LIB_SRCS - balooimagefetcher.cpp - ${LIB_SRCS} - ) -else() - set(LIB_SRCS - filesystemimagefetcher.cpp - ${LIB_SRCS} - ) -endif() - add_library(kokocommon SHARED ${LIB_SRCS}) target_link_libraries(kokocommon Qt5::Core Qt5::Positioning Qt5::Sql ) -if (KF5Baloo_FOUND) - target_link_libraries(kokocommon KF5::Baloo) -endif() - generate_export_header(kokocommon BASE_NAME KOKO EXPORT_FILE_NAME koko_export.h) install(TARGETS kokocommon EXPORT KokoLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) # # Application # add_executable(koko main.cpp reversegeocoder.cpp filesystemtracker.cpp processor.cpp committimer.cpp imageprocessorrunnable.cpp exiv2extractor.cpp kokoconfig.cpp kdtree.c ) -if (KF5Baloo_FOUND) - target_compile_definitions(koko PRIVATE -DBALOO_FOUND="${KF5Baloo_FOUND}") -endif() - target_link_libraries(koko Qt5::Quick Qt5::Widgets Qt5::Qml Qt5::Positioning KF5::ConfigCore KF5::DBusAddons KF5::I18n kokocommon ${EXIV2_LIBRARIES} ) install(TARGETS koko ${INSTALL_TARGETS_DEFAULT_ARGS}) # # QML Plugin # set (qml_plugin_SRCS qmlplugins.cpp tagmodel.cpp imagelocationmodel.cpp imagetimemodel.cpp imagefoldermodel.cpp sortmodel.cpp allimagesmodel.cpp fileinfo.cpp ) add_library (kokoqmlplugin SHARED ${qml_plugin_SRCS}) target_link_libraries (kokoqmlplugin Qt5::Qml KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets kokocommon ) install (TARGETS kokoqmlplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/koko) install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/koko) install (FILES org.kde.koko.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) # # Reverse GeoLookup Data # # Packagers can download the file and put it in the tarball if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cities1000.zip) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cities1000.zip DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif() if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip) file (DOWNLOAD "http://download.geonames.org/export/dump/cities1000.zip" ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip SHOW_PROGRESS ) endif() execute_process( COMMAND ${CMAKE_COMMAND} -E tar -xzf ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/admin1CodesASCII.txt) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/admin1CodesASCII.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif() if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt) file (DOWNLOAD "http://download.geonames.org/export/dump/admin1CodesASCII.txt" ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt SHOW_PROGRESS ) endif() file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt ${CMAKE_CURRENT_BINARY_DIR}/admin1Codes.txt) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/admin2Codes.txt) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/admin2Codes.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) endif() if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt) file (DOWNLOAD "http://download.geonames.org/export/dump/admin2Codes.txt" ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt SHOW_PROGRESS ) endif() install (FILES ${CMAKE_CURRENT_BINARY_DIR}/cities1000.txt DESTINATION ${DATA_INSTALL_DIR}/koko) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/admin1Codes.txt DESTINATION ${DATA_INSTALL_DIR}/koko) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt DESTINATION ${DATA_INSTALL_DIR}/koko) install (FILES countries.csv DESTINATION ${DATA_INSTALL_DIR}/koko) diff --git a/src/balooimagefetcher.cpp b/src/balooimagefetcher.cpp deleted file mode 100644 index ee390a4..0000000 --- a/src/balooimagefetcher.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "balooimagefetcher.h" - -#include - -#include - -BalooImageFetcher::BalooImageFetcher(const QString& folder, QObject* parent) - : QObject(parent) - , m_folder(folder) -{ -} - -void BalooImageFetcher::fetch() -{ - Baloo::Query query; - query.setType("Image"); - query.setIncludeFolder(m_folder); - - Baloo::QueryRunnable *runnable = new Baloo::QueryRunnable(query); - connect(runnable, SIGNAL(queryResult(Baloo::QueryRunnable*, QString)), - this, SLOT(queryResult(Baloo::QueryRunnable*, QString)), Qt::QueuedConnection); - connect(runnable, SIGNAL(finished(Baloo::QueryRunnable*)), - this, SIGNAL(finished())); - - QThreadPool::globalInstance()->start(runnable); -} - -void BalooImageFetcher::queryResult(Baloo::QueryRunnable*, const QString& filePath) -{ - emit imageResult(filePath); -} diff --git a/src/balooimagefetcher.h b/src/balooimagefetcher.h deleted file mode 100644 index 425ad21..0000000 --- a/src/balooimagefetcher.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef BALOOIMAGEFETCHER_H -#define BALOOIMAGEFETCHER_H - -#include -#include - -#include "koko_export.h" - -class KOKO_EXPORT BalooImageFetcher : public QObject -{ - Q_OBJECT -public: - explicit BalooImageFetcher(const QString& folder, QObject* parent = 0); - void fetch(); - -signals: - void imageResult(const QString& filePath); - void finished(); - -private slots: - void queryResult(Baloo::QueryRunnable*, const QString& filePath); - -private: - QString m_folder; -}; - -#endif // BALOOIMAGEFETCHER_H diff --git a/src/filesystemtracker.cpp b/src/filesystemtracker.cpp index cb328a5..51f7f0b 100644 --- a/src/filesystemtracker.cpp +++ b/src/filesystemtracker.cpp @@ -1,202 +1,188 @@ /* * Copyright (C) 2014 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "filesystemtracker.h" -#ifdef BALOO_FOUND - #include "balooimagefetcher.h" -#else - #include "filesystemimagefetcher.h" -#endif +#include "filesystemimagefetcher.h" #include #include #include #include #include #include #include #include FileSystemTracker::FileSystemTracker(QObject* parent) : QObject(parent) { // // Real time updates // QDBusConnection con = QDBusConnection::sessionBus(); con.connect(QString(), QLatin1String("/files"), QLatin1String("org.kde"), QLatin1String("changed"), this, SLOT(slotNewFiles(QStringList))); // // Database // static QString dir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/koko/"; QDir().mkpath(dir); QSqlDatabase db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), QStringLiteral("fstracker")); db.setDatabaseName(dir + "/fstracker.sqlite3"); if (!db.open()) { qDebug() << "Failed to open db" << db.lastError().text(); return; } if (db.tables().contains("files")) { return; } QSqlQuery query(db); bool ret = query.exec(QLatin1String("CREATE TABLE files(" "id INTEGER PRIMARY KEY, " "url TEXT NOT NULL UNIQUE)")); if (!ret) { qDebug() << "Could not create files table" << query.lastError().text(); return; } ret = query.exec(QLatin1String("CREATE INDEX fileUrl_index ON files (url)")); if (!ret) { qDebug() << "Could not create tags index" << query.lastError().text(); return; } // // WAL Journaling mode has much lower io writes than the traditional journal // based indexing. // ret = query.exec(QLatin1String("PRAGMA journal_mode = WAL")); if (!ret) { qDebug() << "Could not set WAL journaling mode" << query.lastError().text(); return; } } FileSystemTracker::~FileSystemTracker() { QSqlDatabase::removeDatabase(QStringLiteral("fstracker")); } void FileSystemTracker::init() { -#ifdef BALOO_FOUND - BalooImageFetcher* fetcher = new BalooImageFetcher(m_folder); - connect(fetcher, &BalooImageFetcher::imageResult, - this, &FileSystemTracker::slotImageResult, Qt::QueuedConnection); - connect(fetcher, &BalooImageFetcher::finished, - this, &FileSystemTracker::slotFetchFinished, Qt::QueuedConnection); - - fetcher->fetch(); -#else FileSystemImageFetcher* fetcher = new FileSystemImageFetcher(m_folder); connect(fetcher, &FileSystemImageFetcher::imageResult, this, &FileSystemTracker::slotImageResult, Qt::QueuedConnection); connect(fetcher, &FileSystemImageFetcher::finished, this, &FileSystemTracker::slotFetchFinished, Qt::QueuedConnection); fetcher->fetch(); -#endif QSqlDatabase::database("fstracker").transaction(); } void FileSystemTracker::slotImageResult(const QString& filePath) { QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("SELECT id from files where url = ?"); query.addBindValue(filePath); if (!query.exec()) { qDebug() << query.lastError(); return; } if (!query.next()) { QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("INSERT into files(url) VALUES (?)"); query.addBindValue(filePath); if (!query.exec()) { qDebug() << query.lastError(); return; } qDebug() << "ADDED" << filePath; emit imageAdded(filePath); } m_filePaths << filePath; } void FileSystemTracker::slotFetchFinished() { QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("SELECT url from files"); if (!query.exec()) { qDebug() << query.lastError(); return; } while (query.next()) { QString filePath = query.value(0).toString(); if (!m_filePaths.contains(filePath)) { qDebug() << "REMOVED" << filePath; emit imageRemoved(filePath); QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("DELETE from files where url = ?"); query.addBindValue(filePath); if (!query.exec()) { qDebug() << query.lastError(); } } } QSqlDatabase::database("fstracker").commit(); m_filePaths.clear(); emit initialScanComplete(); } void FileSystemTracker::slotNewFiles(const QStringList& files) { if (!m_filePaths.isEmpty()) { // A scan is already going on. No point interrupting it. return; } QMimeDatabase db; for (const QString& file: files) { QMimeType mimetype = db.mimeTypeForFile(file); if (mimetype.name().startsWith("image/")) { slotImageResult(file); } } m_filePaths.clear(); } void FileSystemTracker::setFolder(const QString& folder) { m_folder = folder; } QString FileSystemTracker::folder() const { return m_folder; } diff --git a/src/kokoconfig.cpp b/src/kokoconfig.cpp index a930d84..8b8b086 100644 --- a/src/kokoconfig.cpp +++ b/src/kokoconfig.cpp @@ -1,68 +1,54 @@ /* * Copyright (C) 2014 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "kokoconfig.h" #include #include -#ifdef BALOO_FOUND - #include -#endif - KokoConfig::KokoConfig(QObject* parent) : QObject(parent) , m_config("kokorc") { } KokoConfig::~KokoConfig() { } bool KokoConfig::initialRun() const { return m_config.group("general").readEntry("initial run", true); } void KokoConfig::setInitialRun(bool value) { m_config.group("general").writeEntry("initial run", value); m_config.sync(); } void KokoConfig::reset() { QString path = QStandardPaths::locate(QStandardPaths::ConfigLocation, m_config.name()); if (QFile::exists(path)) { QFile::remove(path); } m_config.reparseConfiguration(); } - -bool KokoConfig::balooEnabled() const -{ -#ifdef BALOO_FOUND - Baloo::IndexerConfig config; - return config.fileIndexingEnabled(); -#endif - return true; -} - diff --git a/src/kokoconfig.h b/src/kokoconfig.h index 4c43010..4c80d9d 100644 --- a/src/kokoconfig.h +++ b/src/kokoconfig.h @@ -1,45 +1,43 @@ /* * Copyright (C) 2014 Vishesh Handa * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef JUNGLE_JUNGLECONFIG_H #define JUNGLE_JUNGLECONFIG_H #include #include #include class KokoConfig : public QObject { Q_OBJECT Q_PROPERTY(bool initialRun READ initialRun WRITE setInitialRun) - Q_PROPERTY(bool balooEnabled READ balooEnabled) public: KokoConfig(QObject* parent = 0); virtual ~KokoConfig(); bool initialRun() const; void setInitialRun(bool value); - bool balooEnabled() const; void reset(); private: KConfig m_config; }; #endif // JUNGLE_JUNGLECONFIG_H